Reformatting and cleanup
This commit is contained in:
parent
72ab9f6aa2
commit
390ab7c3b4
@ -19,10 +19,8 @@ FragmentResult depth_shader_fragment(void *shader, const V3f *barycentric, const
|
|||||||
const Model *model) {
|
const Model *model) {
|
||||||
DepthShader *shdr = (DepthShader *)shader;
|
DepthShader *shdr = (DepthShader *)shader;
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
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);
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
V3f position = mat3x3_mul_vec3(pos_mat, (*barycentric));
|
V3f position = mat3x3_mul_vec3(pos_mat, (*barycentric));
|
||||||
f32 channel = clamp(position.z + DEPTH_MAX, 0.0f, DEPTH_MAX);
|
f32 channel = clamp(position.z + DEPTH_MAX, 0.0f, DEPTH_MAX);
|
||||||
|
@ -106,11 +106,8 @@ FragmentResult albedo_shader_fragment(void *shader, const V3f *barycentric, cons
|
|||||||
const Model *model) {
|
const Model *model) {
|
||||||
Shader *shdr = (Shader *)shader;
|
Shader *shdr = (Shader *)shader;
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
M3x2f uvs = {shdr->vertices[0].uv, shdr->vertices[1].uv, shdr->vertices[2].uv};
|
M3x2f uvs = {shdr->vertices[0].uv, shdr->vertices[1].uv, shdr->vertices[2].uv};
|
||||||
M2x3f uv_mat = mat3x2_transpose(uvs);
|
M2x3f uv_mat = mat3x2_transpose(uvs);
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
V2f uv = mat2x3_mul_vec3(uv_mat, (*barycentric));
|
V2f uv = mat2x3_mul_vec3(uv_mat, (*barycentric));
|
||||||
|
|
||||||
Colour output;
|
Colour output;
|
||||||
|
@ -29,14 +29,12 @@ M4x4f lookat(V3f eye, V3f target, V3f up) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
M4x4f projection(f32 coeff) {
|
M4x4f projection(f32 coeff) {
|
||||||
// clang-format off
|
|
||||||
return (M4x4f){
|
return (M4x4f){
|
||||||
.row0 = {1.0f, 0.0f, 0.0f, 0.0f},
|
.row0 = {1.0f, 0.0f, 0.0f, 0.0f},
|
||||||
.row1 = {0.0f, 1.0f, 0.0f, 0.0f},
|
.row1 = {0.0f, 1.0f, 0.0f, 0.0f},
|
||||||
.row2 = {0.0f, 0.0f, 1.0f, 0.0f},
|
.row2 = {0.0f, 0.0f, 1.0f, 0.0f},
|
||||||
.row3 = {0.0f, 0.0f, coeff, 1.0f},
|
.row3 = {0.0f, 0.0f, coeff, 1.0f},
|
||||||
};
|
};
|
||||||
// clang-format on
|
|
||||||
}
|
}
|
||||||
|
|
||||||
M4x4f viewport(f32 x, f32 y, u64 w, u64 h) {
|
M4x4f viewport(f32 x, f32 y, u64 w, u64 h) {
|
||||||
|
Loading…
Reference in New Issue
Block a user