reintroduce sleep
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
6ee0a1b2c5
commit
1c73c2d5ea
@ -1270,6 +1270,7 @@ Frame tracking on native side
|
|||||||
Fix memory leak in client fluid data chunks
|
Fix memory leak in client fluid data chunks
|
||||||
Work on cellular sim determinism
|
Work on cellular sim determinism
|
||||||
More cellular determinism verification
|
More cellular determinism verification
|
||||||
|
reintroduce sleeping code
|
||||||
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -43,49 +43,49 @@ void updateMetadata(JNIEnv * env, int numChunks, Chunk ** passedInChunks, Enviro
|
|||||||
}
|
}
|
||||||
//get whether the chunk is currently homogenous or not
|
//get whether the chunk is currently homogenous or not
|
||||||
int homogenous = sum <= 0 ? JNI_TRUE : JNI_FALSE;
|
int homogenous = sum <= 0 ? JNI_TRUE : JNI_FALSE;
|
||||||
// (*env)->SetBooleanField(env,jObj,environment->lookupTable.serverFluidChunkTable.homogenousId,homogenous);
|
(*env)->SetBooleanField(env,jObj,environment->lookupTable.serverFluidChunkTable.homogenousId,homogenous);
|
||||||
(*env)->SetBooleanField(env,jObj,environment->lookupTable.serverFluidChunkTable.homogenousId,JNI_FALSE);
|
// (*env)->SetBooleanField(env,jObj,environment->lookupTable.serverFluidChunkTable.homogenousId,JNI_FALSE);
|
||||||
|
|
||||||
//update total density
|
//update total density
|
||||||
(*env)->SetFloatField(env,jObj,totalDensityId,sum);
|
(*env)->SetFloatField(env,jObj,totalDensityId,sum);
|
||||||
|
|
||||||
//check if any neighbor is non-homogenous
|
//check if any neighbor is non-homogenous
|
||||||
// jobject neighborArr = (*env)->GetObjectField(env,jObj,environment->lookupTable.serverFluidChunkTable.neighborsId);
|
jobject neighborArr = (*env)->GetObjectField(env,jObj,environment->lookupTable.serverFluidChunkTable.neighborsId);
|
||||||
// int nonHomogenousNeighbor = JNI_FALSE;
|
int nonHomogenousNeighbor = JNI_FALSE;
|
||||||
// for(int j = 0; j < NEIGHBOR_ARRAY_COUNT; j++){
|
for(int j = 0; j < NEIGHBOR_ARRAY_COUNT; j++){
|
||||||
// if(j == CENTER_LOC){
|
if(j == CENTER_LOC){
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
// jobject neighborObj = (*env)->GetObjectArrayElement(env,neighborArr,j);
|
jobject neighborObj = (*env)->GetObjectArrayElement(env,neighborArr,j);
|
||||||
// if(neighborObj != NULL){
|
if(neighborObj != NULL){
|
||||||
// int neighborHomogenous = (*env)->GetBooleanField(env,neighborObj,environment->lookupTable.serverFluidChunkTable.homogenousId);
|
int neighborHomogenous = (*env)->GetBooleanField(env,neighborObj,environment->lookupTable.serverFluidChunkTable.homogenousId);
|
||||||
// if(neighborHomogenous == JNI_FALSE){
|
if(neighborHomogenous == JNI_FALSE){
|
||||||
// nonHomogenousNeighbor = JNI_TRUE;
|
nonHomogenousNeighbor = JNI_TRUE;
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
//figure out if this chunk should sleep or not
|
//figure out if this chunk should sleep or not
|
||||||
int shouldSleep = JNI_TRUE;
|
int shouldSleep = JNI_TRUE;
|
||||||
// if(nonHomogenousNeighbor == JNI_TRUE || homogenous == JNI_FALSE){
|
if(nonHomogenousNeighbor == JNI_TRUE || homogenous == JNI_FALSE){
|
||||||
shouldSleep = JNI_FALSE;
|
shouldSleep = JNI_FALSE;
|
||||||
// }
|
}
|
||||||
(*env)->SetBooleanField(env,jObj,environment->lookupTable.serverFluidChunkTable.asleepId,shouldSleep);
|
(*env)->SetBooleanField(env,jObj,environment->lookupTable.serverFluidChunkTable.asleepId,shouldSleep);
|
||||||
|
|
||||||
//if this cell is awake AND non-homogenous, make sure all neighbors are awake
|
//if this cell is awake AND non-homogenous, make sure all neighbors are awake
|
||||||
// if(shouldSleep == JNI_FALSE && homogenous == JNI_FALSE){
|
if(shouldSleep == JNI_FALSE && homogenous == JNI_FALSE){
|
||||||
(*env)->SetBooleanField(env,jObj,updatedId,JNI_TRUE);
|
(*env)->SetBooleanField(env,jObj,updatedId,JNI_TRUE);
|
||||||
// for(int j = 0; j < NEIGHBOR_ARRAY_COUNT; j++){
|
for(int j = 0; j < NEIGHBOR_ARRAY_COUNT; j++){
|
||||||
// if(j == CENTER_LOC){
|
if(j == CENTER_LOC){
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
// jobject neighborObj = (*env)->GetObjectArrayElement(env,neighborArr,j);
|
jobject neighborObj = (*env)->GetObjectArrayElement(env,neighborArr,j);
|
||||||
// if(neighborObj != NULL){
|
if(neighborObj != NULL){
|
||||||
// (*env)->SetBooleanField(env,neighborObj,environment->lookupTable.serverFluidChunkTable.asleepId,JNI_FALSE);
|
(*env)->SetBooleanField(env,neighborObj,environment->lookupTable.serverFluidChunkTable.asleepId,JNI_FALSE);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//alert java side to updated static values
|
//alert java side to updated static values
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user