diff --git a/.vscode/settings.json b/.vscode/settings.json index 46eb8be..b9cbf89 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,6 +13,7 @@ "stb_ds.h": "c", "threadpool.h": "c", "electrosphere_fluidsim.h": "c", - "type_traits": "c" + "type_traits": "c", + "mainfunctions.h": "c" } } \ No newline at end of file diff --git a/src/main/java/electrosphere/FluidSim.java b/src/main/java/electrosphere/FluidSim.java index 00c9790..c3a45f0 100644 --- a/src/main/java/electrosphere/FluidSim.java +++ b/src/main/java/electrosphere/FluidSim.java @@ -160,7 +160,9 @@ public class FluidSim { static double lastTime = 0; public static void simChunks(FluidSim[][][] simArray, int step, float timestep){ - // simArray[0][1][2].density0ArrayView[5] = 3.0f; + simArray[0][1][2].density0ArrayView[IX(10,10,3)] = 3.0f; + simArray[2][1][2].density0ArrayView[IX(10,10,3)] = 3.0f; + simArray[2][1][0].density0ArrayView[IX(10,10,3)] = 3.0f; List chunksToSim = new LinkedList(); // diff --git a/src/main/resources/shader.fs b/src/main/resources/shader.fs index 905d839..fbf7c6f 100644 --- a/src/main/resources/shader.fs +++ b/src/main/resources/shader.fs @@ -10,6 +10,7 @@ vec3 dLDiffuse = vec3(0.5,0.5,0.5); in vec3 FragPos; in vec3 Normal; +in vec3 rawPos; uniform vec3 viewPos; @@ -26,7 +27,15 @@ void main(){ vec3 lightAmount = CalcDirLight(norm, viewDir); - vec3 color = vec3(0.3,0.7,0.9) * lightAmount; + vec3 color = vec3(0.3,0.7,0.9); + if( + rawPos.x < 2 || rawPos.x > 16 || + rawPos.y < 2 || rawPos.y > 16 || + rawPos.z < 2 || rawPos.z > 16 + ){ + color = vec3(0.9,0.7,0.3); + } + color = color * lightAmount; //this final calculation is for transparency FragColor = vec4(color,1.0); diff --git a/src/main/resources/shader.vs b/src/main/resources/shader.vs index a2b344b..97b0628 100644 --- a/src/main/resources/shader.vs +++ b/src/main/resources/shader.vs @@ -16,6 +16,7 @@ uniform mat4 projection; //output buffers out vec3 Normal; out vec3 FragPos; +out vec3 rawPos; @@ -29,6 +30,7 @@ void main() { //push frag, normal, and texture positions to fragment shader FragPos = vec3(model * FinalVertex); Normal = mat3(transpose(inverse(model))) * aNormal; + rawPos = aPos; //set final position with opengl space