OpenCMISS-Zinc C++ API Documentation
Public Types | Public Member Functions | Protected Attributes | List of all members
OpenCMISS::Zinc::Sceneviewer Class Reference

The Zinc sceneviewer is responsible for rendering the graphical Scene. More...

#include <sceneviewer.hpp>

Public Types

enum  BufferingMode {
  BUFFERING_MODE_INVALID = CMZN_SCENEVIEWER_BUFFERING_MODE_INVALID, BUFFERING_MODE_DEFAULT = CMZN_SCENEVIEWER_BUFFERING_MODE_DEFAULT, BUFFERING_MODE_SINGLE = CMZN_SCENEVIEWER_BUFFERING_MODE_SINGLE, BUFFERING_MODE_DOUBLE = CMZN_SCENEVIEWER_BUFFERING_MODE_DOUBLE,
  BUFFERING_MODE_RENDER_OFFSCREEN_AND_COPY = CMZN_SCENEVIEWER_BUFFERING_MODE_RENDER_OFFSCREEN_AND_COPY, BUFFERING_MODE_RENDER_OFFSCREEN_AND_BLEND = CMZN_SCENEVIEWER_BUFFERING_MODE_RENDER_OFFSCREEN_AND_BLEND
}
 
enum  InteractMode { INTERACT_MODE_INVALID = CMZN_SCENEVIEWER_INTERACT_MODE_INVALID, INTERACT_MODE_STANDARD = CMZN_SCENEVIEWER_INTERACT_MODE_STANDARD, INTERACT_MODE_2D = CMZN_SCENEVIEWER_INTERACT_MODE_2D }
 
enum  ProjectionMode { PROJECTION_MODE_INVALID = CMZN_SCENEVIEWER_PROJECTION_MODE_INVALID, PROJECTION_MODE_PARALLEL = CMZN_SCENEVIEWER_PROJECTION_MODE_PARALLEL, PROJECTION_MODE_PERSPECTIVE = CMZN_SCENEVIEWER_PROJECTION_MODE_PERSPECTIVE }
 
enum  StereoMode { STEREO_MODE_INVALID = CMZN_SCENEVIEWER_STEREO_MODE_INVALID, STEREO_MODE_DEFAULT = CMZN_SCENEVIEWER_STEREO_MODE_DEFAULT, STEREO_MODE_MONO = CMZN_SCENEVIEWER_STEREO_MODE_MONO, STEREO_MODE_STEREO = CMZN_SCENEVIEWER_STEREO_MODE_STEREO }
 
enum  TransparencyMode { TRANSPARENCY_MODE_INVALID = CMZN_SCENEVIEWER_TRANSPARENCY_MODE_INVALID, TRANSPARENCY_MODE_FAST = CMZN_SCENEVIEWER_TRANSPARENCY_MODE_FAST, TRANSPARENCY_MODE_SLOW = CMZN_SCENEVIEWER_TRANSPARENCY_MODE_SLOW, TRANSPARENCY_MODE_ORDER_INDEPENDENT = CMZN_SCENEVIEWER_TRANSPARENCY_MODE_ORDER_INDEPENDENT }
 
enum  ViewportMode { VIEWPORT_MODE_INVALID = CMZN_SCENEVIEWER_VIEWPORT_MODE_INVALID, VIEWPORT_MODE_ABSOLUTE = CMZN_SCENEVIEWER_VIEWPORT_MODE_ABSOLUTE, VIEWPORT_MODE_RELATIVE = CMZN_SCENEVIEWER_VIEWPORT_MODE_RELATIVE, VIEWPORT_MODE_DISTORTING_RELATIVE = CMZN_SCENEVIEWER_VIEWPORT_MODE_DISTORTING_RELATIVE }
 

Public Member Functions

 Sceneviewer (cmzn_sceneviewer_id in_sceneviewer_id)
 
 Sceneviewer (const Sceneviewer &sceneviewermodule)
 
Scenevieweroperator= (const Sceneviewer &sceneviewer)
 
bool isValid () const
 
cmzn_sceneviewer_id getId () const
 
int beginChange ()
 
int endChange ()
 
int renderScene ()
 
int setScene (const Scene &scene)
 
Scene getScene ()
 
int setScenefilter (const Scenefilter &scenefilter)
 
Scenefilter getScenefilter ()
 
int setViewportSize (int width, int height)
 
Sceneviewerinput createSceneviewerinput ()
 
int processSceneviewerinput (const Sceneviewerinput &input)
 
int getAntialiasSampling ()
 
int setAntialiasSampling (int numberOfSamples)
 
double getBackgroundColourAlpha ()
 
int setBackgroundColourAlpha (const double alpha)
 
int setBackgroundColourComponentRGB (double red, double green, double blue)
 
int setBackgroundColourComponentRGBA (double red, double green, double blue, double alpha)
 
int getBackgroundColourRGB (double *valuesOut3)
 
int setBackgroundColourRGB (const double *valuesIn3)
 
int getBackgroundColourRGBA (double *valuesOut4)
 
int setBackgroundColourRGBA (const double *valuesIn4)
 
int getEyePosition (double *eyeValuesOut3)
 
int setEyePosition (const double *eyeValuesIn3)
 
InteractMode getInteractMode ()
 
int setInteractMode (InteractMode interactMode)
 
int getLookatPosition (double *lookatValuesOut3)
 
int setLookatPosition (const double *lookatValuesIn3)
 
bool getPerturbLinesFlag ()
 
int setPerturbLinesFlag (bool value)
 
ProjectionMode getProjectionMode ()
 
int setProjectionMode (ProjectionMode projectionMode)
 
double getTranslationRate ()
 
int setTranslationRate (double translationRate)
 
double getTumbleRate ()
 
int setTumbleRate (double tumbleRate)
 
double getZoomRate ()
 
int setZoomRate (double zoomRate)
 
int getUpVector (double *upVectorValuesOut3)
 
int setUpVector (const double *upVectorValuesIn3)
 
int getLookatParameters (double *eyeValuesOut3, double *lookatValuesOut3, double *upVectorValuesOut3)
 
int setLookatParametersNonSkew (const double *eyeValuesIn3, const double *lookatValuesIn3, const double *upVectorValuesIn3)
 
int getViewingVolume (double *left, double *right, double *bottom, double *top, double *near_plane, double *far_plane)
 
int setViewingVolume (double left, double right, double bottom, double top, double near_plane, double far_plane)
 
int viewAll ()
 
TransparencyMode getTransparencyMode ()
 
int setTransparencyMode (TransparencyMode transparencyMode)
 
int getTransparencyLayers ()
 
int setTransparencyLayers (int layers)
 
double getViewAngle ()
 
int setViewAngle (double viewAngle)
 
ViewportMode getViewportMode ()
 
int setViewportMode (ViewportMode viewportMode)
 
double getFarClippingPlane ()
 
double getNearClippingPlane ()
 
int setFarClippingPlane (double farClippingPlane)
 
int setNearClippingPlane (double nearClippingPlane)
 
int writeImageToFile (const char *file_name, int force_onscreen, int preferred_width, int preferred_height, int preferred_antialias, int preferred_transparency_layers)
 
int addLight (const Light &light)
 
bool hasLight (const Light &light)
 
int removeLight (const Light &light)
 
bool isLightingLocalViewer ()
 
int setLightingLocalViewer (bool value)
 
bool isLightingTwoSided ()
 
int setLightingTwoSided (bool value)
 
int transformCoordinates (Scenecoordinatesystem inCoordinateSystem, Scenecoordinatesystem outCoordinateSystem, const Scene &localScene, const double *valuesIn3, double *valuesOut3)
 
int readDescription (const char *description)
 
char * writeDescription ()
 
Sceneviewernotifier createSceneviewernotifier ()
 

Protected Attributes

cmzn_sceneviewer_id id
 

Detailed Description

The Zinc sceneviewer is responsible for rendering the graphical Scene.

The Zinc sceneviewer is responsible for rendering the graphical Scene using OpenGL. It has methods to set its top scene and scene filter, and to get and set attributes controlling the view orientation, field of view, clipping planes and more. The client is responsible for creating the OpenGL-capable canvas with a sceneviewer, informing the sceneviewer of its size including on resize events, making the OpenGL context current and invoking the render scene method of the sceneviewer.

Member Enumeration Documentation

Describes the buffering mode of the scene viewer. The special modes RENDER_OFFSCREEN_AND_COPY and RENDER_OFFSCREEN_AND_BLEND are used when an OpenGL context cannot be activated directly on the supplied window, such as when the graphics are to be composited by an external program. These are currently only implemeneted for winapi. The graphics will be drawn offscreen and only rendered on screen when requested. The COPY version will overwrite any existing pixels when drawing and the BLEND version will use the alpha channel of the rendered scene to blend itself with the existing pixels.

Enumerator
BUFFERING_MODE_INVALID 

Invalid scene viewer buffering mode.

BUFFERING_MODE_DEFAULT 

BUFFERING_MODE_DEFAULT will mean that with SINGLE_BUFFER or DOUBLE_BUFFER mode may be selected depending on the other requirements of the scene viewer.

BUFFERING_MODE_SINGLE 

allow you a greater colour depth or other features unavailable on a single buffer scene viewer.

BUFFERING_MODE_DOUBLE 

allows the graphics to be drawn offscreen before being displayed all at once, reducing the apparent flicker.

BUFFERING_MODE_RENDER_OFFSCREEN_AND_COPY 

A special modes, used when an OpenGL context cannot be activated directly on the supplied window, such as when the graphics are to be composited by an external program. These are currently only implemeneted for winapi. The graphics will be drawn offscreen and only rendered on screen when requested. This mode will overwrite any existing pixels when drawing.

BUFFERING_MODE_RENDER_OFFSCREEN_AND_BLEND 

Similar to RENDER_OFFSCREEN_AND_COPY, however instead of overwriting existing pixels, this mode will use the alpha channel of the rendered scene to blend itself with the existing pixels.

Controls the way the mouse and keyboard are used to interact with the scene viewer.

Enumerator
INTERACT_MODE_INVALID 

Unspecified scene viewer interaction mode.

INTERACT_MODE_STANDARD 

CMZN_SCENEVIEWER_INTERACT_MODE_STANDARD is the traditional cmgui mode. Rotate: Left mouse button Translate: Middle mouse button Zoom: Right mouse button

INTERACT_MODE_2D 

CMZN_SCENEVIEWER_INTERACT_MODE_2D is a mode more suitable for 2D use Translate: Left mouse button Rotate: Middle mouse button Zoom: Right mouse button

Specifies the sort of projection matrix used to render the 3D scene.

Enumerator
PROJECTION_MODE_INVALID 

Unspecified scene viewer projection mode.

PROJECTION_MODE_PARALLEL 

Parallel (orthographic) projection transformations will be used when drawing.

PROJECTION_MODE_PERSPECTIVE 

Perspective projection transformations will be used when drawing.

Specifies whether a STEREO capable scene viewer is required. This will have to work in cooperation with your window manager and hardware.

Enumerator
STEREO_MODE_INVALID 

Unspecified scene viewer stereo mode.

STEREO_MODE_DEFAULT 

either STEREO or MONO depending on other scene viewer requirements

STEREO_MODE_MONO 

Normal 2-D Monoscopic display

STEREO_MODE_STEREO 

Stereoscopic display

Controls the way partially transparent objects are rendered in scene viewer.

Enumerator
TRANSPARENCY_MODE_INVALID 

Unspecified scene viewer transparency mode.

TRANSPARENCY_MODE_FAST 

CMZN_CMZN_SCENEVIEWER_TRANSPARENCY_MODE_FAST just includes transparent objects in the normal render, this causes them to obscure other objects behind if they are drawn first.

TRANSPARENCY_MODE_SLOW 

CMZN_CMZN_SCENEVIEWER_TRANSPARENCY_MODE_SLOW puts out all the opaque geometry first and then ignores the depth test while drawing all partially transparent objects, this ensures everything is drawn but multiple layers of transparency will always draw on top of each other which means a surface that is behind another may be drawn over the top of one that is supposed to be in front.

TRANSPARENCY_MODE_ORDER_INDEPENDENT 

CMZN_CMZN_SCENEVIEWER_TRANSPARENCY_MODE_ORDER_INDEPENDENT uses some Nvidia extensions to implement a full back to front perl pixel fragment sort correctly rendering transparency with a small number of passes, specified by "transparency layers". This uses all the texturing resources of the current Nvidia hardware and so no materials used in the scene can contain textures.

Specifies the behaviour of the NDC coordinates with respect to the size of the viewport.

Enumerator
VIEWPORT_MODE_INVALID 

Unspecified scene viewer viewport mode.

VIEWPORT_MODE_ABSOLUTE 

viewport_pixels_per_unit values are used to give and exact mapping from user coordinates to pixels.

VIEWPORT_MODE_RELATIVE 

the intended viewing volume is made as large as possible in the physical viewport while maintaining the aspect ratio from NDC_width and NDC_height.

VIEWPORT_MODE_DISTORTING_RELATIVE 

the intended viewing volume is made as large as possible in the physical viewport, and the aspect ratio may be changed.

Member Function Documentation

int OpenCMISS::Zinc::Sceneviewer::addLight ( const Light light)
inline

Adds a light to the Scene_viewer list of lights.

Parameters
lightHandle to the light to be added to scene viewer.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::beginChange ( )
inline

Call this function before making multiple changes on the sceneviewer, this will stop sceneviewer from notifying clients of every change. After multiple changes have been made, call the sceneviewer end change method to restart notifications and notify clients of changes that have happened. Can be nested.

See also
Sceneviewer::endChange
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
Sceneviewerinput OpenCMISS::Zinc::Sceneviewer::createSceneviewerinput ( )
inline

Create a scene viewer input object for manually setting mouse or other input event data.

Returns
Handle to new sceneviewerinput, or NULL/invalid handle on failure.
Sceneviewernotifier OpenCMISS::Zinc::Sceneviewer::createSceneviewernotifier ( )
inline

Create a notifier for getting callbacks for changes to the scene viewer.

Returns
Handle to new sceneviewer notifier, or NULL/invalid handle on failure.
int OpenCMISS::Zinc::Sceneviewer::endChange ( )
inline

Call sceneviewer begin change method before making multiple changes on the sceneviewer, to stop sceneviewer from notifying clients of every change. After multiple changes have been made, call this method to restart notifications and notify clients of changes that have happened.

See also
Sceneviewer::beginChange
Parameters
sceneThe handle to the sceneviewer.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::getAntialiasSampling ( )
inline

Gets the number of jitter samples used to antialias the scene viewer.

Returns
The number of jitter samples used to antialias the graphics, or 0 if antialiasing is off or bad argument.
double OpenCMISS::Zinc::Sceneviewer::getBackgroundColourAlpha ( )
inline

Get the alpha opacity component of the scene viewer background colour.

Returns
Alpha value in [0.0, 1.0].
int OpenCMISS::Zinc::Sceneviewer::getBackgroundColourRGB ( double *  valuesOut3)
inline

Get the background colour of the scene viewer.

Parameters
valuesOut3Three colour components in order [red, green, blue], with values in [0, 1.0].
Returns
Result OK if successful, otherwise ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::getEyePosition ( double *  eyeValuesOut3)
inline

Get the eye position of the scene viewer.

Parameters
eyeValuesOut3Array of size 3 to hold the values of the eye position.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
double OpenCMISS::Zinc::Sceneviewer::getFarClippingPlane ( )
inline

Gets the distance from the eye_point to the far clipping plane in the scene viewer.

Returns
distance from the eye_point to the far clipping plane on success, any other value on failure.
cmzn_sceneviewer_id OpenCMISS::Zinc::Sceneviewer::getId ( ) const
inline

Return the C handle of the Sceneviewer object.

Returns
C handle of Sceneviewer if this objects is valid, 0 otherwise.
InteractMode OpenCMISS::Zinc::Sceneviewer::getInteractMode ( )
inline

Gets the mouse and keyboard interaction mode of the scene viewer.

See also
Sceneviewer::InteractMode
Returns
The interact mode or CMZN_SCENEVIEWER_INTERACT_MODE_INVALID on error.
int OpenCMISS::Zinc::Sceneviewer::getLookatParameters ( double *  eyeValuesOut3,
double *  lookatValuesOut3,
double *  upVectorValuesOut3 
)
inline

Gets the 3 main viewing parameters of the scene viewer: eye point, lookat point and up vector in a single call.

Parameters
eyeValuesOut3Array of size 3 to receive the coordinates of the point you are looking from.
lookatValuesOut3Array of size 3 to receive the coordinates of the point you are looking at, often also called the interest point.
upVectorValuesOut3Array of size 3 to receive the vector giving the up orientation in the scene viewer.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::getLookatPosition ( double *  lookatValuesOut3)
inline

Get the lookat position of the scene viewer.

Parameters
lookatValuesOut3Array of size 3 to hold the values of the lookat position.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
double OpenCMISS::Zinc::Sceneviewer::getNearClippingPlane ( )
inline

Gets the distance from the eye_point to the near clipping plane in the scene viewer.

Returns
distance from the eye_point to the near clipping plane on success, any other value on failure.
bool OpenCMISS::Zinc::Sceneviewer::getPerturbLinesFlag ( )
inline

Query whether lines are perturbed to appear in front of surfaces at the same depth to avoid visual stitching artefacts.

Returns
Boolean true if perturbing lines, otherwise false.
ProjectionMode OpenCMISS::Zinc::Sceneviewer::getProjectionMode ( )
inline

Gets the projection mode - parallel/perspective - of the scene viewer.

Returns
The viewport mode or CMZN_SCENEVIEWER_PROJECTION_MODE_INVALID on error.
Scene OpenCMISS::Zinc::Sceneviewer::getScene ( )
inline

Get the top scene for the scene viewer.

Returns
Handle to scene, or NULL/invalid handle if none or failed.
Scenefilter OpenCMISS::Zinc::Sceneviewer::getScenefilter ( )
inline

Get the filter currently used in scene viewer.

Returns
Handle to scene filter, or NULL/invalid handle if none or failed.
double OpenCMISS::Zinc::Sceneviewer::getTranslationRate ( )
inline

Gets the rate at which translation occurs in relation to mouse movement using standard sceneviewerinput transformation processing.

Returns
The translation rate, or 0 if invalid arguments.
int OpenCMISS::Zinc::Sceneviewer::getTransparencyLayers ( )
inline

Get the number of layers used in the TRANSPARENCY_MODE_ORDER_INDEPENDENT transparency mode.

See also
Sceneviewer::TransparencyMode
Returns
number of layers for this scene viewer. Any otehr value if failed or it is not set correctly.
TransparencyMode OpenCMISS::Zinc::Sceneviewer::getTransparencyMode ( )
inline

Get the transparency_mode of the scene viewer. In fast transparency mode, the scene is drawn as it is, with depth buffer writing even for semi-transparent objects. In slow transparency mode, opaque objects are rendered first, then semi-transparent objects are rendered without writing the depth buffer. Hence, you can even see through the first semi-transparent surface drawn.

See also
Sceneviewer::TransparencyMode
Sceneviewer::setTransparencyMode
Returns
transparency_mode set for this sceneviewer. CMZN_SCENEVIEWER_TRANSPARENCY_MODE_ORDER_INDEPENDENT if failed or mode is not set correctly
double OpenCMISS::Zinc::Sceneviewer::getTumbleRate ( )
inline

Gets the rate at which tumble occurs in relation to mouse movement using standard sceneviewerinput transformation processing.

Returns
The tumble rate, or 0 if invalid arguments.
int OpenCMISS::Zinc::Sceneviewer::getUpVector ( double *  upVectorValuesOut3)
inline

Get the up vector of the scene viewer.

Parameters
upVectorValuesOut3Array of size 3 to hold the values of the up vector.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
double OpenCMISS::Zinc::Sceneviewer::getViewAngle ( )
inline

Gets the diagonal view angle, in radians, of the scene viewer. View angle is measured across the largest square which fits inside the viewing window.

Returns
The view angle in radians, or 0 if invalid arguments.
int OpenCMISS::Zinc::Sceneviewer::getViewingVolume ( double *  left,
double *  right,
double *  bottom,
double *  top,
double *  near_plane,
double *  far_plane 
)
inline

Gets the viewing volume of the scene viewer.

ViewportMode OpenCMISS::Zinc::Sceneviewer::getViewportMode ( )
inline

Gets the viewport mode (absolute/relative/distorting relative) for the scene viewer.

Returns
The viewport mode or CMZN_SCENEVIEWER_VIEWPORT_MODE_INVALID on error.
double OpenCMISS::Zinc::Sceneviewer::getZoomRate ( )
inline

Gets the rate at which zoom occurs in relation to mouse movement using standard sceneviewerinput transformation processing.

Returns
The zoom rate, or 0 if invalid arguments.
bool OpenCMISS::Zinc::Sceneviewer::hasLight ( const Light light)
inline

Check if a light is on Scene_viewer list of lights.

Parameters
lightHandle to the light to be checked.
Returns
1 if light is on the list, 0 otherwise.
bool OpenCMISS::Zinc::Sceneviewer::isLightingLocalViewer ( )
inline

Queries whether local viewer lighting is used by the scene viewer.

See also
Sceneviewer::setLightingLocalViewer
Returns
Boolean true if local viewer lighting is set, false if not or bad argument.
bool OpenCMISS::Zinc::Sceneviewer::isLightingTwoSided ( )
inline

Queries whether two-sided lighting is used for rendering polygons.

See also
Sceneviewer::setLightingTwoSided
Returns
Boolean true if lighting is on, false if not or bad argument.
bool OpenCMISS::Zinc::Sceneviewer::isValid ( ) const
inline

Check if this is a valid Sceneviewer object.

Returns
Status True if object is valid, false otherwise.
int OpenCMISS::Zinc::Sceneviewer::processSceneviewerinput ( const Sceneviewerinput input)
inline

Manually calls the scene viewer's list of input callbacks with the supplied input data.

Parameters
inputDescription of the input event.
Returns
Status OpenCMISS::Zinc::OK on success, any other value if failed.
int OpenCMISS::Zinc::Sceneviewer::readDescription ( const char *  description)
inline

Read the json description to the scene viewer. This will change the settings of the scene viewer.

The string containing json description

Returns
OpenCMISS::Zinc::OK on success, otherwise ERROR status.
int OpenCMISS::Zinc::Sceneviewer::removeLight ( const Light light)
inline

Remove a light from the Scene_viewer list of lights.

Parameters
lightHandle to the light to be removed from scene viewer.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::renderScene ( )
inline

Forces a redraw of the given scene viewer to take place immediately

int OpenCMISS::Zinc::Sceneviewer::setAntialiasSampling ( int  numberOfSamples)
inline

Sets the number of jitter samples used to antialias the scene viewer.

Parameters
numberOfSamplesThe number of jitter samples used to antialias the graphics. Only 2, 4 or 8 samples are supported. Zero disables antialiasing.
Returns
On success OpenCMISS::Zinc::OK, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setBackgroundColourAlpha ( const double  alpha)
inline

Set the alpha opacity component of the scene viewer background colour. The remaining components of the background colour are unchanged.

Parameters
alphaThe alpha value in [0, 1.0] where 0.0 is transparent, 1.0 is opaque.
Returns
Result OK if successful, otherwise ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setBackgroundColourComponentRGB ( double  red,
double  green,
double  blue 
)
inline

Set the background colour of the scene viewer by individual component. Each component should be in the range [0, 1.0].

Parameters
redThe red component value between [0, 1.0].
greenThe green component value between [0, 1.0].
blueThe blue component value between [0, 1.0].
Returns
Result OK if successful, otherwise ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setBackgroundColourRGB ( const double *  valuesIn3)
inline

Set the background colour of the scene viewer.

Parameters
valuesIn3Three colour components in order [red, green, blue], with values in [0, 1.0].
Returns
Result OK if successful, otherwise ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setEyePosition ( const double *  eyeValuesIn3)
inline

Set the eye position of the scene viewer.

Parameters
eyeValuesIn3Array of three values containing the new eye position.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::setFarClippingPlane ( double  farClippingPlane)
inline

Sets the distance from the eye_point to the far clipping plane in the scene viewer.

Parameters
farClippingPlanedistance from the eye_point to the far clipping plane
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::setInteractMode ( InteractMode  interactMode)
inline

Sets the mouse and keyboard interaction mode of the scene viewer.

See also
Sceneviewer::InteractMode
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setLightingLocalViewer ( bool  value)
inline

Sets whether local viewer lighting is used by the scene viewer. If true, the angle of view from the eye to the graphics vertex is used to give more realistic lighting, at slightly greater rendering expense. If false (default) infinite lighting is assumed, which gives faster rendering. The difference becomes apparent when viewing a plane close up with specular colour: with local viewer lighting (and sufficient tessellation divisions) rounded specular highlighting can be seen; with infinite viewer lighting the specular highlighting is even across the plane.

Parameters
valueThe new state of the local viewer lighting flag.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setLightingTwoSided ( bool  value)
inline

Sets whether two-sided lighting is used for rendering polygons. If true (default) then back surfaces are lit with reversed normals. If false i.e. one-sided then back surfaces are only lit by ambient lights. One-sided lighting is useful for finding problems with element definitions in 3-D: exterior faces should have outward normals, so if these are not lit on the outside with one-sided lighting, then the element has a left-handed coordinate system i.e. negative volume. Note that interior faces' normals should only be outward with respect to their first parent element, and inward with respect to their second parent.

Parameters
valueThe new state of the two-sided lighting flag.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setLookatParametersNonSkew ( const double *  eyeValuesIn3,
const double *  lookatValuesIn3,
const double *  upVectorValuesIn3 
)
inline

Sets the 3 main viewing parameters of the scene viewer: eye point, lookat point and up vector in a single call. This function ensures the up vector is orthogonal to the view direction so the projection is not skew.

Parameters
eyeValuesIn3The 3 coordinates of the point you are looking from. It is an error if this is at the same as the lookat point.
lookatValuesIn3The 3 coordinates of the point you are looking at, often also called the interest point.
upVectorValuesIn3A vector which gives the up orientation in the scene viewer. It is an error if this vector is colinear with the view direction line from the eye to the lookat point. This vector is automatically converted to a unit vector orthogonal to the view direction.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setLookatPosition ( const double *  lookatValuesIn3)
inline

Set the lookat position of the scene viewer.

Parameters
lookatValuesIn3Array of three values containing the new lookat position.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::setNearClippingPlane ( double  nearClippingPlane)
inline

Sets the distance from the eye_point to the near clipping plane in the scene viewer.

Parameters
nearClippingPlanedistance from the eye_point to the near clipping plane
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::setPerturbLinesFlag ( bool  value)
inline

Set whether lines are perturbed to appear in front of surfaces at the same depth to avoid visual stitching artefacts. Uses GL_EXT_polygon_offset. Note that quality of surface-only graphics can be impacted with this mode.

Parameters
valueNew value of perturb lines flag.
Returns
On success OpenCMISS::Zinc::OK, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setProjectionMode ( ProjectionMode  projectionMode)
inline

Sets the projection mode - parallel/perspective - of the scene viewer.

Parameters
projectionModeThe new projection mode.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setScene ( const Scene scene)
inline

Set the top scene for the scene viewer. Only graphics for this scene and its descendents, filtered by the scene filter, are displayed.

See also
Sceneviewer::setScenefilter
Parameters
sceneThe top scene to display.
Returns
Status OpenCMISS::Zinc::OK on success, any other value if failed.
int OpenCMISS::Zinc::Sceneviewer::setScenefilter ( const Scenefilter scenefilter)
inline

Set the filter to be used in scene viewer. All graphics will be shown if no filter is set.

Parameters
scenefilterScene filter to set for scene viewer, or NULL to show all graphics in scene.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::setTranslationRate ( double  translationRate)
inline

Sets the rate at which translation occurs in relation to mouse movement using standard sceneviewerinput transformation processing.

Parameters
translationRateThe translation rate;
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setTransparencyLayers ( int  layers)
inline

Set the number of layers used in the TRANSPARENCY_MODE_ORDER_INDEPENDENT transparency_mode.

See also
Sceneviewer::TransparencyMode
Parameters
layersnumber of layers to be set for this scene viewer.
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Sceneviewer::setTransparencyMode ( TransparencyMode  transparencyMode)
inline

Set the transparency_mode of the scene viewer.

See also
Sceneviewer::TransparencyMode
Sceneviewer::getTransparencyMode
Parameters
transparencyModeTransparency mode to be set for sceneviewer
Returns
OpenCMISS::Zinc::OK if value is set successfully, any other value if failed.
int OpenCMISS::Zinc::Sceneviewer::setTumbleRate ( double  tumbleRate)
inline

Sets the rate at which tumble occurs in relation to mouse movement using standard sceneviewerinput transformation processing.

Parameters
tumbleRateThe tumble rate;
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setUpVector ( const double *  upVectorValuesIn3)
inline

Set the up vector of the scene viewer. Internally this is always converted into a unit vector.

Parameters
upVectorValuesIn3Array of three values containing the new up vector.
Returns
Status OpenCMISS::Zinc::OK on success, any other value on failure.
int OpenCMISS::Zinc::Sceneviewer::setViewAngle ( double  viewAngle)
inline

Sets the diagonal view angle, in radians, of the scene viewer. View angle is measured across the largest square which fits inside the viewing window.

Parameters
viewAngleThe view angle in radians, > 0.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setViewingVolume ( double  left,
double  right,
double  bottom,
double  top,
double  near_plane,
double  far_plane 
)
inline

Sets the viewing volume of the scene viewer. Unless the viewing volume is the same shape as the window, taking into account the aspect, the scene viewer will enlarge it to maintain the desired aspect ratio. Hence, the values specified represent the minimum viewing volume. The left, right, bottom and top values are at the lookat point, not on the near plane as OpenGL assumes. This gives a similar sized viewing_volume for both parallel and perspective projections. The viewing volume can be made unsymmetric to create special effects such as rendering a higher resolution image in parts.

int OpenCMISS::Zinc::Sceneviewer::setViewportMode ( ViewportMode  viewportMode)
inline

Sets the viewport mode(absolute/relative/distorting relative) for the scene viewer.

Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::setViewportSize ( int  width,
int  height 
)
inline

Sets the width and height of the scene viewer's drawing area.

int OpenCMISS::Zinc::Sceneviewer::setZoomRate ( double  zoomRate)
inline

Sets the rate at which zoom occurs in relation to mouse movement using standard sceneviewerinput transformation processing.

Parameters
zoomRateThe zoom rate;
Returns
Status OpenCMISS::Zinc::OK on success, otherwise OpenCMISS::Zinc::ERROR_ARGUMENT.
int OpenCMISS::Zinc::Sceneviewer::transformCoordinates ( Scenecoordinatesystem  inCoordinateSystem,
Scenecoordinatesystem  outCoordinateSystem,
const Scene localScene,
const double *  valuesIn3,
double *  valuesOut3 
)
inline

Transforms coordinates between scene coordinate systems relative to this scene viewer. Note: this function only works once there is an OpenGL rendering context!

Parameters
inCoordinateSystemThe coordinate system of the input values.
outCoordinateSystemThe coordinate system of the output values.
localSceneOptional local scene, relative to top scene of scene viewer from which the local-to-world transformation is obtained. If omitted the identity transformation is assumed. Only used with scene local coordinate systems, relative to world.
valuesIn3The input coordinates, 3-component.
valuesOut3The output coordinates to set, 3-component.
Returns
Status OpenCMISS::Zinc::OK on success, otherwise any error code.
int OpenCMISS::Zinc::Sceneviewer::viewAll ( )
inline

Finds the x, y and z ranges from the scene and sets the view parameters so that everything can be seen, and with window's std_view_angle. Also adjusts near and far clipping planes; if specific values are required, should follow with commands for setting these.

char* OpenCMISS::Zinc::Sceneviewer::writeDescription ( )
inline

Write the json file describing settings of the scene viewer, which can be used to store the current settings.

Returns
c string containing the json description of scene viewer, otherwise 0;
int OpenCMISS::Zinc::Sceneviewer::writeImageToFile ( const char *  file_name,
int  force_onscreen,
int  preferred_width,
int  preferred_height,
int  preferred_antialias,
int  preferred_transparency_layers 
)
inline

Writes the view in the scene viewer to the specified filename. If <preferred_width>, <preferred_height>, <preferred_antialias> or <preferred_transparency_layers> are non zero then they attempt to override the default values for just this write. The width and height cannot be overridden when the <force_onscreen> flag is set.


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