Class OGLVisibilitySensor
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseSensorNode
org.web3d.vrml.renderer.common.nodes.environment.BaseVisibilitySensor
org.web3d.vrml.renderer.ogl.nodes.environment.OGLVisibilitySensor
- All Implemented Interfaces:
org.j3d.aviatrix3d.NodeUpdateListener
,VRMLNode
,FrameStateListener
,VRMLChildNodeType
,VRMLEnvironmentalSensorNodeType
,VRMLNodeType
,VRMLSensorNodeType
,VRMLTimeDependentNodeType
,VRMLWorldRootChildNodeType
,VisibilityListener
,OGLVisibilityListener
,OGLVRMLNode
public class OGLVisibilitySensor
extends BaseVisibilitySensor
implements OGLVRMLNode, OGLVisibilityListener, org.j3d.aviatrix3d.NodeUpdateListener
OpenGL implementation of a VisibilitySensor node.
- Version:
- $Revision: 1.6 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class org.web3d.vrml.renderer.common.nodes.environment.BaseVisibilitySensor
FIELD_CENTER, FIELD_ENTER_TIME, FIELD_EXIT_TIME, FIELD_SIZE, LAST_VISIBILITYSENSOR_INDEX, vfCenter, vfEnterTime, vfExitTime, vfSize, vrmlClock
Fields inherited from class org.web3d.vrml.renderer.common.nodes.BaseSensorNode
FIELD_ENABLED, FIELD_IS_ACTIVE, LAST_SENSOR_INDEX, vfEnabled, vfIsActive
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
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new visibility sensor objectConstruct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Notification that the rendering of the event model is complete and that rendering is about to begin.org.j3d.aviatrix3d.SceneGraphObject
Get the OpenGL scene graph object representation of this node.protected void
setCenter
(float[] val) Update the center of the sensor.void
setEnabled
(boolean state) Set the sensor enabled or disabled.protected void
setSize
(float[] val) Update the size of the sensor.void
Notification that the construction phase of this node has finished.void
setVRMLClock
(VRMLClock clk) Set the vrmlClock that this time dependent node will be running with.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.void
viewPositionChanged
(javax.vecmath.Point3f position, javax.vecmath.AxisAngle4f orientation, javax.vecmath.Matrix4f localPosition) Notification that the object is still visible, but that the viewer reference point has changed.void
visibilityStateChange
(boolean visible, javax.vecmath.Point3f position, javax.vecmath.AxisAngle4f orientation, javax.vecmath.Matrix4f localPosition) Invoked when the user enters or leaves an area.Methods inherited from class org.web3d.vrml.renderer.common.nodes.environment.BaseVisibilitySensor
getFieldDeclaration, getFieldIndex, getFieldValue, getNodeFieldIndices, getNumFields, getPrimaryType, getSecondaryType, sendRoute, setValue
Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseSensorNode
copy, getEnabled, getIsActive, setValue
Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, 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, 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.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.VRMLSensorNodeType
getEnabled, getIsActive
-
Constructor Details
-
OGLVisibilitySensor
public OGLVisibilitySensor()Construct a new visibility sensor object -
OGLVisibilitySensor
Construct a new instance of this node based on the details from the given node. If the node is not the right type, an exception will be thrown.- Parameters:
node
- The node to copy- Throws:
IllegalArgumentException
- The node is not the right type
-
-
Method Details
-
setEnabled
public void setEnabled(boolean state) Set the sensor enabled or disabled.- Specified by:
setEnabled
in interfaceVRMLSensorNodeType
- Overrides:
setEnabled
in classBaseSensorNode
- Parameters:
state
- true if the sensor is to be enabled
-
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.- Specified by:
getSceneGraphObject
in interfaceOGLVRMLNode
- Returns:
- The OGL representation.
-
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
-
visibilityStateChange
public void visibilityStateChange(boolean visible, javax.vecmath.Point3f position, javax.vecmath.AxisAngle4f orientation, javax.vecmath.Matrix4f localPosition) Invoked when the user enters or leaves an area.- Specified by:
visibilityStateChange
in interfaceOGLVisibilityListener
- Parameters:
visible
- true when the user enters the areaposition
- The position of the user on entry/exitorientation
- The orientation of the user therelocalPosition
- The vworld transform object for the class that implemented this listener
-
viewPositionChanged
public void viewPositionChanged(javax.vecmath.Point3f position, javax.vecmath.AxisAngle4f orientation, javax.vecmath.Matrix4f localPosition) Notification that the object is still visible, but that the viewer reference point has changed. Ignored for this implementation.- Specified by:
viewPositionChanged
in interfaceOGLVisibilityListener
- Parameters:
position
- The new position of the userorientation
- The orientation of the user therelocalPosition
- The vworld transform object for the class that implemented this listener
-
setVRMLClock
Set the vrmlClock that this time dependent node will be running with.- Specified by:
setVRMLClock
in interfaceVRMLTimeDependentNodeType
- Overrides:
setVRMLClock
in classBaseVisibilitySensor
- Parameters:
clk
- The vrmlClock to use for this node
-
setSize
protected void setSize(float[] val) Update the size of the sensor. May be overridden by derived classes but should make sure to call this as well- Overrides:
setSize
in classBaseVisibilitySensor
- Parameters:
val
- The new size to use
-
setCenter
protected void setCenter(float[] val) Update the center of the sensor. May be overridden by derived classes but should make sure to call this as well- Overrides:
setCenter
in classBaseVisibilitySensor
- Parameters:
val
- The new center to use
-
allEventsComplete
public void allEventsComplete()Notification that the rendering of the event model is complete and that rendering is about to begin. Used to update the transformation matrix only once per frame.- Specified by:
allEventsComplete
in interfaceFrameStateListener
- Overrides:
allEventsComplete
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.
-