stabilize static liquids
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
83b8227b68
commit
251f6d2c66
@ -1,3 +1,3 @@
|
|||||||
#maven.buildNumber.plugin properties file
|
#maven.buildNumber.plugin properties file
|
||||||
#Sun Dec 01 19:21:24 EST 2024
|
#Sun Dec 01 19:28:46 EST 2024
|
||||||
buildNumber=502
|
buildNumber=504
|
||||||
|
|||||||
@ -1217,6 +1217,7 @@ Conditionally rasterize fluid chunks based on homogeneity
|
|||||||
Awake fluid chunks based on neighbor state
|
Awake fluid chunks based on neighbor state
|
||||||
Fluid chunk conditionally send update based on sleep status
|
Fluid chunk conditionally send update based on sleep status
|
||||||
Fluid simulation normalization ratio
|
Fluid simulation normalization ratio
|
||||||
|
Stabilized static liquids
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ Chunk ** chunks = NULL;
|
|||||||
|
|
||||||
static inline void saveStep(float * values, const char * name);
|
static inline void saveStep(float * values, const char * name);
|
||||||
static inline void applyGravity(Chunk * currentChunk, Environment * environment);
|
static inline void applyGravity(Chunk * currentChunk, Environment * environment);
|
||||||
|
static inline void clearArr(float ** d);
|
||||||
|
|
||||||
void simulate(
|
void simulate(
|
||||||
int numChunks,
|
int numChunks,
|
||||||
@ -524,7 +525,7 @@ void simulate(
|
|||||||
}
|
}
|
||||||
float normalizationRatio = 0;
|
float normalizationRatio = 0;
|
||||||
if(transformedDensity != 0){
|
if(transformedDensity != 0){
|
||||||
normalizationRatio = transformedDensity / (environment->existingDensity + environment->newDensity);
|
normalizationRatio = (environment->existingDensity + environment->newDensity) / transformedDensity;
|
||||||
environment->normalizationRatio = normalizationRatio;
|
environment->normalizationRatio = normalizationRatio;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < numChunks; i++){
|
for(int i = 0; i < numChunks; i++){
|
||||||
@ -532,6 +533,16 @@ void simulate(
|
|||||||
normalizeDensity(DIM,currentChunk->d,normalizationRatio);
|
normalizeDensity(DIM,currentChunk->d,normalizationRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//clear delta arrays
|
||||||
|
{
|
||||||
|
for(int i = 0; i < numChunks; i++){
|
||||||
|
Chunk * currentChunk = chunks[i];
|
||||||
|
clearArr(currentChunk->d0);
|
||||||
|
clearArr(currentChunk->u0);
|
||||||
|
clearArr(currentChunk->v0);
|
||||||
|
clearArr(currentChunk->w0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -578,3 +589,13 @@ static inline void applyGravity(Chunk * currentChunk, Environment * environment)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears an array
|
||||||
|
*/
|
||||||
|
static inline void clearArr(float ** d){
|
||||||
|
float * x = GET_ARR_RAW(d,CENTER_LOC);
|
||||||
|
for(int j = 0; j < DIM * DIM * DIM; j++){
|
||||||
|
x[j] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user