Fix native bounds setting bug
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
878f839f65
commit
d3f545955f
@ -1,3 +1,3 @@
|
|||||||
#maven.buildNumber.plugin properties file
|
#maven.buildNumber.plugin properties file
|
||||||
#Fri Dec 06 16:10:07 EST 2024
|
#Fri Dec 06 19:03:01 EST 2024
|
||||||
buildNumber=534
|
buildNumber=558
|
||||||
|
|||||||
@ -14,6 +14,11 @@
|
|||||||
*/
|
*/
|
||||||
#define BOUND_MIN_VALUE 0
|
#define BOUND_MIN_VALUE 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum value of bounds array for it to be considered a blocker
|
||||||
|
*/
|
||||||
|
#define BOUND_MAX_VALUE 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The dimension of a single chunk's array
|
* The dimension of a single chunk's array
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void fluid_solve_bounds_checker(float ** arrays){
|
static inline void fluid_solve_bounds_checker(float ** arrays){
|
||||||
int i, j;
|
int i, j;
|
||||||
int neighborIndex;
|
int neighborIndex;
|
||||||
//x+ face
|
//x+ face
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
//local includes
|
//local includes
|
||||||
#include "fluid/queue/chunk.h"
|
#include "fluid/queue/chunk.h"
|
||||||
#include "fluid/queue/chunkmask.h"
|
#include "fluid/queue/chunkmask.h"
|
||||||
|
#include "fluid/queue/boundsolver.h"
|
||||||
#include "fluid/queue/metadatacalc.h"
|
#include "fluid/queue/metadatacalc.h"
|
||||||
#include "fluid/env/environment.h"
|
#include "fluid/env/environment.h"
|
||||||
#include "fluid/env/utilities.h"
|
#include "fluid/env/utilities.h"
|
||||||
@ -57,6 +58,7 @@ JNIEXPORT void JNICALL Java_electrosphere_server_fluid_simulator_FluidAccelerate
|
|||||||
){
|
){
|
||||||
environment->consts.dt = dt;
|
environment->consts.dt = dt;
|
||||||
int numReadIn = readInChunks(env,chunkList,environment);
|
int numReadIn = readInChunks(env,chunkList,environment);
|
||||||
|
fluid_solve_bounds(numReadIn,chunkViewC,environment);
|
||||||
fluid_dispatch(numReadIn,chunkViewC,environment);
|
fluid_dispatch(numReadIn,chunkViewC,environment);
|
||||||
fluid_simulate(environment);
|
fluid_simulate(environment);
|
||||||
updateMetadata(env,numReadIn,chunkViewC,environment);
|
updateMetadata(env,numReadIn,chunkViewC,environment);
|
||||||
@ -237,6 +239,16 @@ int readInChunks(JNIEnv * env, jobject chunkList, Environment * environment){
|
|||||||
newChunk->v0[j] = getArray(env,v0,j);
|
newChunk->v0[j] = getArray(env,v0,j);
|
||||||
newChunk->w0[j] = getArray(env,w0,j);
|
newChunk->w0[j] = getArray(env,w0,j);
|
||||||
newChunk->bounds[j] = getArray(env,bounds,j);
|
newChunk->bounds[j] = getArray(env,bounds,j);
|
||||||
|
} else {
|
||||||
|
newChunk->d[j] = NULL;
|
||||||
|
newChunk->d0[j] = NULL;
|
||||||
|
newChunk->u[j] = NULL;
|
||||||
|
newChunk->v[j] = NULL;
|
||||||
|
newChunk->w[j] = NULL;
|
||||||
|
newChunk->u0[j] = NULL;
|
||||||
|
newChunk->v0[j] = NULL;
|
||||||
|
newChunk->w0[j] = NULL;
|
||||||
|
newChunk->bounds[j] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ LIBRARY_API void fluid_cellular_simulate(Environment * environment){
|
|||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
//transfer straight down
|
//transfer straight down
|
||||||
if(bounds[IX(x,y-1,z)] <= BOUND_MIN_VALUE){
|
if(bounds[IX(x,y-1,z)] < BOUND_MIN_VALUE){
|
||||||
int deltaLower = MAX_VALUE - d[IX(x,y-1,z)];
|
int deltaLower = MAX_VALUE - d[IX(x,y-1,z)];
|
||||||
if(deltaLower > 0){
|
if(deltaLower > 0){
|
||||||
int transferLower;
|
int transferLower;
|
||||||
|
|||||||
@ -109,6 +109,8 @@ void allocateCenterField(JNIEnv * env, jobject fluidObj, jfieldID arrFieldId){
|
|||||||
if (byteBuffer == NULL) {
|
if (byteBuffer == NULL) {
|
||||||
// Handle ByteBuffer creation failure
|
// Handle ByteBuffer creation failure
|
||||||
pool_return(centerArrPool, buffer);
|
pool_return(centerArrPool, buffer);
|
||||||
|
jobject jd = (*env)->GetObjectField(env,fluidObj,arrFieldId);
|
||||||
|
(*env)->SetObjectArrayElement(env,jd,CENTER_POS,NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,6 +210,7 @@ void allocateField(JNIEnv * env, jobject fluidObj, jfieldID arrFieldId){
|
|||||||
if (byteBuffer == NULL) {
|
if (byteBuffer == NULL) {
|
||||||
// Handle ByteBuffer creation failure
|
// Handle ByteBuffer creation failure
|
||||||
pool_return(fieldPool,buffer);
|
pool_return(fieldPool,buffer);
|
||||||
|
(*env)->SetObjectField(env,fluidObj,arrFieldId,NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
//Libraries
|
//Libraries
|
||||||
#include "../../lib/stb/stb_ds.h"
|
#include "../../lib/stb/stb_ds.h"
|
||||||
@ -26,14 +27,20 @@ POOL * pool_create(int blockSize){
|
|||||||
* @return The block of memory
|
* @return The block of memory
|
||||||
*/
|
*/
|
||||||
void * pool_get(POOL * pool){
|
void * pool_get(POOL * pool){
|
||||||
|
void * rVal;
|
||||||
pool->posCurr++;
|
pool->posCurr++;
|
||||||
if(pool->posCurr >= pool->posMax){
|
if(pool->posCurr >= pool->posMax){
|
||||||
//allocate a new block
|
//allocate a new block
|
||||||
void * newBlock = (void *)calloc(1,pool->blockSize);
|
void * newBlock = (void *)calloc(1,pool->blockSize);
|
||||||
|
if(newBlock == NULL){
|
||||||
|
pool->posCurr--;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
stbds_arrput(pool->table,newBlock);
|
stbds_arrput(pool->table,newBlock);
|
||||||
pool->posMax++;
|
pool->posMax++;
|
||||||
}
|
}
|
||||||
return pool->table[pool->posCurr - 1];
|
rVal = pool->table[pool->posCurr - 1];
|
||||||
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -545,6 +545,17 @@ public class ServerFluidChunk {
|
|||||||
*/
|
*/
|
||||||
public void freeBuffers(){
|
public void freeBuffers(){
|
||||||
this.free();
|
this.free();
|
||||||
|
for(int i = 0; i < 27; i++){
|
||||||
|
bWeights[i] = null;
|
||||||
|
b0Weights[i] = null;
|
||||||
|
bVelocityX[i] = null;
|
||||||
|
bVelocityY[i] = null;
|
||||||
|
bVelocityZ[i] = null;
|
||||||
|
b0VelocityX[i] = null;
|
||||||
|
b0VelocityY[i] = null;
|
||||||
|
b0VelocityZ[i] = null;
|
||||||
|
bBounds[i] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user