|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.threed.jpct.util.Light
Light is a helper class to ease the rather unintuitive handling of light
sources in jPCT. Usually, lights are managed by the corresponding world
instance and identified by a numerical ID. This is a fast way of doing it,
but not very convenient nor OO. This little helper will improve this
situation but it still sits on top of the "normal" implementation.
Constructor Summary | |
Light(World world)
Creates a new light in the world. |
Method Summary | |
void |
disable()
Disables a light. |
void |
dispose()
Disposes the light. |
void |
enable()
Enables a light. |
float |
getAttenuation()
Returns the light's attenuation if it has been set before. |
float |
getDiscardDistance()
Gets the discard distance of this light, if it has be set before. |
float |
getDistanceOverride()
Returns the overriden distance. |
SimpleVector |
getIntensity()
Sets the light's intensity. |
int |
getLightId()
Returns the light's internal ID. |
SimpleVector |
getPosition()
Returns the position of this light in world space. |
boolean |
isEnabled()
Is the light enabled? |
void |
rotate(SimpleVector degrees,
SimpleVector pivot)
Rotates the light around a rotation pivot. |
void |
setAttenuation(float att)
Sets the light's attenuation. |
void |
setDiscardDistance(float dist)
Sets the light's discard distance. |
void |
setDistanceOverride(float distance)
Overrides the distance that is usually calculated by taking the distance between the light source and an object. |
void |
setIntensity(float red,
float green,
float blue)
Sets the light's intensity. |
void |
setIntensity(SimpleVector inty)
Sets the light's intensity. |
void |
setPosition(SimpleVector pos)
Sets the position of this light in world space. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Light(World world)
world
- the instance of worldMethod Detail |
public void enable()
public void disable()
public void dispose()
public int getLightId()
public boolean isEnabled()
public void setIntensity(SimpleVector inty)
inty
- a SimpleVector that contains the intensities of r,g,b in its
x,y,z-components.public void setIntensity(float red, float green, float blue)
red
- the red intensitygreen
- the green intensityblue
- the blue intensitypublic SimpleVector getIntensity()
public void setAttenuation(float att)
att
- the attenuation. The lower the value, the faster the light
will fade. -1 means no fading at all.public float getAttenuation()
public void setDiscardDistance(float dist)
dist
- the discard distance, i.e. the distance where the light will
be "cut off" at latest. -1 means never.public float getDiscardDistance()
public void setDistanceOverride(float distance)
distance
- the new distancepublic float getDistanceOverride()
public void setPosition(SimpleVector pos)
pos
- the positionpublic SimpleVector getPosition()
public void rotate(SimpleVector degrees, SimpleVector pivot)
degrees
- a SimpleVector that contains the rotation angles in its
x,y,z-componentspivot
- SimpleVector the rotation pivot
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |