diff --git a/src/shader/depth_shader.c b/src/shader/depth_shader.c index 18afdbc..19a02cc 100644 --- a/src/shader/depth_shader.c +++ b/src/shader/depth_shader.c @@ -1,4 +1,5 @@ #include "depth_shader.h" +#include "constants.h" #include "shader.h" VertexData depth_shader_vertex(void *shader, const VertexData *vert, u8 index, const Model *model) { @@ -18,9 +19,9 @@ FragmentResult depth_shader_fragment(void *shader, const V3f *barycentric, const M3x3f pos_mat = {.rows = {shdr->vertices[0].position, shdr->vertices[1].position, shdr->vertices[2].position}}; pos_mat = mat3x3_transpose(pos_mat); + V3f position = mat3x3_mul_vec3(pos_mat, (*barycentric)); - V3f position = mat3x3_mul_vec3(pos_mat, (*barycentric)); - V4f output = {.r = position.z, .g = position.z, .b = position.z, .a = 255}; + V4f output = {.r = position.z, .g = position.z, .b = position.z, .a = 255}; return (FragmentResult){.colour = output}; } diff --git a/src/shader/depth_shader.h b/src/shader/depth_shader.h index afc5fac..13ac22c 100644 --- a/src/shader/depth_shader.h +++ b/src/shader/depth_shader.h @@ -7,7 +7,7 @@ typedef struct depth_shader DepthShader; struct depth_shader { -#include "shader_base.inc" + #include "shader_base.inc" }; VertexData depth_shader_vertex(void *shader, const VertexData *vert, u8 index, const Model *model); diff --git a/src/shader/main_shader.h b/src/shader/main_shader.h index 7f374e0..8a2344f 100644 --- a/src/shader/main_shader.h +++ b/src/shader/main_shader.h @@ -6,7 +6,8 @@ typedef struct shader Shader; struct shader { -#include "shader_base.inc" + #include "shader_base.inc" + M4x4f shadow_matrix; }; VertexData general_shader_vertex(void *shader, const VertexData *vert, u8 index, const Model *model);