debug work in shaders

This commit is contained in:
unknown 2024-03-10 20:48:51 -04:00
parent 3e591442c9
commit d4d5d2c94e
4 changed files with 17 additions and 3 deletions

View File

@ -13,6 +13,7 @@
"stb_ds.h": "c",
"threadpool.h": "c",
"electrosphere_fluidsim.h": "c",
"type_traits": "c"
"type_traits": "c",
"mainfunctions.h": "c"
}
}

View File

@ -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<FluidSim> chunksToSim = new LinkedList<FluidSim>();
//

View File

@ -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);

View File

@ -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