15#include <glm/gtc/matrix_transform.hpp>
21 static glm::dvec3 origin{0.0};
28inline glm::vec3
rebased(
const glm::vec3& world) {
35 if (step == glm::dvec3(0.0))
return viewProjection;
36 return viewProjection * glm::translate(glm::mat4(1.0f), glm::vec3(step));
40inline glm::mat4
modelFromOrigin(
const glm::mat4& model,
const glm::dvec3& origin) {
42 if (step == glm::dvec3(0.0))
return model;
43 return glm::translate(glm::mat4(1.0f), glm::vec3(step)) * model;
glm::mat4 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 orig...
void setRenderOrigin(const glm::dvec3 &origin)
glm::mat4 modelFromOrigin(const glm::mat4 &model, const glm::dvec3 &origin)
A model placed from origin, as it is placed from the origin now.
glm::vec3 rebased(const glm::vec3 &world)
A world position as the frame draws it: from the origin.
glm::dvec3 & renderOrigin()
The origin, in world units. A double, as the world positions it is taken from are far from zero.