hmi.graphics.util.basicobjects
Class SimpleLight

java.lang.Object
  extended by hmi.graphics.opengl.scenegraph.VGLNode
      extended by hmi.graphics.util.basicobjects.SimpleLight
All Implemented Interfaces:
GLRenderObject

public class SimpleLight
extends VGLNode

A basic positional or directional light object. The assumption is that color attributes, and position or direction are set during initialization, and that the light is permanently bound to one of the fixed OpenGL lights. The position is passed to OpenGL for every render call, so that it will take the ModelView transform into account.


Field Summary
private  SimpleLightGeometry glGeometry
           
private  SimpleLightState glState
           
(package private)  float[][] points
           
private  float[] position
           
(package private)  float[] shadowMatrix
           
private  float[] translation
           
private  VJoint vjoint
           
 
Constructor Summary
SimpleLight(int gl_light, String name)
          common initialization for new DirectionalLights.
SimpleLight(int gl_light, String name, boolean visible)
           
 
Method Summary
 SimpleLightGeometry getGeometry()
           
 float[] getPosition()
          Returns a reference to the position float array of this light
 SimpleLightState getState()
           
 void glInit(GLRenderContext glc)
          called during initialization phase of the renderer.
 void glRender(GLRenderContext glc)
          Rendering a light means: set position, taking into account the current ModelView transformation.
 void setDirection(float x, float y, float z)
          Turns the light into a direction light, and sets the direction from which the light is shining.
 void setPosition(float[] pos)
          Turns the light into a positional light, and sets the position from which the light is shining.
 void setPosition(float x, float y, float z)
          Turns the light into a positional light, and sets the position from which the light is shining.
 void setShadowMatrix(float[] matrix)
           
 void setShadowPlane(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2)
           
 
Methods inherited from class hmi.graphics.opengl.scenegraph.VGLNode
addChild, addGLShape, addMarker, addMarker, getGLShapeList, getRoot, prependGLShape, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

glGeometry

private SimpleLightGeometry glGeometry

glState

private SimpleLightState glState

vjoint

private VJoint vjoint

translation

private float[] translation

position

private float[] position

shadowMatrix

float[] shadowMatrix

points

float[][] points
Constructor Detail

SimpleLight

public SimpleLight(int gl_light,
                   String name)
common initialization for new DirectionalLights.


SimpleLight

public SimpleLight(int gl_light,
                   String name,
                   boolean visible)
Method Detail

getState

public SimpleLightState getState()

getGeometry

public SimpleLightGeometry getGeometry()

setPosition

public void setPosition(float x,
                        float y,
                        float z)
Turns the light into a positional light, and sets the position from which the light is shining. Should be called before initialization.


setPosition

public void setPosition(float[] pos)
Turns the light into a positional light, and sets the position from which the light is shining. Should be called before initialization.


getPosition

public float[] getPosition()
Returns a reference to the position float array of this light


setDirection

public void setDirection(float x,
                         float y,
                         float z)
Turns the light into a direction light, and sets the direction from which the light is shining. Should be called before initialization.


setShadowMatrix

public void setShadowMatrix(float[] matrix)

glInit

public void glInit(GLRenderContext glc)
called during initialization phase of the renderer. It binds the attributes, like color, to some OpenGL light.

Specified by:
glInit in interface GLRenderObject
Overrides:
glInit in class VGLNode

glRender

public void glRender(GLRenderContext glc)
Rendering a light means: set position, taking into account the current ModelView transformation. Optionally, a small sphere is rendered, to indicate the position of the light.

Specified by:
glRender in interface GLRenderObject
Overrides:
glRender in class VGLNode

setShadowPlane

public void setShadowPlane(float x0,
                           float y0,
                           float z0,
                           float x1,
                           float y1,
                           float z1,
                           float x2,
                           float y2,
                           float z2)