Package org.xjge.core
Class Light
java.lang.Object
org.xjge.core.Light
public final class Light
extends java.lang.Object
Represents a source of visible light at some point in 3D space. This can be
best conceptualized as a physical object that emits light, such as a light
bulb.
This data structure is used internally by the engine for its own lighting utilities.
- Since:
- 2.0.0
-
Field Summary
Fields Modifier and Type Field Description Color
ambientColor
float
brightness
float
contrast
Color
diffuseColor
float
distance
boolean
enabled
org.joml.Vector3f
position
Color
specularColor
-
Constructor Summary
Constructors Constructor Description Light(float brightness, float contrast, float distance, org.joml.Vector3f position, Color color)
Variant ofLight(float,float,float,org.joml.Vector3f,org.xjge.graphics.Color,org.xjge.graphics.Color,org.xjge.graphics.Color)
that will initialize each color used in the Phong lighting model to the same value.Light(float brightness, float contrast, float distance, org.joml.Vector3f position, Color ambientColor, Color diffuseColor, Color specularColor)
Creates a new light object that contains data which can be used by a fragment shader during lighting calculations. -
Method Summary
Modifier and Type Method Description static Light
beacon()
Provides implementing applications with a predefined light object that resembles a red air traffic beacon.static Light
campfire()
Provides implementing applications with a predefined light object that resembles the warm glow of a campfire.static Light
cryotube()
Provides implementing applications with a predefined light object that resembles a cryogenic storage device.static Light
daylight()
Provides implementing applications with an predefined light object that mimics daylight.static Light
glowstick()
Provides implementing applications with a predefined light object that resembles a bright green glowstick.static Light
midnight()
Provides implementing applications with an predefined light object that resembles moonlight.static Light
random()
Provides implementing applications with a randomized light object.static Light
sunset()
Provides implementing applications with an predefined light object that simulates the hue of a sunset.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
enabled
public boolean enabled -
brightness
public float brightness -
contrast
public float contrast -
distance
public float distance -
position
public org.joml.Vector3f position -
ambientColor
-
diffuseColor
-
specularColor
-
-
Constructor Details
-
Light
public Light(float brightness, float contrast, float distance, org.joml.Vector3f position, Color ambientColor, Color diffuseColor, Color specularColor)Creates a new light object that contains data which can be used by a fragment shader during lighting calculations.- Parameters:
brightness
- the intensity of the lightcontrast
- the noticeable difference between the intensity of the ambient and diffuse colors of this light. Should be a non-negative value between 0 and 1.distance
- the range of the lights influence. NOTE: this value may not correlate to world space perfectly.position
- the position from which the light will be emittedambientColor
- the color that will be used to shade the side of the entity which is not facing the light sourcediffuseColor
- the color that will be dispersed into nearby entity from the general direction of the light sourcespecularColor
- the color that will be reflected off entities depending on their shininess value
-
Light
public Light(float brightness, float contrast, float distance, org.joml.Vector3f position, Color color)Variant ofLight(float,float,float,org.joml.Vector3f,org.xjge.graphics.Color,org.xjge.graphics.Color,org.xjge.graphics.Color)
that will initialize each color used in the Phong lighting model to the same value.- Parameters:
brightness
- the intensity of the lightcontrast
- the noticeable difference between the intensity of the ambient and diffuse colors of this light. Should be a non-negative value between 0 and 1.distance
- the range of the lights influence. NOTE: this value may not correlate to world space perfectly.position
- the position from which the light will be emittedcolor
- the color that each Phong component (ambient, diffuse, specular) will be set to
-
-
Method Details
-
daylight
Provides implementing applications with an predefined light object that mimics daylight.- Returns:
- a new engine-defined light object
-
sunset
Provides implementing applications with an predefined light object that simulates the hue of a sunset.- Returns:
- a new engine-defined light object
-
midnight
Provides implementing applications with an predefined light object that resembles moonlight.- Returns:
- a new engine-defined light object
-
beacon
Provides implementing applications with a predefined light object that resembles a red air traffic beacon.- Returns:
- a new engine-defined light object
-
glowstick
Provides implementing applications with a predefined light object that resembles a bright green glowstick. NOTE: This light does not produce specular highlights be design.- Returns:
- a new engine-defined light object
-
cryotube
Provides implementing applications with a predefined light object that resembles a cryogenic storage device.- Returns:
- a new engine-defined light object
-
campfire
Provides implementing applications with a predefined light object that resembles the warm glow of a campfire.- Returns:
- a new engine-defined light object
-
random
Provides implementing applications with a randomized light object.- Returns:
- a new engine-generated light object
-