Class OGLMaterial
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.shape.BaseMaterial
org.web3d.vrml.renderer.ogl.nodes.shape.OGLMaterial
- All Implemented Interfaces:
org.j3d.aviatrix3d.NodeUpdateListener,VRMLNode,FrameStateListener,VRMLAppearanceChildNodeType,VRMLMaterialNodeType,VRMLNodeType,VRMLSurfaceMaterialNodeType,VRMLVisualMaterialNodeType,OGLMaterialNodeType,OGLVRMLNode
public class OGLMaterial
extends BaseMaterial
implements OGLMaterialNodeType, org.j3d.aviatrix3d.NodeUpdateListener
OpenGL implementation of a material node.
- Version:
- $Revision: 1.18 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class org.web3d.vrml.renderer.common.nodes.shape.BaseMaterial
FIELD_AMBIENT_INTENSITY, FIELD_AMBIENTTEXTURE, FIELD_AMBIENTTEXTUREMAPPING, FIELD_DIFFUSE_COLOR, FIELD_DIFFUSETEXTURE, FIELD_DIFFUSETEXTUREMAPPING, FIELD_EMISSIVE_COLOR, FIELD_EMISSIVETEXTURE, FIELD_EMISSIVETEXTUREMAPPING, FIELD_NORMALSCALE, FIELD_NORMALTEXTURE, FIELD_NORMALTEXTUREMAPPING, FIELD_OCCLUSIONSTRENGTH, FIELD_OCCLUSIONTEXTURE, FIELD_OCCLUSIONTEXTUREMAPPING, FIELD_SHININESS, FIELD_SHININESSTEXTURE, FIELD_SHININESSTEXTUREMAPPING, FIELD_SPECULAR_COLOR, FIELD_SPECULARTEXTURE, FIELD_SPECULARTEXTUREMAPPING, FIELD_TRANSPARENCY, ignoreDiffuse, NUM_FIELDS, vfAmbientIntensity, vfAmbientTexture, vfDiffuseColor, vfDiffuseTexture, vfEmissiveColor, vfEmissiveTexture, vfNormalScale, vfNormalTexture, vfOcclusionStrength, vfOcclusionTexture, vfShininess, vfShininessTexture, vfSpecularColor, vfSpecularTexture, vfTransparencyFields 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
ConstructorsConstructorDescriptionConstruct a default instance of the materialOGLMaterial(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.MaterialRequest the OpenGL material node structure.org.j3d.aviatrix3d.SceneGraphObjectGet the OpenGL scene graph object representation of this node.voidsetAmbientIntensity(float newAmbientIntensity) Accessor method to set a new value for field attribute ambientIntensity.voidsetDiffuseColor(float[] newDiffuseColor) Accessor method to set a new value for field attribute diffuseColor.voidsetEmissiveColor(float[] newEmissiveColor) Accessor method to set a new value for field attribute emissiveColor.voidsetIgnoreDiffuse(boolean ignore) Ignore the diffuseColor color term and use 1,1,1 for the diffuse color.voidsetLightingEnable(boolean enable) Set whether lighting will be used for this material.voidsetLocalColor(boolean enable, boolean hasAlpha) Set whether the geometry has local colors to override the diffuse color.voidsetShininess(float newShininess) Accessor method to set a new value for field attribute shininess.voidsetSpecularColor(float[] newSpecularColor) Accessor method to set a new value for field attribute specularColor.voidsetTransparency(float newTransparency) Accessor method to set a new value for field attribute transparency.voidNotification that the construction phase of this node has finished.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.BaseMaterial
addMaterialColorListener, getAmbientIntensity, getAmbientTexture, getDiffuseColor, getDiffuseTexture, getEmissiveColor, getEmissiveTexture, getFieldDeclaration, getFieldIndex, getFieldValue, getNodeFieldIndices, getNormalScale, getNormalTexture, getNumFields, getOcclusionStrength, getOcclusionTexture, getPrimaryType, getShininess, getShininessTexture, getSpecularColor, getSpecularTexture, getTransparency, removeMaterialColorListener, sendRoute, setNormalScale, setOcclusionStrength, 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, notifyExternProtoLoaded, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, 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.VRMLMaterialNodeType
addMaterialColorListener, getAmbientIntensity, getDiffuseColor, getEmissiveColor, getShininess, getSpecularColor, getTransparency, 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, notifyExternProtoLoaded, removeNodeListener, sendRoute, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Constructor Details
-
OGLMaterial
public OGLMaterial()Construct a default instance of the material -
OGLMaterial
Construct a new instance of this node based on the details from the given node. If the node is not the right type, an exception will be thrown.- Parameters:
node- The node to copy- Throws:
IllegalArgumentException- The node is not a Group node
-
-
Method Details
-
getMaterial
public org.j3d.aviatrix3d.Material getMaterial()Request the OpenGL material node structure.- Specified by:
getMaterialin interfaceOGLMaterialNodeType- Returns:
- The material node
-
setLightingEnable
public void setLightingEnable(boolean enable) Set whether lighting will be used for this material. In general you should let the material node decide this. Needed to handle IndexedLineSets or other geometry that specifically declares lighting be turned off.- Specified by:
setLightingEnablein interfaceOGLMaterialNodeType- 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 interfaceOGLMaterialNodeType- Parameters:
enable- Whether local color is enabledhasAlpha- true with the local color also contains alpha values
-
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
-
allEventsComplete
public void allEventsComplete()Notification that the rendering of the event model is complete and that rendering is about to begin. If the node needs to update itself for this frame, it should do so now before the render pass takes place.- Specified by:
allEventsCompletein interfaceFrameStateListener- Overrides:
allEventsCompletein classAbstractNode
-
setAmbientIntensity
Accessor method to set a new value for field attribute ambientIntensity. How much ambient omnidirectional light is reflected from all light sources.- Specified by:
setAmbientIntensityin interfaceVRMLMaterialNodeType- Overrides:
setAmbientIntensityin classBaseMaterial- Parameters:
newAmbientIntensity- The new intensity value- Throws:
InvalidFieldValueException
-
setDiffuseColor
Accessor method to set a new value for field attribute diffuseColor. How much direct, angle-dependent light is reflected from all light sources.- Specified by:
setDiffuseColorin interfaceVRMLMaterialNodeType- Overrides:
setDiffuseColorin classBaseMaterial- Parameters:
newDiffuseColor- The new value of diffuseColor- Throws:
InvalidFieldValueException
-
setIgnoreDiffuse
public void setIgnoreDiffuse(boolean ignore) Ignore the diffuseColor color term and use 1,1,1 for the diffuse color.- Specified by:
setIgnoreDiffusein interfaceVRMLMaterialNodeType- Overrides:
setIgnoreDiffusein classBaseMaterial- Parameters:
ignore- True to ignore the diffuse term
-
setEmissiveColor
Accessor method to set a new value for field attribute emissiveColor. How much glowing light is emitted from this object.- Specified by:
setEmissiveColorin interfaceVRMLMaterialNodeType- Overrides:
setEmissiveColorin classBaseMaterial- Parameters:
newEmissiveColor- The new value of EmissiveColor- Throws:
InvalidFieldValueException
-
setShininess
Accessor method to set a new value for field attribute shininess. Low values provide soft specular glows, high values provide sharper, smaller highlights.- Specified by:
setShininessin interfaceVRMLMaterialNodeType- Overrides:
setShininessin classBaseMaterial- Parameters:
newShininess- The new value of Shininess- Throws:
InvalidFieldValueException
-
setSpecularColor
Accessor method to set a new value for field attribute specularColor. Specular highlights are brightness reflections (example: shiny spots on an apple).- Specified by:
setSpecularColorin interfaceVRMLMaterialNodeType- Overrides:
setSpecularColorin classBaseMaterial- Parameters:
newSpecularColor- The new value of SpecularColor- Throws:
InvalidFieldValueException
-
setTransparency
Accessor method to set a new value for field attribute transparency. How "clear" an object is: 1.0 is completely transparent, 0.0 is completely opaque .- Specified by:
setTransparencyin interfaceVRMLMaterialNodeType- Overrides:
setTransparencyin classBaseMaterial- Parameters:
newTransparency- The new value of Transparency- Throws:
InvalidFieldValueException
-
getSceneGraphObject
public org.j3d.aviatrix3d.SceneGraphObject getSceneGraphObject()Get the OpenGL scene graph object representation of this node. This will need to be cast to the appropriate parent type when being used. Default implementation returns null.- Specified by:
getSceneGraphObjectin interfaceOGLVRMLNode- Returns:
- The OpenGL representation.
-
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.
-