Class BaseTextureBackground
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseBindableNode
org.web3d.vrml.renderer.common.nodes.enveffects.BaseTextureBackground
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLBackgroundNodeType
,VRMLBindableNodeType
,VRMLChildNodeType
,VRMLNodeType
,VRMLTimeDependentNodeType
,VRMLWorldRootChildNodeType
- Direct Known Subclasses:
NRTextureBackground
,OGLTextureBackground
public abstract class BaseTextureBackground
extends BaseBindableNode
implements VRMLBackgroundNodeType
Common base implementation of a TextureBackground node.
TODO: This is a very light copy of background right now to get transparency in
- Version:
- $Revision: 1.9 $
- Author:
- Alan Hudson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
protected static final int
protected static final String[]
An empty list of URL fields for initializationprotected static final int
Index of the backUrl fieldprotected static final int
Index of the bottomUrl fieldprotected static final int
Index of the frontUrl fieldprotected static final int
Index of the groundAngle fieldprotected static final int
Index of the groundColor fieldprotected static final int
Index of the leftUrl fieldprotected static final int
Index of the rightUrl fieldprotected static final int
Index of the skyAngle fieldprotected static final int
Index of the skyColor fieldprotected static final int
Index of the topUrl fieldprotected static final int
Index of the topUrl fieldprotected static final int
protected static final int
protected static final int
The last field index used by this classprotected static final int
protected static final int
protected static final int
The number of fields implementedprotected int
Number of valid values in vfGroundAngleprotected int
Number of valid values in vfGroundColorprotected int
Number of valid values in vfSkyAngleprotected int
Number of valid values in vfSkyColorprotected static final int
protected static final int
protected static final int
protected VRMLNodeType
MFString backTexture listprotected VRMLNodeType
MFString bottomTexture listprotected VRMLNodeType
MFString frontTexture listprotected float[]
MFFloat groundAngleprotected float[]
MFColor groundColorprotected VRMLNodeType
MFString leftTexture listprotected VRMLNodeType
MFString rightTexture listprotected float[]
MFFloat skyAngleprotected float[]
MFColor skyColorprotected VRMLNodeType
MFString topTexture listprotected float
SFFloat transparencyFields 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
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Create a new, default instance of this class.protected
Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptiongetFieldDeclaration
(int index) Get the declaration of the field at the given index.int
getFieldIndex
(String fieldName) Get the index of the given field name.getFieldValue
(int index) Get the value of a field.void
getGroundValues
(float[] color, float[] angle) Fetch the color and angles for the ground values.int[]
Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).int
Get the number of fields.int
Get the number of valid ground color values that are currently defined.int
Get the number of valid sky color values that are currently defined.int
Get the primary type of this node.int[]
Get the secondary type of this node.void
getSkyValues
(float[] color, float[] angle) Fetch the color and angles for the sky values.float
Get the transparency of the background.void
sendRoute
(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.void
setTransparency
(float val) Set the transparency of the background.void
setValue
(int index, float value) Set the value of the field at the given index as an array of floats.void
setValue
(int index, float[] value, int numValid) Set the value of the field at the given index as an array of floats.void
Set the value of the field at the given index as an array of strings.void
setValue
(int index, VRMLNodeType child) Set the value of the field at the given index as an array of nodes.Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseBindableNode
addBindableNodeListener, copy, fireIsBoundChanged, getBindTime, getIsBound, removeBindableNodeListener, setBind, setOnStack, setValue, 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, setupFinished, setUserData, 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.nodes.VRMLBindableNodeType
addBindableNodeListener, getBindTime, getIsBound, removeBindableNodeListener, setBind, setOnStack
Methods inherited from interface org.web3d.vrml.lang.VRMLNode
getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersion
Methods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setFrameStateManager, setMetadataObject, setupFinished, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Field Details
-
FIELD_GROUND_ANGLE
protected static final int FIELD_GROUND_ANGLEIndex of the groundAngle field- See Also:
-
FIELD_GROUND_COLOR
protected static final int FIELD_GROUND_COLORIndex of the groundColor field- See Also:
-
FIELD_SKY_ANGLE
protected static final int FIELD_SKY_ANGLEIndex of the skyAngle field- See Also:
-
FIELD_SKY_COLOR
protected static final int FIELD_SKY_COLORIndex of the skyColor field- See Also:
-
FIELD_BACK_TEXTURE
protected static final int FIELD_BACK_TEXTUREIndex of the backUrl field- See Also:
-
FIELD_FRONT_TEXTURE
protected static final int FIELD_FRONT_TEXTUREIndex of the frontUrl field- See Also:
-
FIELD_LEFT_TEXTURE
protected static final int FIELD_LEFT_TEXTUREIndex of the leftUrl field- See Also:
-
FIELD_RIGHT_TEXTURE
protected static final int FIELD_RIGHT_TEXTUREIndex of the rightUrl field- See Also:
-
FIELD_BOTTOM_TEXTURE
protected static final int FIELD_BOTTOM_TEXTUREIndex of the bottomUrl field- See Also:
-
FIELD_TOP_TEXTURE
protected static final int FIELD_TOP_TEXTUREIndex of the topUrl field- See Also:
-
FIELD_TRANSPARENCY
protected static final int FIELD_TRANSPARENCYIndex of the topUrl field- See Also:
-
LAST_BACKGROUND_INDEX
protected static final int LAST_BACKGROUND_INDEXThe last field index used by this class- See Also:
-
NUM_FIELDS
protected static final int NUM_FIELDSThe number of fields implemented- See Also:
-
EMPTY_LIST
An empty list of URL fields for initialization -
BACK
protected static final int BACK- See Also:
-
FRONT
protected static final int FRONT- See Also:
-
LEFT
protected static final int LEFT- See Also:
-
RIGHT
protected static final int RIGHT- See Also:
-
TOP
protected static final int TOP- See Also:
-
BOTTOM
protected static final int BOTTOM- See Also:
-
SKY_SPHERE
protected static final int SKY_SPHERE- See Also:
-
GROUND_SPHERE
protected static final int GROUND_SPHERE- See Also:
-
NUM_BG_OBJECTS
protected static final int NUM_BG_OBJECTS- See Also:
-
vfBackTexture
MFString backTexture list -
vfFrontTexture
MFString frontTexture list -
vfLeftTexture
MFString leftTexture list -
vfRightTexture
MFString rightTexture list -
vfTopTexture
MFString topTexture list -
vfBottomTexture
MFString bottomTexture list -
vfGroundAngle
protected float[] vfGroundAngleMFFloat groundAngle -
vfGroundColor
protected float[] vfGroundColorMFColor groundColor -
vfSkyAngle
protected float[] vfSkyAngleMFFloat skyAngle -
vfSkyColor
protected float[] vfSkyColorMFColor skyColor -
vfTransparency
protected float vfTransparencySFFloat transparency -
numGroundAngle
protected int numGroundAngleNumber of valid values in vfGroundAngle -
numGroundColor
protected int numGroundColorNumber of valid values in vfGroundColor -
numSkyAngle
protected int numSkyAngleNumber of valid values in vfSkyAngle -
numSkyColor
protected int numSkyColorNumber of valid values in vfSkyColor
-
-
Constructor Details
-
BaseTextureBackground
protected BaseTextureBackground()Create a new, default instance of this class. -
BaseTextureBackground
Construct a new instance of this node based on the details from the given node.- Parameters:
node
- The node to copy- Throws:
IllegalArgumentException
- The node is not the right type.
-
-
Method Details
-
getTransparency
public float getTransparency()Get the transparency of the background.- Specified by:
getTransparency
in interfaceVRMLBackgroundNodeType
- Returns:
- the transparency of the background
-
setTransparency
public void setTransparency(float val) Set the transparency of the background.- Specified by:
setTransparency
in interfaceVRMLBackgroundNodeType
- Parameters:
val
- The transparency value
-
getNumSkyColors
public int getNumSkyColors()Get the number of valid sky color values that are currently defined.- Specified by:
getNumSkyColors
in interfaceVRMLBackgroundNodeType
- Returns:
- The number of values
-
getNumGroundColors
public int getNumGroundColors()Get the number of valid ground color values that are currently defined.- Specified by:
getNumGroundColors
in interfaceVRMLBackgroundNodeType
- Returns:
- The number of values
-
getSkyValues
public void getSkyValues(float[] color, float[] angle) Fetch the color and angles for the sky values. Assumes that the sky color size is at least 1.- Specified by:
getSkyValues
in interfaceVRMLBackgroundNodeType
- Parameters:
color
- The array to return the color values inangle
- The array to return the angle values in
-
getGroundValues
public void getGroundValues(float[] color, float[] angle) Fetch the color and angles for the ground values. Assumes that the ground color size is at least 1.- Specified by:
getGroundValues
in interfaceVRMLBackgroundNodeType
- Parameters:
color
- The array to return the color values inangle
- The array to return the angle values in
-
getFieldIndex
Get the index of the given field name. If the name does not exist for this node then return a value of -1.- Specified by:
getFieldIndex
in interfaceVRMLNode
- Parameters:
fieldName
- The name of the field we want the index from- Returns:
- The index of the field name or -1
-
getNodeFieldIndices
public int[] getNodeFieldIndices()Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode). Used for blind scene graph traversal without needing to spend time querying for all fields etc. If a node does not have any fields that contain nodes, this shall return null. The field list covers all field types, regardless of whether they are readable or not at the VRML-level.- Specified by:
getNodeFieldIndices
in interfaceVRMLNode
- Returns:
- The list of field indices that correspond to SF/MFnode fields or null if none
-
getFieldDeclaration
Get the declaration of the field at the given index. This allows for reverse lookup if needed. If the field does not exist, this will give a value of null.- Specified by:
getFieldDeclaration
in interfaceVRMLNode
- Parameters:
index
- The index of the field to get information- Returns:
- A representation of this field's information
-
getNumFields
public int getNumFields()Get the number of fields.- Specified by:
getNumFields
in interfaceVRMLNode
- Returns:
- The number of fields.
-
getPrimaryType
public int getPrimaryType()Get the primary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getPrimaryType
in interfaceVRMLNode
- Returns:
- The primary type
-
getSecondaryType
public int[] getSecondaryType()Get the secondary type of this node. Replaces the instanceof mechanism for use in switch statements.- Specified by:
getSecondaryType
in interfaceVRMLNode
- Overrides:
getSecondaryType
in classBaseBindableNode
- Returns:
- The secondary type
-
getFieldValue
Get the value of a field. If the field is a primitive type, it will return a class representing the value. For arrays or nodes it will return the instance directly.- Specified by:
getFieldValue
in interfaceVRMLNodeType
- Overrides:
getFieldValue
in classBaseBindableNode
- Parameters:
index
- The index of the field to change.- Returns:
- The class representing the field value
- Throws:
InvalidFieldException
- The field index is not known
-
sendRoute
Send a routed value from this node to the given destination node. The route should use the appropriate setValue() method of the destination node. It should not attempt to cast the node up to a higher level. Routing should also follow the standard rules for the loop breaking and other appropriate rules for the specification.- Specified by:
sendRoute
in interfaceVRMLNodeType
- Overrides:
sendRoute
in classBaseBindableNode
- Parameters:
time
- The time that this route occurred (not necessarily epoch time. Should be treated as a relative value only)srcIndex
- The index of the field in this node that the value should be sent fromdestNode
- The node reference that we will be sending the value todestIndex
- The index of the field in the destination node that the value should be sent to.
-
setValue
public void setValue(int index, float value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as an array of floats. This would be used to set SFFloat fields.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is not in range or not appropriate for this field
-
setValue
public void setValue(int index, float[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as an array of floats. This would be used to set SFVec3f field types bboxCenter and bboxSize.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is out of range for the field type.InvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, String[] value, int numValid) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as an array of strings. This would be used to set MFString field type url.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- Parameters:
index
- The index of destination field to setvalue
- The new value to use for the nodenumValid
- The number of valid values to copy from the array- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is out of range for the field type.InvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-
setValue
public void setValue(int index, VRMLNodeType child) throws InvalidFieldException, InvalidFieldValueException, InvalidFieldAccessException Set the value of the field at the given index as an array of nodes. This would be used to set MFNode field types.- Specified by:
setValue
in interfaceVRMLNodeType
- Overrides:
setValue
in classAbstractNode
- Parameters:
index
- The index of destination field to setchild
- The new value to use for the node- Throws:
InvalidFieldException
- The field index is not knownInvalidFieldValueException
- The value provided is out of range for the field type.InvalidFieldAccessException
- The call is attempting to write to a field that does not permit writing now
-