Class BaseAppearance
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.shape.BaseAppearance
- All Implemented Interfaces:
VRMLNode,FrameStateListener,VRMLAppearanceNodeType,VRMLNodeType,VRMLTextureListener
- Direct Known Subclasses:
NRAppearance,OGLAppearance
public abstract class BaseAppearance
extends AbstractNode
implements VRMLAppearanceNodeType, VRMLTextureListener
Common base implementation of an Appearance node.
Properties
The properties for this file are loaded once on startup so they cannot be initialized per run of loader. The following properties are used by this class:
org.web3d.vrml.renderer.common.nodes.shape.useTextureCacheWhether to cache textures for later reuse. This caches by URL which might be incorrect for some dynamic systems. It improves performance for files which don't use DEF/USE for textures.org.web3d.vrml.renderer.common.nodes.shape.useMipMapsForce the use of mipmaps on nodes without TextureProperties.
- Version:
- $Revision: 1.43 $
- Author:
- Justin Couch, Alan Hudson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringProperty describing the anisotropicDegree valueprotected static final intThe anisotropicDegree valueprotected static final intThe default anisotropicDegree valueprotected static final booleanThe default useMipMaps valueprotected static final booleanThe default useTextureCache valueprotected static final intIndex of the acousticProperties field valueprotected static final intIndex of the alphaCutoff field valueprotected static final intIndex of the alphaMode field valueprotected static final intIndex of the backMaterial field valueprotected static final intIndex of the fillProperties field valueprotected static final intIndex of the lineProperties field valueprotected static final intIndex of the Material field valueprotected static final intIndex of the pointProperties field valueprotected static final intIndex of the backMaterial field valueprotected static final intIndex of the Texture field valueprotected static final intIndex of the textureProperties field valueprotected static final intIndex of the TextureTransform field valueprotected static final StringMessage for when the node in setValue() is not a FillPropertiesprotected static final StringMessage for when the proto is not a FillPropertiesprotected static final StringMessage for when the node in setValue() is not a LinePropertiesprotected static final StringMessage for when the proto is not a LinePropertiesprotected static final StringMessage for when the node in setValue() is not a Materialprotected static final StringMessage for when the proto is not a Materialprotected intprotected VRMLProtoInstanceProto version of the acousticPropertiesprotected VRMLProtoInstanceProto version of the backMaterialprotected VRMLProtoInstanceProto version of the fillPropertiesprotected VRMLProtoInstanceProto version of the linePropertiesprotected VRMLProtoInstanceProto version of the materialprotected static final StringMessage for when the node in setValue() is not a PointPropertiesprotected static final StringMessage for when the proto is not a PointPropertiesprotected VRMLProtoInstanceProto version of the pointPropertiesprotected VRMLProtoInstanceProto version of the shadersprotected VRMLProtoInstanceProto version of the textureprotected VRMLProtoInstanceProto version of the texturePropertiesprotected VRMLProtoInstanceProto version of the texture transformprotected TextureStage[]protected static final StringMessage for when the node in setValue() is not a Textureprotected static final StringMessage for when the node in setValue() is not a TexturePropertiesprotected static final StringMessage for when the proto is not a TexturePropertiesprotected static final StringMessage for when the proto is not a Textureprotected static floatTotal size of textures (K bytes)protected static final StringMessage for when the node in setValue() is not a TextureTransformprotected static final StringMessage for when the proto is not a TextureTransformprotected String[]protected static final StringProperty describing the mipmap usageprotected static booleanThe value read from the system property for MIPMAPSprotected static final booleanThe value read from the system property for TEXTURECACHEprotected static final StringProperty describing the rescaling method to useprotected VRMLNodeTypeSFNode acousticProperties.protected floatSFFloat alphaCutoff.protected StringSFString alphaMode.protected VRMLNodeTypeSFNode backMaterial.protected VRMLAppearanceChildNodeTypeSFNode fillPropertiesprotected VRMLAppearanceChildNodeTypeSFNode lineProperties.protected VRMLMaterialNodeTypeSFNode materialprotected VRMLPointPropertiesNodeTypeSFNode pointProperties.protected VRMLNodeTypeSFNode shaders.protected VRMLTextureNodeTypeSFNode texture.protected VRMLTextureProperties2DNodeTypeSFNode textureProperties.protected VRMLTextureTransformNodeTypeSFNode textureTransformFields 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
ConstructorsModifierConstructorDescriptionprotectedDefault constructor that initialises all fields to the spec defaults.protectedBaseAppearance(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener instance for the material color change notifications.Get the current acousticProperties used by the appearance.floatGet the current alphaCutoff used by the appearance.Get the current alphaMode used by the appearance.Get the current backMaterial used by the appearance.getFieldDeclaration(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.Get the current texture used by the appearance.Get the current line properties used by the appearance.Get the current material used by the appearance.int[]Get the list of indices that correspond to fields that contain nodes ie MFNode and SFNode).intGet the number of fields.Get the current point properties used by the appearance.intGet the primary type of this node.Get the current shaders used by the appearance.Get the current texture used by the appearance.Get the current texture properties used by the appearance.Get the current texture transform used by the appearance.static floatGet the total texture size of all textured loaded to date.protected voidinsureStageSize(int newLen, boolean inc) Insures that the Texture Stage array and associated arrays are at least this big.voidnotifyExternProtoLoaded(int index, VRMLNodeType node) Notify a node that an ExternProto has resolved.protected NIOBufferImage[]processImage(int stage, NIOBufferImage niobi, String url) Setup TextureStage parametersprotected voidprocessImages(int stage, VRMLTextureNodeType tex) Process the images in this texture.voidRemove a listener instance from this node.voidsendRoute(double time, int srcIndex, VRMLNodeType destNode, int destIndex) Send a routed value from this node to the given destination node.voidSet the acousticProperties that should be used for this appearance.protected voidsetAlphaCutoff(float alphaCutoff) Set the alphaCutoffprotected voidsetAlphaMode(String alphaMode) Set the alphaModevoidsetBackMaterial(VRMLNodeType prop) Set the backMaterial that should be used for this appearance.voidsetCCW(boolean ccw) Specify whether the geometry's triangles are in counter clockwise order (the default) or clockwise.voidSet the fillProperties that should be used for this appearance.voidsetLightingEnabled(boolean enable) Set whether lighting will be used for this appearance.voidSet the line properties that should be used for this appearance.voidsetLocalColor(boolean enable, boolean hasAlpha) Set whether the geometry has local colors to override the diffuse color.voidsetMaterial(VRMLNodeType mat) Set the material that should be used for this appearance.voidSet the point properties that should be used for this appearance.voidsetShaders(VRMLNodeType prop) Set the shaders that should be used for this appearance.voidsetSolid(boolean solid) Specify whether an object is solid.voidsetTexture(VRMLNodeType tex) Set the texture that should be used for this appearance.voidSet the textureProperties that should be used for this appearance.voidsetTextureTransform(VRMLNodeType trans) Set the texture transform that should be used for this appearance.voidNotification that the construction phase of this node has finished.voidsetValue(int index, float value) Set the value of the field at the given index as a float.voidSet the value of the field at the given index as a String.voidsetValue(int index, VRMLNodeType child) Set the value of the field at the given index as a node.voidtextureImageChanged(int len, VRMLNodeType[] node, NIOBufferImage[] image, String[] url) Invoked when all of the underlying images have changed.voidtextureImageChanged(int idx, VRMLNodeType node, NIOBufferImage image, String url) Invoked when an underlying image has changed.voidtextureParamsChanged(int len, int[] mode, int[] source, int[] function, float alpha, float[] color) Invoked when the texture parameters have changed.voidtextureParamsChanged(int idx, int mode, int source, int function, float alpha, float[] color) Invoked when the texture parameters have changed.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, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, setValue, 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.lang.VRMLNode
getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersionMethods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, removeNodeListener, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Field Details
-
FIELD_MATERIAL
protected static final int FIELD_MATERIALIndex of the Material field value- See Also:
-
FIELD_TEXTURE
protected static final int FIELD_TEXTUREIndex of the Texture field value- See Also:
-
FIELD_TEXTURE_TRANSFORM
protected static final int FIELD_TEXTURE_TRANSFORMIndex of the TextureTransform field value- See Also:
-
FIELD_LINE_PROPERTIES
protected static final int FIELD_LINE_PROPERTIESIndex of the lineProperties field value- See Also:
-
FIELD_POINT_PROPERTIES
protected static final int FIELD_POINT_PROPERTIESIndex of the pointProperties field value- See Also:
-
FIELD_FILL_PROPERTIES
protected static final int FIELD_FILL_PROPERTIESIndex of the fillProperties field value- See Also:
-
FIELD_TEXTURE_PROPERTIES
protected static final int FIELD_TEXTURE_PROPERTIESIndex of the textureProperties field value- See Also:
-
FIELD_ACOUSTIC_PROPERTIES
protected static final int FIELD_ACOUSTIC_PROPERTIESIndex of the acousticProperties field value- See Also:
-
FIELD_ALPHACUTOFF
protected static final int FIELD_ALPHACUTOFFIndex of the alphaCutoff field value- See Also:
-
FIELD_ALPHAMODE
protected static final int FIELD_ALPHAMODEIndex of the alphaMode field value- See Also:
-
FIELD_BACKMATERIAL
protected static final int FIELD_BACKMATERIALIndex of the backMaterial field value- See Also:
-
FIELD_SHADERS
protected static final int FIELD_SHADERSIndex of the backMaterial field value- See Also:
-
DEFAULT_USETEXTURECACHE
protected static final boolean DEFAULT_USETEXTURECACHEThe default useTextureCache value- See Also:
-
USETEXTURECACHE_PROP
Property describing the rescaling method to use- See Also:
-
useTextureCache
protected static final boolean useTextureCacheThe value read from the system property for TEXTURECACHE -
DEFAULT_USE_MIPMAPS
protected static final boolean DEFAULT_USE_MIPMAPSThe default useMipMaps value- See Also:
-
USE_MIPMAPS_PROP
-
useMipMaps
protected static boolean useMipMapsThe value read from the system property for MIPMAPS -
DEFAULT_ANISOTROPIC_DEGREE
protected static final int DEFAULT_ANISOTROPIC_DEGREEThe default anisotropicDegree value- See Also:
-
ANISOTROPIC_DEGREE_PROP
Property describing the anisotropicDegree value- See Also:
-
anisotropicDegree
protected static final int anisotropicDegreeThe anisotropicDegree value -
MATERIAL_PROTO_MSG
Message for when the proto is not a Material- See Also:
-
MATERIAL_NODE_MSG
Message for when the node in setValue() is not a Material- See Also:
-
TEXTURE_PROTO_MSG
Message for when the proto is not a Texture- See Also:
-
TEXTURE_NODE_MSG
Message for when the node in setValue() is not a Texture- See Also:
-
TRANSFORM_PROTO_MSG
Message for when the proto is not a TextureTransform- See Also:
-
TRANSFORM_NODE_MSG
Message for when the node in setValue() is not a TextureTransform- See Also:
-
FILL_PROP_PROTO_MSG
Message for when the proto is not a FillProperties- See Also:
-
FILL_PROP_NODE_MSG
Message for when the node in setValue() is not a FillProperties- See Also:
-
LINE_PROP_PROTO_MSG
Message for when the proto is not a LineProperties- See Also:
-
LINE_PROP_NODE_MSG
Message for when the node in setValue() is not a LineProperties- See Also:
-
POINT_PROP_PROTO_MSG
Message for when the proto is not a PointProperties- See Also:
-
POINT_PROP_NODE_MSG
Message for when the node in setValue() is not a PointProperties- See Also:
-
TEXTURE_PROP_NODE_MSG
Message for when the node in setValue() is not a TextureProperties- See Also:
-
TEXTURE_PROP_PROTO_MSG
Message for when the proto is not a TextureProperties- See Also:
-
pMaterial
Proto version of the material -
vfMaterial
SFNode material -
pTexture
Proto version of the texture -
vfTexture
SFNode texture. -
pTextureTransform
Proto version of the texture transform -
vfTextureTransform
SFNode textureTransform -
pFillProperties
Proto version of the fillProperties -
vfFillProperties
SFNode fillProperties -
pLineProperties
Proto version of the lineProperties -
vfLineProperties
SFNode lineProperties. -
pPointProperties
Proto version of the pointProperties -
vfPointProperties
SFNode pointProperties. -
pTextureProperties
Proto version of the textureProperties -
vfTextureProperties
SFNode textureProperties. -
pAcousticProperties
Proto version of the acousticProperties -
vfAcousticProperties
SFNode acousticProperties. -
vfAlphaCutoff
protected float vfAlphaCutoffSFFloat alphaCutoff. -
vfAlphaMode
SFString alphaMode. -
pBackMaterial
Proto version of the backMaterial -
vfBackMaterial
SFNode backMaterial. -
pShaders
Proto version of the shaders -
vfShaders
SFNode shaders. -
numStages
protected int numStages -
stages
-
urls
-
totalTextureSize
protected static float totalTextureSizeTotal size of textures (K bytes)
-
-
Constructor Details
-
BaseAppearance
protected BaseAppearance()Default constructor that initialises all fields to the spec defaults. -
BaseAppearance
Construct a new instance of this node based on the details from the given node. If the node is not a Appearance node, an exception will be thrown.- Parameters:
node- The node to copy- Throws:
IllegalArgumentException- The node is not a Group node
-
-
Method Details
-
notifyExternProtoLoaded
Description copied from interface:VRMLNodeTypeNotify a node that an ExternProto has resolved. This will verify the objects type and add it to the render sceneGraph.- Specified by:
notifyExternProtoLoadedin interfaceVRMLNodeType- Overrides:
notifyExternProtoLoadedin classAbstractNode- Parameters:
index- The field indexnode- The node resolved- Throws:
InvalidFieldValueException- If the proto contains he wrong type
-
textureImageChanged
Invoked when an underlying image has changed.- Specified by:
textureImageChangedin interfaceVRMLTextureListener- Parameters:
idx- The stage which changed.node- The texture which changed.image- The image for this texture.url- The url used to load this image.
-
textureImageChanged
Invoked when all of the underlying images have changed.- Specified by:
textureImageChangedin interfaceVRMLTextureListener- Parameters:
len- The number of valid entries in the image array.node- The textures which changed.image- The images for this texture.url- The urls used to load these images.
-
textureParamsChanged
public void textureParamsChanged(int idx, int mode, int source, int function, float alpha, float[] color) Invoked when the texture parameters have changed. The most efficient route is to set the parameters before the image.- Specified by:
textureParamsChangedin interfaceVRMLTextureListener- Parameters:
idx- The texture index which changed.mode- The mode for the stage.source- The source for the stage.function- The function to apply to the stage values.alpha- The alpha value to use for modes requiring it.color- The color to use for modes requiring it. 3 Component color.
-
textureParamsChanged
public void textureParamsChanged(int len, int[] mode, int[] source, int[] function, float alpha, float[] color) Invoked when the texture parameters have changed. The most efficient route is to set the parameters before the image.- Specified by:
textureParamsChangedin interfaceVRMLTextureListener- Parameters:
len- The number of valid entries in the arrays.mode- The mode for the stage.source- The source for the stage.function- The function to apply to the stage values.alpha- The alpha value to use for modes requiring it.color- The color to use for modes requiring it. An array of 3 component colors.
-
setMaterial
Set the material that should be used for this appearance. Setting a value of null will clear the current material.- Specified by:
setMaterialin interfaceVRMLAppearanceNodeType- Parameters:
mat- The new material instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
getMaterial
Get the current material used by the appearance. If none has been set this will return null.- Specified by:
getMaterialin interfaceVRMLAppearanceNodeType- Returns:
- The currently set Material
-
setTexture
Set the texture that should be used for this appearance. Setting a value of null will clear the current texture.- Specified by:
setTexturein interfaceVRMLAppearanceNodeType- Parameters:
tex- The new texture instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
getTexture
Get the current texture used by the appearance. If none has been set this will return null.- Specified by:
getTexturein interfaceVRMLAppearanceNodeType- Returns:
- The currently set Texture
-
setTextureTransform
Set the texture transform that should be used for this appearance. Setting a value of null will clear the current texture transform.- Specified by:
setTextureTransformin interfaceVRMLAppearanceNodeType- Parameters:
trans- The new texture transform instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type
-
getTextureTransform
Get the current texture transform used by the appearance. If none has been set this will return null.- Specified by:
getTextureTransformin interfaceVRMLAppearanceNodeType- Returns:
- The currently set TextureTransform
-
setLineProperties
Set the line properties that should be used for this appearance. Setting a value of null will clear the current property.- Specified by:
setLinePropertiesin interfaceVRMLAppearanceNodeType- Parameters:
prop- The new property instance instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
getLineProperties
Get the current line properties used by the appearance. If none has been set this will return null.- Specified by:
getLinePropertiesin interfaceVRMLAppearanceNodeType- Returns:
- The currently set LineProperties
-
setPointProperties
Set the point properties that should be used for this appearance. Setting a value of null will clear the current property.- Parameters:
prop- The new property instance instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
getPointProperties
Get the current point properties used by the appearance. If none has been set this will return null.- Returns:
- The currently set PointProperties
-
setAcousticProperties
Set the acousticProperties that should be used for this appearance. Setting a value of null will clear the current texture Properties.- Parameters:
prop- The new acousticProperties instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
setAlphaCutoff
Set the alphaCutoff- Parameters:
alphaCutoff- The new alphaCutoff to use- Throws:
InvalidFieldValueException- Radius value was negative
-
setAlphaMode
Set the alphaMode- Parameters:
alphaMode- The new alphaMode to use- Throws:
InvalidFieldValueException- Radius value was negative
-
setBackMaterial
Set the backMaterial that should be used for this appearance. Setting a value of null will clear the current texture Properties.- Parameters:
prop- The new backMaterial instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
setShaders
Set the shaders that should be used for this appearance. Setting a value of null will clear the current texture Properties.- Parameters:
prop- The new shaders instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
setTextureProperties
Set the textureProperties that should be used for this appearance. Setting a value of null will clear the current texture Properties.- Parameters:
prop- The new textureProperties instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
getTextureProperties
Get the current texture properties used by the appearance. If none has been set this will return null.- Returns:
- The currently set TextureProperties
-
getAcousticProperties
Get the current acousticProperties used by the appearance. If none has been set this will return null.- Returns:
- The currently set AcousticProperties
-
getAlphaCutoff
public float getAlphaCutoff()Get the current alphaCutoff used by the appearance. If none has been set this will return null.- Returns:
- The currently set AlphaCutoff
-
getAlphaMode
Get the current alphaMode used by the appearance. If none has been set this will return null.- Returns:
- The currently set alphaMode
-
getBackMaterial
Get the current backMaterial used by the appearance. If none has been set this will return null.- Returns:
- The currently set BackMaterial
-
getShaders
Get the current shaders used by the appearance. If none has been set this will return null.- Returns:
- The currently set Shaders
-
setFillProperties
Set the fillProperties that should be used for this appearance. Setting a value of null will clear the current property.- Specified by:
setFillPropertiesin interfaceVRMLAppearanceNodeType- Parameters:
prop- The new fillProperties instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
getFillProperties
Get the current texture used by the appearance. If none has been set this will return null.- Specified by:
getFillPropertiesin interfaceVRMLAppearanceNodeType- Returns:
- The currently set FillProperties
-
setSolid
public void setSolid(boolean solid) Specify whether an object is solid. The default is true. This will determine if we do backface culling and flip backface normals. Can only be set during setup- Specified by:
setSolidin interfaceVRMLAppearanceNodeType- Parameters:
solid- Whether the object is solid
-
setLightingEnabled
public void setLightingEnabled(boolean enable) Set whether lighting will be used for this appearance. In general you should let the material node decide this. Needed to handle IndexedLineSets or other geometry that specifically declares lighting be turned off. This method will notify the related Material node for this Appearance.- Specified by:
setLightingEnabledin interfaceVRMLAppearanceNodeType- Parameters:
enable- Whether lighting is enabled
-
setCCW
public void setCCW(boolean ccw) Specify whether the geometry's triangles are in counter clockwise order (the default) or clockwise. The default is true. This will determine if we do backface culling and flip backface normals. Can only be set during setup- Specified by:
setCCWin interfaceVRMLAppearanceNodeType- Parameters:
ccw- True for counter-clockwise ordering
-
setLocalColor
public void setLocalColor(boolean enable, boolean hasAlpha) Set whether the geometry has local colors to override the diffuse color. If the local color contains alpha values we want to ignore the material's transparency values.- Specified by:
setLocalColorin interfaceVRMLAppearanceNodeType- Parameters:
enable- Whether local color is enabledhasAlpha- true with the local color also contains alpha values
-
addMaterialColorListener
Add a listener instance for the material color change notifications. Adding the same instance more than once is ignored. Adding null values are ignored.- Specified by:
addMaterialColorListenerin interfaceVRMLAppearanceNodeType- Parameters:
l- The new instance to add
-
removeMaterialColorListener
Remove a listener instance from this node. If the listener is not currently registered, the request is silently ignored.- Specified by:
removeMaterialColorListenerin interfaceVRMLAppearanceNodeType- Parameters:
l- The new instance to remove
-
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:
setupFinishedin interfaceVRMLNodeType- Overrides:
setupFinishedin classAbstractNode
-
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
-
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 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:
sendRoutein interfaceVRMLNodeType- Overrides:
sendRoutein 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
public void setValue(int index, float value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a float. This would be used to set SFFloat field types.- 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, String value) throws InvalidFieldException, InvalidFieldValueException Set the value of the field at the given index as a String. This would be used to set SFString field types.- 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, 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:
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 index does not match a known fieldInvalidFieldValueException- The node does not match the required type.
-
getTotalTextureSize
public static float getTotalTextureSize()Get the total texture size of all textured loaded to date.- Returns:
- The total(K bytes) of textures loaded.
-
processImage
Setup TextureStage parameters- Parameters:
stage- The TextureStage indexniobi- The image objecturl- The source of the image- Returns:
- The array of images
-
insureStageSize
protected void insureStageSize(int newLen, boolean inc) Insures that the Texture Stage array and associated arrays are at least this big. Sets the numStages variable to the largest length.- Parameters:
newLen- The new lengthinc- Should this increase the number of valid stages
-
processImages
Process the images in this texture. Recursively follow any multitexture references.- Parameters:
stage- The TextureStage indextex- The texture to process.
-