39 glm::vec4
camera{0.0f, 0.0f, 1.0f, 0.0f};
60 const glm::vec4 axis = glm::inverse(viewProjection)[2];
61 if (std::abs(axis.w) > 1e-6f)
return glm::vec4(glm::vec3(axis) / axis.w, 1.0f);
62 const f32 len = glm::length(glm::vec3(axis));
63 if (len < 1e-12f)
return glm::vec4(0.0f, 0.0f, 1.0f, 0.0f);
64 return glm::vec4(-glm::vec3(axis) / len, 0.0f);
78 for (
int col = 0; col < 4; ++col) out[col][2] = (p[col][2] + p[col][3]) * 0.5f;
Backend-agnostic graphics enumerations.
Core type definitions and utilities for ESEngine.
constexpr u32 FRAME_CONSTANTS_BINDING
Indexed uniform binding point the FrameConstants block is bound to.
constexpr const char * FRAME_CONSTANTS_BLOCK
GLSL block name; must match the shader declarations and Shader::compile lookup.
ClipDepthRange
What a device's clip volume does with depth.
@ MinusOneToOne
OpenGL / OpenGL ES / WebGL.
constexpr u32 TIME_CONSTANTS_BINDING
glm::mat4 toClipDepthRange(const glm::mat4 &p, ClipDepthRange range)
The projection p as a device keeping range wants it.
std::uint32_t u32
Unsigned 32-bit integer.
constexpr const char * TIME_CONSTANTS_BLOCK
glm::vec4 cameraFromViewProjection(const glm::mat4 &viewProjection)
Where the frame is seen from, read out of the matrix that projects it.
float f32
32-bit floating point
CPU mirror of the GLSL FrameConstants block (std140).
glm::vec4 renderOrigin
The render origin (RenderOrigin.hpp): a world position is the one the shader holds plus this,...
glm::mat4 inverseViewProjection
CPU mirror of the injected TimeConstants block (std140).