MCPcopy Create free account
hub / github.com/city-super/Octree-GS / fromCamera

Method fromCamera

SIBR_viewers/src/core/view/InteractiveCameraHandler.cpp:150–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 }
149
150 void InteractiveCameraHandler::fromCamera(const sibr::InputCamera & cam, bool interpolate, bool updateResolution) {
151 _isSetup = true;
152
153 sibr::InputCamera idealCam(cam);
154 if (updateResolution) {
155 // Viewport might have not been set, in this case defer the full camera update
156 // until after the viewport has been updated, ie in onUpdate().
157 if (_viewport.isEmpty()) {
158 _triggerCameraUpdate = true;
159 }
160 else {
161 const float w = _viewport.finalWidth();
162 const float h = _viewport.finalHeight();
163 idealCam.size(uint(w), uint(h));
164 idealCam.aspect(w / h);
165 }
166 }
167
168 _orbit.fromCamera(idealCam, _raycaster);
169 _fpsCamera.fromCamera(idealCam);
170
171
172 if (_raycaster != nullptr) {
173 sibr::RayHit hit = _raycaster->intersect(sibr::Ray(idealCam.position(), idealCam.dir()));
174 // If hit at the proxy surface, save the distance between the camera and the mesh, to use as a trackball radius.
175 if (hit.hitSomething()) {
176 _radius = hit.dist();
177 }
178 }
179 _trackball.fromCamera(idealCam, _viewport, _radius);
180
181 _currentCamera = idealCam;
182 _cameraFovDeg = _currentCamera.fovy() * 180.0f / float(M_PI);
183
184 if (!interpolate) {
185 _previousCamera = _currentCamera;
186 }
187
188 _clippingPlanes[0] = _currentCamera.znear();
189 _clippingPlanes[1] = _currentCamera.zfar();
190 }
191
192 void InteractiveCameraHandler::fromTransform(const Transform3f & transform, bool interpolate, bool updateResolution)
193 {

Callers

nothing calls this directly

Calls 13

isEmptyMethod · 0.80
finalWidthMethod · 0.80
finalHeightMethod · 0.80
aspectMethod · 0.80
intersectMethod · 0.80
distMethod · 0.80
fovyMethod · 0.80
znearMethod · 0.80
zfarMethod · 0.80
sizeMethod · 0.45
positionMethod · 0.45
dirMethod · 0.45

Tested by

no test coverage detected