rename pressure cache
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
2fda30c8c1
commit
254d8d3d9d
2
src/main/c/includes/fluid/env/environment.h
vendored
2
src/main/c/includes/fluid/env/environment.h
vendored
@ -33,7 +33,7 @@ typedef struct {
|
||||
jfieldID worldZId;
|
||||
jfieldID neighborsId;
|
||||
jfieldID divergenceCacheId;
|
||||
jfieldID scalarPotentialCacheId;
|
||||
jfieldID pressureCacheId;
|
||||
jfieldID chunkmaskJId;
|
||||
jfieldID updatedId;
|
||||
jfieldID totalDensityId;
|
||||
|
||||
@ -62,7 +62,7 @@ typedef struct {
|
||||
/**
|
||||
* Caches the scalar potential of this chunk for usage next frame
|
||||
*/
|
||||
float * scalarPotentialCache[27];
|
||||
float * pressureCache[27];
|
||||
|
||||
/**
|
||||
* The bitmask which tracks valid neighbors
|
||||
|
||||
@ -370,7 +370,7 @@ LIBRARY_API void fluid_solve_bounds(int numReadIn, Chunk ** chunkViewC, Environm
|
||||
fluid_solve_bounds_checker(current->w0,0);
|
||||
fluid_solve_bounds_checker(current->bounds,BOUND_MAX_VALUE);
|
||||
fluid_solve_bounds_checker(current->divergenceCache,0);
|
||||
fluid_solve_bounds_checker(current->scalarPotentialCache,0);
|
||||
fluid_solve_bounds_checker(current->pressureCache,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_simulator_FluidAccelerate
|
||||
environment->lookupTable.serverFluidChunkTable.v0JId = (*env)->GetFieldID(env,fluidSimStorageClass,"b0VelocityY","[Ljava/nio/ByteBuffer;");
|
||||
environment->lookupTable.serverFluidChunkTable.w0JId = (*env)->GetFieldID(env,fluidSimStorageClass,"b0VelocityZ","[Ljava/nio/ByteBuffer;");
|
||||
environment->lookupTable.serverFluidChunkTable.boundsId = (*env)->GetFieldID(env,fluidSimStorageClass,"bBounds","[Ljava/nio/ByteBuffer;");
|
||||
environment->lookupTable.serverFluidChunkTable.scalarPotentialCacheId = (*env)->GetFieldID(env,fluidSimStorageClass,"bScalarPotentialCache","[Ljava/nio/ByteBuffer;");
|
||||
environment->lookupTable.serverFluidChunkTable.pressureCacheId = (*env)->GetFieldID(env,fluidSimStorageClass,"bPressureCache","[Ljava/nio/ByteBuffer;");
|
||||
environment->lookupTable.serverFluidChunkTable.divergenceCacheId = (*env)->GetFieldID(env,fluidSimStorageClass,"bDivergenceCache","[Ljava/nio/ByteBuffer;");
|
||||
environment->lookupTable.serverFluidChunkTable.worldXId = (*env)->GetFieldID(env,fluidSimStorageClass,"worldX","I");
|
||||
environment->lookupTable.serverFluidChunkTable.worldYId = (*env)->GetFieldID(env,fluidSimStorageClass,"worldY","I");
|
||||
@ -165,7 +165,7 @@ int readInChunks(JNIEnv * env, jobject chunkList, Environment * environment){
|
||||
jfieldID v0JId = environment->lookupTable.serverFluidChunkTable.v0JId;
|
||||
jfieldID w0JId = environment->lookupTable.serverFluidChunkTable.w0JId;
|
||||
jfieldID boundsId = environment->lookupTable.serverFluidChunkTable.boundsId;
|
||||
jfieldID scalarPotentialCacheId = environment->lookupTable.serverFluidChunkTable.scalarPotentialCacheId;
|
||||
jfieldID pressureCacheId = environment->lookupTable.serverFluidChunkTable.pressureCacheId;
|
||||
jfieldID divergenceCacheId = environment->lookupTable.serverFluidChunkTable.divergenceCacheId;
|
||||
jfieldID chunkmaskJId = environment->lookupTable.serverFluidChunkTable.chunkmaskJId;
|
||||
jfieldID asleepId = environment->lookupTable.serverFluidChunkTable.asleepId;
|
||||
@ -188,7 +188,7 @@ int readInChunks(JNIEnv * env, jobject chunkList, Environment * environment){
|
||||
jobjectArray v0;
|
||||
jobjectArray w0;
|
||||
jobjectArray bounds;
|
||||
jobjectArray scalarPotentialCache;
|
||||
jobjectArray pressureCache;
|
||||
jobjectArray divergenceCache;
|
||||
int chunkMask;
|
||||
|
||||
@ -236,7 +236,7 @@ int readInChunks(JNIEnv * env, jobject chunkList, Environment * environment){
|
||||
v0 = (*env)->GetObjectField(env,chunkJRaw,v0JId);
|
||||
w0 = (*env)->GetObjectField(env,chunkJRaw,w0JId);
|
||||
bounds = (*env)->GetObjectField(env,chunkJRaw,boundsId);
|
||||
scalarPotentialCache = (*env)->GetObjectField(env,chunkJRaw,scalarPotentialCacheId);
|
||||
pressureCache = (*env)->GetObjectField(env,chunkJRaw,pressureCacheId);
|
||||
divergenceCache = (*env)->GetObjectField(env,chunkJRaw,divergenceCacheId);
|
||||
newChunk->chunkMask = chunkMask;
|
||||
newChunk->chunkJRaw = chunkJRaw;
|
||||
@ -254,8 +254,8 @@ int readInChunks(JNIEnv * env, jobject chunkList, Environment * environment){
|
||||
newChunk->v0[j] = getArray(env,v0,j);
|
||||
newChunk->w0[j] = getArray(env,w0,j);
|
||||
newChunk->bounds[j] = getArray(env,bounds,j);
|
||||
newChunk->scalarPotentialCache[j] = getArray(env,scalarPotentialCache,j);
|
||||
newChunk->divergenceCache[j] = getArray(env,scalarPotentialCache,j);
|
||||
newChunk->pressureCache[j] = getArray(env,pressureCache,j);
|
||||
newChunk->divergenceCache[j] = getArray(env,pressureCache,j);
|
||||
} else {
|
||||
newChunk->d[j] = NULL;
|
||||
newChunk->d0[j] = NULL;
|
||||
@ -266,7 +266,7 @@ int readInChunks(JNIEnv * env, jobject chunkList, Environment * environment){
|
||||
newChunk->v0[j] = NULL;
|
||||
newChunk->w0[j] = NULL;
|
||||
newChunk->bounds[j] = NULL;
|
||||
newChunk->scalarPotentialCache[j] = NULL;
|
||||
newChunk->pressureCache[j] = NULL;
|
||||
newChunk->divergenceCache[j] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -379,6 +379,6 @@ void fluid_grid2_estimate_ghost_flux(float ** arrays){
|
||||
* Updates the flux stored in the ghost cells of this chunk
|
||||
*/
|
||||
void fluid_grid2_update_ghost_flux(Environment * environment, Chunk * chunk){
|
||||
fluid_grid2_estimate_ghost_flux(chunk->scalarPotentialCache);
|
||||
fluid_grid2_estimate_ghost_flux(chunk->pressureCache);
|
||||
fluid_grid2_estimate_ghost_flux(chunk->divergenceCache);
|
||||
}
|
||||
@ -452,7 +452,7 @@ static inline void fluid_grid2_rewrite_bounds(Environment * environment, Chunk *
|
||||
fluid_grid2_populate_masked_arr(environment,chunk->v0[CENTER_LOC], environment->state.grid2.fluid_grid2_neighborArr_v0);
|
||||
fluid_grid2_populate_masked_arr(environment,chunk->w0[CENTER_LOC], environment->state.grid2.fluid_grid2_neighborArr_w0);
|
||||
fluid_grid2_populate_masked_arr(environment,chunk->bounds[CENTER_LOC], environment->state.grid2.fluid_grid2_neighborArr_bounds);
|
||||
fluid_grid2_populate_masked_arr(environment,chunk->scalarPotentialCache[CENTER_LOC], environment->state.grid2.fluid_grid2_neighborArr_scalarCache);
|
||||
fluid_grid2_populate_masked_arr(environment,chunk->pressureCache[CENTER_LOC], environment->state.grid2.fluid_grid2_neighborArr_scalarCache);
|
||||
fluid_grid2_populate_masked_arr(environment,chunk->divergenceCache[CENTER_LOC], environment->state.grid2.fluid_grid2_neighborArr_divergenceCache);
|
||||
}
|
||||
|
||||
|
||||
@ -281,7 +281,7 @@ LIBRARY_API void fluid_grid2_solveProjection(
|
||||
// }
|
||||
|
||||
//store scalar potential in cache
|
||||
util_matrix_copy(p,chunk->scalarPotentialCache[CENTER_LOC],DIM);
|
||||
util_matrix_copy(p,chunk->pressureCache[CENTER_LOC],DIM);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -77,7 +77,7 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_manager_ServerFluidChunk_
|
||||
jfieldID v0Id = (*env)->GetFieldID(env,serverFluidChunkClass,"b0VelocityY","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID w0Id = (*env)->GetFieldID(env,serverFluidChunkClass,"b0VelocityZ","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID boundsId = (*env)->GetFieldID(env,serverFluidChunkClass,"bBounds","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID scalarPotentialCacheId = (*env)->GetFieldID(env,serverFluidChunkClass,"bScalarPotentialCache","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID pressureCacheId = (*env)->GetFieldID(env,serverFluidChunkClass,"bPressureCache","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID divergenceCacheId = (*env)->GetFieldID(env,serverFluidChunkClass,"bDivergenceCache","[Ljava/nio/ByteBuffer;");
|
||||
allocateCenterField(env,fluidObj,dId);
|
||||
allocateCenterField(env,fluidObj,d0Id);
|
||||
@ -88,7 +88,7 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_manager_ServerFluidChunk_
|
||||
allocateCenterField(env,fluidObj,v0Id);
|
||||
allocateCenterField(env,fluidObj,w0Id);
|
||||
allocateCenterField(env,fluidObj,boundsId);
|
||||
allocateCenterField(env,fluidObj,scalarPotentialCacheId);
|
||||
allocateCenterField(env,fluidObj,pressureCacheId);
|
||||
allocateCenterField(env,fluidObj,divergenceCacheId);
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_manager_ServerFluidChunk_
|
||||
jfieldID v0Id = (*env)->GetFieldID(env,serverFluidChunkClass,"b0VelocityY","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID w0Id = (*env)->GetFieldID(env,serverFluidChunkClass,"b0VelocityZ","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID boundsId = (*env)->GetFieldID(env,serverFluidChunkClass,"bBounds","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID scalarPotentialCacheId = (*env)->GetFieldID(env,serverFluidChunkClass,"bScalarPotentialCache","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID pressureCacheId = (*env)->GetFieldID(env,serverFluidChunkClass,"bPressureCache","[Ljava/nio/ByteBuffer;");
|
||||
jfieldID divergenceCacheId = (*env)->GetFieldID(env,serverFluidChunkClass,"bDivergenceCache","[Ljava/nio/ByteBuffer;");
|
||||
freeCenterField(env,fluidObj,dId);
|
||||
freeCenterField(env,fluidObj,d0Id);
|
||||
@ -153,7 +153,7 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_manager_ServerFluidChunk_
|
||||
freeCenterField(env,fluidObj,v0Id);
|
||||
freeCenterField(env,fluidObj,w0Id);
|
||||
freeCenterField(env,fluidObj,boundsId);
|
||||
freeCenterField(env,fluidObj,scalarPotentialCacheId);
|
||||
freeCenterField(env,fluidObj,pressureCacheId);
|
||||
freeCenterField(env,fluidObj,divergenceCacheId);
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ public class ServerFluidChunk {
|
||||
/**
|
||||
* The array storing cached pressure data
|
||||
*/
|
||||
public ByteBuffer[] bScalarPotentialCache = new ByteBuffer[ARRAY_CT];
|
||||
public ByteBuffer[] bPressureCache = new ByteBuffer[ARRAY_CT];
|
||||
|
||||
/**
|
||||
* The array of pointers to neighboring chunks
|
||||
@ -236,7 +236,7 @@ public class ServerFluidChunk {
|
||||
this.b0VelocityZ[CENTER_BUFF].order(ByteOrder.LITTLE_ENDIAN);
|
||||
this.bBounds[CENTER_BUFF].order(ByteOrder.LITTLE_ENDIAN);
|
||||
this.bDivergenceCache[CENTER_BUFF].order(ByteOrder.LITTLE_ENDIAN);
|
||||
this.bScalarPotentialCache[CENTER_BUFF].order(ByteOrder.LITTLE_ENDIAN);
|
||||
this.bPressureCache[CENTER_BUFF].order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
//get float view
|
||||
this.weights = this.bWeights[CENTER_BUFF].asFloatBuffer();
|
||||
@ -546,7 +546,7 @@ public class ServerFluidChunk {
|
||||
b0VelocityZ[index] = null;
|
||||
bBounds[index] = null;
|
||||
bDivergenceCache[index] = null;
|
||||
bScalarPotentialCache[index] = null;
|
||||
bPressureCache[index] = null;
|
||||
neighbors[index] = null;
|
||||
} else {
|
||||
bWeights[index] = neighbor.bWeights[CENTER_BUFF];
|
||||
@ -560,7 +560,7 @@ public class ServerFluidChunk {
|
||||
b0VelocityZ[index] = neighbor.b0VelocityZ[CENTER_BUFF];
|
||||
bBounds[index] = neighbor.bBounds[CENTER_BUFF];
|
||||
bDivergenceCache[index] = neighbor.bDivergenceCache[CENTER_BUFF];
|
||||
bScalarPotentialCache[index] = neighbor.bScalarPotentialCache[CENTER_BUFF];
|
||||
bPressureCache[index] = neighbor.bPressureCache[CENTER_BUFF];
|
||||
neighbors[index] = neighbor;
|
||||
}
|
||||
}
|
||||
@ -605,7 +605,7 @@ public class ServerFluidChunk {
|
||||
b0VelocityZ[i] = null;
|
||||
bBounds[i] = null;
|
||||
bDivergenceCache[i] = null;
|
||||
bScalarPotentialCache[i] = null;
|
||||
bPressureCache[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ Chunk * chunk_create(int x, int y, int z){
|
||||
chunk1->v0[i] = NULL;
|
||||
chunk1->w0[i] = NULL;
|
||||
chunk1->bounds[i] = NULL;
|
||||
chunk1->scalarPotentialCache[i] = NULL;
|
||||
chunk1->pressureCache[i] = NULL;
|
||||
chunk1->divergenceCache[i] = NULL;
|
||||
}
|
||||
chunk1->d[CENTER_LOC] = (float *)calloc(1,DIM * DIM * DIM * sizeof(float));
|
||||
@ -58,7 +58,7 @@ Chunk * chunk_create(int x, int y, int z){
|
||||
chunk1->v0[CENTER_LOC] = (float *)calloc(1,DIM * DIM * DIM * sizeof(float));
|
||||
chunk1->w0[CENTER_LOC] = (float *)calloc(1,DIM * DIM * DIM * sizeof(float));
|
||||
chunk1->bounds[CENTER_LOC] = (float *)calloc(1,DIM * DIM * DIM * sizeof(float));
|
||||
chunk1->scalarPotentialCache[CENTER_LOC] = (float *)calloc(1,DIM * DIM * DIM * sizeof(float));
|
||||
chunk1->pressureCache[CENTER_LOC] = (float *)calloc(1,DIM * DIM * DIM * sizeof(float));
|
||||
chunk1->divergenceCache[CENTER_LOC] = (float *)calloc(1,DIM * DIM * DIM * sizeof(float));
|
||||
chunk1->x = x;
|
||||
chunk1->y = y;
|
||||
@ -79,7 +79,7 @@ void chunk_free(Chunk * chunk){
|
||||
free(chunk->v0[CENTER_LOC]);
|
||||
free(chunk->w0[CENTER_LOC]);
|
||||
free(chunk->bounds[CENTER_LOC]);
|
||||
free(chunk->scalarPotentialCache[CENTER_LOC]);
|
||||
free(chunk->pressureCache[CENTER_LOC]);
|
||||
free(chunk->divergenceCache[CENTER_LOC]);
|
||||
free(chunk);
|
||||
}
|
||||
@ -124,7 +124,7 @@ void chunk_fill(Chunk * chunk, float val){
|
||||
chunk->v0[CENTER_LOC][i] = val;
|
||||
chunk->w0[CENTER_LOC][i] = val;
|
||||
chunk->bounds[CENTER_LOC][i] = val;
|
||||
chunk->scalarPotentialCache[CENTER_LOC][i] = val;
|
||||
chunk->pressureCache[CENTER_LOC][i] = val;
|
||||
chunk->divergenceCache[CENTER_LOC][i] = val;
|
||||
}
|
||||
}
|
||||
@ -158,7 +158,7 @@ void chunk_link_by_index(Chunk * chunk1, Chunk * chunk2, int x, int y, int z){
|
||||
chunk1->v0[CK(x,y,z)] = chunk2->v0[CENTER_LOC];
|
||||
chunk1->w0[CK(x,y,z)] = chunk2->w0[CENTER_LOC];
|
||||
chunk1->bounds[CK(x,y,z)] = chunk2->bounds[CENTER_LOC];
|
||||
chunk1->scalarPotentialCache[CK(x,y,z)] = chunk2->scalarPotentialCache[CENTER_LOC];
|
||||
chunk1->pressureCache[CK(x,y,z)] = chunk2->pressureCache[CENTER_LOC];
|
||||
chunk1->divergenceCache[CK(x,y,z)] = chunk2->divergenceCache[CENTER_LOC];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user