work on native cellular sim
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-12-06 15:49:08 -05:00
parent c022ee1206
commit 7f09be679f
5 changed files with 35 additions and 5 deletions

View File

@ -34,6 +34,7 @@
"environment.h": "c", "environment.h": "c",
"simulator.h": "c", "simulator.h": "c",
"dispatcher.h": "c", "dispatcher.h": "c",
"cellular.h": "c" "cellular.h": "c",
"limits": "c"
} }
} }

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file #maven.buildNumber.plugin properties file
#Fri Dec 06 15:38:11 EST 2024 #Fri Dec 06 15:47:19 EST 2024
buildNumber=526 buildNumber=529

View File

@ -28,7 +28,7 @@ LIBRARY_API void fluid_dispatch(int numReadIn, Chunk ** chunkViewC, Environment
for(int i = 0; i < numReadIn; i++){ for(int i = 0; i < numReadIn; i++){
Chunk * currentChunk = chunkViewC[i]; Chunk * currentChunk = chunkViewC[i];
//TODO: conditionally add to queues based on some values (ie lod, spatial loc, etc) //TODO: conditionally add to queues based on some values (ie lod, spatial loc, etc)
arrput(environment->queue.gridQueue,currentChunk); arrput(environment->queue.cellularQueue,currentChunk);
} }
} }

View File

@ -1,6 +1,9 @@
#include "stb/stb_ds.h" #include "stb/stb_ds.h"
#include "fluid/sim/cellular/cellular.h" #include "fluid/sim/cellular/cellular.h"
#include "fluid/queue/chunkmask.h"
#include "fluid/env/utilities.h"
/** /**
@ -15,6 +18,30 @@ LIBRARY_API void fluid_cellular_simulate(Environment * environment){
for(int i = 0; i < chunkCount; i++){ for(int i = 0; i < chunkCount; i++){
Chunk * currentChunk = chunks[i]; Chunk * currentChunk = chunks[i];
//simulate here //simulate here
float * d = currentChunk->d[CENTER_LOC];
for(int x = 1; x < DIM-1; x++){
for(int y = 1; y < DIM-1; y++){
for(int z = 1; z < DIM-1; z++){
if(d[IX(x,y,z)] <= 0){
continue;
} else {
int deltaLower = MAX_VALUE - d[IX(x,y-1,z)];
if(deltaLower > 0){
int transferLower;
if(d[IX(x,y,z)] >= deltaLower){
transferLower = deltaLower;
} else {
transferLower = d[IX(x,y,z)];
}
d[IX(x,y,z)] -= transferLower;
d[IX(x,y-1,z)] += transferLower;
}
}
}
}
}
} }
} }

View File

@ -16,7 +16,9 @@ int fluid_dispatch_dispatcher_tests(){
Chunk ** queue = chunk_create_queue(queueSize); Chunk ** queue = chunk_create_queue(queueSize);
fluid_dispatch(queueSize,queue,env); fluid_dispatch(queueSize,queue,env);
int gridChunksFound = stbds_arrlen(env->queue.gridQueue); int gridChunksFound = stbds_arrlen(env->queue.gridQueue) +
stbds_arrlen(env->queue.cellularQueue)
;
rVal += assertEquals(gridChunksFound,queueSize,"should have 10 queued chunks -- %d %d \n"); rVal += assertEquals(gridChunksFound,queueSize,"should have 10 queued chunks -- %d %d \n");
return rVal; return rVal;