Katana Plug-in APIs 0.1
Public Member Functions | Static Public Member Functions

Foundry::Katana::ViewerAPI::ViewportCamera Class Reference

The ViewportCamera class to be extended by plugins. More...

#include <FnViewportCamera.h>

Inheritance diagram for Foundry::Katana::ViewerAPI::ViewportCamera:
Foundry::Katana::ViewerAPI::ViewportCameraPluginBase

List of all members.

Public Member Functions

virtual int getCameraTypeID ()=0
 Returns an integer indicating the type of the camera.
virtual void setViewportDimensions (unsigned int width, unsigned int height)=0
 Processes Viewport resizing.
virtual void setOption (OptionIdGenerator::value_type optionId, FnAttribute::Attribute attr)
 Sets a generic option.
virtual FnAttribute::Attribute getOption (OptionIdGenerator::value_type optionId)
 Gets the value of a generic option.
void setOption (const std::string &name, FnAttribute::Attribute attr)
 Sets a generic option by generating an option ID from the passed name.
FnAttribute::Attribute getOption (const std::string &name)
 Gets a generic option by generating an option ID from the passed name.
virtual void startInteraction ()=0
 Called when the user starts interacting with the camera.
virtual void endInteraction ()=0
 Called when the user finishes interacting with the camera.
virtual void translate (double x, double y, double z)=0
 Handles translation movement of the camera.
virtual void rotate (double x, double y, double z)=0
 Handles rotation movement of the camera.
virtual void setup (FnAttribute::GroupAttribute attr)=0
 Initializes the camera with values from an attribute.
virtual FnAttribute::GroupAttribute asAttribute ()=0
 Returns the camera settings as a GroupAttribute.
virtual bool getPointOnPlane (int x, int y, const Vec3d &planeOrigin, const Vec3d &planeNormal, Vec3d &intersection)=0
 Maps window coordinates to a 3D point on a plane.
virtual void getRay (int x, int y, Vec3d &pos, Vec3d &dir)=0
 Calculates the ray from the camera through the given window coordinates.
virtual Vec3d projectObjectIntoWindow (Vec3d point)=0
 Converts a 3D point in the scene into window co-ordinates.
virtual Vec3d projectWindowIntoObject (Vec3d point)=0
 Converts a window co-ordinates into a point in the scene.
virtual void * getPrivateData (void *inputData)
 Returns some arbitrary data.
virtual void setDirty (CameraDirtyBits dirtyBits)=0
 Specifies what has changed in the camera.

Static Public Member Functions

static void flush ()
 Flush plugin Caches.

Detailed Description

The ViewportCamera class to be extended by plugins.


Member Function Documentation

virtual FnAttribute::GroupAttribute Foundry::Katana::ViewerAPI::ViewportCamera::asAttribute ( ) [pure virtual]

Returns the camera settings as a GroupAttribute.

This function should return a GroupAttribute that fully represents the current camera settings in a format that can be passed into the setup() function (as a way of duplicating the camera) or into a scene graph location in order to populate a camera location.

Returns:
A GroupAttribute representing the camera state.
virtual void Foundry::Katana::ViewerAPI::ViewportCamera::endInteraction ( ) [pure virtual]

Called when the user finishes interacting with the camera.

This is called when finishes interacting with this camera while, for example, is viewing through it. This allows the camera to commit or tear down some values used during the user interaction. One example could be set the final camera transform values back into the node graph in a location-backed camera. The translate() and rotate() functions are expected to be called after startInteraction() and before endInteraction().

static void Foundry::Katana::ViewerAPI::ViewportCamera::flush ( ) [inline, static]

Flush plugin Caches.

Allows to discard any cache for this plugin when a Flush Caches event occurs.

virtual int Foundry::Katana::ViewerAPI::ViewportCamera::getCameraTypeID ( ) [pure virtual]

Returns an integer indicating the type of the camera.

Can be kPERSPECTIVE_CAMERA, kORTHOGRAPHIC_CAMERA, or another custom type.

Returns:
The camera type ID.
virtual FnAttribute::Attribute Foundry::Katana::ViewerAPI::ViewportCamera::getOption ( OptionIdGenerator::value_type  optionId) [virtual]

Gets the value of a generic option.

Optional. Returns the value of a generic option being requested from Python or from other C++ Viewer plugin classes.

Parameters:
optionIdThe ID of the option created from OptionIdGenerator or manually defined by users.
Returns:
Attribute with the value of the option.
FnAttribute::Attribute Foundry::Katana::ViewerAPI::ViewportCamera::getOption ( const std::string &  name)

Gets a generic option by generating an option ID from the passed name.

This generates an Option ID from the passed string and passes it to getOption(OptionIdGenerator::value_type optionId). Since the ID is generated on every call, it is more efficient to generate the ID once, and store it for future use.

Parameters:
nameThe name of the option whose value to retrieve.
Returns:
The value of the option with the given name.
virtual bool Foundry::Katana::ViewerAPI::ViewportCamera::getPointOnPlane ( int  x,
int  y,
const Vec3d planeOrigin,
const Vec3d planeNormal,
Vec3d intersection 
) [pure virtual]

Maps window coordinates to a 3D point on a plane.

Parameters:
xThe X co-ordinate of the window.
yThe Y co-ordinate of the window.
planeOriginThe coordinates of the plane origin.
planeNormalThe normal direction of the plane.
intersectionOutput argument where the intersection position (if any) is set.
Returns:
true if an intersection occured.
virtual void* Foundry::Katana::ViewerAPI::ViewportCamera::getPrivateData ( void *  inputData) [inline, virtual]

Returns some arbitrary data.

This can be used by other plugins to access some data that is specific to this object after it is compiled, allowing built-in parts of existing Viewers to be extendable by other plugins like ViewerDelegateComponents, Viewports and ViewportLayers.

This function should be called by other plugins after getting a ManipulatorWrapperPtr and converting it into a concrete instance via ManipulatorWrapper::getPluginInstance(). These other plugins will have to be built with the same compiler and using the same compiler flags as the ViewerDelegate so that this data can be cast and used without running into C++ name mangling issues.

Parameters:
inputDataA pointer to some input data that can be used to produce the returned data.
Returns:
The arbitrary private data. A void pointer that can be cast into specific object types by other plugins.
virtual void Foundry::Katana::ViewerAPI::ViewportCamera::getRay ( int  x,
int  y,
Vec3d pos,
Vec3d dir 
) [pure virtual]

Calculates the ray from the camera through the given window coordinates.

Parameters:
xThe X co-ordinate of the window.
yThe Y co-ordinate of the window.
posOutput argument where the line position is set.
dirOutput argument where the line direction is set.
virtual Vec3d Foundry::Katana::ViewerAPI::ViewportCamera::projectObjectIntoWindow ( Vec3d  point) [pure virtual]

Converts a 3D point in the scene into window co-ordinates.

Parameters:
pointThe point in world space to transform.
Returns:
A 3 dimensional vector representing the screen coordinates of the point in its X, Y members and the depth of the point in the Z member.
virtual Vec3d Foundry::Katana::ViewerAPI::ViewportCamera::projectWindowIntoObject ( Vec3d  point) [pure virtual]

Converts a window co-ordinates into a point in the scene.

Parameters:
pointThe point in window space to transform into world space. point.x and point.y indicate the X and Y position in pixels and point.z indicates the depth into the scene in world space.
Returns:
The position of the transformed point in world space.
virtual void Foundry::Katana::ViewerAPI::ViewportCamera::rotate ( double  x,
double  y,
double  z 
) [pure virtual]

Handles rotation movement of the camera.

This is expected to be called after startInteraction() and before endInteraction().

Parameters:
xThe X-axis rotation in camera's local space.
yThe Y-axis rotation in camera's local space.
zThe Z-axis rotation in camera's local space.
virtual void Foundry::Katana::ViewerAPI::ViewportCamera::setDirty ( CameraDirtyBits  dirtyBits) [pure virtual]

Specifies what has changed in the camera.

Something has changed and the camera needs to be updated. DirtyFlag is passed to specify what has been changed so the plugin can update accordingly.

Parameters:
dirtyBitsFlag to specify what has changed.
virtual void Foundry::Katana::ViewerAPI::ViewportCamera::setOption ( OptionIdGenerator::value_type  optionId,
FnAttribute::Attribute  attr 
) [inline, virtual]

Sets a generic option.

Reacts to a generic option being set by other C++ Viewer plugin classes. This can be used as a message passing mechanism from the outside into the ViewportCamera.

Parameters:
optionIdThe ID of the option created from OptionIdGenerator or manually defined by users.
attrAttribute with the value being set.
void Foundry::Katana::ViewerAPI::ViewportCamera::setOption ( const std::string &  name,
FnAttribute::Attribute  attr 
)

Sets a generic option by generating an option ID from the passed name.

This generates an Option ID from the passed string and passes it to setOption(OptionIdGenerator::value_type optionId, FnAttribute::Attribute attr). Since the ID is generated on every call, it is more efficient to generate the ID once, and store it for future use.

Parameters:
nameThe name of the option whose value to set.
attrAttribute with the value to set for the option.
virtual void Foundry::Katana::ViewerAPI::ViewportCamera::setup ( FnAttribute::GroupAttribute  attr) [pure virtual]

Initializes the camera with values from an attribute.

If the camera is based on a scene graph camera, the passed attribute will be the relevant attributes from the scene graph location.

Parameters:
attrAttribute with the initial camera state values.
virtual void Foundry::Katana::ViewerAPI::ViewportCamera::setViewportDimensions ( unsigned int  width,
unsigned int  height 
) [pure virtual]

Processes Viewport resizing.

Used to specify the dimensions of a Viewport which can affect picking calculations.

Parameters:
widthThe viewport width in pixels.
heightThe viewport height in pixels.
virtual void Foundry::Katana::ViewerAPI::ViewportCamera::startInteraction ( ) [pure virtual]

Called when the user starts interacting with the camera.

This is called when starts interacting with this camera while, for example, is viewing through it. This allows the camera to initialize some initial values used during the user interaction. The translate() and rotate() functions are expected to be called after startInteraction() and before endInteraction().

virtual void Foundry::Katana::ViewerAPI::ViewportCamera::translate ( double  x,
double  y,
double  z 
) [pure virtual]

Handles translation movement of the camera.

This is expected to be called after startInteraction() and before endInteraction().

Parameters:
xThe X-axis translation in camera's local space.
yThe Y-axis translation in camera's local space.
zThe Z-axis translation in camera's local space.

The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator