normalization tracking
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
0b1b693433
commit
5efb1b7ea2
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -51,6 +51,7 @@
|
||||
"flux.h": "c",
|
||||
"diffusion_ode.h": "c",
|
||||
"pressurecell.h": "c",
|
||||
"pressure.h": "c"
|
||||
"pressure.h": "c",
|
||||
"tracking.h": "c"
|
||||
}
|
||||
}
|
||||
15
src/main/c/includes/fluid/tracking/tracking.h
Normal file
15
src/main/c/includes/fluid/tracking/tracking.h
Normal 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
|
||||
@ -15,6 +15,7 @@
|
||||
#include "fluid/sim/grid/simulation.h"
|
||||
#include "fluid/sim/grid2/grid2.h"
|
||||
#include "fluid/sim/simulator.h"
|
||||
#include "fluid/tracking/tracking.h"
|
||||
#include "fluid/dispatch/dispatcher.h"
|
||||
#include "math/ode/multigrid.h"
|
||||
|
||||
@ -58,6 +59,7 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_simulator_FluidAccelerate
|
||||
){
|
||||
environment->consts.dt = dt;
|
||||
int numReadIn = readInChunks(env,chunkList,environment);
|
||||
fluid_tracking_reset(environment);
|
||||
fluid_solve_bounds(numReadIn,chunkViewC,environment);
|
||||
fluid_dispatch(numReadIn,chunkViewC,environment,FLUID_DISPATCHER_OVERRIDE_NONE);
|
||||
fluid_simulate(environment);
|
||||
|
||||
@ -37,6 +37,7 @@ LIBRARY_API void fluid_pressurecell_calculate_normalization_ratio(Environment *
|
||||
}
|
||||
}
|
||||
double expected = chunk->pressureCellData.densitySum;
|
||||
env->state.existingDensity = env->state.existingDensity + expected;
|
||||
double normalizationRatio = expected / sum;
|
||||
chunk->pressureCellData.densitySum = normalizationRatio;
|
||||
}
|
||||
|
||||
12
src/main/c/src/fluid/tracking/tracking.c
Normal file
12
src/main/c/src/fluid/tracking/tracking.c
Normal 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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user