hmi.graphics.opengl.renderobjects
Class SimpleLight

java.lang.Object
  extended by hmi.graphics.opengl.scenegraph.VGLNode
      extended by hmi.graphics.opengl.renderobjects.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.

Author:
Job Zwiers

Field Summary
private  SimpleLightGeometry glGeometry
           
private  SimpleLightState glState
           
private  float[][] points
           
private  float[] position
           
private  float[] shadowMatrix
           
private static float SHADOWPLANE_HEIGHT
           
private static float SHADOWPLANE_X0
           
private static float SHADOWPLANE_X1
           
private static float SHADOWPLANE_X2
           
private static float SHADOWPLANE_Z0
           
private static float SHADOWPLANE_Z1
           
private static float SHADOWPLANE_Z2
           
private  float[] translation
           
private static int VEC3SIZE
           
private static int VEC4SIZE
           
private  VJoint vjoint
           
 
Constructor Summary
SimpleLight(int gl_light, String name)
          common initialization for new DirectionalLights.
 
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

VEC3SIZE

private static final int VEC3SIZE
See Also:
Constant Field Values

VEC4SIZE

private static final int VEC4SIZE
See Also:
Constant Field Values

SHADOWPLANE_HEIGHT

private static final float SHADOWPLANE_HEIGHT
See Also:
Constant Field Values

SHADOWPLANE_X0

private static final float SHADOWPLANE_X0
See Also:
Constant Field Values

SHADOWPLANE_Z0

private static final float SHADOWPLANE_Z0
See Also:
Constant Field Values

SHADOWPLANE_X1

private static final float SHADOWPLANE_X1
See Also:
Constant Field Values

SHADOWPLANE_Z1

private static final float SHADOWPLANE_Z1
See Also:
Constant Field Values

SHADOWPLANE_X2

private static final float SHADOWPLANE_X2
See Also:
Constant Field Values

SHADOWPLANE_Z2

private static final float SHADOWPLANE_Z2
See Also:
Constant Field Values

glGeometry

private SimpleLightGeometry glGeometry

glState

private SimpleLightState glState

vjoint

private VJoint vjoint

translation

private float[] translation

position

private float[] position

shadowMatrix

private float[] shadowMatrix

points

private float[][] points
Constructor Detail

SimpleLight

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

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)