Start using reverse z and row major matrices, yay
This commit is contained in:
parent
63171f468d
commit
8cf7df0a90
@ -8,7 +8,7 @@ struct View
|
|||||||
mat4 world_to_view;
|
mat4 world_to_view;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(binding = 0, std430) uniform GlobalUniform {
|
layout(binding = 0, std430, row_major) uniform GlobalUniform {
|
||||||
View view;
|
View view;
|
||||||
} Global;
|
} Global;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ layout(location = 0) out vec3 VertexColor;
|
|||||||
void main() {
|
void main() {
|
||||||
VertexColor = colors[gl_VertexIndex];
|
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
|
#endif
|
||||||
|
@ -22,7 +22,7 @@ pub const Camera = struct {
|
|||||||
view_mat: Mat4 = Mat4.identity(),
|
view_mat: Mat4 = Mat4.identity(),
|
||||||
|
|
||||||
pub fn projection(self: *const Camera) Mat4 {
|
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user