Class OGLViewpoint
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseBindableNode
org.web3d.vrml.renderer.common.nodes.navigation.BaseViewpoint
org.web3d.vrml.renderer.ogl.nodes.navigation.OGLViewpoint
- All Implemented Interfaces:
org.j3d.aviatrix3d.NodeUpdateListener
,VRMLNode
,FrameStateListener
,VRMLBindableNodeType
,VRMLChildNodeType
,VRMLNodeType
,VRMLTimeDependentNodeType
,VRMLViewpointNodeType
,VRMLWorldRootChildNodeType
,OGLBindableNodeType
,OGLTransformNodeType
,OGLViewpointNodeType
,OGLVRMLNode
public class OGLViewpoint
extends BaseViewpoint
implements OGLViewpointNodeType, org.j3d.aviatrix3d.NodeUpdateListener, OGLTransformNodeType
OGL implementation of a Viewpoint node.
Viewpoints cannot be shared using DEF/USE. They may be named as such for Anchor purposes, but attempting to reuse them will cause an error. This implementation does not provide any protection against USE of this node and attempting to do so will result in exceptions - most probably in the grouping node that includes this node.
- Version:
- $Revision: 1.26 $
- Author:
- Alan Hudson
-
Field Summary
Fields inherited from class org.web3d.vrml.renderer.common.nodes.navigation.BaseViewpoint
FIELD_CENTEROFROTATION, FIELD_DESCRIPTION, FIELD_FARDISTANCE, FIELD_FIELDOFVIEW, FIELD_JUMP, FIELD_NEARDISTANCE, FIELD_ORIENTATION, FIELD_POSITION, FIELD_RETAIN_USER_OFFSETS, FIELD_VIEWALL, LAST_VIEWPOINT_INDEX, NUM_FIELDS, vfCenterOfRotation, vfDescription, vfFarDistance, vfFieldOfView, vfJump, vfNearDistance, vfOrientation, vfPosition, vfRetainUserOffsets, vfViewAll, viewpointListeners
Fields inherited from class org.web3d.vrml.renderer.common.nodes.BaseBindableNode
FIELD_BIND, FIELD_BIND_TIME, FIELD_IS_BOUND, isOnStack, LAST_BINDABLE_INDEX, vfBindTime, vfIsBound
Fields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
errorReporter, FIELD_METADATA, fieldLocalData, hasChanged, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, STATIC_SCENE_GRAPH, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
Fields inherited from interface org.web3d.vrml.nodes.VRMLViewpointNodeType
PROJECTION_ORTHO, PROJECTION_PERSPECTIVE
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a default viewpoint instanceOGLViewpoint
(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionorg.j3d.aviatrix3d.TransformGroup
Get the parent transform used to control the view platform.org.j3d.aviatrix3d.SceneGraphObject
Get the OpenGL scene graph object representation of this node.javax.vecmath.Matrix4f
Get the transform matrix for this node.javax.vecmath.Matrix4f
Get the default Transform representation of this viewpoint based on its current position and orientation values.void
setNavigationTransform
(javax.vecmath.Matrix4f trans) Set a new transform for this viewpoint.protected void
setOrientation
(float[] dir) Convenience method to set the orientation of the viewpoint.protected void
setPosition
(float[] pos) Convenience method to set the position of the viewpoint.void
Notification that the construction phase of this node has finished.void
setWorldScale
(float scale) Set the world scale applied.void
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.void
Notification that its safe to update the node now with any operations that only change the node's properties, but do not change the bounds.Methods inherited from class org.web3d.vrml.renderer.common.nodes.navigation.BaseViewpoint
addViewpointListener, fireCenterOfRotationChanged, fireFieldOfViewChanged, getCenterOfRotation, getDescription, getFarDistance, getFieldDeclaration, getFieldIndex, getFieldOfView, getFieldValue, getJump, getNearDistance, getNodeFieldIndices, getNumFields, getPrimaryType, getProjectionType, getRetainUserOffsets, getViewAll, removeViewpointListener, sendRoute, setCenterOfRotation, setDescription, setFarDistance, setFieldOfView, setJump, setNearDistance, setRetainUserOffsets, setValue, setValue, setValue, setValue, setViewAll
Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseBindableNode
addBindableNodeListener, copy, fireIsBoundChanged, getBindTime, getIsBound, getSecondaryType, removeBindableNodeListener, setBind, setOnStack, setVRMLClock
Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, allEventsComplete, checkNodeType, checkSecondaryType, checkSecondaryType, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, updateRefs
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.web3d.vrml.nodes.FrameStateListener
allEventsComplete
Methods inherited from interface org.web3d.vrml.renderer.ogl.nodes.OGLBindableNodeType
setOnStack
Methods inherited from interface org.web3d.vrml.nodes.VRMLBindableNodeType
addBindableNodeListener, getBindTime, getIsBound, removeBindableNodeListener, setBind
Methods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getPrimaryType, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersion
Methods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getFieldValue, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, sendRoute, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
Methods inherited from interface org.web3d.vrml.nodes.VRMLViewpointNodeType
addViewpointListener, getCenterOfRotation, getDescription, getFieldOfView, getJump, getProjectionType, getRetainUserOffsets, getViewAll, removeViewpointListener, setCenterOfRotation, setDescription, setJump, setRetainUserOffsets, setViewAll
-
Constructor Details
-
OGLViewpoint
public OGLViewpoint()Construct a default viewpoint instance -
OGLViewpoint
Construct a new instance of this node based on the details from the given node. If the node is not the same type, an exception will be thrown.- Parameters:
node
- The node to copy- Throws:
IllegalArgumentException
- The node is not the same type
-
-
Method Details
-
getSceneGraphObject
public org.j3d.aviatrix3d.SceneGraphObject getSceneGraphObject()Get the OpenGL scene graph object representation of this node. This will need to be cast to the appropriate parent type when being used. Default implementation returns null.- Specified by:
getSceneGraphObject
in interfaceOGLVRMLNode
- Returns:
- The OpenGL representation.
-
setPosition
protected void setPosition(float[] pos) Convenience method to set the position of the viewpoint.- Overrides:
setPosition
in classBaseViewpoint
- Parameters:
pos
- The position vector to use
-
setOrientation
protected void setOrientation(float[] dir) Convenience method to set the orientation of the viewpoint.- Overrides:
setOrientation
in classBaseViewpoint
- Parameters:
dir
- The orientation quaternion to use
-
setupFinished
public void setupFinished()Notification that the construction phase of this node has finished. If the node would like to do any internal processing, such as setting up geometry, then go for it now.- Specified by:
setupFinished
in interfaceVRMLNodeType
- Overrides:
setupFinished
in classAbstractNode
-
updateNodeBoundsChanges
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.- Specified by:
updateNodeBoundsChanges
in interfaceorg.j3d.aviatrix3d.NodeUpdateListener
- Parameters:
src
- The node or Node Component that is to be updated.
-
updateNodeDataChanges
Notification that its safe to update the node now with any operations that only change the node's properties, but do not change the bounds.- Specified by:
updateNodeDataChanges
in interfaceorg.j3d.aviatrix3d.NodeUpdateListener
- Parameters:
src
- The node or Node Component that is to be updated.
-
getTransform
public javax.vecmath.Matrix4f getTransform()Get the transform matrix for this node. A reference is ok as the users of this method will not modify the matrix. This- Specified by:
getTransform
in interfaceOGLTransformNodeType
- Returns:
- The matrix.
-
getViewTransform
public javax.vecmath.Matrix4f getViewTransform()Get the default Transform representation of this viewpoint based on its current position and orientation values. This is used to reset the viewpoint to the original position after the user has moved around or we transition between two viewpoints. It should remain independent of the underlying TransformGroup.- Specified by:
getViewTransform
in interfaceOGLViewpointNodeType
- Returns:
- The default transform of this viewpoint
-
getPlatformGroup
public org.j3d.aviatrix3d.TransformGroup getPlatformGroup()Get the parent transform used to control the view platform. Used for the navigation controls.- Specified by:
getPlatformGroup
in interfaceOGLViewpointNodeType
- Returns:
- The current view TransformGroup
-
setWorldScale
public void setWorldScale(float scale) Set the world scale applied. This will scale down navinfo parameters to fit into the world.- Specified by:
setWorldScale
in interfaceOGLViewpointNodeType
- Parameters:
scale
- The new world scale.
-