espresso3d.engine.world.sector.light
Class E3DLight

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.world.sector.base.E3DPortalEnabledRenderableItem
              extended byespresso3d.engine.world.sector.light.E3DLight
All Implemented Interfaces:
E3DPortalEnabledItem

public class E3DLight
extends E3DPortalEnabledRenderableItem

Author:
Curt A light class for lighting the world/actors. A light belongs to a single sector, but will light any sectors that its sector is connected to with a portal as well. TODO: This is temporary and basic light support for E3D. This will very likely change and be extended upon to provide support for all the light types and models planned. This is essentially available now in a basic format to provide you with some sort of lighting facility.

Field Summary
static int LIGHT_TYPE_GLOBAL
           
static int LIGHT_TYPE_OMNIDIRECTIONAL
           
 
Fields inherited from class espresso3d.engine.renderer.base.E3DRenderable
RENDERMODE_SOLID, RENDERMODE_TEXTURED, RENDERMODE_WIREFRAME
 
Constructor Summary
E3DLight(E3DEngine engine, java.lang.String lightID)
           
 
Method Summary
 double getBrightness()
           
 E3DVector3F getColor()
           
 double getFalloff()
           
 java.lang.String getLightID()
           
 E3DVector3F getLitVertex(E3DVector3F vertex)
          Returns the RGB values in a E3DVector3F with the correct lighting information for this light based on the distance the vertex passed in is away and the lights color, brightness, falloff, etc.
 E3DVector3F getPosition()
           
 int getType()
           
 void renderAtPosition(E3DVector3F position)
           
 void setBrightness(double brightness)
          Brightness is how bright the light is.
 void setColor(E3DVector3F color)
           
 void setFalloff(double falloff)
           
 void setLightID(java.lang.String lightID)
           
 void setPosition(E3DVector3F position)
           
 void setSector(E3DSector sector)
          Override setSector to provide ability to tell the sector it needs to be relit when this light is set to point to it.
 void setType(int type)
           
 void translate(E3DVector3F translationAmt)
          Translate the light
 
Methods inherited from class espresso3d.engine.world.sector.base.E3DPortalEnabledRenderableItem
checkSectorChangeDuringMovement, getSector
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
getRenderableOptionsKey, getRenderMode, initCorrectGeometryRenderer, render, setRenderMode
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIGHT_TYPE_OMNIDIRECTIONAL

public static final int LIGHT_TYPE_OMNIDIRECTIONAL
See Also:
Constant Field Values

LIGHT_TYPE_GLOBAL

public static final int LIGHT_TYPE_GLOBAL
See Also:
Constant Field Values
Constructor Detail

E3DLight

public E3DLight(E3DEngine engine,
                java.lang.String lightID)
Method Detail

getLitVertex

public E3DVector3F getLitVertex(E3DVector3F vertex)
Returns the RGB values in a E3DVector3F with the correct lighting information for this light based on the distance the vertex passed in is away and the lights color, brightness, falloff, etc.

Parameters:
vertex - The vertex that we want to get the lit values of from this light
Returns:
Returns the lit values for this vertex from this light or null if it has no effect. Other lights will have to be accumulated

renderAtPosition

public void renderAtPosition(E3DVector3F position)
Specified by:
renderAtPosition in class E3DRenderable

getBrightness

public double getBrightness()
Returns:
Returns the brightness of the light

setBrightness

public void setBrightness(double brightness)
Brightness is how bright the light is.

Parameters:
brightness - The brightness to set.

getColor

public E3DVector3F getColor()
Returns:
Returns the color in a vector with RGB = XYZ as a 0.0 to 1.0 value

setColor

public void setColor(E3DVector3F color)
Parameters:
color - The color to set.

getFalloff

public double getFalloff()
Returns:
Returns the falloff distance

setFalloff

public void setFalloff(double falloff)
Parameters:
falloff - The falloff distance is the distance the light stops working. 0 disables falloff and the light goes until it no longer has any strength left

getPosition

public E3DVector3F getPosition()
Returns:
Returns the position.

setPosition

public void setPosition(E3DVector3F position)
Parameters:
position - The position to set.

getType

public int getType()
Returns:
Returns the type.

setType

public void setType(int type)
Parameters:
type - The type to set.

getLightID

public java.lang.String getLightID()

setLightID

public void setLightID(java.lang.String lightID)

setSector

public void setSector(E3DSector sector)
Override setSector to provide ability to tell the sector it needs to be relit when this light is set to point to it.

Specified by:
setSector in interface E3DPortalEnabledItem
Overrides:
setSector in class E3DPortalEnabledRenderableItem

translate

public void translate(E3DVector3F translationAmt)
Translate the light

Parameters:
translationAmt -