|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimogl.effect.light.Light
public class Light
This class is used to set light sources in the scene
Constructor Summary | |
---|---|
Light(float x,
float y,
float z,
int lightNr)
Creates a new light source at the specified position |
Method Summary | |
---|---|
void |
draw(javax.media.opengl.GL gl)
This method draws the light to the scene with all its properties |
float |
getAttenuationConstant()
Returns the constant attenuation value |
float |
getAttenuationLinear()
Returns the linear attenuation value |
float |
getAttenuationQuadratic()
Returns the quadric attenuation |
float[] |
getColorAmbient()
Returns the color of the ambient light |
float[] |
getColorDiffuese()
Returns the color of the diffuse light |
float[] |
getColorSpecular()
Returns the color of the specular light |
int |
getLightNumberFrom0to7()
Returns an simple integer value (0-7) representing the openGl constants GL.GL_LIGHT0 upto GL.GL_LIGHT7 |
Point3D |
getPosition()
Returns the current position of the light source |
Point3D |
getSpotDirection()
Returns the direction of the spot light |
float |
getSpotExponent()
Returns the value for spot exponent |
boolean |
isDirectional()
Determines whether this light is a directional light |
boolean |
isEnabled()
Determins whether the light source is enabled |
boolean |
isEnabledAmbient()
Determins whether the ambient light is enabled |
boolean |
isEnabledDiffuse()
Determins whether the diffuse light is enabled |
boolean |
isEnabledSpecular()
Determins whether the specular light is enabled |
boolean |
isPositional()
Determines whether this light is a positional light |
boolean |
isSpot()
Determines whether this light is a spot light |
void |
setAttenuationConstant(float factor)
Sets the constant attenuation value. |
void |
setAttenuationLinear(float factor)
Sets the linear attenuation value. |
void |
setAttenuationQuadratic(float factor)
Sets the quadric attenuation value. |
void |
setColorAmbient(float red,
float green,
float blue,
float alpha)
Sets the RGBA color of the ambient light |
void |
setColorDiffuse(float red,
float green,
float blue,
float alpha)
Sets the RGBA color of the diffuse light |
void |
setColorSpecular(float red,
float green,
float blue,
float alpha)
Sets the RGBA color of the specular light |
void |
setDirectional()
Turns the light source into a directional light source |
void |
setEnabled(boolean activate)
Enables (true) or disables (false) the light source. |
void |
setEnabledAmbient(boolean activate)
Enables (true) or disables (false) the ambient light |
void |
setEnabledDiffuse(boolean activate)
Enables (true) or disables (false) the diffuse light |
void |
setEnabledSpecular(boolean activate)
Enables (true) or disables (false) the specular light |
static void |
setGlobalAmbientLight(javax.media.opengl.GL gl,
float red,
float green,
float blue,
float alpha)
Sets the color of the global ambient background light. |
void |
setPosition(float x,
float y,
float z)
Sets the position of the light source |
void |
setPositional()
Turns the light source into a positional light source |
void |
setSpot(float spotCutOff,
float spotExponent)
Turns this light to a spot light. |
void |
setSpotDirection(float x,
float y,
float z)
Set the direction of the spot light |
void |
setSpotExponent(float value)
Sets the value for the spot exponent. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Light(float x, float y, float z, int lightNr)
x
- x-coordinatey
- y-coordinatez
- z-coordinatelightNr
- number from 0 to 7Method Detail |
---|
public void setPosition(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic Point3D getPosition()
public void setDirectional()
public boolean isDirectional()
public void setPositional()
public boolean isPositional()
public void setSpot(float spotCutOff, float spotExponent)
spotCutOff
- angle from 0.0f-90.0f or exactly 180.0f degreesspotExponent
- factor to focus the spot lightpublic boolean isSpot()
public void setSpotDirection(float x, float y, float z)
x
- x-coordinatey
- y-coordinatez
- z-coordinatepublic Point3D getSpotDirection()
public void setSpotExponent(float value)
value
- spot exponent (0.0f - 128.0f)public float getSpotExponent()
public void setColorAmbient(float red, float green, float blue, float alpha)
red
- amount of redgreen
- amount of greenblue
- amount of bluealpha
- amount of alphapublic float[] getColorAmbient()
public void setColorDiffuse(float red, float green, float blue, float alpha)
red
- amount of redgreen
- amount of greenblue
- amount of bluealpha
- amount of alphapublic float[] getColorDiffuese()
public void setColorSpecular(float red, float green, float blue, float alpha)
red
- amount of redgreen
- amount of greenblue
- amount of bluealpha
- amount of alphapublic float[] getColorSpecular()
public void setEnabled(boolean activate)
activate
- set enabled? -> true or falsepublic boolean isEnabled()
public void setEnabledAmbient(boolean activate)
activate
- set enabled? -> true or falsepublic boolean isEnabledAmbient()
public void setEnabledDiffuse(boolean activate)
activate
- set enabled? -> true or falsepublic boolean isEnabledDiffuse()
public void setEnabledSpecular(boolean activate)
activate
- set enabled? -> true or falsepublic boolean isEnabledSpecular()
public void setAttenuationConstant(float factor)
factor
- constant attenuation factorpublic float getAttenuationConstant()
public void setAttenuationLinear(float factor)
factor
- linear attenuation factorpublic float getAttenuationLinear()
public void setAttenuationQuadratic(float factor)
factor
- quadric attenuation factorpublic float getAttenuationQuadratic()
public int getLightNumberFrom0to7()
public void draw(javax.media.opengl.GL gl)
gl
- public static void setGlobalAmbientLight(javax.media.opengl.GL gl, float red, float green, float blue, float alpha)
red
- amount of redgreen
- amount of greenblue
- amount of bluealpha
- alpha-value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |