Class BaseTexture2DNode
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.BaseTextureNode
org.web3d.vrml.renderer.common.nodes.BaseTexture2DNode
- All Implemented Interfaces:
VRMLNode
,FrameStateListener
,VRMLAppearanceChildNodeType
,VRMLNodeType
,VRMLTexture2DNodeType
,VRMLTextureNodeType
- Direct Known Subclasses:
BaseImageTexture
,BasePixelTexture
,BaseRenderedTexture
Base implementation of a 2D texture object.
Performs the VRML field handling for REPEAT_S and REPEAT_T.
- Version:
- $Revision: 1.12 $
- Author:
- Alan Hudson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
Index of the description fieldprotected static final int
Field Index for the common repeatS fieldprotected static final int
Field Index for the common repeatT fieldprotected static final int
Field Index for the textureProperties field that is available from 3.2 or later specs.protected NIOBufferImage
The base image for this textureprotected static final int
Index of the last common field for all 2D texturesprotected VRMLProtoInstance
PROTO version of the textureProperties nodeprotected static final String
Message when accessing the texture properties field in a file with the spec version earlier than 3.2.protected static final String
Message for when the node in setValue() is not a TexturePropertyprotected static final String
Message for when the proto is not a TexturePropertiesprotected String
SFString description ""protected boolean
field SFBool repeatS TRUEprotected boolean
field SFBool repeatT TRUEprotected VRMLTextureProperties2DNodeType
inputOutput SFNode textureProperties main fieldFields inherited from class org.web3d.vrml.renderer.common.nodes.BaseTextureNode
listenerList
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
copy
(VRMLTexture2DNodeType node) Set the fields of the grouping node that has the fields set based on the fields of the passed in node.Get the value of field description.getFieldValue
(int index) Get the value of a field.getImage()
Get the image representation of this texture.boolean
Get the value of field repeatS.boolean
Get the value of field repeatT.Get node content for the textureProperties field.int
Get the texture type of this texture.void
sendRoute
(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.void
setTextureProperties
(VRMLNodeType props) Set node content as replacement for the textureProperties field.void
Notification that the construction phase of this node has finished.void
setValue
(int index, boolean value) Set the value of the field at the given index as a boolean.void
Set the value of the field at the given index as a String.void
setValue
(int index, VRMLNodeType child) Set the value of the field at the given index as a node.Methods inherited from class org.web3d.vrml.renderer.common.nodes.BaseTextureNode
addTextureListener, fireTextureImageChanged, fireTextureParamsChanged, getCacheString, removeTextureListener
Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, allEventsComplete, checkNodeType, checkSecondaryType, checkSecondaryType, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, getSecondaryType, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, 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.nodes.FrameStateListener
allEventsComplete
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, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
Methods inherited from interface org.web3d.vrml.nodes.VRMLTextureNodeType
addTextureListener, getCacheString, removeTextureListener
-
Field Details
-
FIELD_REPEATS
protected static final int FIELD_REPEATSField Index for the common repeatS field- See Also:
-
FIELD_REPEATT
protected static final int FIELD_REPEATTField Index for the common repeatT field- See Also:
-
FIELD_TEXTURE_PROPERTIES
protected static final int FIELD_TEXTURE_PROPERTIESField Index for the textureProperties field that is available from 3.2 or later specs.- See Also:
-
FIELD_DESCRIPTION
protected static final int FIELD_DESCRIPTIONIndex of the description field- See Also:
-
LAST_TEXTURENODETYPE_INDEX
protected static final int LAST_TEXTURENODETYPE_INDEXIndex of the last common field for all 2D textures- See Also:
-
TEXTURE_PROPS_PROTO_MSG
Message for when the proto is not a TextureProperties- See Also:
-
TEXTURE_PROPS_NODE_MSG
Message for when the node in setValue() is not a TextureProperty- See Also:
-
TEXPROPS_VERSION_MSG
Message when accessing the texture properties field in a file with the spec version earlier than 3.2.- See Also:
-
vfRepeatS
protected boolean vfRepeatSfield SFBool repeatS TRUE -
vfRepeatT
protected boolean vfRepeatTfield SFBool repeatT TRUE -
pTextureProperties
PROTO version of the textureProperties node -
vfTextureProperties
inputOutput SFNode textureProperties main field -
vfDescription
SFString description "" -
implImage
The base image for this texture
-
-
Constructor Details
-
BaseTexture2DNode
Default constructor for the node. The repeat flags are set to TRUE.- Parameters:
name
- The name of the type of node
-
-
Method Details
-
copy
Set the fields of the grouping node that has the fields set based on the fields of the passed in node. This will not copy any children nodes, only the local fields.- Parameters:
node
- The grouping node to copy info from
-
getTextureType
public int getTextureType()Description copied from interface:VRMLTextureNodeType
Get the texture type of this texture. Valid entries are defined in the vrml.lang.TextureConstants.- Specified by:
getTextureType
in interfaceVRMLTextureNodeType
- Returns:
- the texture type of this texture
-
getImage
Get the image representation of this texture.- Specified by:
getImage
in interfaceVRMLTexture2DNodeType
- Returns:
- The image.
-
getDescription
Get the value of field description. The field is writable. Default value is empty string""
.- Specified by:
getDescription
in interfaceVRMLTexture2DNodeType
- Returns:
- The current value of description
-
getRepeatS
public boolean getRepeatS()Get the value of field repeatS. The field is not writable. Default value istrue
.- Specified by:
getRepeatS
in interfaceVRMLTexture2DNodeType
- Returns:
- The current value of repeatS
-
getRepeatT
public boolean getRepeatT()Get the value of field repeatT. The field is not writable. Default value istrue
.- Specified by:
getRepeatT
in interfaceVRMLTexture2DNodeType
- Returns:
- The current value of repeatT
-
getTextureProperties
Get node content for the textureProperties field. This field is only available for X3D 3.2 or later.- Specified by:
getTextureProperties
in interfaceVRMLTexture2DNodeType
- Returns:
- The current field value
- Throws:
InvalidFieldException
- This field was request in a field with spec version < 3.2
-
setTextureProperties
public void setTextureProperties(VRMLNodeType props) throws InvalidFieldValueException, InvalidFieldException Set node content as replacement for the textureProperties field. This field is only available for X3D 3.2 or later.- Specified by:
setTextureProperties
in interfaceVRMLTexture2DNodeType
- Parameters:
props
- The new value for geometry. Null will act like delete- Throws:
InvalidFieldValueException
- The node does not match the required type.InvalidFieldException
- This field was request in a field with spec version < 3.2
-
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
-
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 classAbstractNode
- 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 classAbstractNode
- 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
Set the value of the field at the given index as a boolean. This would be used to set SFBool field types.- 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 field- Throws:
InvalidFieldException
- The field index is not know
-
setValue
Set the value of the field at the given index as a String. This would be used to set SFString field types.- 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 field- Throws:
InvalidFieldException
- The field index is not know
-
setValue
public void setValue(int index, VRMLNodeType child) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a node. This would be used to set SFNode 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:
InvalidFieldValueException
- The node does not match the required type.InvalidFieldException
- This field was request in a field with spec version < 3.2
-