Skip to content
Snippets Groups Projects
Commit b669966e authored by Lava Block's avatar Lava Block
Browse files

add perspective_matrix

parent 08801a6e
Branches
No related tags found
No related merge requests found
......@@ -83,4 +83,10 @@ namespace lava {
constexpr v3 const default_color = v3{ 0.8118f, 0.0627f, 0.1255f }; // #CF1020 : 207, 16, 32
inline mat4 perspective_matrix(uv2 size, float fov = 90.f, float far_plane = 5.f) {
// Vulkan NDC is right-handed with Y pointing down
// we flip Y which makes it left-handed
return glm::scale(glm::identity<glm::mat4>(), { 1.f, -1.f, 1.f }) * glm::perspectiveLH_ZO(glm::radians(fov), float(size.x) / size.y, 0.1f, far_plane);
}
} // namespace lava
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment