debug work in shaders
This commit is contained in:
parent
3e591442c9
commit
d4d5d2c94e
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -13,6 +13,7 @@
|
|||||||
"stb_ds.h": "c",
|
"stb_ds.h": "c",
|
||||||
"threadpool.h": "c",
|
"threadpool.h": "c",
|
||||||
"electrosphere_fluidsim.h": "c",
|
"electrosphere_fluidsim.h": "c",
|
||||||
"type_traits": "c"
|
"type_traits": "c",
|
||||||
|
"mainfunctions.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,7 +160,9 @@ public class FluidSim {
|
|||||||
static double lastTime = 0;
|
static double lastTime = 0;
|
||||||
public static void simChunks(FluidSim[][][] simArray, int step, float timestep){
|
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>();
|
List<FluidSim> chunksToSim = new LinkedList<FluidSim>();
|
||||||
//
|
//
|
||||||
|
|||||||
@ -10,6 +10,7 @@ vec3 dLDiffuse = vec3(0.5,0.5,0.5);
|
|||||||
|
|
||||||
in vec3 FragPos;
|
in vec3 FragPos;
|
||||||
in vec3 Normal;
|
in vec3 Normal;
|
||||||
|
in vec3 rawPos;
|
||||||
|
|
||||||
|
|
||||||
uniform vec3 viewPos;
|
uniform vec3 viewPos;
|
||||||
@ -26,7 +27,15 @@ void main(){
|
|||||||
|
|
||||||
vec3 lightAmount = CalcDirLight(norm, viewDir);
|
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
|
//this final calculation is for transparency
|
||||||
FragColor = vec4(color,1.0);
|
FragColor = vec4(color,1.0);
|
||||||
|
|||||||
@ -16,6 +16,7 @@ uniform mat4 projection;
|
|||||||
//output buffers
|
//output buffers
|
||||||
out vec3 Normal;
|
out vec3 Normal;
|
||||||
out vec3 FragPos;
|
out vec3 FragPos;
|
||||||
|
out vec3 rawPos;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ void main() {
|
|||||||
//push frag, normal, and texture positions to fragment shader
|
//push frag, normal, and texture positions to fragment shader
|
||||||
FragPos = vec3(model * FinalVertex);
|
FragPos = vec3(model * FinalVertex);
|
||||||
Normal = mat3(transpose(inverse(model))) * aNormal;
|
Normal = mat3(transpose(inverse(model))) * aNormal;
|
||||||
|
rawPos = aPos;
|
||||||
|
|
||||||
|
|
||||||
//set final position with opengl space
|
//set final position with opengl space
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user