Cortex  10.0.0-a4
Public Types | Public Member Functions | List of all members
IECore::CameraController Class Reference

#include <CameraController.h>

Inherits noncopyable.

Public Types

enum  ScreenWindowAdjustment { CropScreenWindow, ScaleScreenWindow }
 

Public Member Functions

 CameraController (CameraPtr camera)
 
void setCamera (CameraPtr camera)
 
CameraPtr getCamera ()
 
ConstCameraPtr getCamera () const
 
void setCentreOfInterest (float centreOfInterest)
 Positive.
 
float getCentreOfInterest ()
 
void setResolution (const Imath::V2i &resolution)
 
void setResolution (const Imath::V2i &resolution, ScreenWindowAdjustment adjustment)
 
const Imath::V2i & getResolution () const
 
void frame (const Imath::Box3f &box)
 
void frame (const Imath::Box3f &box, const Imath::V3f &viewDirection, const Imath::V3f &upVector=Imath::V3f(0, 1, 0))
 
void unproject (const Imath::V2f rasterPosition, Imath::V3f &near, Imath::V3f &far)
 
Imath::V2f project (const Imath::V3f &worldPosition) const
 Projects the point in world space into a raster space position.
 

Motion

These functions facilitate the implementation of maya style camera movement controls within a UI. All coordinates passed are mouse coordinates in raster space (0,0 at top left).

enum  MotionType { None, Track, Tumble, Dolly }
 
void motionStart (MotionType motion, const Imath::V2f &startPosition)
 Starts a motion of the specified type.
 
void motionUpdate (const Imath::V2f &newPosition)
 
void motionEnd (const Imath::V2f &endPosition)
 End the current motion, ready to call motionStart() again if required.
 

Detailed Description

The CameraController class provides methods to aid in the use of the Camera class within the context of a GUI.

Member Enumeration Documentation

Enumerator
CropScreenWindow 

Crop/extend the screen window to accommodate the new resolution without scaling the content.

ScaleScreenWindow 

Preserve the horizontal framing and change the vertical framing to maintain aspect ratio.

Member Function Documentation

void IECore::CameraController::frame ( const Imath::Box3f &  box)

Moves the camera to frame the specified box, keeping the current viewing direction unchanged.

void IECore::CameraController::frame ( const Imath::Box3f &  box,
const Imath::V3f &  viewDirection,
const Imath::V3f &  upVector = Imath::V3f(0, 1, 0) 
)

Moves the camera to frame the specified box, viewing it from the specified direction, and with the specified up vector.

void IECore::CameraController::motionUpdate ( const Imath::V2f &  newPosition)

Updates the camera position based on a changed mouse position. Can only be called after motionStart() and before motionEnd().

void IECore::CameraController::setResolution ( const Imath::V2i &  resolution)
Todo:
Remove this form, and add a default value for adjustment in the form below.
void IECore::CameraController::setResolution ( const Imath::V2i &  resolution,
ScreenWindowAdjustment  adjustment 
)

Changes the camera resolution, modifying the screen window in a manner determined by the adjustment argument.

void IECore::CameraController::unproject ( const Imath::V2f  rasterPosition,
Imath::V3f &  near,
Imath::V3f &  far 
)

Computes the points on the near and far clipping planes that correspond with the specified raster position. Points are computed in world space.

Todo:
Accept a V2f to provide extra precision and make this method const.

The documentation for this class was generated from the following file: