Rename depth shader to shadow shader
This commit is contained in:
parent
2ffd44f1a5
commit
669064e4a7
@ -1,17 +0,0 @@
|
|||||||
#ifndef DEPTH_SHADER_H
|
|
||||||
#define DEPTH_SHADER_H
|
|
||||||
|
|
||||||
#include "constants.h"
|
|
||||||
#include "shader.h"
|
|
||||||
#include "vec.h"
|
|
||||||
|
|
||||||
typedef struct depth_shader DepthShader;
|
|
||||||
struct depth_shader {
|
|
||||||
#include "shader_base.inc"
|
|
||||||
};
|
|
||||||
|
|
||||||
VertexData depth_shader_vertex(void *shader, const VertexData *vert, u8 index, const Model *model);
|
|
||||||
FragmentResult depth_shader_fragment(void *shader, const V3f *barycentric, const V4f *colour,
|
|
||||||
const Model *model);
|
|
||||||
|
|
||||||
#endif // !DEPTH_SHADER_H
|
|
@ -1,22 +1,23 @@
|
|||||||
#include "depth_shader.h"
|
#include "shadow_shader.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
VertexData depth_shader_vertex(void *shader, const VertexData *vert, u8 index, const Model *model) {
|
VertexData shadow_shader_vertex(void *shader, const VertexData *vert, u8 index, const Model *model) {
|
||||||
DepthShader *shdr = (DepthShader *)shader;
|
ShadowShader *shdr = (ShadowShader *)shader;
|
||||||
|
|
||||||
V4f vh = V3_to_V4(vert->position);
|
V4f vh = V3_to_V4(vert->position);
|
||||||
vh.y = 0.0 - vh.y;
|
vh.y = 0.0 - vh.y;
|
||||||
vh = mat4x4_mul_vec4(shdr->final, vh);
|
vh = mat4x4_mul_vec4(shdr->final, vh);
|
||||||
|
|
||||||
shdr->vertices[index].position = project_vec4(vh);
|
shdr->vertices[index].position = project_vec4(vh);
|
||||||
|
|
||||||
return shdr->vertices[index];
|
return shdr->vertices[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
FragmentResult depth_shader_fragment(void *shader, const V3f *barycentric, const V4f *colour,
|
FragmentResult shadow_shader_fragment(void *shader, const V3f *barycentric, const V4f *colour,
|
||||||
const Model *model) {
|
const Model *model) {
|
||||||
DepthShader *shdr = (DepthShader *)shader;
|
ShadowShader *shdr = (ShadowShader *)shader;
|
||||||
|
|
||||||
M3x3f pos_mat = {.rows = {shdr->vertices[0].position, shdr->vertices[1].position, shdr->vertices[2].position}};
|
M3x3f pos_mat = {.rows = {shdr->vertices[0].position, shdr->vertices[1].position, shdr->vertices[2].position}};
|
||||||
pos_mat = mat3x3_transpose(pos_mat);
|
pos_mat = mat3x3_transpose(pos_mat);
|
17
src/shader/shadow_shader.h
Normal file
17
src/shader/shadow_shader.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef SHADOW_SHADER_H
|
||||||
|
#define SHADOW_SHADER_H
|
||||||
|
|
||||||
|
#include "constants.h"
|
||||||
|
#include "shader.h"
|
||||||
|
#include "vec.h"
|
||||||
|
|
||||||
|
typedef struct shadow_shader ShadowShader;
|
||||||
|
struct shadow_shader {
|
||||||
|
#include "shader_base.inc"
|
||||||
|
};
|
||||||
|
|
||||||
|
VertexData shadow_shader_vertex(void *shader, const VertexData *vert, u8 index, const Model *model);
|
||||||
|
FragmentResult shadow_shader_fragment(void *shader, const V3f *barycentric, const V4f *colour,
|
||||||
|
const Model *model);
|
||||||
|
|
||||||
|
#endif // !SHADOW_SHADER_H
|
Loading…
Reference in New Issue
Block a user