Start using reverse z and row major matrices, yay

This commit is contained in:
sergeypdev 2024-12-08 21:58:58 +04:00
parent 63171f468d
commit 8cf7df0a90
3 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ struct View
mat4 world_to_view;
};
layout(binding = 0, std430) uniform GlobalUniform {
layout(binding = 0, std430, row_major) uniform GlobalUniform {
View view;
} Global;

View File

@ -22,7 +22,7 @@ layout(location = 0) out vec3 VertexColor;
void main() {
VertexColor = colors[gl_VertexIndex];
gl_Position = Global.view.world_to_clip * vec4(positions[gl_VertexIndex], 0.0, 1.0);
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0) * Global.view.world_to_clip;
}
#endif

View File

@ -22,7 +22,7 @@ pub const Camera = struct {
view_mat: Mat4 = Mat4.identity(),
pub fn projection(self: *const Camera) Mat4 {
return za.perspective(self.fovy, self.aspect, self.near, self.far);
return za.perspectiveReversedZ(self.fovy, self.aspect, self.near);
}
};