cee::vis::CameraAnimation
-
class CameraAnimation
Support class for supplying camera positions that can be used to animate the camera from one setup to another.
Example: Animate the change from the current camera setup to looking down the Y axis:
cee::BoundingBox bb = m_viewerWidget->view()->boundingBox(); cee::Vec3d dir(0, 1, 0); cee::Vec3d up(0, 0, 1); cee::Vec3d eye = m_viewerWidget->view()->camera().computeFitViewEyePosition(bb, dir, up); cee::vis::CameraAnimation anim(&m_viewerWidget->view()->camera(), eye, dir, up); anim.setTargetOrthoHeight(bb.radius() * 2.0); anim.setTargetFieldOfViewYDegrees(40.0); while (anim.updateCamera()) { // An immediate redraw of the view is required m_viewerWidget->view()->requestImmediateRedraw(); }
For C#, example will look like:
while (anim.updateCamera()) { m_view.requestRedraw(); Application.DoEvents(); }
Public Functions
-
CameraAnimation(Camera *camera, const Vec3d &newPos, const Vec3d &newDir, const Vec3d &newUp)
Creates a camera animation object.
Send in the camera to modify and the destination camera setup.
-
void setDuration(double seconds)
Sets the duration (in seconds) of the animation.
-
void setTargetFieldOfViewYDegrees(double targetFOV)
Sets the target field of view (for perspective projections) if you want to animate the change in field of view as well as the camera position.
Useful for zoom navigation mode.
-
void setTargetOrthoHeight(double height)
Sets the target field frustum height (for orthographic projections) if you want to animate the change in frustum size as well as the camera position.
Useful for zoom navigation mode.
-
bool updateCamera()
Updates the camera based on the current time of the animation.
This should be called repeatedly together with a redraw of the screen until the method returns false (animation finished).
-
CameraAnimation(Camera *camera, const Vec3d &newPos, const Vec3d &newDir, const Vec3d &newUp)