Class OGLAppearance
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.shape.BaseAppearance
org.web3d.vrml.renderer.ogl.nodes.shape.OGLAppearance
- All Implemented Interfaces:
org.j3d.aviatrix3d.NodeUpdateListener,VRMLNode,FrameStateListener,VRMLAppearanceNodeType,VRMLNodeType,VRMLTextureListener,OGLAppearanceNodeType,OGLTextureTransformListener,OGLVRMLNode
public class OGLAppearance
extends BaseAppearance
implements OGLAppearanceNodeType, OGLTextureTransformListener, org.j3d.aviatrix3d.NodeUpdateListener, FrameStateListener
OpenGL implementation of an Appearance node.
MultiTexture Notes: function and source not mapped 3D Texture Notes: Getting a rescale problem, not working. Cubic Environment Notes: Not implemented.
- Version:
- $Revision: 1.70 $
- Author:
- Alan Hudson
-
Field Summary
Fields inherited from class org.web3d.vrml.renderer.common.nodes.shape.BaseAppearance
ANISOTROPIC_DEGREE_PROP, anisotropicDegree, DEFAULT_ANISOTROPIC_DEGREE, DEFAULT_USE_MIPMAPS, DEFAULT_USETEXTURECACHE, FIELD_ACOUSTIC_PROPERTIES, FIELD_ALPHACUTOFF, FIELD_ALPHAMODE, FIELD_BACKMATERIAL, FIELD_FILL_PROPERTIES, FIELD_LINE_PROPERTIES, FIELD_MATERIAL, FIELD_POINT_PROPERTIES, FIELD_SHADERS, FIELD_TEXTURE, FIELD_TEXTURE_PROPERTIES, FIELD_TEXTURE_TRANSFORM, FILL_PROP_NODE_MSG, FILL_PROP_PROTO_MSG, LINE_PROP_NODE_MSG, LINE_PROP_PROTO_MSG, MATERIAL_NODE_MSG, MATERIAL_PROTO_MSG, numStages, pAcousticProperties, pBackMaterial, pFillProperties, pLineProperties, pMaterial, POINT_PROP_NODE_MSG, POINT_PROP_PROTO_MSG, pPointProperties, pShaders, pTexture, pTextureProperties, pTextureTransform, stages, TEXTURE_NODE_MSG, TEXTURE_PROP_NODE_MSG, TEXTURE_PROP_PROTO_MSG, TEXTURE_PROTO_MSG, totalTextureSize, TRANSFORM_NODE_MSG, TRANSFORM_PROTO_MSG, urls, USE_MIPMAPS_PROP, useMipMaps, useTextureCache, USETEXTURECACHE_PROP, vfAcousticProperties, vfAlphaCutoff, vfAlphaMode, vfBackMaterial, vfFillProperties, vfLineProperties, vfMaterial, vfPointProperties, vfShaders, vfTexture, vfTextureProperties, vfTextureTransformFields 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
ConstructorsConstructorDescriptionEmpty constructorOGLAppearance(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoidNotification that the rendering of the event model is complete and that rendering is about to begin.org.j3d.aviatrix3d.AppearanceGet the appearance instance used to represent this object.protected intgetFormat(NIOBufferImage image) From the image information, generate the appropriate TextureComponent type.org.j3d.aviatrix3d.SceneGraphObjectGet the scene graph object representation of this node.protected intgetTextureFormat(org.j3d.aviatrix3d.TextureComponent comp) From the image component format, generate the appropriate texture format.voidnotifyExternProtoLoaded(int index, VRMLNodeType node) Notify a node that an ExternProto has resolved.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 newMaterial) Set the material that should be used for this appearance.voidSet the point properties that should be used for this appearance.voidsetSolid(boolean solid) Specify whether an object is solid.voidsetTexCoordGenMode(int setNum, String mode) Set the texture coordinate generation mode for a texture set.voidsetTexture(VRMLNodeType newTexture) Set the texture that should be used for this appearance.voidsetTextureTransform(VRMLNodeType newTransform) Set the texture transform that should be used for this appearance.voidNotification that the construction phase of this node has finished.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.voidtextureTransformChanged(OGLVRMLNode src, javax.vecmath.Matrix4f[] tmatrix, boolean[] updated) Invoked when a textureTransform has changed.voidNotification that its safe to update the node now with any operations that could potentially effect the node's bounds.voidNotification that its safe to update the node now with any operations that only change the node's properties, but do not change the bounds.Methods inherited from class org.web3d.vrml.renderer.common.nodes.shape.BaseAppearance
addMaterialColorListener, getAcousticProperties, getAlphaCutoff, getAlphaMode, getBackMaterial, getFieldDeclaration, getFieldIndex, getFieldValue, getFillProperties, getLineProperties, getMaterial, getNodeFieldIndices, getNumFields, getPointProperties, getPrimaryType, getShaders, getTexture, getTextureProperties, getTextureTransform, getTotalTextureSize, insureStageSize, processImage, processImages, removeMaterialColorListener, sendRoute, setAcousticProperties, setAlphaCutoff, setAlphaMode, setBackMaterial, setShaders, setTextureProperties, setValue, setValue, setValueMethods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, 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.VRMLAppearanceNodeType
addMaterialColorListener, getFillProperties, getLineProperties, getMaterial, getTexture, getTextureTransform, removeMaterialColorListenerMethods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getPrimaryType, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersionMethods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getFieldValue, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, removeNodeListener, sendRoute, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Constructor Details
-
OGLAppearance
public OGLAppearance()Empty constructor -
OGLAppearance
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
-
allEventsComplete
public void allEventsComplete()Notification that the rendering of the event model is complete and that rendering is about to begin.- Specified by:
allEventsCompletein interfaceFrameStateListener- Overrides:
allEventsCompletein classAbstractNode
-
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- Overrides:
setMaterialin classBaseAppearance- Parameters:
newMaterial- The new material instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
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- Overrides:
setTexturein classBaseAppearance- Parameters:
newTexture- The new texture instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
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- Overrides:
setTextureTransformin classBaseAppearance- Parameters:
newTransform- The new texture transform instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
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- Overrides:
setLinePropertiesin classBaseAppearance- Parameters:
prop- The new property instance instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
setPointProperties
Set the point properties that should be used for this appearance. Setting a value of null will clear the current property.- Overrides:
setPointPropertiesin classBaseAppearance- Parameters:
prop- The new property instance instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
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- Overrides:
setFillPropertiesin classBaseAppearance- Parameters:
prop- The new fillProperties instance to be used.- Throws:
InvalidFieldValueException- The node does not match the required type.
-
getAppearance
public org.j3d.aviatrix3d.Appearance getAppearance()Get the appearance instance used to represent this object.- Specified by:
getAppearancein interfaceOGLAppearanceNodeType- Returns:
- The appearance instance
-
setTexCoordGenMode
Set the texture coordinate generation mode for a texture set. If its not set then texture coordinates will be used. A value of null will clear the setting.- Specified by:
setTexCoordGenModein interfaceOGLAppearanceNodeType- Parameters:
setNum- The set which this tex gen mode refersmode- The mode to use. Straight VRML field value
-
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- Overrides:
setSolidin classBaseAppearance- 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- Overrides:
setLightingEnabledin classBaseAppearance- Parameters:
enable- Whether lighting is enabled
-
setLocalColor
public void setLocalColor(boolean enable, boolean hasAlpha) Set whether the geometry has local colors to override the diffuse color.- Specified by:
setLocalColorin interfaceVRMLAppearanceNodeType- Overrides:
setLocalColorin classBaseAppearance- Parameters:
enable- Whether local color is enabledhasAlpha- true with the local color also contains alpha values
-
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- Overrides:
setCCWin classBaseAppearance- Parameters:
ccw- True for counter-clockwise ordering
-
textureTransformChanged
public void textureTransformChanged(OGLVRMLNode src, javax.vecmath.Matrix4f[] tmatrix, boolean[] updated) Invoked when a textureTransform has changed.- Specified by:
textureTransformChangedin interfaceOGLTextureTransformListener- Parameters:
src- The node instance that was the source of this changetmatrix- The new TransformMatrix arrayupdated- Flag for each index illustrating whether it has been updated or not.
-
textureImageChanged
Invoked when an underlying image has changed. Synchronized due to competition for the image arrays.- Specified by:
textureImageChangedin interfaceVRMLTextureListener- Overrides:
textureImageChangedin classBaseAppearance- Parameters:
idx- The image idx 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- Overrides:
textureImageChangedin classBaseAppearance- 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- Overrides:
textureParamsChangedin classBaseAppearance- 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- Overrides:
textureParamsChangedin classBaseAppearance- 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.
-
getSceneGraphObject
public org.j3d.aviatrix3d.SceneGraphObject getSceneGraphObject()Get the scene graph object representation of this node. This will need to be cast to the appropriate parent type when being used.- Specified by:
getSceneGraphObjectin 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:
setupFinishedin interfaceVRMLNodeType- Overrides:
setupFinishedin classBaseAppearance
-
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 classBaseAppearance- Parameters:
index- The field indexnode- The node resolved- Throws:
InvalidFieldValueException- If the proto contains he wrong type
-
updateNodeBoundsChanges
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.- Specified by:
updateNodeBoundsChangesin 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:
updateNodeDataChangesin interfaceorg.j3d.aviatrix3d.NodeUpdateListener- Parameters:
src- The node or Node Component that is to be updated.
-
getTextureFormat
protected int getTextureFormat(org.j3d.aviatrix3d.TextureComponent comp) From the image component format, generate the appropriate texture format.- Parameters:
comp- The image component to get the value from- Returns:
- The appropriate corresponding texture format value
-
getFormat
From the image information, generate the appropriate TextureComponent type.- Parameters:
image- The image component to get the value from- Returns:
- The appropriate corresponding texture format value
-