OpenCMISS-Zinc C++ API Documentation
|
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) | |
Sceneviewer & | operator= (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 |
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.
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.
Controls the way the mouse and keyboard are used to interact with the scene viewer.
Specifies the sort of projection matrix used to render the 3D scene.
Specifies whether a STEREO capable scene viewer is required. This will have to work in cooperation with your window manager and hardware.
Controls the way partially transparent objects are rendered in scene viewer.
Specifies the behaviour of the NDC coordinates with respect to the size of the viewport.
|
inline |
Adds a light to the Scene_viewer list of lights.
light | Handle to the light to be added to scene viewer. |
|
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.
|
inline |
Create a scene viewer input object for manually setting mouse or other input event data.
|
inline |
Create a notifier for getting callbacks for changes to the scene viewer.
|
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.
scene | The handle to the sceneviewer. |
|
inline |
Gets the number of jitter samples used to antialias the scene viewer.
|
inline |
Get the alpha opacity component of the scene viewer background colour.
|
inline |
Get the background colour of the scene viewer.
valuesOut3 | Three colour components in order [red, green, blue], with values in [0, 1.0]. |
|
inline |
Get the eye position of the scene viewer.
eyeValuesOut3 | Array of size 3 to hold the values of the eye position. |
|
inline |
Gets the distance from the eye_point to the far clipping plane in the scene viewer.
|
inline |
Return the C handle of the Sceneviewer object.
|
inline |
Gets the mouse and keyboard interaction mode of the scene viewer.
|
inline |
Gets the 3 main viewing parameters of the scene viewer: eye point, lookat point and up vector in a single call.
eyeValuesOut3 | Array of size 3 to receive the coordinates of the point you are looking from. |
lookatValuesOut3 | Array of size 3 to receive the coordinates of the point you are looking at, often also called the interest point. |
upVectorValuesOut3 | Array of size 3 to receive the vector giving the up orientation in the scene viewer. |
|
inline |
Get the lookat position of the scene viewer.
lookatValuesOut3 | Array of size 3 to hold the values of the lookat position. |
|
inline |
Gets the distance from the eye_point to the near clipping plane in the scene viewer.
|
inline |
Query whether lines are perturbed to appear in front of surfaces at the same depth to avoid visual stitching artefacts.
|
inline |
Gets the projection mode - parallel/perspective - of the scene viewer.
|
inline |
Get the top scene for the scene viewer.
|
inline |
Get the filter currently used in scene viewer.
|
inline |
Gets the rate at which translation occurs in relation to mouse movement using standard sceneviewerinput transformation processing.
|
inline |
Get the number of layers used in the TRANSPARENCY_MODE_ORDER_INDEPENDENT transparency mode.
|
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.
|
inline |
Gets the rate at which tumble occurs in relation to mouse movement using standard sceneviewerinput transformation processing.
|
inline |
Get the up vector of the scene viewer.
upVectorValuesOut3 | Array of size 3 to hold the values of the up vector. |
|
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.
|
inline |
Gets the viewing volume of the scene viewer.
|
inline |
Gets the viewport mode (absolute/relative/distorting relative) for the scene viewer.
|
inline |
Gets the rate at which zoom occurs in relation to mouse movement using standard sceneviewerinput transformation processing.
|
inline |
Check if a light is on Scene_viewer list of lights.
light | Handle to the light to be checked. |
|
inline |
Queries whether local viewer lighting is used by the scene viewer.
|
inline |
Queries whether two-sided lighting is used for rendering polygons.
|
inline |
Check if this is a valid Sceneviewer object.
|
inline |
Manually calls the scene viewer's list of input callbacks with the supplied input data.
input | Description of the input event. |
|
inline |
Read the json description to the scene viewer. This will change the settings of the scene viewer.
The string containing json description
|
inline |
Remove a light from the Scene_viewer list of lights.
light | Handle to the light to be removed from scene viewer. |
|
inline |
Forces a redraw of the given scene viewer to take place immediately
|
inline |
Sets the number of jitter samples used to antialias the scene viewer.
numberOfSamples | The number of jitter samples used to antialias the graphics. Only 2, 4 or 8 samples are supported. Zero disables antialiasing. |
|
inline |
Set the alpha opacity component of the scene viewer background colour. The remaining components of the background colour are unchanged.
alpha | The alpha value in [0, 1.0] where 0.0 is transparent, 1.0 is opaque. |
|
inline |
Set the background colour of the scene viewer by individual component. Each component should be in the range [0, 1.0].
red | The red component value between [0, 1.0]. |
green | The green component value between [0, 1.0]. |
blue | The blue component value between [0, 1.0]. |
|
inline |
Set the background colour of the scene viewer.
valuesIn3 | Three colour components in order [red, green, blue], with values in [0, 1.0]. |
|
inline |
Set the eye position of the scene viewer.
eyeValuesIn3 | Array of three values containing the new eye position. |
|
inline |
Sets the distance from the eye_point to the far clipping plane in the scene viewer.
farClippingPlane | distance from the eye_point to the far clipping plane |
|
inline |
Sets the mouse and keyboard interaction mode of the scene viewer.
|
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.
value | The new state of the local viewer lighting flag. |
|
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.
value | The new state of the two-sided lighting flag. |
|
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.
eyeValuesIn3 | The 3 coordinates of the point you are looking from. It is an error if this is at the same as the lookat point. |
lookatValuesIn3 | The 3 coordinates of the point you are looking at, often also called the interest point. |
upVectorValuesIn3 | A 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. |
|
inline |
Set the lookat position of the scene viewer.
lookatValuesIn3 | Array of three values containing the new lookat position. |
|
inline |
Sets the distance from the eye_point to the near clipping plane in the scene viewer.
nearClippingPlane | distance from the eye_point to the near clipping plane |
|
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.
value | New value of perturb lines flag. |
|
inline |
Sets the projection mode - parallel/perspective - of the scene viewer.
projectionMode | The new projection mode. |
|
inline |
Set the top scene for the scene viewer. Only graphics for this scene and its descendents, filtered by the scene filter, are displayed.
scene | The top scene to display. |
|
inline |
Set the filter to be used in scene viewer. All graphics will be shown if no filter is set.
scenefilter | Scene filter to set for scene viewer, or NULL to show all graphics in scene. |
|
inline |
Sets the rate at which translation occurs in relation to mouse movement using standard sceneviewerinput transformation processing.
translationRate | The translation rate; |
|
inline |
Set the number of layers used in the TRANSPARENCY_MODE_ORDER_INDEPENDENT transparency_mode.
layers | number of layers to be set for this scene viewer. |
|
inline |
Set the transparency_mode of the scene viewer.
transparencyMode | Transparency mode to be set for sceneviewer |
|
inline |
Sets the rate at which tumble occurs in relation to mouse movement using standard sceneviewerinput transformation processing.
tumbleRate | The tumble rate; |
|
inline |
Set the up vector of the scene viewer. Internally this is always converted into a unit vector.
upVectorValuesIn3 | Array of three values containing the new up vector. |
|
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.
viewAngle | The view angle in radians, > 0. |
|
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.
|
inline |
Sets the viewport mode(absolute/relative/distorting relative) for the scene viewer.
|
inline |
Sets the width and height of the scene viewer's drawing area.
|
inline |
Sets the rate at which zoom occurs in relation to mouse movement using standard sceneviewerinput transformation processing.
zoomRate | The zoom rate; |
|
inline |
Transforms coordinates between scene coordinate systems relative to this scene viewer. Note: this function only works once there is an OpenGL rendering context!
inCoordinateSystem | The coordinate system of the input values. |
outCoordinateSystem | The coordinate system of the output values. |
localScene | Optional 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. |
valuesIn3 | The input coordinates, 3-component. |
valuesOut3 | The output coordinates to set, 3-component. |
|
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.
|
inline |
Write the json file describing settings of the scene viewer, which can be used to store the current settings.
|
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.