public class LightHelper
extends java.lang.Object
Constructor and Description |
---|
LightHelper() |
Modifier and Type | Method and Description |
---|---|
static java.awt.Color[] |
applyAmbient(java.awt.Color ambient,
java.awt.Color[] output,
boolean additive)
Apply the given ambient color to the output.
|
static java.awt.Color[] |
applyAmbient(java.awt.Color ambient,
java.awt.Color[] input,
java.awt.Color[] output,
boolean additive)
Apply the given ambient color to the output.
|
static java.awt.Color[] |
applyDiffuse(Vector3f light,
boolean directional,
Vector3f[] vertices,
Vector3f[] normals,
java.awt.Color[] colors,
java.awt.Color diffuse,
java.awt.Color[] output,
boolean additive)
Apply diffuse light to the output colors
|
static java.awt.Color[] |
applyDiffuse(Vector3f light,
boolean directional,
Vector3f[] vertices,
Vector3f[] normals,
java.awt.Color color,
java.awt.Color[] output,
boolean additive)
Apply diffuse light to the output colors
|
static java.awt.Color[] |
applyLight(G2DLight light,
Material mat,
Vector3f camera,
Vector3f[] vertices,
Vector3f[] normals,
java.awt.Color[] colors,
java.awt.Color[] output,
float[] transf,
boolean additive)
Apply a per-vertex lighting to the given colors
|
static java.awt.Color[] |
applySpecular(Vector3f camera,
Vector3f light,
float shininess,
boolean directional,
Vector3f[] vertices,
Vector3f[] normals,
java.awt.Color specular,
java.awt.Color[] output,
boolean additive) |
static Vector3f[] |
getIndexedVector3f(java.nio.FloatBuffer buffer,
java.nio.IntBuffer index,
int stride,
float[] transf) |
static Vector3f[] |
getVector3f(java.nio.FloatBuffer buffer,
int stride) |
public static Vector3f[] getVector3f(java.nio.FloatBuffer buffer, int stride)
buffer
- the float buffer.stride
- the stride between elements.public static Vector3f[] getIndexedVector3f(java.nio.FloatBuffer buffer, java.nio.IntBuffer index, int stride, float[] transf)
buffer
- the float buffer.index
- the indices buffer.stride
- the stride between elements.transf
- matrix to transform the vector, if null no transformation is applied.public static java.awt.Color[] applyAmbient(java.awt.Color ambient, java.awt.Color[] output, boolean additive)
ambient
- the ambient color.output
- the color vector to apply the ambient color.additive
- if true the ambient color is added to output.public static java.awt.Color[] applyAmbient(java.awt.Color ambient, java.awt.Color[] input, java.awt.Color[] output, boolean additive)
ambient
- the ambient color.input
- the input color.output
- the color vector to apply the ambient color.additive
- if true the ambient color is added to output.public static java.awt.Color[] applyDiffuse(Vector3f light, boolean directional, Vector3f[] vertices, Vector3f[] normals, java.awt.Color[] colors, java.awt.Color diffuse, java.awt.Color[] output, boolean additive)
light
- the light position or direction.directional
- if true the vector light is considered a direction otherwise a position.vertices
- the surface vertices.normals
- the surface normals.colors
- the surface per-vertex colors.dffuse
- the light diffuse color.output
- the output color vector.additive
- if true the calculated diffuse color is added to the output.public static java.awt.Color[] applyDiffuse(Vector3f light, boolean directional, Vector3f[] vertices, Vector3f[] normals, java.awt.Color color, java.awt.Color[] output, boolean additive)
light
- the light position or direction.directional
- if true the vector light is considered a direction otherwise a position.vertices
- the surface vertices.normals
- the surface normals.color
- the surface color.output
- the output color vector.additive
- if true the calculated diffuse color is added to the output.public static java.awt.Color[] applySpecular(Vector3f camera, Vector3f light, float shininess, boolean directional, Vector3f[] vertices, Vector3f[] normals, java.awt.Color specular, java.awt.Color[] output, boolean additive)
public static java.awt.Color[] applyLight(G2DLight light, Material mat, Vector3f camera, Vector3f[] vertices, Vector3f[] normals, java.awt.Color[] colors, java.awt.Color[] output, float[] transf, boolean additive)
light
- the light.mat
- the material properties.camera
- the camera position.vertices
- the surface vertices.normals
- the surface normals.colors
- the surface per-vertex colors.output
- the output color vector.transf
- the light transformation matrix. If null no transformation is applyed.additive
- if true the calculated color is added to the output.