This commit is contained in:
Abdelrahman Said 2024-09-14 02:45:34 +01:00
parent ef0c29de02
commit 66ca20ee5b
3 changed files with 6 additions and 4 deletions

View File

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

View File

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

View File

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