fix cellular sim
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-12-06 19:31:05 -05:00
parent 3436bfa457
commit 86da26675f
3 changed files with 41 additions and 38 deletions

View File

@ -1,3 +1,3 @@
#maven.buildNumber.plugin properties file #maven.buildNumber.plugin properties file
#Fri Dec 06 19:27:15 EST 2024 #Fri Dec 06 19:29:52 EST 2024
buildNumber=569 buildNumber=570

View File

@ -1258,6 +1258,8 @@ Fix fluid dispatcher array deref
Bounds array allocation Bounds array allocation
Store world pos on native side Store world pos on native side
Native bounds solver Native bounds solver
Fix cellular sim bounds check
Add hard walls to bounds solver

View File

@ -1,13 +1,14 @@
#include "fluid/queue/boundsolver.h" #include "fluid/queue/boundsolver.h"
#include "fluid/queue/chunk.h"
#include "fluid/queue/chunkmask.h" #include "fluid/queue/chunkmask.h"
#include "fluid/env/utilities.h" #include "fluid/env/utilities.h"
static inline void fluid_solve_bounds_checker(float ** arrays){ static inline void fluid_solve_bounds_checker(float ** arrays, int fillVal){
int i, j; int i, j;
int neighborIndex; int neighborIndex;
//x+ face //x+ face
@ -21,7 +22,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
for(j = 1; j < DIM; j++){ for(j = 1; j < DIM; j++){
arrays[CENTER_LOC][IX(DIM-1, i, j)] = 0; arrays[CENTER_LOC][IX(DIM-1, i, j)] = fillVal;
} }
} }
} }
@ -37,7 +38,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} else { } else {
for(i = 1; i < DIM-1; i++){ for(i = 1; i < DIM-1; i++){
for(j = 1; j < DIM-1; j++){ for(j = 1; j < DIM-1; j++){
arrays[CENTER_LOC][IX(0, i, j)] = 0; arrays[CENTER_LOC][IX(0, i, j)] = fillVal;
} }
} }
} }
@ -53,7 +54,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} else { } else {
for(i = 1; i < DIM-1; i++){ for(i = 1; i < DIM-1; i++){
for(j = 1; j < DIM-1; j++){ for(j = 1; j < DIM-1; j++){
arrays[CENTER_LOC][IX( i, DIM-1, j)] = 0; arrays[CENTER_LOC][IX( i, DIM-1, j)] = fillVal;
} }
} }
} }
@ -69,7 +70,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} else { } else {
for(i = 1; i < DIM-1; i++){ for(i = 1; i < DIM-1; i++){
for(j = 1; j < DIM-1; j++){ for(j = 1; j < DIM-1; j++){
arrays[CENTER_LOC][IX(i, 0, j)] = 0; arrays[CENTER_LOC][IX(i, 0, j)] = fillVal;
} }
} }
} }
@ -85,7 +86,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} else { } else {
for(i = 1; i < DIM-1; i++){ for(i = 1; i < DIM-1; i++){
for(j = 1; j < DIM-1; j++){ for(j = 1; j < DIM-1; j++){
arrays[CENTER_LOC][IX( i, j, DIM-1)] = 0; arrays[CENTER_LOC][IX( i, j, DIM-1)] = fillVal;
} }
} }
} }
@ -101,7 +102,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} else { } else {
for(i = 1; i < DIM-1; i++){ for(i = 1; i < DIM-1; i++){
for(j = 1; j < DIM-1; j++){ for(j = 1; j < DIM-1; j++){
arrays[CENTER_LOC][IX(i, j, 0)] = 0; arrays[CENTER_LOC][IX(i, j, 0)] = fillVal;
} }
} }
} }
@ -119,7 +120,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX(DIM-1, DIM-1, i)] = 0; arrays[CENTER_LOC][IX(DIM-1, DIM-1, i)] = fillVal;
} }
} }
@ -131,7 +132,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX(DIM-1, 0, i)] = 0; arrays[CENTER_LOC][IX(DIM-1, 0, i)] = fillVal;
} }
} }
@ -143,7 +144,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX( 0, DIM-1, i)] = 0; arrays[CENTER_LOC][IX( 0, DIM-1, i)] = fillVal;
} }
} }
@ -155,7 +156,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX( 0, 0, i)] = 0; arrays[CENTER_LOC][IX( 0, 0, i)] = fillVal;
} }
} }
@ -175,7 +176,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX(DIM-1, i, DIM-1)] = 0; arrays[CENTER_LOC][IX(DIM-1, i, DIM-1)] = fillVal;
} }
} }
@ -187,7 +188,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX(DIM-1, i, 0)] = 0; arrays[CENTER_LOC][IX(DIM-1, i, 0)] = fillVal;
} }
} }
@ -199,7 +200,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX( 0, i, DIM-1)] = 0; arrays[CENTER_LOC][IX( 0, i, DIM-1)] = fillVal;
} }
} }
@ -211,7 +212,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX( 0, i, 0)] = 0; arrays[CENTER_LOC][IX( 0, i, 0)] = fillVal;
} }
} }
@ -230,7 +231,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX( i, DIM-1, DIM-1)] = 0; arrays[CENTER_LOC][IX( i, DIM-1, DIM-1)] = fillVal;
} }
} }
@ -242,7 +243,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX( i,DIM-1, 0)] = 0; arrays[CENTER_LOC][IX( i,DIM-1, 0)] = fillVal;
} }
} }
@ -254,7 +255,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX( i, 0, DIM-1)] = 0; arrays[CENTER_LOC][IX( i, 0, DIM-1)] = fillVal;
} }
} }
@ -266,7 +267,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
} }
} else { } else {
for(i = 1; i < DIM; i++){ for(i = 1; i < DIM; i++){
arrays[CENTER_LOC][IX( i, 0, 0)] = 0; arrays[CENTER_LOC][IX( i, 0, 0)] = fillVal;
} }
} }
@ -280,7 +281,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
if(arrays[neighborIndex] != NULL){ if(arrays[neighborIndex] != NULL){
arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = arrays[neighborIndex][IX( 1, 1, 1)]; arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = arrays[neighborIndex][IX( 1, 1, 1)];
} else { } else {
arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = 0; arrays[CENTER_LOC][IX(DIM-1, DIM-1, DIM-1)] = fillVal;
} }
//x+ y+ z- corner //x+ y+ z- corner
@ -288,7 +289,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
if(arrays[neighborIndex] != NULL){ if(arrays[neighborIndex] != NULL){
arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = arrays[neighborIndex][IX( 1, 1, DIM-2)]; arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = arrays[neighborIndex][IX( 1, 1, DIM-2)];
} else { } else {
arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = 0; arrays[CENTER_LOC][IX(DIM-1, DIM-1, 0)] = fillVal;
} }
@ -298,7 +299,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
if(arrays[neighborIndex] != NULL){ if(arrays[neighborIndex] != NULL){
arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = arrays[neighborIndex][IX( 1, DIM-2, 1)]; arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = arrays[neighborIndex][IX( 1, DIM-2, 1)];
} else { } else {
arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = 0; arrays[CENTER_LOC][IX(DIM-1, 0, DIM-1)] = fillVal;
} }
//x+ y- z- corner //x+ y- z- corner
@ -306,7 +307,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
if(arrays[neighborIndex] != NULL){ if(arrays[neighborIndex] != NULL){
arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = arrays[neighborIndex][IX( 1, DIM-2, DIM-2)]; arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = arrays[neighborIndex][IX( 1, DIM-2, DIM-2)];
} else { } else {
arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = 0; arrays[CENTER_LOC][IX(DIM-1, 0, 0)] = fillVal;
} }
@ -316,7 +317,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
if(arrays[neighborIndex] != NULL){ if(arrays[neighborIndex] != NULL){
arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = arrays[neighborIndex][IX( DIM-2, 1, 1)]; arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = arrays[neighborIndex][IX( DIM-2, 1, 1)];
} else { } else {
arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = 0; arrays[CENTER_LOC][IX(0, DIM-1, DIM-1)] = fillVal;
} }
//x- y+ z- corner //x- y+ z- corner
@ -324,7 +325,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
if(arrays[neighborIndex] != NULL){ if(arrays[neighborIndex] != NULL){
arrays[CENTER_LOC][IX(0, DIM-1, 0)] = arrays[neighborIndex][IX( DIM-2, 1, DIM-2)]; arrays[CENTER_LOC][IX(0, DIM-1, 0)] = arrays[neighborIndex][IX( DIM-2, 1, DIM-2)];
} else { } else {
arrays[CENTER_LOC][IX(0, DIM-1, 0)] = 0; arrays[CENTER_LOC][IX(0, DIM-1, 0)] = fillVal;
} }
@ -334,7 +335,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
if(arrays[neighborIndex] != NULL){ if(arrays[neighborIndex] != NULL){
arrays[CENTER_LOC][IX(0, 0, DIM-1)] = arrays[neighborIndex][IX( DIM-2, DIM-2, 1)]; arrays[CENTER_LOC][IX(0, 0, DIM-1)] = arrays[neighborIndex][IX( DIM-2, DIM-2, 1)];
} else { } else {
arrays[CENTER_LOC][IX(0, 0, DIM-1)] = 0; arrays[CENTER_LOC][IX(0, 0, DIM-1)] = fillVal;
} }
//x- y- z- corner //x- y- z- corner
@ -342,7 +343,7 @@ static inline void fluid_solve_bounds_checker(float ** arrays){
if(arrays[neighborIndex] != NULL){ if(arrays[neighborIndex] != NULL){
arrays[CENTER_LOC][IX(0, 0, 0)] = arrays[neighborIndex][IX( DIM-2, DIM-2, DIM-2)]; arrays[CENTER_LOC][IX(0, 0, 0)] = arrays[neighborIndex][IX( DIM-2, DIM-2, DIM-2)];
} else { } else {
arrays[CENTER_LOC][IX(0, 0, 0)] = 0; arrays[CENTER_LOC][IX(0, 0, 0)] = fillVal;
} }
} }
@ -359,15 +360,15 @@ LIBRARY_API void fluid_solve_bounds(int numReadIn, Chunk ** chunkViewC, Environm
int neighborIndex; int neighborIndex;
for(chunkIndex = 0; chunkIndex < numReadIn; chunkIndex++){ for(chunkIndex = 0; chunkIndex < numReadIn; chunkIndex++){
Chunk * current = chunkViewC[chunkIndex]; Chunk * current = chunkViewC[chunkIndex];
fluid_solve_bounds_checker(current->d); fluid_solve_bounds_checker(current->d,0);
fluid_solve_bounds_checker(current->d0); fluid_solve_bounds_checker(current->d0,0);
fluid_solve_bounds_checker(current->u); fluid_solve_bounds_checker(current->u,0);
fluid_solve_bounds_checker(current->v); fluid_solve_bounds_checker(current->v,0);
fluid_solve_bounds_checker(current->w); fluid_solve_bounds_checker(current->w,0);
fluid_solve_bounds_checker(current->u0); fluid_solve_bounds_checker(current->u0,0);
fluid_solve_bounds_checker(current->v0); fluid_solve_bounds_checker(current->v0,0);
fluid_solve_bounds_checker(current->w0); fluid_solve_bounds_checker(current->w0,0);
fluid_solve_bounds_checker(current->bounds); fluid_solve_bounds_checker(current->bounds,BOUND_MAX_VALUE);
} }
} }