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 intprotected static final intprotected static final String[]An empty list of URL fields for initializationprotected static final intIndex of the backUrl fieldprotected static final intIndex of the bottomUrl fieldprotected static final intIndex of the frontUrl fieldprotected static final intIndex of the groundAngle fieldprotected static final intIndex of the groundColor fieldprotected static final intIndex of the leftUrl fieldprotected static final intIndex of the rightUrl fieldprotected static final intIndex of the skyAngle fieldprotected static final intIndex of the skyColor fieldprotected static final intIndex of the topUrl fieldprotected static final intIndex of the topUrl fieldprotected static final intprotected static final intprotected static final intThe last field index used by this classprotected static final intprotected static final intprotected static final intThe number of fields implementedprotected intNumber of valid values in vfGroundAngleprotected intNumber of valid values in vfGroundColorprotected intNumber of valid values in vfSkyAngleprotected intNumber of valid values in vfSkyColorprotected static final intprotected static final intprotected static final intprotected VRMLNodeTypeMFString backTexture listprotected VRMLNodeTypeMFString bottomTexture listprotected VRMLNodeTypeMFString frontTexture listprotected float[]MFFloat groundAngleprotected float[]MFColor groundColorprotected VRMLNodeTypeMFString leftTexture listprotected VRMLNodeTypeMFString rightTexture listprotected float[]MFFloat skyAngleprotected float[]MFColor skyColorprotected VRMLNodeTypeMFString topTexture listprotected floatSFFloat transparencyFields inherited from class org.web3d.vrml.renderer.common.nodes.BaseBindableNode
FIELD_BIND, FIELD_BIND_TIME, FIELD_IS_BOUND, isOnStack, LAST_BINDABLE_INDEX, vfBindTime, vfIsBoundFields 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
ConstructorsModifierConstructorDescriptionprotectedCreate a new, default instance of this class.protectedConstruct 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.intgetFieldIndex(String fieldName) Get the index of the given field name.getFieldValue(int index) Get the value of a field.voidgetGroundValues(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).intGet the number of fields.intGet the number of valid ground color values that are currently defined.intGet the number of valid sky color values that are currently defined.intGet the primary type of this node.int[]Get the secondary type of this node.voidgetSkyValues(float[] color, float[] angle) Fetch the color and angles for the sky values.floatGet the transparency of the background.voidsendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.voidsetTransparency(float val) Set the transparency of the background.voidsetValue(int index, float value) Set the value of the field at the given index as an array of floats.voidsetValue(int index, float[] value, int numValid) Set the value of the field at the given index as an array of floats.voidSet the value of the field at the given index as an array of strings.voidsetValue(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, setVRMLClockMethods 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, updateRefsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.web3d.vrml.nodes.FrameStateListener
allEventsCompleteMethods inherited from interface org.web3d.vrml.nodes.VRMLBindableNodeType
addBindableNodeListener, getBindTime, getIsBound, removeBindableNodeListener, setBind, setOnStackMethods inherited from interface org.web3d.vrml.lang.VRMLNode
getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersionMethods 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:
getTransparencyin interfaceVRMLBackgroundNodeType- Returns:
- the transparency of the background
-
setTransparency
public void setTransparency(float val) Set the transparency of the background.- Specified by:
setTransparencyin interfaceVRMLBackgroundNodeType- Parameters:
val- The transparency value
-
getNumSkyColors
public int getNumSkyColors()Get the number of valid sky color values that are currently defined.- Specified by:
getNumSkyColorsin interfaceVRMLBackgroundNodeType- Returns:
- The number of values
-
getNumGroundColors
public int getNumGroundColors()Get the number of valid ground color values that are currently defined.- Specified by:
getNumGroundColorsin 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:
getSkyValuesin 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:
getGroundValuesin 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:
getFieldIndexin 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:
getNodeFieldIndicesin 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:
getFieldDeclarationin 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:
getNumFieldsin 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:
getPrimaryTypein 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:
getSecondaryTypein interfaceVRMLNode- Overrides:
getSecondaryTypein 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:
getFieldValuein interfaceVRMLNodeType- Overrides:
getFieldValuein 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:
sendRoutein interfaceVRMLNodeType- Overrides:
sendRoutein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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:
setValuein interfaceVRMLNodeType- Overrides:
setValuein 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
-