Package gov.nasa.worldwind.render
Class BasicLightingModel
- java.lang.Object
-
- gov.nasa.worldwind.render.BasicLightingModel
-
- All Implemented Interfaces:
LightingModel
public class BasicLightingModel extends java.lang.Object implements LightingModel
Provides a simple lighting model with one light. This model uses only OpenGL light 0.
-
-
Field Summary
Fields Modifier and Type Field Description protected long
frameID
protected Vec4
lightDirection
protected OGLStackHandler
lightingStackHandler
protected Material
lightMaterial
-
Constructor Summary
Constructors Constructor Description BasicLightingModel()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
apply(DrawContext dc)
protected void
applyStandardLightDirection(com.jogamp.opengl.GL2 gl, int light, Vec4 direction)
protected static void
applyStandardLightMaterial(com.jogamp.opengl.GL2 gl, int light, Material material)
protected void
applyStandardLightModel(com.jogamp.opengl.GL2 gl)
protected void
applyStandardShadeModel(com.jogamp.opengl.GL2 gl)
void
beginLighting(DrawContext dc)
Initializes the OpenGL state necessary to effect the lighting model.void
endLighting(DrawContext dc)
Restores state set byLightingModel.beginLighting(DrawContext)
to its original state.Vec4
getLightDirection()
Returns the model's light direction.Material
getLightMaterial()
Returns the model's light material.void
setLightDirection(Vec4 lightDirection)
Specifies the model's light direction.void
setLightMaterial(Material lightMaterial)
Specifies the model's light direction.
-
-
-
Field Detail
-
lightingStackHandler
protected OGLStackHandler lightingStackHandler
-
lightDirection
protected Vec4 lightDirection
-
lightMaterial
protected Material lightMaterial
-
frameID
protected long frameID
-
-
Method Detail
-
beginLighting
public void beginLighting(DrawContext dc)
Description copied from interface:LightingModel
Initializes the OpenGL state necessary to effect the lighting model.- Specified by:
beginLighting
in interfaceLightingModel
- Parameters:
dc
- the current draw context.- See Also:
DrawContext.setStandardLightingModel(LightingModel)
,DrawContext.endStandardLighting()
-
endLighting
public void endLighting(DrawContext dc)
Description copied from interface:LightingModel
Restores state set byLightingModel.beginLighting(DrawContext)
to its original state.- Specified by:
endLighting
in interfaceLightingModel
- Parameters:
dc
- the current draw context.
-
getLightDirection
public Vec4 getLightDirection()
Returns the model's light direction.- Returns:
- the model's light direction.
-
setLightDirection
public void setLightDirection(Vec4 lightDirection)
Specifies the model's light direction.- Parameters:
lightDirection
- the model's light direction.- Throws:
java.lang.IllegalArgumentException
- if the light direction is null.
-
getLightMaterial
public Material getLightMaterial()
Returns the model's light material.- Returns:
- the model's light material.
-
setLightMaterial
public void setLightMaterial(Material lightMaterial)
Specifies the model's light direction.- Parameters:
lightMaterial
- the model's light material.- Throws:
java.lang.IllegalArgumentException
- if the light material is null.
-
apply
protected void apply(DrawContext dc)
-
applyStandardLightModel
protected void applyStandardLightModel(com.jogamp.opengl.GL2 gl)
-
applyStandardShadeModel
protected void applyStandardShadeModel(com.jogamp.opengl.GL2 gl)
-
applyStandardLightMaterial
protected static void applyStandardLightMaterial(com.jogamp.opengl.GL2 gl, int light, Material material)
-
applyStandardLightDirection
protected void applyStandardLightDirection(com.jogamp.opengl.GL2 gl, int light, Vec4 direction)
-
-