载入中...
搜索中...
未找到
ClipSpace.h
浏览该文件的文档.
1#pragma once
2
3#include <glm/gtc/matrix_transform.hpp>
4
5#include <algorithm>
6
7namespace eve {
8namespace graphics {
9
22inline glm::mat4 perspectiveVulkanRH_ZO(float fovyRad, float aspect, float zNear, float zFar) {
23 glm::mat4 p = glm::perspectiveRH_ZO(fovyRad, aspect, zNear, zFar);
24 p[1][1] *= -1.f;
25 return p;
26}
27
30inline glm::mat4 orthoVulkanRH_ZO(float left, float right, float bottom, float top, float zNear,
31 float zFar) {
32 glm::mat4 p = glm::orthoRH_ZO(left, right, bottom, top, zNear, zFar);
33 p[1][1] *= -1.f;
34 return p;
35}
36
38inline glm::mat4 cameraProjectionVulkanRH_ZO(bool orthographic, float fovyRad,
39 float orthoHeight, float aspect,
40 float zNear, float zFar) {
41 if (!orthographic) return perspectiveVulkanRH_ZO(fovyRad, aspect, zNear, zFar);
42 const float halfH = std::max(0.001f, orthoHeight * 0.5f);
43 const float halfW = halfH * std::max(0.001f, aspect);
45 return orthoVulkanRH_ZO(-halfW, halfW, -halfH, halfH, zNear, zFar);
46}
47
48} // namespace graphics
49} // namespace eve
SQInteger top
float halfW
float halfH
glm::vec4 p[6]
HexVec3 left
HexVec3 right
float bottom
glm::mat4 cameraProjectionVulkanRH_ZO(bool orthographic, float fovyRad, float orthoHeight, float aspect, float zNear, float zFar)
Camera projection shared by rendering, picking, and diagnostic passes.
Definition ClipSpace.h:38
glm::mat4 perspectiveVulkanRH_ZO(float fovyRad, float aspect, float zNear, float zFar)
Right-handed, zero-to-one depth perspective for Vulkan swapchains.
Definition ClipSpace.h:22
glm::mat4 orthoVulkanRH_ZO(float left, float right, float bottom, float top, float zNear, float zFar)
Ortho vulkan rh zo.
Definition ClipSpace.h:30
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16