incoming/outgoing field caching on fluid chunks
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
f248d68a5b
commit
b5cd111e34
4
src/main/c/includes/fluid/env/environment.h
vendored
4
src/main/c/includes/fluid/env/environment.h
vendored
@ -43,6 +43,10 @@ typedef struct {
|
|||||||
jfieldID massCountId;
|
jfieldID massCountId;
|
||||||
jfieldID pressureTotalId;
|
jfieldID pressureTotalId;
|
||||||
jfieldID velocityMagTotalId;
|
jfieldID velocityMagTotalId;
|
||||||
|
jfieldID pressureOutgoingId;
|
||||||
|
jfieldID pressureIncomingId;
|
||||||
|
jfieldID densityOutgoingId;
|
||||||
|
jfieldID densityIncomingId;
|
||||||
} ServerFluidChunkLookupTable;
|
} ServerFluidChunkLookupTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -190,6 +190,26 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
int projectionIterations;
|
int projectionIterations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of pressure outgoing to other chunks this frame
|
||||||
|
*/
|
||||||
|
float outgoingPressure[27];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of pressure incoming to other chunks this frame
|
||||||
|
*/
|
||||||
|
float incomingPressure[27];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of density outgoing to other chunks this frame
|
||||||
|
*/
|
||||||
|
float outgoingDensity[27];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of density incoming to other chunks this frame
|
||||||
|
*/
|
||||||
|
float incomingDensity[27];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data for pressure cell work in particular
|
* The data for pressure cell work in particular
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -145,6 +145,10 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_simulator_FluidAccelerate
|
|||||||
environment->lookupTable.serverFluidChunkTable.massCountId = (*env)->GetStaticFieldID(env,fluidSimStorageClass,"massCount","F");
|
environment->lookupTable.serverFluidChunkTable.massCountId = (*env)->GetStaticFieldID(env,fluidSimStorageClass,"massCount","F");
|
||||||
environment->lookupTable.serverFluidChunkTable.pressureTotalId = (*env)->GetFieldID(env,fluidSimStorageClass,"totalPressure","F");
|
environment->lookupTable.serverFluidChunkTable.pressureTotalId = (*env)->GetFieldID(env,fluidSimStorageClass,"totalPressure","F");
|
||||||
environment->lookupTable.serverFluidChunkTable.velocityMagTotalId = (*env)->GetFieldID(env,fluidSimStorageClass,"totalVelocityMag","F");
|
environment->lookupTable.serverFluidChunkTable.velocityMagTotalId = (*env)->GetFieldID(env,fluidSimStorageClass,"totalVelocityMag","F");
|
||||||
|
environment->lookupTable.serverFluidChunkTable.pressureOutgoingId = (*env)->GetFieldID(env,fluidSimStorageClass,"pressureOutgoing","[F");
|
||||||
|
environment->lookupTable.serverFluidChunkTable.pressureIncomingId = (*env)->GetFieldID(env,fluidSimStorageClass,"pressureIncoming","[F");
|
||||||
|
environment->lookupTable.serverFluidChunkTable.densityOutgoingId = (*env)->GetFieldID(env,fluidSimStorageClass,"densityOutgoing","[F");
|
||||||
|
environment->lookupTable.serverFluidChunkTable.densityIncomingId = (*env)->GetFieldID(env,fluidSimStorageClass,"densityIncoming","[F");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -260,6 +264,10 @@ int readInChunks(JNIEnv * env, jobject chunkList, Environment * environment){
|
|||||||
newChunk->bounds[j] = getArray(env,bounds,j);
|
newChunk->bounds[j] = getArray(env,bounds,j);
|
||||||
newChunk->pressureCache[j] = getArray(env,pressureCache,j);
|
newChunk->pressureCache[j] = getArray(env,pressureCache,j);
|
||||||
newChunk->divergenceCache[j] = getArray(env,divergenceCache,j);
|
newChunk->divergenceCache[j] = getArray(env,divergenceCache,j);
|
||||||
|
newChunk->outgoingPressure[j] = (*env)->GetFloatArrayElements(env,(*env)->GetObjectField(env,chunkJRaw,environment->lookupTable.serverFluidChunkTable.pressureOutgoingId),JNI_FALSE)[j];
|
||||||
|
newChunk->incomingPressure[j] = (*env)->GetFloatArrayElements(env,(*env)->GetObjectField(env,chunkJRaw,environment->lookupTable.serverFluidChunkTable.pressureIncomingId),JNI_FALSE)[j];
|
||||||
|
newChunk->outgoingDensity[j] = (*env)->GetFloatArrayElements(env,(*env)->GetObjectField(env,chunkJRaw,environment->lookupTable.serverFluidChunkTable.densityOutgoingId),JNI_FALSE)[j];
|
||||||
|
newChunk->incomingDensity[j] = (*env)->GetFloatArrayElements(env,(*env)->GetObjectField(env,chunkJRaw,environment->lookupTable.serverFluidChunkTable.densityIncomingId),JNI_FALSE)[j];
|
||||||
} else {
|
} else {
|
||||||
newChunk->d[j] = NULL;
|
newChunk->d[j] = NULL;
|
||||||
newChunk->d0[j] = NULL;
|
newChunk->d0[j] = NULL;
|
||||||
@ -272,6 +280,10 @@ int readInChunks(JNIEnv * env, jobject chunkList, Environment * environment){
|
|||||||
newChunk->bounds[j] = NULL;
|
newChunk->bounds[j] = NULL;
|
||||||
newChunk->pressureCache[j] = NULL;
|
newChunk->pressureCache[j] = NULL;
|
||||||
newChunk->divergenceCache[j] = NULL;
|
newChunk->divergenceCache[j] = NULL;
|
||||||
|
newChunk->outgoingPressure[j] = 0;
|
||||||
|
newChunk->incomingPressure[j] = 0;
|
||||||
|
newChunk->outgoingDensity[j] = 0;
|
||||||
|
newChunk->incomingDensity[j] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -221,6 +221,26 @@ public class ServerFluidChunk {
|
|||||||
*/
|
*/
|
||||||
public static float massCount = 0;
|
public static float massCount = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of pressure outgoing to other chunks
|
||||||
|
*/
|
||||||
|
public float[] pressureOutgoing = new float[ARRAY_CT];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of pressure incoming from other chunks
|
||||||
|
*/
|
||||||
|
public float[] pressureIncoming = new float[ARRAY_CT];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of density outgoing to other chunks
|
||||||
|
*/
|
||||||
|
public float[] densityOutgoing = new float[ARRAY_CT];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of density incoming from other chunks
|
||||||
|
*/
|
||||||
|
public float[] densityIncoming = new float[ARRAY_CT];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates the central arrays for this chunk
|
* Allocates the central arrays for this chunk
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user