Class LightEngine
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.lightengine.LightEngine
-
public class LightEngine extends java.lang.Object
This Light engine calculates phong shading for three normals over the day. The data is relative to a position on a map because the lighting can be different on different positions on the map.- Since:
- WE1.1
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
VERSION
The Version of the light engine.
-
Constructor Summary
Constructors Constructor Description LightEngine()
LightEngine(int xPos, int yPos)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.badlogic.gdx.graphics.Color
getAmbient(Position pos)
Returns the sum of every light source's ambient lightcom.badlogic.gdx.graphics.Color
getColor(Side normal, Position pos)
copy safeGlobalLightSource
getMoon(Position pos)
You can pass the position if the moon changes relative to the postition.GlobalLightSource
getSun(Position pos)
You can pass the position if the sun changes relative to the postition.float
getTimeOfDay()
static float
getVertexBrightness()
Returns the average brightness.boolean
isInDebug()
boolean
isShadingPixelBased()
The light engine can shade the world pixel based or vertext based.void
render(GameView view, Position pos)
Shows the data of the light engine in diagramms.void
setDebug(boolean debug)
Should diagrams be rendered showing the data of the LE.void
setMoon(GlobalLightSource moon)
void
setSun(GlobalLightSource sun)
restores position via save cvar "LEsunAzimuth".void
setToNight(Position pos)
void
setToNoon(Position pos)
void
update(float dt)
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
The Version of the light engine.- See Also:
- Constant Field Values
-
-
Method Detail
-
update
public void update(float dt)
- Parameters:
dt
-
-
getVertexBrightness
public static float getVertexBrightness()
Returns the average brightness.- Returns:
-
getSun
public GlobalLightSource getSun(Position pos)
You can pass the position if the sun changes relative to the postition.- Parameters:
pos
- relative to this position- Returns:
-
getMoon
public GlobalLightSource getMoon(Position pos)
You can pass the position if the moon changes relative to the postition.- Parameters:
pos
-- Returns:
-
setMoon
public void setMoon(GlobalLightSource moon)
- Parameters:
moon
-
-
setSun
public void setSun(GlobalLightSource sun)
restores position via save cvar "LEsunAzimuth".- Parameters:
sun
-
-
isShadingPixelBased
public boolean isShadingPixelBased()
The light engine can shade the world pixel based or vertext based.- Returns:
- true if rendering via normal map false if vertext based
-
getColor
public com.badlogic.gdx.graphics.Color getColor(Side normal, Position pos)
copy safe- Parameters:
normal
-pos
-- Returns:
-
getAmbient
public com.badlogic.gdx.graphics.Color getAmbient(Position pos)
Returns the sum of every light source's ambient light- Parameters:
pos
-- Returns:
- a color with a tone
-
isInDebug
public boolean isInDebug()
- Returns:
-
setDebug
public void setDebug(boolean debug)
Should diagrams be rendered showing the data of the LE.- Parameters:
debug
-
-
render
public void render(GameView view, Position pos)
Shows the data of the light engine in diagramms.- Parameters:
view
-pos
- display the light data at this position
-
setToNoon
public void setToNoon(Position pos)
- Parameters:
pos
-
-
setToNight
public void setToNight(Position pos)
- Parameters:
pos
-
-
getTimeOfDay
public float getTimeOfDay()
- Returns:
- value between 0 and 1
-
-