javax.media.j3d
Class MaterialRetained

java.lang.Object
  extended by javax.media.j3d.IndexedObject
      extended by javax.media.j3d.SceneGraphObjectRetained
          extended by javax.media.j3d.NodeComponentRetained
              extended by javax.media.j3d.MaterialRetained
All Implemented Interfaces:
java.lang.Cloneable

 class MaterialRetained
extends NodeComponentRetained

The MaterialRetained object defines the appearance of an object under illumination.


Field Summary
(package private) static int AMBIENT_COLOR_CHANGED
           
(package private)  Color3f ambientColor
           
(package private)  int colorTarget
           
(package private) static int COLORTARGET_CHANGED
           
(package private) static int DIFFUSE_COLOR_CHANGED
           
(package private)  Color3f diffuseColor
           
(package private) static int EMISSIVE_COLOR_CHANGED
           
(package private)  Color3f emissiveColor
           
(package private) static int ENABLE_CHANGED
           
(package private)  boolean lightingEnable
           
(package private)  float shininess
           
(package private) static int SHININESS_CHANGED
           
(package private) static int SPECULAR_COLOR_CHANGED
           
(package private)  Color3f specularColor
           
 
Fields inherited from class javax.media.j3d.NodeComponentRetained
changedFrequent, compChanged, duplicateOnCloneTree, mirror, refCnt, refCount, users
 
Fields inherited from class javax.media.j3d.SceneGraphObjectRetained
DONT_MERGE, inBackgroundGroup, inSetLive, MERGE, MERGE_DONE, mergeFlag, onUpdateList, source
 
Fields inherited from class javax.media.j3d.IndexedObject
listIdx
 
Constructor Summary
MaterialRetained()
           
 
Method Summary
protected  java.lang.Object clone()
           
(package private)  void createMaterial(Color3f aColor, Color3f eColor, Color3f dColor, Color3f sColor, float shine)
          Constructs and initializes a new material object using the specified parameters.
(package private)  void createMirrorObject()
           
(package private)  boolean equivalent(MaterialRetained m)
           
(package private)  void getAmbientColor(Color3f color)
          Retrieves this material's ambient color.
(package private)  int getColorTarget()
           
(package private)  void getDiffuseColor(Color3f color)
          Retrieves this material's diffuse color.
(package private)  void getEmissiveColor(Color3f color)
          Retrieves this material's emissive color and stores it in the argument provided.
(package private)  boolean getLightingEnable()
          Retrieves the state of the lighting enable flag.
(package private)  float getShininess()
          Retrieves this material's shininess.
(package private)  void getSpecularColor(Color3f color)
          Retrieves this material's specular color.
(package private)  void handleFrequencyChange(int bit)
           
(package private)  void initAmbientColor(Color3f color)
          Initializes this material's ambient color This specifies how much ambient light is reflected by the surface.
(package private)  void initAmbientColor(float r, float g, float b)
          Sets this material's ambient color
(package private)  void initColorTarget(int colorTarget)
           
(package private)  void initDiffuseColor(Color3f color)
          Sets this material's diffuse color.
(package private)  void initDiffuseColor(float r, float g, float b)
          Sets this material's diffuse color.
(package private)  void initDiffuseColor(float r, float g, float b, float a)
          Sets this material's diffuse color plus alpha.
(package private)  void initEmissiveColor(Color3f color)
          Sets this material's emissive color This is the color of light, if any, that the material emits.
(package private)  void initEmissiveColor(float r, float g, float b)
          Sets this material's emissive color.
(package private)  void initLightingEnable(boolean state)
          Enables or disables lighting for this appearance component object.
(package private)  void initMirrorObject()
          Creates a mirror object, point the mirror object to the retained object if the object is not editable
(package private)  void initShininess(float shininess)
          Sets this material's shininess.
(package private)  void initSpecularColor(Color3f color)
          Sets this material's specular color.
(package private)  void initSpecularColor(float r, float g, float b)
          Sets this material's specular color.
(package private)  void sendMessage(int attrMask, java.lang.Object attr)
           
protected  void set(MaterialRetained mat)
           
(package private)  void setAmbientColor(Color3f color)
          Sets this material's ambient color and sends a message notifying the interested structures of the change.
(package private)  void setAmbientColor(float r, float g, float b)
          Sets this material's ambient color and sends a message notifying the interested structures of the change.
(package private)  void setColorTarget(int colorTarget)
           
(package private)  void setDiffuseColor(Color3f color)
          Sets this material's diffuse color and sends a message notifying the interested structures of the change.
(package private)  void setDiffuseColor(float r, float g, float b)
          Sets this material's diffuse color and sends a message notifying the interested structures of the change.
(package private)  void setDiffuseColor(float r, float g, float b, float a)
          Sets this material's diffuse color plus alpha and sends a message notifying the interested structures of the change.
(package private)  void setEmissiveColor(Color3f color)
          Sets this material's emissive color and sends a message notifying the interested structures of the change.
(package private)  void setEmissiveColor(float r, float g, float b)
          Sets this material's emissive color and sends a message notifying the interested structures of the change.
(package private)  void setLightingEnable(boolean state)
          Enables or disables lighting for this appearance component object and sends a message notifying the interested structures of the change.
(package private)  void setShininess(float shininess)
          Sets this material's shininess and sends a message notifying the interested structures of the change.
(package private)  void setSpecularColor(Color3f color)
          Sets this material's specular color and sends a message notifying the interested structures of the change.
(package private)  void setSpecularColor(float r, float g, float b)
          Sets this material's specular color and sends a message notifying the interested structures of the change.
(package private)  void updateMirrorObject(int component, java.lang.Object value)
          Update the "component" field of the mirror object with the given "value"
(package private)  void updateNative(Context ctx, float red, float green, float blue, float alpha, boolean enableLighting)
          Updates the native context.
 
Methods inherited from class javax.media.j3d.NodeComponentRetained
addAMirrorUser, addUser, clearLive, copyMirrorUsers, decRefCnt, doSetLive, getDuplicateOnCloneTree, getInImmCtx, incRefCnt, notifyUsers, removeAMirrorUser, removeMirrorUsers, removeUser, set, setDuplicateOnCloneTree, setFrequencyChangeMask, setInImmCtx, setLive
 
Methods inherited from class javax.media.j3d.SceneGraphObjectRetained
clearLive, clearLive, compile, doSetLive, doSetLive, getSource, getVirtualUniverse, isInSetLive, isStatic, markAsLive, merge, mergeTransform, setCompiled, setLive, setLive, setSource, traverse
 
Methods inherited from class javax.media.j3d.IndexedObject
getIdxUsed, incIdxUsed
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ambientColor

Color3f ambientColor

emissiveColor

Color3f emissiveColor

diffuseColor

Color3f diffuseColor

specularColor

Color3f specularColor

shininess

float shininess

colorTarget

int colorTarget

lightingEnable

boolean lightingEnable

AMBIENT_COLOR_CHANGED

static final int AMBIENT_COLOR_CHANGED
See Also:
Constant Field Values

EMISSIVE_COLOR_CHANGED

static final int EMISSIVE_COLOR_CHANGED
See Also:
Constant Field Values

DIFFUSE_COLOR_CHANGED

static final int DIFFUSE_COLOR_CHANGED
See Also:
Constant Field Values

SPECULAR_COLOR_CHANGED

static final int SPECULAR_COLOR_CHANGED
See Also:
Constant Field Values

SHININESS_CHANGED

static final int SHININESS_CHANGED
See Also:
Constant Field Values

ENABLE_CHANGED

static final int ENABLE_CHANGED
See Also:
Constant Field Values

COLORTARGET_CHANGED

static final int COLORTARGET_CHANGED
See Also:
Constant Field Values
Constructor Detail

MaterialRetained

MaterialRetained()
Method Detail

createMaterial

void createMaterial(Color3f aColor,
                    Color3f eColor,
                    Color3f dColor,
                    Color3f sColor,
                    float shine)
Constructs and initializes a new material object using the specified parameters.

Parameters:
ambientColor - the material's ambient color
emissiveColor - the material's emissive color
diffuseColor - the material's diffuse color when illuminated by a light
specularColor - the material's specular color when illuminated to generate a highlight
shininess - the material's shininess in the range [1.0, 128.0] with 1.0 being not shiny and 128.0 being very shiny

initAmbientColor

final void initAmbientColor(Color3f color)
Initializes this material's ambient color This specifies how much ambient light is reflected by the surface. The ambient light color is the product of this color and the material diffuseColor.

Parameters:
color - the material's ambient color

setAmbientColor

final void setAmbientColor(Color3f color)
Sets this material's ambient color and sends a message notifying the interested structures of the change. This specifies how much ambient light is reflected by the surface. The ambient light color is the product of this color and the material diffuseColor.

Parameters:
color - the material's ambient color

initAmbientColor

final void initAmbientColor(float r,
                            float g,
                            float b)
Sets this material's ambient color

Parameters:
r - the new ambient color's red component
g - the new ambient color's green component
b - the new ambient color's blue component

setAmbientColor

final void setAmbientColor(float r,
                           float g,
                           float b)
Sets this material's ambient color and sends a message notifying the interested structures of the change.

Parameters:
r - the new ambient color's red component
g - the new ambient color's green component
b - the new ambient color's blue component

getAmbientColor

final void getAmbientColor(Color3f color)
Retrieves this material's ambient color.


initEmissiveColor

final void initEmissiveColor(Color3f color)
Sets this material's emissive color This is the color of light, if any, that the material emits.

Parameters:
color - the new emissive color

setEmissiveColor

final void setEmissiveColor(Color3f color)
Sets this material's emissive color and sends a message notifying the interested structures of the change. This is the color of light, if any, that the material emits.

Parameters:
color - the new emissive color

initEmissiveColor

final void initEmissiveColor(float r,
                             float g,
                             float b)
Sets this material's emissive color. This is the color of light, if any, that the material emits.

Parameters:
r - the new emissive color's red component
g - the new emissive color's green component
b - the new emissive color's blue component

setEmissiveColor

final void setEmissiveColor(float r,
                            float g,
                            float b)
Sets this material's emissive color and sends a message notifying the interested structures of the change. This is the color of light, if any, that the material emits.

Parameters:
r - the new emissive color's red component
g - the new emissive color's green component
b - the new emissive color's blue component

getEmissiveColor

final void getEmissiveColor(Color3f color)
Retrieves this material's emissive color and stores it in the argument provided.

Parameters:
color - the vector that will receive this material's emissive color

initDiffuseColor

final void initDiffuseColor(Color3f color)
Sets this material's diffuse color. This is the color of the material when illuminated by a light source.

Parameters:
color - the new diffuse color

setDiffuseColor

final void setDiffuseColor(Color3f color)
Sets this material's diffuse color and sends a message notifying the interested structures of the change. This is the color of the material when illuminated by a light source.

Parameters:
color - the new diffuse color

initDiffuseColor

final void initDiffuseColor(float r,
                            float g,
                            float b)
Sets this material's diffuse color.

Parameters:
r - the new diffuse color's red component
g - the new diffuse color's green component
b - the new diffuse color's blue component

setDiffuseColor

final void setDiffuseColor(float r,
                           float g,
                           float b)
Sets this material's diffuse color and sends a message notifying the interested structures of the change.

Parameters:
r - the new diffuse color's red component
g - the new diffuse color's green component
b - the new diffuse color's blue component

initDiffuseColor

final void initDiffuseColor(float r,
                            float g,
                            float b,
                            float a)
Sets this material's diffuse color plus alpha. This is the color of the material when illuminated by a light source.

Parameters:
r - the new diffuse color's red component
g - the new diffuse color's green component
b - the new diffuse color's blue component
a - the alpha component used to set transparency

setDiffuseColor

final void setDiffuseColor(float r,
                           float g,
                           float b,
                           float a)
Sets this material's diffuse color plus alpha and sends a message notifying the interested structures of the change. This is the color of the material when illuminated by a light source.

Parameters:
r - the new diffuse color's red component
g - the new diffuse color's green component
b - the new diffuse color's blue component
a - the alpha component used to set transparency

getDiffuseColor

final void getDiffuseColor(Color3f color)
Retrieves this material's diffuse color.

Parameters:
color - the vector that will receive this material's diffuse color

initSpecularColor

final void initSpecularColor(Color3f color)
Sets this material's specular color. This is the specular highlight color of the material.

Parameters:
color - the new specular color

setSpecularColor

final void setSpecularColor(Color3f color)
Sets this material's specular color and sends a message notifying the interested structures of the change. This is the specular highlight color of the material.

Parameters:
color - the new specular color

initSpecularColor

final void initSpecularColor(float r,
                             float g,
                             float b)
Sets this material's specular color. This is the specular highlight color of the material.

Parameters:
r - the new specular color's red component
g - the new specular color's green component
b - the new specular color's blue component

setSpecularColor

final void setSpecularColor(float r,
                            float g,
                            float b)
Sets this material's specular color and sends a message notifying the interested structures of the change. This is the specular highlight color of the material.

Parameters:
r - the new specular color's red component
g - the new specular color's green component
b - the new specular color's blue component

getSpecularColor

final void getSpecularColor(Color3f color)
Retrieves this material's specular color.

Parameters:
color - the vector that will receive this material's specular color

initShininess

final void initShininess(float shininess)
Sets this material's shininess. This specifies a material specular exponent, or shininess. It takes a floating point number in the range [1.0, 128.0] with 1.0 being not shiny and 128.0 being very shiny.

Parameters:
shininess - the material's shininess

setShininess

final void setShininess(float shininess)
Sets this material's shininess and sends a message notifying the interested structures of the change. This specifies a material specular exponent, or shininess. It takes a floating point number in the range [1.0, 128.0] with 1.0 being not shiny and 128.0 being very shiny.

Parameters:
shininess - the material's shininess

getShininess

final float getShininess()
Retrieves this material's shininess.

Returns:
the material's shininess

initLightingEnable

void initLightingEnable(boolean state)
Enables or disables lighting for this appearance component object.

Parameters:
state - true or false to enable or disable lighting

setLightingEnable

void setLightingEnable(boolean state)
Enables or disables lighting for this appearance component object and sends a message notifying the interested structures of the change.

Parameters:
state - true or false to enable or disable lighting

getLightingEnable

boolean getLightingEnable()
Retrieves the state of the lighting enable flag.

Returns:
true if lighting is enabled, false if lighting is disabled

initColorTarget

void initColorTarget(int colorTarget)

setColorTarget

final void setColorTarget(int colorTarget)

getColorTarget

final int getColorTarget()

createMirrorObject

void createMirrorObject()
Overrides:
createMirrorObject in class NodeComponentRetained

updateNative

void updateNative(Context ctx,
                  float red,
                  float green,
                  float blue,
                  float alpha,
                  boolean enableLighting)
Updates the native context.


initMirrorObject

void initMirrorObject()
Creates a mirror object, point the mirror object to the retained object if the object is not editable

Overrides:
initMirrorObject in class NodeComponentRetained

updateMirrorObject

void updateMirrorObject(int component,
                        java.lang.Object value)
Update the "component" field of the mirror object with the given "value"

Overrides:
updateMirrorObject in class NodeComponentRetained

equivalent

boolean equivalent(MaterialRetained m)

clone

protected java.lang.Object clone()
Overrides:
clone in class NodeComponentRetained

set

protected void set(MaterialRetained mat)

sendMessage

final void sendMessage(int attrMask,
                       java.lang.Object attr)

handleFrequencyChange

void handleFrequencyChange(int bit)
Overrides:
handleFrequencyChange in class SceneGraphObjectRetained


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.