fix gravity test
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-12-18 17:43:32 -05:00
parent dc79f1b0ba
commit efb37b1618
4 changed files with 13 additions and 5 deletions

View File

@ -47,6 +47,11 @@
*/
#define FLUID_PRESSURECELL_DIV_PRESSURE_CONST 5.0f
/**
* Cutoff after which density is clamped to zero while diffusing
*/
#define FLUID_PRESSURECELL_MIN_DENSITY_CLAMP_CUTOFF 0.0001f
/**
* The number of times to relax most solvers
*/

View File

@ -130,6 +130,9 @@ LIBRARY_API void pressurecell_diffuse_density(Environment * environment, Chunk *
)
) * a
;
if(densityTemp[IX(x,y,z)] < FLUID_PRESSURECELL_MIN_DENSITY_CLAMP_CUTOFF){
densityTemp[IX(x,y,z)] = 0;
}
}
}
}

View File

@ -65,10 +65,10 @@ int fluid_sim_pressurecell_add_gravity_test1(){
//
expected = 0;
actual = currentChunk->v[CENTER_LOC][IX(1,1,DIM-2)];
if(fabs(expected - actual) < 0.1f){
if(fabs(expected - actual) < FLUID_PRESSURE_CELL_ERROR_MARGIN){
rVal++;
printf("Gravity not applied!\n");
printf("%f \n", currentChunk->v[CENTER_LOC][IX(1,1,DIM-2)]);
printf("grav(1,1,DIM-2): %f \n", currentChunk->v[CENTER_LOC][IX(1,1,DIM-2)]);
}
return rVal;

View File

@ -95,10 +95,10 @@ int fluid_sim_pressurecell_sim_e2e_test2(){
// cell that originall had values
//
expected = 0;
actual = currentChunk->d[CENTER_LOC][IX(1,2,DIM-2)];
actual = currentChunk->d[CENTER_LOC][IX(1,4,DIM-2)];
if(fabs(expected - actual) > FLUID_PRESSURE_CELL_ERROR_MARGIN){
rVal += assertEqualsFloat(expected,actual,"Failed to recapture density into (1,2,DIM-2)! expected: %f actual: %f \n");
printf("%f \n", currentChunk->v[CENTER_LOC][IX(1,2,DIM-2)]);
rVal += assertEqualsFloat(expected,actual,"Failed to recapture density into (1,4,DIM-2)! expected: %f actual: %f \n");
printf("%f \n", currentChunk->v[CENTER_LOC][IX(1,4,DIM-2)]);
}
expected = MAX_FLUID_VALUE;