work on native cellular sim
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
c022ee1206
commit
7f09be679f
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -34,6 +34,7 @@
|
||||
"environment.h": "c",
|
||||
"simulator.h": "c",
|
||||
"dispatcher.h": "c",
|
||||
"cellular.h": "c"
|
||||
"cellular.h": "c",
|
||||
"limits": "c"
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,3 @@
|
||||
#maven.buildNumber.plugin properties file
|
||||
#Fri Dec 06 15:38:11 EST 2024
|
||||
buildNumber=526
|
||||
#Fri Dec 06 15:47:19 EST 2024
|
||||
buildNumber=529
|
||||
|
||||
@ -28,7 +28,7 @@ LIBRARY_API void fluid_dispatch(int numReadIn, Chunk ** chunkViewC, Environment
|
||||
for(int i = 0; i < numReadIn; i++){
|
||||
Chunk * currentChunk = chunkViewC[i];
|
||||
//TODO: conditionally add to queues based on some values (ie lod, spatial loc, etc)
|
||||
arrput(environment->queue.gridQueue,currentChunk);
|
||||
arrput(environment->queue.cellularQueue,currentChunk);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
|
||||
|
||||
#include "stb/stb_ds.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++){
|
||||
Chunk * currentChunk = chunks[i];
|
||||
//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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -16,7 +16,9 @@ int fluid_dispatch_dispatcher_tests(){
|
||||
Chunk ** queue = chunk_create_queue(queueSize);
|
||||
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");
|
||||
|
||||
return rVal;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user