Skip to content

Commit 591f8d1

Browse files
committed
add getters for fov
1 parent 4b202c1 commit 591f8d1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/polyscope/view.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@ glm::vec3 getCameraWorldPosition();
9090
void getCameraFrame(glm::vec3& lookDir, glm::vec3& upDir, glm::vec3& rightDir);
9191
glm::vec3 getUpVec();
9292
glm::vec3 getFrontVec();
93+
float getVerticalFieldOfViewDegrees();
9394

9495
// Set the camera extrinsics to look at a particular location
9596
void setViewToCamera(const CameraParameters& p);
9697
void lookAt(glm::vec3 cameraLocation, glm::vec3 target, bool flyTo = false);
9798
void lookAt(glm::vec3 cameraLocation, glm::vec3 target, glm::vec3 upDir, bool flyTo = false);
99+
void setVerticalFieldOfViewDegrees(float newVal);
98100

99101
// The "home" view looks at the center of the scene's bounding box.
100102
glm::mat4 computeHomeView();

src/view.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,13 @@ void setCameraViewMatrix(glm::mat4 mat) { viewMat = mat; }
626626

627627
glm::mat4 getCameraViewMatrix() { return viewMat; }
628628

629+
void setVerticalFieldOfViewDegrees(float newVal) {
630+
view::fov = newVal;
631+
requestRedraw();
632+
}
633+
634+
float getVerticalFieldOfViewDegrees() { return view::fov; }
635+
629636
glm::mat4 getCameraPerspectiveMatrix() {
630637
double farClip = farClipRatio * state::lengthScale;
631638
double nearClip = nearClipRatio * state::lengthScale;

0 commit comments

Comments
 (0)