Class LightEngine
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.lightengine.LightEngine
-
public class LightEngine extends java.lang.ObjectThis 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.StringVERSIONThe 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.ColorgetAmbient(Position pos)Returns the sum of every light source's ambient lightcom.badlogic.gdx.graphics.ColorgetColor(Side normal, Position pos)copy safeGlobalLightSourcegetMoon(Position pos)You can pass the position if the moon changes relative to the postition.GlobalLightSourcegetSun(Position pos)You can pass the position if the sun changes relative to the postition.floatgetTimeOfDay()static floatgetVertexBrightness()Returns the average brightness.booleanisInDebug()booleanisShadingPixelBased()The light engine can shade the world pixel based or vertext based.voidrender(GameView view, Position pos)Shows the data of the light engine in diagramms.voidsetDebug(boolean debug)Should diagrams be rendered showing the data of the LE.voidsetMoon(GlobalLightSource moon)voidsetSun(GlobalLightSource sun)restores position via save cvar "LEsunAzimuth".voidsetToNight(Position pos)voidsetToNoon(Position pos)voidupdate(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
-
-