MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / viewMatrixRelativeTo

Method viewMatrixRelativeTo

pj_scene3D/core/src/camera/camera.cpp:96–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96glm::mat4 OrbitCamera::viewMatrixRelativeTo(const glm::dvec3& render_origin) const {
97 // Subtract the origin from the focal in DOUBLE, then add the (small) orbit offset
98 // radius·dir — so eye_rel/focal_rel stay near the radius scale even when the focal
99 // is at 1e6. With render_origin == focal, focal_rel is exactly 0.
100 const glm::vec3 focal_rel = toRenderSpace(state_.focal, render_origin);
101 const glm::vec3 eye_rel = focal_rel + state_.radius * sphericalDir(state_.azimuth, state_.elevation);
102 return glm::lookAt(eye_rel, focal_rel, glm::vec3{0.0f, 0.0f, 1.0f});
103}
104
105glm::mat4 OrbitCamera::projMatrix(float aspect) const {
106 // Decoupled adaptive near/far: near tracks the working distance (so close

Callers 2

TESTFunction · 0.80
paintGLMethod · 0.80

Calls 3

toRenderSpaceFunction · 0.85
sphericalDirFunction · 0.85
mapUpFunction · 0.85

Tested by 1

TESTFunction · 0.64