Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
RenderOrigin.hpp File Reference

The point the frame is drawn relative to: a world far from zero loses precision in single floats, so positions go to the GPU as offsets from a point near the camera. More...

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
Include dependency graph for RenderOrigin.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  esengine

Functions

glm::dvec3 & esengine::renderOrigin ()
 The origin, in world units. A double, as the world positions it is taken from are far from zero.
void esengine::setRenderOrigin (const glm::dvec3 &origin)
glm::vec3 esengine::rebased (const glm::vec3 &world)
 A world position as the frame draws it: from the origin.
glm::mat4 esengine::viewProjectionFromOrigin (const glm::mat4 &viewProjection, const glm::dvec3 &origin)
 A view-projection made for origin, for a point given from the origin now: the point from the old origin is the new one's plus the step between them.
glm::mat4 esengine::modelFromOrigin (const glm::mat4 &model, const glm::dvec3 &origin)
 A model placed from origin, as it is placed from the origin now.

Detailed Description

The point the frame is drawn relative to: a world far from zero loses precision in single floats, so positions go to the GPU as offsets from a point near the camera.

The view-projection a frame is begun with is built by the host for the same origin (the camera near zero), and every world position the renderer hands the GPU is taken from it first, so the product on the GPU is the same and the numbers in it are small. Zero is the default and changes nothing. One origin serves the whole frame, a shadow pass's draws included, so it is set between frames.

Definition in file RenderOrigin.hpp.