Click or drag to resize
SoViewingCube Class

Interactive cubic shape to control the orientation of a camera.

Preview Feature: this class is fully supported and can be used in Open Inventor applications. Being tagged as a Preview Feature just means that the implementation is still subject to API changes and adjustments based on feedback from early adopters. Please be also aware that source compatibility might be broken regardless of the Open Inventor compatibility changes policy due to our commitment to bring needed changes to be sure the specifications of this Preview Feature match the expectations of our customers.

Inheritance Hierarchy

Namespace: OIV.Inventor.ViewerComponents.Nodes
Assembly: OIV.Inventor (in OIV.Inventor.dll) Version: 10.9.2.0 (10.9.2.0)
Syntax
public class SoViewingCube : SoNode

The SoViewingCube type exposes the following members.

Constructors
  NameDescription
Public methodSoViewingCube
Initializes a new instance of the SoViewingCube class
Top
Methods
  NameDescription
Public methodAffectsState

This node does not affect the state.

(Overrides SoNodeAffectsState.)
Public methodCallback
(Inherited from SoNode.)
Public methodCopy
Calls Copy(false).
(Inherited from SoNode.)
Public methodCopy(Boolean)

Creates and returns an exact copy of the node.

(Inherited from SoNode.)
Public methodCopyFieldValues(SoFieldContainer)
Calls CopyFieldValues(fc, false).
(Inherited from SoFieldContainer.)
Public methodCopyFieldValues(SoFieldContainer, Boolean)

Copies the contents of fc's fields into this object's fields.

(Inherited from SoFieldContainer.)
Public methodDispose
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.)
Public methodDistribute
(Inherited from SoNode.)
Public methodDoAction
(Inherited from SoNode.)
Public methodEnableNotify

Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false).

(Inherited from SoFieldContainer.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFieldsAreEqual

Returns true if this object's fields are exactly equal to fc's fields.

(Inherited from SoFieldContainer.)
Public methodGet

Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.

(Inherited from SoFieldContainer.)
Public methodGetAllFields

Returns a list of fields, including the eventIn's and eventOut's.

(Inherited from SoFieldContainer.)
Public methodGetAlternateRep

This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type).

(Inherited from SoNode.)
Public methodGetBoundingBox
(Inherited from SoNode.)
Public methodGetEventIn

Returns a the eventIn with the given name.

(Inherited from SoFieldContainer.)
Public methodGetEventOut

Returns the eventOut with the given name.

(Inherited from SoFieldContainer.)
Public methodGetField

Returns a the field of this object whose name is fieldName.

(Inherited from SoFieldContainer.)
Public methodGetFieldName

Returns the name of the given field in the fieldName argument.

(Inherited from SoFieldContainer.)
Public methodGetFields

Appends references to all of this object's fields to resultList, and returns the number of fields appended.

(Inherited from SoFieldContainer.)
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetMatrix
(Inherited from SoNode.)
Public methodGetName

Returns the name of an instance.

(Inherited from SoBase.)
Public methodGetPrimitiveCount
(Inherited from SoNode.)
Public methodGetRenderEngineMode

Returns the supported Render engine mode.

(Inherited from SoNode.)
Public methodGetRenderUnitID
(Inherited from SoNode.)
Public methodGetStringName (Inherited from SoBase.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGLRender
Public methodGLRenderBelowPath
(Inherited from SoNode.)
Public methodGLRenderInPath
(Inherited from SoNode.)
Public methodGLRenderOffPath
(Inherited from SoNode.)
Public methodGrabEventsCleanup
(Inherited from SoNode.)
Public methodGrabEventsSetup
(Inherited from SoNode.)
Public methodHandleEvent
Public methodHasDefaultValues

Returns true if all of the object's fields have their default values.

(Inherited from SoFieldContainer.)
Public methodIsBoundingBoxIgnoring

This method is used by getBoundingBox action traversal to know if the current node must be traversed or not, ie the bounding should be ignored.

(Inherited from SoNode.)
Public methodIsNotifyEnabled

Notification is the process of telling interested objects that this object has changed.

(Inherited from SoFieldContainer.)
Public methodIsOverride

Returns the state of the override flag.

(Inherited from SoNode.)
Public methodIsSynchronizable

Gets the ScaleViz synchronizable state of this object.

(Inherited from SoBase.)
Public methodPick
(Inherited from SoNode.)
Public methodRayPick
(Inherited from SoNode.)
Public methodSearch
(Inherited from SoNode.)
Public methodSet

Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.

(Inherited from SoFieldContainer.)
Public methodSetName (Inherited from SoBase.)
Public methodSetOverride

Turns the override flag on or off.

(Inherited from SoNode.)
Public methodSetSynchronizable

Sets this to be a ScaleViz synchronizable object.

(Inherited from SoBase.)
Public methodSetToDefaults

Sets all fields in this object to their default values.

(Inherited from SoFieldContainer.)
Public methodToString
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.)
Public methodTouch

Marks an instance as modified, simulating a change to it.

(Inherited from SoNode.)
Public methodWrite
(Inherited from SoNode.)
Top
Properties
  NameDescription
Public propertyanimationDuration

Duration of camera movement to reach the desired position.

Public propertycornerColor

Color used to render the corners of the cube.

Public propertyedgeColor

Color used to render the edges of the cube.

Public propertyedgeSize

Size of the edges, relative to the size of the faces.

Public propertyedgeStyle

Style of edges and corners.

Public propertyfaceColor

Color used to render the faces of the cube.

Public propertyfaceNegX

Texture to customize the face's appearance which has a "Left" label by default.

Public propertyfaceNegY

Texture to customize the face's appearance which has a "Bottom" label by default.

Public propertyfaceNegZ

Texture to customize the face's appearance which has a "Back" label by default.

Public propertyfacePosX

Texture to customize the face's appearance which has a "Right" label by default.

Public propertyfacePosY

Texture to customize the face's appearance which has a "Top" label by default.

Public propertyfacePosZ

Texture to customize the face's appearance which has a "Front" label by default.

Public propertyIsDisposable
ISafeDisposable interface implementation.
(Inherited from SoDisposable.)
Public propertyposition

Position of the viewing cube in the scene camera viewport.

Public propertysceneCamera

Camera which is synchronized with this viewing cube.

Public propertyselectionColor

Color used to highlight the part of the viewing cube that is under the cursor.

Public propertysize

Size of the viewport, in pixels, in which the viewing cube is drawn.

Public propertyupAxis

Up axis of the scene.

Public propertyUserData
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.)
Top
Remarks

The viewing cube is an interactive shape that indicates the current orientation of a camera (like a "compass" or "gnomon") and also responds to user actions by re-orienting the associated camera to one of the predefined orientations. These orientations are defined so that the camera will be in front of a selected part of the bounding cube of the scene.

Interactions

When the mouse cursor is over the viewing cube, the part (face, edge, or corner) that is under the cursor is highlighted with the OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.selectionColor. Then if the left mouse button (button 1) is clicked (pressed and released), the selected part of the viewing cube is used to define the new orientation.

The viewing cube can be used as a replacement for the X/Y/Z camera orientation buttons implemented in many graphical user interfaces. It provides even more possibilities thanks to the pick-able edges and corners of the viewing cube which offer 26 different viewing positions. However if the OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.edgeSize is set to 0, the edges and corners are not pick-able. In this case the user can only select six different positions.

The camera controlled by the viewing cube is defined by the field OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.sceneCamera. This is normally the same camera that the 3D viewer is controlling. In this case both the viewer and the viewing cube control the camera and the viewing cube orientation is synchronized with the OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.sceneCamera.

In principle, as OIV.Inventor.ViewerComponents.Nodes.SoViewingCube is a standard class derived from OIV.Inventor.Nodes.SoNode, it can be inserted in any scene graph and used with a classical viewer or SceneExaminer class. In that case the viewing cube will correctly indicate the camera orientation, but it will not be convenient for the user to use the viewing cube's interaction feature. These viewers are always in either viewing mode (mouse events control the camera) or in selection mode (mouse events are sent to the scene graph). In viewing mode, the viewing cube will not respond to mouse clicks, but in selection mode the viewer will not respond to mouse clicks.

Therefore we recommend to use the SceneOrbiter class as the viewer when using a viewing cube. SceneOrbiter is a "mode less" viewer. A mouse click without moving the mouse is interpreted as a selection (for example triggering the viewing cube behavior), but a mouse click and "drag" is interpreted as controlling the camera. For convenience, the SceneOrbiter automatically adds a viewing cube to the scene graph.

The viewing cube is rendered in a corner of the render area. Its size and position in the render area are defined by the OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.size and OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.position fields.

viewing cube at the top right corner of a render area

Rendering customization

When the mouse cursor is moved on top of the viewing cube, the part that is under the cursor is highlighted using the color defined by the field OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.selectionColor. The colors of the cube can also be personalized with 3 fields: OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.faceColor, OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.edgeColor and OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.cornerColor.

Cubic shape customization

The shape of the viewing cube can be customized by several fields. The shape of the edges and corners is defined by the field OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.edgeStyle. The edges can form a sharp corner, be rounded or be flat (beveled). The size of the edges and corners relative to the cube face is defined by the field OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.edgeSize.

OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.edgeStyle=ROUND and OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.edgeSize=0.1

Each flat face of the viewing cube can also be customized. By default the text Top/Bottom/Front/Back/Left/Right appears on the center of each face according to its orientation. The six fields OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.facePosX ... OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.faceNegZ allow the application to replace the default appearance of each face with an image. Note that these images should have a transparent background so the highlight color is visible when the cursor is over the face.

viewing cube custom faces with F/R/B textures

Animation

To provide a better user experience, picking a part of the viewing cube does not immediately change the camera orientation. A smooth animation is done between the current camera orientation and the new orientation. The duration of the animation is defined by the OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.animationDuration field.

Note that the animation of the camera is done in such a way that the default text of each face Top/Bottom/Front/Back/Left/Right are always legible.

FILE FORMAT/DEFAULT

ViewingCube {
sceneCamera NULL
size (150.0, 150.0)
position TOP_RIGHT
edgeStyle ROUND
edgeSize 0.4
selectionColor cyan
faceColor 0.8 0.8 0.8
edgeColor 0.8 0.8 0.8
cornerColor 0.8 0.8 0.8
animationDuration 0.8
upAxis "Y"
facePosX ""
faceNegX ""
facePosY ""
faceNegY ""
facePosZ ""
faceNegZ ""
}

See Also