# class RED::IViewpoint

This is the REDsdk camera. More...

`#include <REDIViewpoint.h>`

Inherits: IREDObject.

## Public functions:

virtual RED_RC | AddRenderShaderParameter ( int iIndex, const RED::RenderShaderParameter & iParam, const RED::State & iState ) = 0 |

virtual RED_RC | AddShape ( RED::Object * iShape, const RED::State & iState ) = 0 |

virtual RED_RC | ApplyLayerSet ( const RED::LayerSet & iLayerSet, const RED::State & iState ) = 0 |

virtual RED_RC | GetAsymmetricFrustumParallel ( float & oXLeft, float & oXRight, float & oYBottom, float & oYTop, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetAsymmetricFrustumParallel ( double & oXLeft, double & oXRight, double & oYBottom, double & oYTop, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetAsymmetricFrustumPerspective ( float & oFovLeft, float & oFovRight, float & oFovBottom, float & oFovTop, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetAsymmetricFrustumPerspective ( double & oFovLeft, double & oFovRight, double & oFovBottom, double & oFovTop, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetClipPlanes ( double oA[6], double oB[6], double oC[6], double oD[6], int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetEye ( RED::Vector3 & oEye, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFloatingEye ( RED::Vector3 & oEye, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFloatingInvertViewingMatrix ( RED::Matrix & oMatrix, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFloatingOrigin ( RED::Matrix & oMatx, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFloatingRight ( RED::Vector3 & oRight, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFloatingSight ( RED::Vector3 & oSight, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFloatingTop ( RED::Vector3 & oTop, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFloatingViewingMatrix ( RED::Matrix & oMatrix, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFloatingViewProjectionMatrix ( RED::Matrix & oMatrix, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFocusDistance ( double & oFocus, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFocusDistance ( float & oFocus, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFrustum ( double & oLeft, double & oRight, double & oBottom, double & oTop, double & oNear, double & oFar, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFrustum ( float & oLeft, float & oRight, float & oBottom, float & oTop, float & oNear, float & oFar, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFrustumCustom ( RED::Matrix & oMatrix, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFrustumParallel ( float & oXSiz, float & oYSiz, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFrustumParallel ( double & oXSiz, double & oYSiz, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFrustumPerspective ( double & oFov, double & oRatio, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetFrustumPerspective ( float & oFov, float & oRatio, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetInstanceCounterCallback ( RED::INSTANCE_COUNTER_CALLBACK & oCallback, void *& oUserData, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetInstanceCounterImageCallback ( RED::INSTANCE_COUNTER_IMAGE_CALLBACK & oCallback, void *& oUserData, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetInvertViewingMatrix ( RED::Matrix & oMatrix, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetLayerSet ( RED::LayerSet & oLayerSet, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetLinkedWindows ( RED::Vector< RED::Object * > & oWindowList, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetNearFar ( double & oDNear, double & oDFar, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetNearFar ( float & oDNear, float & oDFar, int iStateNumber = -1 ) const = 0 |

virtual RED::PostProcess & | GetPostProcessSettings ( ) = 0 |

virtual RED_RC | GetProjection ( RED::VIEWPOINT_TYPE & oProj, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetProjectionMatrix ( RED::Matrix & oMatrix, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetRenderShaderParameter ( RED::RenderShaderParameter & oParam, int iIndex, int iStateNumber = -1 ) const = 0 |

virtual const RED::Map< int, RED::RenderShaderParameter > & | GetRenderShaderParameters ( int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetRight ( RED::Vector3 & oRight, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetRootShape ( RED::Object *& oRoot, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetSight ( RED::Vector3 & oSight, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetTop ( RED::Vector3 & oTop, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetViewingAxis ( RED::Vector3 & oSight, RED::Vector3 & oTop, RED::Vector3 & oRight, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetViewingMatrix ( RED::Matrix & oMatrix, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | GetViewProjectionMatrix ( RED::Matrix & oMatrix, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | IsAsymmetric ( bool & oAsym, int iStateNumber = -1 ) const = 0 |

virtual RED_RC | RemoveRenderShaderParameter ( int iIndex, const RED::State & iState ) = 0 |

virtual RED_RC | RemoveShape ( RED::Object * iShape, const RED::State & iState ) = 0 |

virtual RED_RC | RotateAroundEye ( double iPitchOffset, double iYawOffset, double iRollOffset, const RED::State & iState ) = 0 |

virtual RED_RC | RotateAroundFocus ( double iPitchOffset, double iYawOffset, double iRollOffset, const RED::State & iState ) = 0 |

virtual RED_RC | SetAsymmetricFrustumParallel ( double iXLeft, double iXRight, double iYBottom, double iYTop, const RED::State & iState ) = 0 |

virtual RED_RC | SetAsymmetricFrustumPerspective ( double iFovLeft, double iFovRight, double iFovBottom, double iFovTop, const RED::State & iState ) = 0 |

virtual RED_RC | SetCustomClipPlanes ( double iA[6], double iB[6], double iC[6], double iD[6], const RED::State & iState ) = 0 |

virtual RED_RC | SetEye ( const RED::Vector3 & iEye, const RED::State & iState ) = 0 |

virtual RED_RC | SetFloatingOrigin ( const RED::Matrix & iMatx, const RED::State & iState ) = 0 |

virtual RED_RC | SetFocusDistance ( double iDistance, const RED::State & iState ) = 0 |

virtual RED_RC | SetForScreenDraw ( double iWidth, double iHeight, double iZMin, double iZMax, const RED::State & iState ) = 0 |

virtual RED_RC | SetFrustumCustom ( const RED::Matrix & iMatrix, const RED::State & iState ) = 0 |

virtual RED_RC | SetFrustumParallel ( double iXSiz, double iYSiz, const RED::State & iState ) = 0 |

virtual RED_RC | SetFrustumPerspective ( double iFov, double iRatio, const RED::State & iState ) = 0 |

virtual RED_RC | SetInstanceCounterCallback ( RED::INSTANCE_COUNTER_CALLBACK iCallback, void * iUserData, const RED::State & iState ) = 0 |

virtual RED_RC | SetInstanceCounterImageCallback ( RED::INSTANCE_COUNTER_IMAGE_CALLBACK iCallback, void * iUserData, const RED::State & iState ) = 0 |

virtual RED_RC | SetNearFar ( double iDnear, double iDFar, const RED::State & iState ) = 0 |

virtual RED_RC | SetProjection ( RED::VIEWPOINT_TYPE iProjection, const RED::State & iState ) = 0 |

virtual RED_RC | SetRight ( const RED::Vector3 & iRight, const RED::State & iState ) = 0 |

virtual RED_RC | SetSight ( const RED::Vector3 & iSight, const RED::State & iState ) = 0 |

virtual RED_RC | SetTop ( const RED::Vector3 & iTop, const RED::State & iState ) = 0 |

virtual RED_RC | SetViewingAxis ( const RED::Vector3 & iSight, const RED::Vector3 & iTop, const RED::Vector3 & iRight, const RED::State & iState ) = 0 |

virtual RED_RC | SetViewingMatrix ( const RED::Matrix & iMatrix, const RED::State & iState ) = 0 |

virtual RED_RC | TranslateEye ( const RED::Vector3 & iOffset, const RED::State & iState ) = 0 |

virtual RED_RC | TranslateWithFocus ( const RED::Vector3 & iNewFocus, const RED::State & iState ) = 0 |

virtual RED_RC | ZoomOnFocus ( double iZoomingFactor, const RED::State & iState ) = 0 |

## Public static functions:

static RED::CID | GetClassID ( ) |

## Detailed description:

This is the REDsdk camera.

The CID_REDViewpoint object defines a visualization frustum in the world coordinate system of the scene graph it contains. A viewpoint need to be inserted in a window (RED::IWindow), or added to a viewpoint render list (RED::IViewpointRenderList) in a window to be part of the rendering. See the RED::IWindow::InsertViewpoint and RED::IViewpointRenderList::InsertViewpoint methods for that.

The viewpoint is a state managed object. Therefore, accessing viewpoints parameters is either performed in read-only using a transaction number or in read-write using a RED::State class retrieved from the cluster's resource manager (RED::IResourceManager interface).

The viewpoint offers methods to entirely define the viewing frustum for orthographic, perspective both symmetric or asymmetric, as well as a set of pre-defined navigation methods, making its use easier. It's also possible to define custom projection models, by directly supplying the frustum matrix to the object.

Transformations are set so that the eye position lies at the center of the screen, up being headed toward the top of the window, and right to the right of the screen. This means that the top left corner of the raster display is at coordinates x negatives and y positives for the viewpoint axis, as shown by the illustration below:

Viewpoints must define a near distance and a far distance. These two parameters are used to define which data will be inside the truncated viewing pyramid or parallelogram defined by the perpective and orthographic projection models. The entire Z-Buffer range of values is mapped to match that near / far range.

A viewpoint is built by default centered at ( 100.0f, 100.0f, 100.0f) looking at the origin, headed up with a perspective projection of hemi-fov set to RED_PI / 4.0f.

Viewpoints that are destroyed delete all scene graph objects they visualize and that are not visualized by any other viewpoint. A viewpoint is destroyed by a call to RED::Factory::DeleteInstance.

## Functions documentation

public static RED::CID RED::IViewpoint::GetClassID | ( | ) |

public virtual RED_RC RED::IViewpoint::AddRenderShaderParameter | ( | int | iIndex, |

const RED::RenderShaderParameter & | iParam, | ||

const RED::State & | iState | ||

) | = 0 |

Defines a RED::RenderShaderParameter for the camera.

This method can be used to register a list of RED::RenderShaderParameter objects into the viewpoint. A RED::RenderShaderParameter is used by RED::RenderShader objects used themselves by materials (RED::IMaterial).

That list of shader parameters - specified at the viewpoint level - defines kind of global parameters that are common to all materials visualized in the context of the scene graph. Then, a shader parameter used in a render shader used in a material of the scene graph can be set to point to a replacement parameter defined in this list, as illustrated by the picture below:

Each camera in the scene has a parameter storing a color: yellow for the first camera, blue for the second camera. During the rendering of each camera scene graph, the geometry shading will look for the referenced parameter in the list of parameters available from the camera. This can for example replace the shading color of the geometry.

So we see that we can globalize parameters across materials at the level of the camera thanks to this method. Each camera can then redefine the values used for each referenced parameter according to its own needs.

Adding a parameter at an index entry that is already in use will replace the parameter value for that index using the new iParam.

The parameter in the shader declared as a RED::RenderShaderParameter::REF_CAMERA_PARAMETER whose value is set to an index value that'll be used to look for the corresponding camera parameter bearing the same 'iIndex' value.

Then, the corresponding parameter 'iParam' dynamically replaces the reference parameter stored in the shader during any rendering phase. The type and value of the reference are replaced by the values of 'iParam'. However, the binding position, name and target of the original reference parameter remain those used for the rendering phase.

Parameters:

iIndex: | The index of the parameter in the camera list. This number will be used to uniquely identify that parameter from the RED::RenderShaderParameter::REF_CAMERA_PARAMETER reference. The 'iIndex' value -1 is reserved. |

iParam: | The parameter to register in the camera. |

iState: | Current transaction parameter. |

Returns:

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::AddShape | ( | RED::Object * | iShape, |

const RED::State & | iState | ||

) | = 0 |

Adds a shape to the viewpoint's scene graph.

This method adds a shape to the scene graph handled by this viewpoint. The operation is identical to a RED::ITransformShape::AddChild operation performed from the root of the scene graph.

Parameters:

iShape: | The shape to add to the scene graph. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_WORKFLOW_ERROR if the added shape is a scene graph root,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::ApplyLayerSet | ( | const RED::LayerSet & | iLayerSet, |

const RED::State & | iState | ||

) | = 0 |

Defines the whole visibility layer set.

Defines the overall RED::LayerSet that'll filter elements that will be removed from the visible elements, for all rendering passes.

Parameters:

iLayerSet: | Layer set for the visible elements filtering. |

iState: | Current transaction parameter. |

Returns:

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_BAD_PARAM if the method received an invalid parameter,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::GetAsymmetricFrustumParallel | ( | float & | oXLeft, |

float & | oXRight, | ||

float & | oYBottom, | ||

float & | oYTop, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves asymmetric orthographic viewpoint parameters, simple precision.

This method works as RED::IViewpoint::GetAsymmetricFrustumParallel, except that it returns all floating point values in simple precision.

Parameters:

oXLeft: | X viewpoint size along the -right direction. |

oXRight: | X viewpoint size along the +right direction. |

oYBottom: | Y viewpoint size along the -top direction. |

oYTop: | Y viewpoint size along the +top direction. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetAsymmetricFrustumParallel | ( | double & | oXLeft, |

double & | oXRight, | ||

double & | oYBottom, | ||

double & | oYTop, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves asymmetric orthographic viewpoint parameters, double precision.

This method retrieves asymmetric parameters, for an orthographic viewpoint. If the viewpoint is symmetric, the returned values may be undefined.

oXLeft is positive along the opposite right direction of the viewpoint. oXRight is positive along the right direction of the viewpoint. The same applies for 'oYBottom' and 'oYTop' vs the top viewpoint direction.

See Orthographic camera for details on the orthographic camera models and orientation of values.

Parameters:

oXLeft: | X viewpoint size along the -right direction. |

oXRight: | X viewpoint size along the +right direction. |

oYBottom: | Y viewpoint size along the -top direction. |

oYTop: | Y viewpoint size along the +top direction. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetAsymmetricFrustumPerspective | ( | float & | oFovLeft, |

float & | oFovRight, | ||

float & | oFovBottom, | ||

float & | oFovTop, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves asymmetric frustum parameters, simple precision.

This method works as RED::IViewpoint::GetAsymmetricFrustumPerspective, except that it returns all floating point values in simple precision.

Parameters:

oFovLeft: | Left side of the viewing pyramid fov. |

oFovRight: | Right side of the viewing pyramid fov. |

oFovBottom: | Bottom side of the viewing pyramid fov. |

oFovTop: | Top side of the viewing pyramid fov. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetAsymmetricFrustumPerspective | ( | double & | oFovLeft, |

double & | oFovRight, | ||

double & | oFovBottom, | ||

double & | oFovTop, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves asymmetric frustum parameters, double precision.

This method retrieves asymmetric viewpoint parameters for a perspective viewpoint. If the viewpoint is symmetric, returned values may be undefined.

oFovLeft angle is positively oriented from the screen center to the screen left side. oFovRight is positively oriented from the screen center to the screen right side. Same applies for bottom and top fields of view.

See Perspective camera for details on the perspective camera models and orientation of values.

Parameters:

oFovLeft: | Left side of the viewing pyramid fov. |

oFovRight: | Right side of the viewing pyramid fov. |

oFovBottom: | Bottom side of the viewing pyramid fov. |

oFovTop: | Top side of the viewing pyramid fov. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetClipPlanes | ( | double | oA[6], |

double | oB[6], | ||

double | oC[6], | ||

double | oD[6], | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieve the camera clip planes equations.

Returns the equation of the 6 clipping planes that define the truncated viewing pyramid. Clip planes equations are A * x + B * y + C * z + D = 0; expressed in WCS. Clip planes order is: 0: Far; 1: Bottom; 2: Top; 3: Right; 4: Left; 5: Near.

Returned values are valid only for RED::VPT_PERSPECTIVE and RED::VPT_PARALLEL cameras. Custom cameras (RED::VPT_CUSTOM) cameras don't have valid clip planes unless RED::IViewpoint::SetCustomClipPlanes has been called.

Parameters:

oA: | Clip planes equations 'A' terms. |

oB: | Clip planes equations 'B' terms. |

oC: | Clip planes equations 'C' terms. |

oD: | Clip planes equations 'D' terms. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetEye | ( | RED::Vector3 & | oEye, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewpoint eye position.

Parameters:

oEye: | Viewpoint eye position. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFloatingEye | ( | RED::Vector3 & | oEye, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewpoint eye position with floating origin applied.

Parameters:

oEye: | Viewpoint eye position, floating origin applied. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFloatingInvertViewingMatrix | ( | RED::Matrix & | oMatrix, |

int | iStateNumber = -1 | ||

) | const = 0 |

Get the invert viewing matrix with floating origin applied.

Parameters:

oMatrix: | The inverse of ( floating_origin x view ). |

iStateNumber: | The transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFloatingOrigin | ( | RED::Matrix & | oMatx, |

int | iStateNumber = -1 | ||

) | const = 0 |

Return the current auxiliary floating origin for that camera.

See RED::IViewpoint::SetFloatingOrigin for all details on this method.

Parameters:

oMatx: | The current floating origin value. |

iStateNumber: | Accessed transaction number. |

Returns:

RED_BAD_PARAM if the method has received an invalid parameter,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::GetFloatingRight | ( | RED::Vector3 & | oRight, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewpoint right vector with floating origin applied.

Parameters:

oRight: | Viewpoint right vector, floating origin applied. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFloatingSight | ( | RED::Vector3 & | oSight, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewpoint sight vector with floating origin applied.

Parameters:

oSight: | Viewpoint sight vector, floating origin applied. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFloatingTop | ( | RED::Vector3 & | oTop, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewpoint top vector with floating origin applied.

Parameters:

oTop: | Viewpoint top vector, floating origin applied. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFloatingViewingMatrix | ( | RED::Matrix & | oMatrix, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewing matrix of the viewpoint with floating origin applied.

For all details on the REDsdk transformation pipeline, please refer to Matrix transforms in a cluster.

Parameters:

oMatrix: | ( floating_origin ) x ( view ) matrix of the viewpoint. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFloatingViewProjectionMatrix | ( | RED::Matrix & | oMatrix, |

int | iStateNumber = -1 | ||

) | const = 0 |

Get the projection x invert viewing matrix with floating origin applied.

Parameters:

oMatrix: | The ( floating_origin ) x ( projection ) x ( view_invert ). |

iStateNumber: | The transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFocusDistance | ( | double & | oFocus, |

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves the focus distance information, double precision.

This method access the focus distance information. This is the distance between the eye and the focus point (center of CAD style built-in rotations), that is at the focus distance along the sight vector.

Parameters:

oFocus: | The focus distance value. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFocusDistance | ( | float & | oFocus, |

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves the focus distance information, simple precision;.

This method works as RED::IViewpoint::GetFocusDistance, except that it returns all floating point values in simple precision.

Parameters:

oFocus: | The focus distance value. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFrustum | ( | double & | oLeft, |

double & | oRight, | ||

double & | oBottom, | ||

double & | oTop, | ||

double & | oNear, | ||

double & | oFar, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves frustum parameters, double precision.

This method retrieve all the frustum parameters that can be used to define it for a graphical API like OpenGL or Direct3D. The returned parameters are a left, right, bottom, top, near and far values, that correspond to the total truncated pyramid that defines the viewpoint.

This method works for all kinds of viewpoints except those that have defined a custom projection matrix: this includes parallel and perspective viewpoints, both symmetric and asymmetric.

The returned values are undefined for custom projection viewpoints.

Parameters:

oLeft: | Frustum definition value. |

oRight: | Frustum definition value. |

oBottom: | Frustum definition value. |

oTop: | Frustum definition value. |

oNear: | Frustum definition value. |

oFar: | Frustum definition value. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFrustum | ( | float & | oLeft, |

float & | oRight, | ||

float & | oBottom, | ||

float & | oTop, | ||

float & | oNear, | ||

float & | oFar, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves frustum parameters, simple precision.

This method works as RED::IViewpoint::GetFrustum, except that it returns all floating point values in simple precision.

Parameters:

oLeft: | Frustum definition value. |

oRight: | Frustum definition value. |

oBottom: | Frustum definition value. |

oTop: | Frustum definition value. |

oNear: | Frustum definition value. |

oFar: | Frustum definition value. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFrustumCustom | ( | RED::Matrix & | oMatrix, |

int | iStateNumber = -1 | ||

) | const = 0 |

Returns the custom projection matrix for this viewpoint.

This method returns the projection matrix that has been set through a call to RED::IViewpoint::SetFrustumCustom.

Parameters:

oMatrix: | The viewpoint projection matrix. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFrustumParallel | ( | float & | oXSiz, |

float & | oYSiz, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves parallel frustum parameters, simple precision.

This method works as RED::IViewpoint::GetFrustumParallel, except that it returns all floating point values in simple precision.

Parameters:

oXSiz: | Viewpoint's width (in model units). |

oYSiz: | Viewpoint's height (in model units). |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFrustumParallel | ( | double & | oXSiz, |

double & | oYSiz, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves parallel frustum parameters.

This method returns parallel frustum parameters:

- width of the viewing parallelogram in model units.
- height of the viewing parallelogram in model units.

See Orthographic camera for details on the orthographic camera models and orientation of values.

Parameters:

oXSiz: | Viewpoint's width (in model units). |

oYSiz: | Viewpoint's height (in model units). |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFrustumPerspective | ( | double & | oFov, |

double & | oRatio, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves perspective frustum parameters, double precision.

This method returns all perspective frustum parameters:

- field of view angle (radians, half field angle),
- height / width aspect ratio.

Parameters:

oFov: | Semi field of view. |

oRatio: | Aspect ratio height / width. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetFrustumPerspective | ( | float & | oFov, |

float & | oRatio, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves perspective frustum parameters, simple precision.

Works as RED::IViewpoint::GetFrustumPerspective, but returns all data as simple precision floating point values.

Parameters:

oFov: | Semi field of view. |

oRatio: | Aspect ratio height / width. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetInstanceCounterCallback | ( | RED::INSTANCE_COUNTER_CALLBACK & | oCallback, |

void *& | oUserData, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Returns the instance counter callback for this camera.

This method returns the callback set by RED::IViewpoint::SetInstanceCounterCallback.

Parameters:

oCallback: | The current callback address. |

oUserData: | Returned user data associated to the callback. |

iStateNumber: | Queried state number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetInstanceCounterImageCallback | ( | RED::INSTANCE_COUNTER_IMAGE_CALLBACK & | oCallback, |

void *& | oUserData, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Returns the instance counter image callback for this camera.

This method returns the callback set by RED::IViewpoint::SetInstanceCounterImageCallback.

Parameters:

oCallback: | The current callback address. |

oUserData: | Returned user data associated to the callback. |

iStateNumber: | Queried state number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetInvertViewingMatrix | ( | RED::Matrix & | oMatrix, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the inverted viewing matrix.

This the inverted viewing matrix that is returned by RED::IViewpoint::GetViewingMatrix.

Parameters:

oMatrix: | Inverted viewpoint's viewing matrix. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetLayerSet | ( | RED::LayerSet & | oLayerSet, |

int | iStateNumber = -1 | ||

) | const = 0 |

Returns the layer set defining overall visibility rules.

Parameters:

oLayerSet: | Whole visibility layer set. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetLinkedWindows | ( | RED::Vector< RED::Object * > & | oWindowList, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the list of windows linked to the viewpoint.

This method returns the list of windows that have been linked to the viewpoint. A window gets linked to the viewpoint if a call to RED::IWindow::InsertViewpoint occurs.

Parameters:

oWindowList: | A pointer to the internal window list. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetNearFar | ( | double & | oDNear, |

double & | oDFar, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Gets near and far clipping distance of the viewpoint, double precision.

Parameters:

oDNear: | Near clip distance. |

oDFar: | Far clip distance. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetNearFar | ( | float & | oDNear, |

float & | oDFar, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Gets near and far clipping distance of the viewpoint, simple precision.

Native viewpoint data is stored in double precision. This method can be used as a helper to access the values as simple precision floats for client applications.

Parameters:

oDNear: | Near clip distance, simple precision. |

oDFar: | Far clip distance, simple precision. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED::PostProcess & RED::IViewpoint::GetPostProcessSettings | ( | ) = 0 |

Gets the image post processing configuration for reading and/or writing.

Images rendered through a viewpoint can be automatically post-processed before being displayed.

By setting a RED::PostProcess instance to a viewpoint, the user can setup his own post-processing pipeline made of built-in classical operations.

Post-processing may be required in case of HDR renderings where tone mapping is needed to make the images displayable.

Post-processing is done after rendering and can be tuned interactively without re-rendering the image. Therefore, the operation does not need any transaction to be re-opened and can be done interactively on the last closed transaction.

Returns:

public virtual RED_RC RED::IViewpoint::GetProjection | ( | RED::VIEWPOINT_TYPE & | oProj, |

int | iStateNumber = -1 | ||

) | const = 0 |

Retrieves the projection type.

Parameters:

oProj: | Returned set to the kind of projection used by this viewpoint. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetProjectionMatrix | ( | RED::Matrix & | oMatrix, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the projection matrix.

This method calculates and returns the viewpoint's projection matrix. This call is equivalent to GetFrustumCustom for a RED::VPT_CUSTOM camera. It returns the parallel or perspective projection matrix for the other types of cameras.

For all details on the REDsdk transformation pipeline, please refer to Matrix transforms in a cluster.

Parameters:

oMatrix: | Resulting projection matrix. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetRenderShaderParameter | ( | RED::RenderShaderParameter & | oParam, |

int | iIndex, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Gets a camera RED::RenderShaderParameter.

This method gets the shader parameter stored in the camera at iIndex. If no parameter is available at iIndex, oParam is returned with an empty string name and a type set to RED::RenderShaderParameter::FREE.

See RED::IViewpoint::AddRenderShaderParameter for all details on camera level parameters.

Parameters:

oParam: | Returned copy of the accessed parameter. |

iIndex: | Index of the parameter to access in the camera list. |

iStateNumber: | Accessed transaction number. |

Returns:

RED_BAD_PARAM if the method has received an invalid parameter,

RED_FAIL otherwise.

public virtual const RED::Map< int, RED::RenderShaderParameter > & RED::IViewpoint::GetRenderShaderParameters | ( | int | iStateNumber = -1 | ) const = 0 |

Gets the entire list of RED::RenderShaderParameter registered in that viewpoint.

This method returns a reference on the internal list of RED::RenderShaderParameter objects stored by the class. The returned values should not be edited directly and are valid until a transaction is closed. Use multi-threaded RED::Map parsing to get through this list if your application uses several threads for operating REDsdk.

Parameters:

iStateNumber: | The accessed transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetRight | ( | RED::Vector3 & | oRight, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewpoint right vector.

Parameters:

oRight: | Viewpoint right vector. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetRootShape | ( | RED::Object *& | oRoot, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the root shape to which all shapes to visualize are added.

This method returns the internal shape of the viewpoint, which is the root of the scene graph. This shape has the default engine material set on it. A scene graph root may not be added as a children of any other shape.

The root shape is a CID_REDTransformShape implementing the RED::IShape and RED::ITransformShape interface.

Parameters:

oRoot: | Address of the root shape. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetSight | ( | RED::Vector3 & | oSight, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewpoint sight vector.

Parameters:

oSight: | Viewpoint sight vector. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetTop | ( | RED::Vector3 & | oTop, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewpoint top vector.

Parameters:

oTop: | Viewpoint top vector. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetViewingAxis | ( | RED::Vector3 & | oSight, |

RED::Vector3 & | oTop, | ||

RED::Vector3 & | oRight, | ||

int | iStateNumber = -1 | ||

) | const = 0 |

Gets viewpoint's axis vectors.

This method returns the viewing vectors that define the viewpoint's viewing pyramid or parallelogram.

Parameters:

oSight: | Viewpoint sight vector. |

oTop: | Viewpoint top vector. |

oRight: | Viewpoint right vector. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetViewingMatrix | ( | RED::Matrix & | oMatrix, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the viewing matrix of the viewpoint.

Returns the current viewing matrix of the viewpoint. The matrix is defined by the viewing axis system of the viewpoint:

- Column(0): Right vector.
- Column(1): Top vector.
- Column(2): - Sight vector.
- Column(3): Eye position.

For all details on the REDsdk transformation pipeline, please refer to Matrix transforms in a cluster.

Parameters:

oMatrix: | View matrix of the viewpoint. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::GetViewProjectionMatrix | ( | RED::Matrix & | oMatrix, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the view matrix * projection matrix of the camera.

This method calculates the viewpoint's view projection matrix, which is the concatenation of the view transformation matrix (the parallel, perspective or custom projection matrix) with the invert viewing matrix.

Note that this method could also be called GetInvertViewProjectionMatrix since it returns a product that involves the invert viewing matrix. It's called GetViewProjectionMatrix for compliance with usual terminology used in computer graphics.

Parameters:

oMatrix: | Resulting view projection matrix. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::IsAsymmetric | ( | bool & | oAsym, |

int | iStateNumber = -1 | ||

) | const = 0 |

Gets the symmetry information for that viewpoint.

This method indicates whether the viewpoint is symmetrical or not.

If defined using RED::IViewpoint::SetFrustumPerspective or using RED::IViewpoint::SetFrustumParallel, the viewpoint is symmetrical.

If defined using RED::IViewpoint::SetAsymmetricFrustumPerspective or RED::IViewpoint::SetAsymmetricFrustumParallel, the viewpoint is asymmetrical, and may render any thrown off center area using the same referential axis transformations as for a symmetrical viewpoint.

Parameters:

oAsym: | true if the viewpoint is asymmetric, false if it's symmetric. |

iStateNumber: | Queried transaction number. |

Returns:

public virtual RED_RC RED::IViewpoint::RemoveRenderShaderParameter | ( | int | iIndex, |

const RED::State & | iState | ||

) | = 0 |

Removes a camera RED::RenderShaderParameter.

This method removes the parameter registered in the camera list that is identified by iIndex.

See RED::IViewpoint::AddRenderShaderParameter for all details on camera level parameters.

Parameters:

iIndex: | Index of the parameter in the camera list. |

iState: | Current transaction parameter. |

Returns:

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::RemoveShape | ( | RED::Object * | iShape, |

const RED::State & | iState | ||

) | = 0 |

Removes a shape from the viewpoint's scene graph.

This method looks for iShape in the list of children shapes of the scene graph root and removes all found occurrences of it.

Parameters:

iShape: | Address of the shape to remove from the scene graph. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::RotateAroundEye | ( | double | iPitchOffset, |

double | iYawOffset, | ||

double | iRollOffset, | ||

const RED::State & | iState | ||

) | = 0 |

Angular rotation around the eye position.

This method rotates the viewpoint axis system ( sight, top, right ) of the given angles. Rotations are centered at the eye position.

Angular values are in radians.

Cumulative rotation matrices are applied around each axis with the provided angles: right with iPitchOffset, top with iYawOffset and sight with iRollOffset.

Parameters:

iPitchOffset: | Angular variation, rotation around right, in the sight -> top sense (right handed axis system). |

iYawOffset: | Angular variation, rotation around top, in the right -> sight sense (right handed axis system). |

iRollOffset: | Angular variation, rotation around sight, in the top -> right sense (right handed axis system). |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::RotateAroundFocus | ( | double | iPitchOffset, |

double | iYawOffset, | ||

double | iRollOffset, | ||

const RED::State & | iState | ||

) | = 0 |

Rotates the entire viewpoint around the focus point.

This method rotates the viewpoint around the focus point.

Angles must be supplied in radians. Center of all rotations is at the focus point.

Parameters:

iPitchOffset: | Angular variation, rotation around right, in the sight -> top sense (right handed axis system). |

iYawOffset: | Angular variation, rotation around top, in the right -> sight sense (right handed axis system). |

iRollOffset: | Angular variation, rotation around sight, in the top -> right sense (right handed axis system). |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetAsymmetricFrustumParallel | ( | double | iXLeft, |

double | iXRight, | ||

double | iYBottom, | ||

double | iYTop, | ||

const RED::State & | iState | ||

) | = 0 |

Defines an asymmetric orthographic viewpoint.

This method defines an asymmetric orthographic camera. iXLeft, iXRight, iYBottom and iYTop define the 4 extents of the viewing parallelogram of the camera along -right, +right, -top, +top.

See Orthographic camera for details on the orthographic camera models and orientation of values.

Parameters:

iXLeft: | X viewpoint size along the -right direction. |

iXRight: | X viewpoint size along the +right direction. |

iYBottom: | Y viewpoint size along the -top direction. |

iYTop: | Y viewpoint size along the +top direction. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetAsymmetricFrustumPerspective | ( | double | iFovLeft, |

double | iFovRight, | ||

double | iFovBottom, | ||

double | iFovTop, | ||

const RED::State & | iState | ||

) | = 0 |

Sets an asymmetry for this viewpoint.

This method defines all the parameters to render non symmetrical perspective viewing pyramids: iFovLeft, iFovRight, iFovBottom and iFovTop are the four focal values used to define each side of the perspective viewing pyramid.

iFovLeft angle is positively oriented from the screen center to the screen left side. iFovRight is positively oriented from the screen center to the screen right side. Same applies for bottom and top fields of view.

See Perspective camera for details on the perspective camera models and orientation of values. See also Rendering large images for a practical example on using asymmetric perspective cameras for the rendering of large images.

Parameters:

iFovLeft: | Left side of the viewing pyramid fov. |

iFovRight: | Right side of the viewing pyramid fov. |

iFovBottom: | Bottom side of the viewing pyramid fov. |

iFovTop: | Top side of the viewing pyramid fov. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetCustomClipPlanes | ( | double | iA[6], |

double | iB[6], | ||

double | iC[6], | ||

double | iD[6], | ||

const RED::State & | iState | ||

) | = 0 |

Specify custom clip planes for the viewpoint.

This is only effective for custom projection viewpoints (see RED::IViewpoint::SetFrustumCustom). If the camera is not a RED::VPT_CUSTOM at the time of the call, the method will fail. Clip planes equations are A * x + B * y + C * z + D = 0; expressed in WCS. Clip planes order is: 0: Far; 1: Bottom; 2: Top; 3: Right; 4: Left; 5: Near.

Parameters:

iA: | Clip planes equations 'A' terms. |

iB: | Clip planes equations 'B' terms. |

iC: | Clip planes equations 'C' terms. |

iD: | Clip planes equations 'D' terms. |

iState: | Current transaction. |

Returns:

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_WORKFLOW_ERROR if the viewpoint is not a RED::VPT_CUSTOM viewpoint,

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetEye | ( | const RED::Vector3 & | iEye, |

const RED::State & | iState | ||

) | = 0 |

Sets the viewpoint's eye position.

Parameters:

iEye: | New viewpoint's eye position. |

iState: | Current transaction. |

Returns:

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetFloatingOrigin | ( | const RED::Matrix & | iMatx, |

const RED::State & | iState | ||

) | = 0 |

Define a floating origin for the camera and for its scene graph.

This method can be used to store an extra transformation matrix to be applied to the camera viewing matrix and to the scene graph that is stored by the camera. Setting up a iMatx floating origin has the same effect as setting that same iMatx matrix on the root of the scene graph stored by this camera and to premultiply the camera viewing matrix by iMatx.

Data managed by the camera remain unaffected by the floating origin. The floating origin is only applied during the rendering of data.

This is a GPU only feature. Software ray-tracing is performed on original data.

See Floating origins for all details on floating origins.

Using this method has two benefits over storing the floating origin on the scene graph:

- The floating origin is generally not part of the data themselves, and keeping it separated is generally more handy for understanding matrices and coordinates in a scene graph.
- The floating origin is a dynamic matrix. Applying a dynamic matrix on large scene graphs can be expensive due to the propagation of the matrix throughout the graph while setting a floating origin on the viewpoint is an operation at no cost.

Parameters:

iMatx: | The value of the floating origin. Set RED::Matrix::IDENTITY to reset the floating origin. |

iState: | Current transaction parameter. |

Returns:

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetFocusDistance | ( | double | iDistance, |

const RED::State & | iState | ||

) | = 0 |

Sets the distance for the CAD rotation/zooming center.

This method sets the focus distance. The focus point is along the sight vector at the focus distance from the eye. It's the center of rotation and zoom for all CAD style transformation methods.

Parameters:

iDistance: | New focus distance value. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetForScreenDraw | ( | double | iWidth, |

double | iHeight, | ||

double | iZMin, | ||

double | iZMax, | ||

const RED::State & | iState | ||

) | = 0 |

Defines a viewpoint for direct screen drawing.

Sets the viewpoint parameters for a direct 2D screen rendering. Viewpoints axis are set to get viewport pixels matching geometry coordinates:

- Viewpoint's top axis is aligned with window's vertical axis,
- Viewpoint's right axis is aligned with window's horizontal axis,
- Viewpoint's origin is at the lower left corner of the window,
- One screen pixel is one unit along the (top,right) axis base,
- Decreasing depths move away from the camera.

The viewpoint set is orthographic.

As we remain 3d, we must indicate the depth bounds of this viewpoint: depth is clamped to the [iZMin,iZMax] segment. iZMin is the farthest depth from the camera, iZMax is the closest depth.

Note that iWidth and iHeight can be negative values. In this case, the viewpoint positions it's viewing area in negative coordinates. For example setting iWidth to 200.0f let the camera see coordinates in [0.0f,200.0f]. Setting iWidth to -200.0f let the camera see coordinates in [-200.0f,0.0f].

Parameters:

iWidth: | Window width. |

iHeight: | Window height. |

iZMin: | Minimal in bounds z value. Farthest from camera. |

iZMax: | Maximal in bounds z value. Closest from camera. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetFrustumCustom | ( | const RED::Matrix & | iMatrix, |

const RED::State & | iState | ||

) | = 0 |

Defines a custom projection type for this viewpoint.

This method lets you define a custom projection matrix for this camera. The viewpoint is neither considered as being parallel nor perspective: the projection transformation is entirely defined by the iMatrix specified in this call.

Practically, iMatrix is used to set the GL_PROJECTION matrix for this camera in the OpenGL pipeline. Note that the camera axis system still needs to be defined in a standard way.

As we can't extract the frustum boundaries from the provided matrix, several engine features are disabled for custom projection viewpoints:

- Auto-range shadow maps calculations are ignored,
- Frustum culling is disabled unless RED::IViewpoint::SetCustomClipPlanes is called. Please note that culling callbacks still work even with custom projections.

The viewpoint is turned into a custom projection viewpoint after this call.

Parameters:

iMatrix: | The projection matrix to use for this viewpoint. |

iState: | Current transaction. |

Returns:

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetFrustumParallel | ( | double | iXSiz, |

double | iYSiz, | ||

const RED::State & | iState | ||

) | = 0 |

Sets parallel frustum related parameters.

This method returns parallel frustum parameters:

- width of the viewing parallelogram in model units,
- height of the viewing parallelogram in model units.

The viewpoint's projection is set to orthographic.

See Orthographic camera for details on the orthographic camera models and orientation of values.

Parameters:

iXSiz: | X viewpoint size. |

iYSiz: | Y viewpoint size. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetFrustumPerspective | ( | double | iFov, |

double | iRatio, | ||

const RED::State & | iState | ||

) | = 0 |

Sets perspective frustum parameters.

This method sets all perspective frustum parameters:

- field of view angle (radians, half field angle),
- height / width aspect ratio.

The viewpoint is turned into a perspective projection viewpoint.

See Perspective camera for details on the perspective camera models and orientation of values.

Parameters:

iFov: | Semi field of view. |

iRatio: | Vertical aspect ratio height / width. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetInstanceCounterCallback | ( | RED::INSTANCE_COUNTER_CALLBACK | iCallback, |

void * | iUserData, | ||

const RED::State & | iState | ||

) | = 0 |

Defines the instance callback for this camera.

This method sets the instance counter callback for values. The callback associates an object unique ID with a user defined value and is leveraged during the rendering by the RED::RenderShaderParameter::REF_INSTANCE_COUNTER.

Parameters:

iCallback: | The instance counter callback address. |

iUserData: | User data associated to the callback. |

iState: | Current transaction parameter. |

Returns:

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetInstanceCounterImageCallback | ( | RED::INSTANCE_COUNTER_IMAGE_CALLBACK | iCallback, |

void * | iUserData, | ||

const RED::State & | iState | ||

) | = 0 |

Defines the instance image callback for this camera.

This method sets the instance counter callback for images. The callback associates an object unique ID with a user defined image and is leveraged during the rendering by the RED::RenderShaderParameter::REF_INSTANCE_COUNTER_IMAGE.

Parameters:

iCallback: | The instance counter callback address. |

iUserData: | User data associated to the callback. |

iState: | Current transaction parameter. |

Returns:

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_ALLOC_FAILURE if an internal allocation has failed,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetNearFar | ( | double | iDnear, |

double | iDFar, | ||

const RED::State & | iState | ||

) | = 0 |

Sets near and far clipping distances for all kind of viewpoints.

This method sets the near and far clip distances, regardless of the other viewpoints parameters Please note that in the case of a RED::VPT_PERSPECTIVE or RED::VPT_PARALLEL camera, iDNear must be strictly lower than iDFar, and in the case of a RED::VPT_PERSPECTIVE camera, iDNear must be greater than 0.0. In the case of a RED::VPT_CUSTOM camera, this method has no effect, as the full projection matrix is defined by RED::IViewpoint::SetFrustumCustom.

By default, a camera uses the RED::VPT_PERSPECTIVE projection, so setting near / far values must be done taking this fact into consideration.

Parameters:

iDnear: | Near clip distance. |

iDFar: | Far clip distance. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetProjection | ( | RED::VIEWPOINT_TYPE | iProjection, |

const RED::State & | iState | ||

) | = 0 |

Sets the projection type.

Changes the kind of projection used by the viewpoint. Note that some frustum parameters may need an update after this call if they have never been set before.

Parameters:

iProjection: | New projection kind for this viewpoint. |

iState: | Current transaction. |

Returns:

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetRight | ( | const RED::Vector3 & | iRight, |

const RED::State & | iState | ||

) | = 0 |

Sets the viewpoint's right vector.

The provided value is stored normalized. Note that the three camera axis vectors must remain perpendicular one to each other for the camera to be valid for the rendering.

Parameters:

iRight: | New viewpoint's right direction. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetSight | ( | const RED::Vector3 & | iSight, |

const RED::State & | iState | ||

) | = 0 |

Sets the viewpoint's sight vector.

The provided value is stored normalized. Note that the three camera axis vectors must remain perpendicular one to each other for the camera to be valid for the rendering.

Parameters:

iSight: | New viewpoint's sight direction. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetTop | ( | const RED::Vector3 & | iTop, |

const RED::State & | iState | ||

) | = 0 |

Sets the viewpoint's top vector.

The provided value is stored normalized. Note that the three camera axis vectors must remain perpendicular one to each other for the camera to be valid for the rendering.

Parameters:

iTop: | New viewpoint's top direction. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetViewingAxis | ( | const RED::Vector3 & | iSight, |

const RED::Vector3 & | iTop, | ||

const RED::Vector3 & | iRight, | ||

const RED::State & | iState | ||

) | = 0 |

Modifies viewpoint's axis vectors.

This method updates all viewpoint's definition axis (sight, top, right) and performs a normalization check and a projection check of the provided input vectors, ensuring that the camera is suitable for rendering.

Parameters:

iSight: | Viewpoint sight vector. |

iTop: | Viewpoint top vector. |

iRight: | Viewpoint right vector. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method has received zero length vectors,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::SetViewingMatrix | ( | const RED::Matrix & | iMatrix, |

const RED::State & | iState | ||

) | = 0 |

Modifies viewpoint's axis vectors.

This method updates the viewpoint's viewing matrix and performs a normalization check and a projection check of the provided input basis, ensuring that the camera is suitable for rendering.

Parameters:

iMatrix: | Viewpoint viewing matrix. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method has received at least one zero length vector,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error has occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::TranslateEye | ( | const RED::Vector3 & | iOffset, |

const RED::State & | iState | ||

) | = 0 |

Offsets the viewpoint eye position.

This method moves the eye position.

Parameters:

iOffset: | Eye movement. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::TranslateWithFocus | ( | const RED::Vector3 & | iNewFocus, |

const RED::State & | iState | ||

) | = 0 |

Moves the focus point, with the eye following it.

This method changes the focus point to the provided iNewFocus coordinates. The focus distance is not changed either, so the eye position of the viewpoint is moved with this operation of an offset between the old focus position and the new one.

Parameters:

iNewFocus: | new focus point coordinates. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.

public virtual RED_RC RED::IViewpoint::ZoomOnFocus | ( | double | iZoomingFactor, |

const RED::State & | iState | ||

) | = 0 |

Zooms in/out on the focus point.

This method takes a zooming factor parameter, that must be strictly positive, that is applied as a multiplicand to the focus distance, therefore defining the new viewpoint position along the eye focus line.

focus_distance = focus_distance * iZoomingFactor.

Viewpoint position is updated so that the focus point does not move.

Parameters:

iZoomingFactor: | The factor to apply to zoom on the focus point. |

iState: | Current transaction. |

Returns:

RED_BAD_PARAM if the method received an invalid parameter,

RED_ALLOC_FAILURE if an internal allocation did fail,

RED_WORKFLOW_ERROR if a transaction error occurred,

RED_FAIL otherwise.