Class OGLTwoSidedMaterial
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.shape.BaseTwoSidedMaterial
org.web3d.vrml.renderer.ogl.nodes.shape.OGLTwoSidedMaterial
- All Implemented Interfaces:
org.j3d.aviatrix3d.NodeUpdateListener
,VRMLNode
,FrameStateListener
,VRMLAppearanceChildNodeType
,VRMLMaterialNodeType
,VRMLNodeType
,VRMLSurfaceMaterialNodeType
,VRMLVisualMaterialNodeType
,OGLMaterialNodeType
,OGLVRMLNode
public class OGLTwoSidedMaterial
extends BaseTwoSidedMaterial
implements OGLMaterialNodeType, org.j3d.aviatrix3d.NodeUpdateListener
OpenGL implementation of a material node.
- Version:
- $Revision: 1.3 $
- Author:
- Justin Couch
-
Field Summary
Fields inherited from class org.web3d.vrml.renderer.common.nodes.shape.BaseTwoSidedMaterial
FIELD_AMBIENT_INTENSITY, FIELD_BACK_AMBIENT_INTENSITY, FIELD_BACK_DIFFUSE_COLOR, FIELD_BACK_EMISSIVE_COLOR, FIELD_BACK_SHININESS, FIELD_BACK_SPECULAR_COLOR, FIELD_BACK_TRANSPARENCY, FIELD_DIFFUSE_COLOR, FIELD_EMISSIVE_COLOR, FIELD_SEPARATE_BACK_COLOR, FIELD_SHININESS, FIELD_SPECULAR_COLOR, FIELD_TRANSPARENCY, ignoreDiffuse, NUM_FIELDS, vfAmbientIntensity, vfBackAmbientIntensity, vfBackDiffuseColor, vfBackEmissiveColor, vfBackShininess, vfBackSpecularColor, vfBackTransparency, vfDiffuseColor, vfEmissiveColor, vfSeparateBackColor, vfShininess, vfSpecularColor, vfTransparency
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
ConstructorsConstructorDescriptionConstruct a default instance of the materialConstruct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionorg.j3d.aviatrix3d.Material
Request the OpenGL material node structure.org.j3d.aviatrix3d.SceneGraphObject
Get the OpenGL scene graph object representation of this node.void
setAmbientIntensity
(float newAmbientIntensity) Accessor method to set a new value for field attribute ambientIntensity.protected void
setBackAmbientIntensity
(float newAmbientIntensity) Accessor method to set a new value for field attribute ambientIntensity.protected void
setBackDiffuseColor
(float[] newDiffuseColor) Accessor method to set a new value for field attribute diffuseColor.protected void
setBackEmissiveColor
(float[] newEmissiveColor) Accessor method to set a new value for field attribute emissiveColor.protected void
setBackShininess
(float newShininess) Accessor method to set a new value for field attribute shininess.protected void
setBackSpecularColor
(float[] newSpecularColor) Accessor method to set a new value for field attribute specularColor.protected void
setBackTransparency
(float newTransparency) Accessor method to set a new value for field attribute transparency.void
setDiffuseColor
(float[] newDiffuseColor) Accessor method to set a new value for field attribute diffuseColor.void
setEmissiveColor
(float[] newEmissiveColor) Accessor method to set a new value for field attribute emissiveColor.void
setIgnoreDiffuse
(boolean ignore) Ignore the diffuseColor color term and use 1,1,1 for the diffuse color.void
setLightingEnable
(boolean enable) Set whether lighting will be used for this material.void
setLocalColor
(boolean enable, boolean hasAlpha) Set whether the geometry has local colors to override the diffuse color.protected void
setSeparateBackColor
(boolean state) Set a new value for the separated back face colour state.void
setShininess
(float newShininess) Accessor method to set a new value for field attribute shininess.void
setSpecularColor
(float[] newSpecularColor) Accessor method to set a new value for field attribute specularColor.void
setTransparency
(float newTransparency) Accessor method to set a new value for field attribute transparency.void
Notification that the construction phase of this node has finished.void
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.void
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.Methods inherited from class org.web3d.vrml.renderer.common.nodes.shape.BaseTwoSidedMaterial
addMaterialColorListener, getAmbientIntensity, getDiffuseColor, getEmissiveColor, getFieldDeclaration, getFieldIndex, getFieldValue, getNodeFieldIndices, getNumFields, getPrimaryType, getShininess, getSpecularColor, getTransparency, removeMaterialColorListener, sendRoute, setValue, setValue, setValue
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.nodes.VRMLMaterialNodeType
addMaterialColorListener, getAmbientIntensity, getDiffuseColor, getEmissiveColor, getShininess, getSpecularColor, getTransparency, removeMaterialColorListener
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, 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
-
OGLTwoSidedMaterial
public OGLTwoSidedMaterial()Construct a default instance of the material -
OGLTwoSidedMaterial
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:
getMaterial
in 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:
setLightingEnable
in 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:
setLocalColor
in 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:
setupFinished
in interfaceVRMLNodeType
- Overrides:
setupFinished
in 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:
setAmbientIntensity
in interfaceVRMLMaterialNodeType
- Overrides:
setAmbientIntensity
in classBaseTwoSidedMaterial
- 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:
setDiffuseColor
in interfaceVRMLMaterialNodeType
- Overrides:
setDiffuseColor
in classBaseTwoSidedMaterial
- 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:
setIgnoreDiffuse
in interfaceVRMLMaterialNodeType
- Overrides:
setIgnoreDiffuse
in classBaseTwoSidedMaterial
- 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:
setEmissiveColor
in interfaceVRMLMaterialNodeType
- Overrides:
setEmissiveColor
in classBaseTwoSidedMaterial
- 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:
setShininess
in interfaceVRMLMaterialNodeType
- Overrides:
setShininess
in classBaseTwoSidedMaterial
- 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:
setSpecularColor
in interfaceVRMLMaterialNodeType
- Overrides:
setSpecularColor
in classBaseTwoSidedMaterial
- 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:
setTransparency
in interfaceVRMLMaterialNodeType
- Overrides:
setTransparency
in classBaseTwoSidedMaterial
- 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:
getSceneGraphObject
in 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:
updateNodeBoundsChanges
in 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:
updateNodeDataChanges
in interfaceorg.j3d.aviatrix3d.NodeUpdateListener
- Parameters:
src
- The node or Node Component that is to be updated.
-
setBackAmbientIntensity
Accessor method to set a new value for field attribute ambientIntensity. How much ambient omnidirectional light is reflected from all light sources.- Overrides:
setBackAmbientIntensity
in classBaseTwoSidedMaterial
- Parameters:
newAmbientIntensity
- The new intensity value- Throws:
InvalidFieldValueException
-
setBackDiffuseColor
Accessor method to set a new value for field attribute diffuseColor. How much direct, angle-dependent light is reflected from all light sources.- Overrides:
setBackDiffuseColor
in classBaseTwoSidedMaterial
- Parameters:
newDiffuseColor
- The new value of diffuseColor- Throws:
InvalidFieldValueException
-
setBackEmissiveColor
Accessor method to set a new value for field attribute emissiveColor. How much glowing light is emitted from this object.- Overrides:
setBackEmissiveColor
in classBaseTwoSidedMaterial
- Parameters:
newEmissiveColor
- The new value of EmissiveColor- Throws:
InvalidFieldValueException
-
setBackShininess
Accessor method to set a new value for field attribute shininess. Low values provide soft specular glows, high values provide sharper, smaller highlights.- Overrides:
setBackShininess
in classBaseTwoSidedMaterial
- Parameters:
newShininess
- The new value of Shininess- Throws:
InvalidFieldValueException
-
setBackSpecularColor
Accessor method to set a new value for field attribute specularColor. Specular highlights are brightness reflections (example: shiny spots on an apple).- Overrides:
setBackSpecularColor
in classBaseTwoSidedMaterial
- Parameters:
newSpecularColor
- The new value of SpecularColor- Throws:
InvalidFieldValueException
-
setBackTransparency
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 .- Overrides:
setBackTransparency
in classBaseTwoSidedMaterial
- Parameters:
newTransparency
- The new value of Transparency- Throws:
InvalidFieldValueException
-
setSeparateBackColor
Set a new value for the separated back face colour state.- Overrides:
setSeparateBackColor
in classBaseTwoSidedMaterial
- Parameters:
state
- true to use different front from back colours- Throws:
InvalidFieldValueException
-