Chunking fluids working partway
This commit is contained in:
parent
cc5edb452b
commit
fbf4e62d9c
@ -612,6 +612,13 @@ JNIEXPORT void JNICALL Java_electrosphere_FluidSim_copyNeighbors
|
||||
int DIM = N;
|
||||
float * target = GET_ARR(env,neighborArray,CENTER_LOC);
|
||||
float * source;
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// PLANES
|
||||
//
|
||||
//
|
||||
if(ARR_EXISTS(chunk_mask,0,1,1)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,1,1));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
@ -629,4 +636,189 @@ JNIEXPORT void JNICALL Java_electrosphere_FluidSim_copyNeighbors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,1,0,1)){
|
||||
source = GET_ARR(env,neighborArray,CK(1,0,1));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
for(int y = 1; y < DIM-1; y++){
|
||||
target[IX(x,0,y)] = source[IX(x,DIM-2,y)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,1,2,1)){
|
||||
source = GET_ARR(env,neighborArray,CK(1,2,1));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
for(int y = 1; y < DIM-1; y++){
|
||||
target[IX(x,DIM-1,y)] = source[IX(x,1,y)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,1,1,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(1,1,0));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
for(int y = 1; y < DIM-1; y++){
|
||||
target[IX(x,y,0)] = source[IX(x,y,DIM-2)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,1,1,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(1,1,2));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
for(int y = 1; y < DIM-1; y++){
|
||||
target[IX(x,y,DIM-1)] = source[IX(x,y,1)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// EDGES
|
||||
//
|
||||
//
|
||||
if(ARR_EXISTS(chunk_mask,0,0,1)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,0,1));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(0,0,x)] = source[IX(DIM-2,DIM-2,x)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,2,0,1)){
|
||||
source = GET_ARR(env,neighborArray,CK(2,0,1));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(DIM-1,0,x)] = source[IX(1,DIM-2,x)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,0,2,1)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,2,1));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(0,DIM-1,x)] = source[IX(DIM-2,1,x)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,2,2,1)){
|
||||
source = GET_ARR(env,neighborArray,CK(2,2,1));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(DIM-1,DIM-1,x)] = source[IX(1,1,x)];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,0,1,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,1,0));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(0,x,0)] = source[IX(DIM-2,x,DIM-2)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,2,1,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(2,1,0));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(DIM-1,x,0)] = source[IX(1,x,DIM-2)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,0,1,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,1,2));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(0,x,DIM-1)] = source[IX(DIM-2,x,1)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,2,1,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(2,1,2));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(DIM-1,x,DIM-1)] = source[IX(1,x,1)];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,1,0,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(1,0,0));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(x,0,0)] = source[IX(x,DIM-2,DIM-2)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,1,2,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(1,2,0));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(x,DIM-1,0)] = source[IX(x,1,DIM-2)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,1,0,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(1,0,2));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(x,0,DIM-1)] = source[IX(x,DIM-2,1)];
|
||||
}
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,1,2,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(1,2,2));
|
||||
for(int x=1; x < DIM-1; x++){
|
||||
target[IX(x,DIM-1,DIM-1)] = source[IX(x,1,1)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// CORNERS
|
||||
//
|
||||
//
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,0,0,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,0,0));
|
||||
target[IX(0,0,0)] = source[IX(DIM-2,DIM-2,DIM-2)];
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,2,0,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(2,0,0));
|
||||
target[IX(DIM-1,0,0)] = source[IX(1,DIM-2,DIM-2)];
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,0,2,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,2,0));
|
||||
target[IX(0,DIM-1,0)] = source[IX(DIM-2,1,DIM-2)];
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,2,2,0)){
|
||||
source = GET_ARR(env,neighborArray,CK(2,2,0));
|
||||
target[IX(DIM-1,DIM-1,0)] = source[IX(1,1,DIM-2)];
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,0,0,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,0,2));
|
||||
target[IX(0,0,DIM-1)] = source[IX(DIM-2,DIM-2,1)];
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,2,0,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(2,0,2));
|
||||
target[IX(DIM-1,0,DIM-1)] = source[IX(1,DIM-2,1)];
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,0,2,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(0,2,2));
|
||||
target[IX(0,DIM-1,DIM-1)] = source[IX(DIM-2,1,1)];
|
||||
}
|
||||
|
||||
if(ARR_EXISTS(chunk_mask,2,2,2)){
|
||||
source = GET_ARR(env,neighborArray,CK(2,2,2));
|
||||
target[IX(DIM-1,DIM-1,DIM-1)] = source[IX(1,1,1)];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -36,9 +36,9 @@ public class Main {
|
||||
Mesh.initShaderProgram();
|
||||
|
||||
|
||||
FluidSim[][][] simArray = initFluidSim(dim,1,1);
|
||||
FluidSim[][][] simArray = initFluidSim(dim,dim,dim);
|
||||
|
||||
Mesh[][][] meshArray = initMeshes(dim,1,1,simArray);
|
||||
Mesh[][][] meshArray = initMeshes(dim,dim,dim,simArray);
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user