normalization tracking
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-12-15 10:42:57 -05:00
parent 0b1b693433
commit 5efb1b7ea2
5 changed files with 32 additions and 1 deletions

View File

@ -51,6 +51,7 @@
"flux.h": "c", "flux.h": "c",
"diffusion_ode.h": "c", "diffusion_ode.h": "c",
"pressurecell.h": "c", "pressurecell.h": "c",
"pressure.h": "c" "pressure.h": "c",
"tracking.h": "c"
} }
} }

View File

@ -0,0 +1,15 @@
#ifndef FLUID_TRACKING_H
#define FLUID_TRACKING_H
#include "public.h"
#include "fluid/env/environment.h"
/**
* Resets the tracking state for this frame
*/
LIBRARY_API void fluid_tracking_reset(Environment * environment);
#endif

View File

@ -15,6 +15,7 @@
#include "fluid/sim/grid/simulation.h" #include "fluid/sim/grid/simulation.h"
#include "fluid/sim/grid2/grid2.h" #include "fluid/sim/grid2/grid2.h"
#include "fluid/sim/simulator.h" #include "fluid/sim/simulator.h"
#include "fluid/tracking/tracking.h"
#include "fluid/dispatch/dispatcher.h" #include "fluid/dispatch/dispatcher.h"
#include "math/ode/multigrid.h" #include "math/ode/multigrid.h"
@ -58,6 +59,7 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_simulator_FluidAccelerate
){ ){
environment->consts.dt = dt; environment->consts.dt = dt;
int numReadIn = readInChunks(env,chunkList,environment); int numReadIn = readInChunks(env,chunkList,environment);
fluid_tracking_reset(environment);
fluid_solve_bounds(numReadIn,chunkViewC,environment); fluid_solve_bounds(numReadIn,chunkViewC,environment);
fluid_dispatch(numReadIn,chunkViewC,environment,FLUID_DISPATCHER_OVERRIDE_NONE); fluid_dispatch(numReadIn,chunkViewC,environment,FLUID_DISPATCHER_OVERRIDE_NONE);
fluid_simulate(environment); fluid_simulate(environment);

View File

@ -37,6 +37,7 @@ LIBRARY_API void fluid_pressurecell_calculate_normalization_ratio(Environment *
} }
} }
double expected = chunk->pressureCellData.densitySum; double expected = chunk->pressureCellData.densitySum;
env->state.existingDensity = env->state.existingDensity + expected;
double normalizationRatio = expected / sum; double normalizationRatio = expected / sum;
chunk->pressureCellData.densitySum = normalizationRatio; chunk->pressureCellData.densitySum = normalizationRatio;
} }

View File

@ -0,0 +1,12 @@
#include "fluid/tracking/tracking.h"
/**
* Resets the tracking state for this frame
*/
LIBRARY_API void fluid_tracking_reset(Environment * environment){
environment->state.existingDensity = 0;
environment->state.normalizationRatio = 0;
}