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.
Namespace: OIV.Inventor.ViewerComponents.Nodes
The SoViewingCube type exposes the following members.
Name | Description | |
---|---|---|
SoViewingCube | Initializes a new instance of the SoViewingCube class |
Name | Description | |
---|---|---|
AffectsState | This node does not affect the state. | |
Callback | (Inherited from SoNode.) | |
Copy | Calls Copy(false). (Inherited from SoNode.) | |
Copy(Boolean) | Creates and returns an exact copy of the node. | |
CopyFieldValues(SoFieldContainer) | Calls CopyFieldValues(fc, false). (Inherited from SoFieldContainer.) | |
CopyFieldValues(SoFieldContainer, Boolean) | Copies the contents of fc's fields into this object's fields. | |
Dispose |
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.) | |
Distribute | (Inherited from SoNode.) | |
DoAction | (Inherited from SoNode.) | |
EnableNotify | Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false). | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FieldsAreEqual | Returns true if this object's fields are exactly equal to fc's fields. | |
Get | Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
GetAllFields | Returns a list of fields, including the eventIn's and eventOut's. | |
GetAlternateRep | This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type). | |
GetBoundingBox | (Inherited from SoNode.) | |
GetEventIn | Returns a the eventIn with the given name. | |
GetEventOut | Returns the eventOut with the given name. | |
GetField | Returns a the field of this object whose name is fieldName. | |
GetFieldName | Returns the name of the given field in the fieldName argument. | |
GetFields | Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetMatrix | (Inherited from SoNode.) | |
GetName | Returns the name of an instance. | |
GetPrimitiveCount | (Inherited from SoNode.) | |
GetRenderEngineMode | Returns the supported Render engine mode. | |
GetRenderUnitID | (Inherited from SoNode.) | |
GetStringName | (Inherited from SoBase.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GLRender | (Overrides SoNodeGLRender(SoGLRenderAction).) | |
GLRenderBelowPath | (Inherited from SoNode.) | |
GLRenderInPath | (Inherited from SoNode.) | |
GLRenderOffPath | (Inherited from SoNode.) | |
GrabEventsCleanup | (Inherited from SoNode.) | |
GrabEventsSetup | (Inherited from SoNode.) | |
HandleEvent | (Overrides SoNodeHandleEvent(SoHandleEventAction).) | |
HasDefaultValues | Returns true if all of the object's fields have their default values. | |
IsBoundingBoxIgnoring | 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. | |
IsNotifyEnabled | Notification is the process of telling interested objects that this object has changed. | |
IsOverride | Returns the state of the override flag. | |
IsSynchronizable | Gets the ScaleViz synchronizable state of this object. | |
Pick | (Inherited from SoNode.) | |
RayPick | (Inherited from SoNode.) | |
Search | (Inherited from SoNode.) | |
Set | 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. | |
SetName | (Inherited from SoBase.) | |
SetOverride | Turns the override flag on or off. | |
SetSynchronizable | Sets this to be a ScaleViz synchronizable object. | |
SetToDefaults | Sets all fields in this object to their default values. | |
ToString |
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.) | |
Touch | Marks an instance as modified, simulating a change to it. | |
Write | (Inherited from SoNode.) |
Name | Description | |
---|---|---|
animationDuration | Duration of camera movement to reach the desired position. | |
compass | Defines an additional and optional scene graph to visualize a compass encapsulated in the viewing cube. | |
cornerColor | Color used to render the corners of the cube. | |
edgeColor | Color used to render the edges of the cube. | |
edgeSize | Size of the edges, relative to the size of the faces. | |
edgeStyle | Style of edges and corners. | |
faceColor | Color used to render the faces of the cube. | |
faceNegX | Texture to customize the face's appearance which has a "Left" label by default. | |
faceNegY | Texture to customize the face's appearance which has a "Bottom" label by default. | |
faceNegZ | Texture to customize the face's appearance which has a "Back" label by default. | |
facePosX | Texture to customize the face's appearance which has a "Right" label by default. | |
facePosY | Texture to customize the face's appearance which has a "Top" label by default. | |
facePosZ | Texture to customize the face's appearance which has a "Front" label by default. | |
IsDisposable | ISafeDisposable interface implementation.
(Inherited from SoDisposable.) | |
opacityMax | Defines the viewing cube opacity when the cursor is close to it or over it. | |
opacityMin | Defines the viewing cube opacity when the cursor is far from it. | |
position | Position of the viewing cube in the scene camera viewport. | |
sceneCamera | Camera which is synchronized with this viewing cube. | |
selectionColor | Color used to highlight the part of the viewing cube that is under the cursor. | |
size | Size of the viewport, in pixels, in which the viewing cube is drawn. | |
upAxis | Up axis of the scene. | |
UserData |
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.) |
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 pickable 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 pickable. 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 features. 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 |
Opacity
The viewing cube's opacity may vary depending on the distance between it and the cursor.
if the cursor is far from the center of the cube, the OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.opacityMin is applied.
if the cursor is very close or over the cube, the OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.opacityMax is applied.
otherwise the opacity varies in the range [opacityMin, opacityMax]
When the cursor moves in an area close to the cube but not over the cube and if the opacityMin and opacityMax differ, a rendering of the scene occurs each time the mouse is moved in this area, which can lead to slowing down of the application.
By default, OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.opacityMin and OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.opacityMax are set to 1, which means the cube is always opaque.
Limitations:
Some visual artifact on semi transparent ViewingCube when you use NO_SORT transparency type.
The opacity of the ViewingCube is only updated on a mouse move event without button pressed. Therefore the opacity won't change if you move the mouse without pressing a button.
Compass The OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.compass is not impacted by the varying opacity, thus independently from the fields OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.opacityMin and OIV.Inventor.ViewerComponents.Nodes.SoViewingCube.opacityMax
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.
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 | "" |
opacityMin | 1 |
opacityMax | 1 |
compass | NULL |