|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.light.Light
public abstract class Light
Light
defines the attributes of a light element. This class
is abstract and intended to be subclassed by specific lighting types. A
light will illuminate portions of the scene by assigning its properties
to the objects in the scene. This will affect the objects color values,
depending on the color of the ambient, diffuse and specular light
components.
Ambient light defines the general light of the scene, that is the
intensity and color of lighting if no particular lights are affecting it.
Diffuse lighting defines the reflection of light on matte surfaces.
Specular lighting defines the reflection of light on shiny surfaces.
Nested Class Summary | |
---|---|
static class |
Light.Type
|
Field Summary | |
---|---|
protected boolean |
shadowCaster
when true, indicates the lights in this lightState will cast shadows. |
Constructor Summary | |
---|---|
Light()
Constructor instantiates a new Light object. |
Method Summary | |
---|---|
void |
copyFrom(Light light)
Copies the light values from the given light into this Light. |
ColorRGBA |
getAmbient()
getAmbient returns the ambient color value for this light. |
java.lang.Class<? extends Light> |
getClassTag()
|
float |
getConstant()
getConstant returns the value for the constant attenuation. |
ColorRGBA |
getDiffuse()
getDiffuse returns the diffuse color value for this light. |
int |
getLightMask()
|
float |
getLinear()
getLinear returns the value for the linear attenuation. |
float |
getQuadratic()
getQuadratic returns the value for the quadratic
attentuation. |
ColorRGBA |
getSpecular()
getSpecular returns the specular color value for this
light. |
abstract Light.Type |
getType()
getType returns the type of the light that has been
created. |
boolean |
isAttenuate()
isAttenuate returns true if attenuation is to be used
for this light. |
boolean |
isEnabled()
isEnabled returns true if the light is enabled, false
otherwise. |
boolean |
isShadowCaster()
|
void |
popLightMask()
Recalls the light mask from a back store or 0 if none was pushed. |
void |
pushLightMask()
Saves the light mask to a back store. |
void |
read(JMEImporter e)
|
void |
setAmbient(ColorRGBA ambient)
setAmbient sets the ambient color value for this light. |
void |
setAttenuate(boolean attenuate)
setAttenuate sets if attenuation is to be used. |
void |
setConstant(float constant)
setConstant sets the value for the constant attentuation. |
void |
setDiffuse(ColorRGBA diffuse)
setDiffuse sets the diffuse color value for this light. |
void |
setEnabled(boolean value)
setEnabled sets the light on or off. |
void |
setLightMask(int lightMask)
setLightMask sets what attributes of this light to apply
as an int comprised of bitwise |'ed values from LightState.Mask_XXXX. |
void |
setLinear(float linear)
setLinear sets the value for the linear attentuation. |
void |
setQuadratic(float quadratic)
setQuadratic sets the value for the quadratic attenuation. |
void |
setShadowCaster(boolean mayCastShadows)
|
void |
setSpecular(ColorRGBA specular)
setSpecular sets the specular color value for this light. |
void |
write(JMEExporter e)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean shadowCaster
Constructor Detail |
---|
public Light()
Light
object. All
light color values are set to white.
Method Detail |
---|
public abstract Light.Type getType()
getType
returns the type of the light that has been
created.
public float getConstant()
getConstant
returns the value for the constant attenuation.
public void setConstant(float constant)
setConstant
sets the value for the constant attentuation.
constant
- the value for the constant attenuation.public float getLinear()
getLinear
returns the value for the linear attenuation.
public void setLinear(float linear)
setLinear
sets the value for the linear attentuation.
linear
- the value for the linear attenuation.public float getQuadratic()
getQuadratic
returns the value for the quadratic
attentuation.
public void setQuadratic(float quadratic)
setQuadratic
sets the value for the quadratic attenuation.
quadratic
- the value for the quadratic attenuation.public boolean isAttenuate()
isAttenuate
returns true if attenuation is to be used
for this light.
public void setAttenuate(boolean attenuate)
setAttenuate
sets if attenuation is to be used. True sets
it on, false otherwise.
attenuate
- true to use attenuation, false not to.public boolean isEnabled()
isEnabled
returns true if the light is enabled, false
otherwise.
public void setEnabled(boolean value)
setEnabled
sets the light on or off. True turns it on,
false turns it off.
value
- true to turn the light on, false to turn it off.public ColorRGBA getSpecular()
getSpecular
returns the specular color value for this
light.
public void setSpecular(ColorRGBA specular)
setSpecular
sets the specular color value for this light.
specular
- the specular color value of the light.public ColorRGBA getDiffuse()
getDiffuse
returns the diffuse color value for this light.
public void setDiffuse(ColorRGBA diffuse)
setDiffuse
sets the diffuse color value for this light.
diffuse
- the diffuse color value for this light.public ColorRGBA getAmbient()
getAmbient
returns the ambient color value for this light.
public void setAmbient(ColorRGBA ambient)
setAmbient
sets the ambient color value for this light.
ambient
- the ambient color value for this light.public int getLightMask()
public void setLightMask(int lightMask)
setLightMask
sets what attributes of this light to apply
as an int comprised of bitwise |'ed values from LightState.Mask_XXXX.
LightMask.MASK_GLOBALAMBIENT is ignored.
lightMask
- The lightMask to set.public void pushLightMask()
public void popLightMask()
pushLightMask()
public boolean isShadowCaster()
public void setShadowCaster(boolean mayCastShadows)
mayCastShadows
- true if this light can be used to derive shadows (when used in
conjunction with a shadow pass.)public void copyFrom(Light light)
light
- the Light to copy from.public void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
java.io.IOException
public java.lang.Class<? extends Light> getClassTag()
getClassTag
in interface Savable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |