Package de.coreengine.system.gameObjects
Class DayNightCycle
- java.lang.Object
-
- de.coreengine.system.GameObject
-
- de.coreengine.system.gameObjects.DayNightCycle
-
public class DayNightCycle extends GameObject
Class that can simulate a day night cycle with skybox, fog and sun- Author:
- Darius Dinger
-
-
Field Summary
-
Fields inherited from class de.coreengine.system.GameObject
parent
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.vecmath.Vector4f
getCaps()
Getting read/writeable vec4f with the day/night caps.javax.vecmath.Vector3f
getCenter()
FogEffect
getFog()
Moon
getMoon()
Skybox
getSkybox()
Sun
getSun()
boolean
isDay()
void
onRender()
In this method the GameObject gets rendered onto the screen (if it has an graphical representation).void
onUpdate()
This method gets called every frame before the render method.void
setCenter(javax.vecmath.Vector3f center)
Setting the center of the sun cycle.void
setSpeed(float Speed)
-
Methods inherited from class de.coreengine.system.GameObject
addActionToPhysicWorld, addChild, addRigidBodyToWorld, getScene, onAdd, onInit, onLoad, onPauseUpdate, onRemove, onSave, onSyncronize, removeChild, setShouldRender, setShouldSyncronize, setShouldUpdate
-
-
-
-
Constructor Detail
-
DayNightCycle
public DayNightCycle(String dayTex, Color dayColor, String eveTex, Color eveColor, String nigTex, Color nigColor, String sunTexture, String moonTexture)
Creating new day night cycle- Parameters:
dayTex
- Day skybox cube map texturedayColor
- Color of the Sun and fog at dayeveTex
- Evening skybox cube map textureeveColor
- Color of the Sun and fog at eveningnigTex
- Night skybox cube map texturenigColor
- Color of the Sun and fog at nightsunTexture
- TextureData of the sunmoonTexture
- TextureData of the moon
-
-
Method Detail
-
onUpdate
public void onUpdate()
Description copied from class:GameObject
This method gets called every frame before the render method. Here is place for the GameObject logic updates, e.g. input handling, physics, actions, ...- Overrides:
onUpdate
in classGameObject
-
onRender
public void onRender()
Description copied from class:GameObject
In this method the GameObject gets rendered onto the screen (if it has an graphical representation). Its primary used for MasterRenderer calls.- Overrides:
onRender
in classGameObject
-
getCaps
public javax.vecmath.Vector4f getCaps()
Getting read/writeable vec4f with the day/night caps. The values are between 0.0f and 1.0f.
X value = Lower day
Y value = Upper evening
Z value = Lower evening
W value = Upper night- Returns:
- Read/writeable vec4f with the day/night caps
-
getSun
public Sun getSun()
- Returns:
- Read/Writeable sun of the day night cycle
-
getMoon
public Moon getMoon()
- Returns:
- Read/Writeable moon of the day night cycle
-
getFog
public FogEffect getFog()
- Returns:
- Read/Writeable fog of the day night cycle
-
getSkybox
public Skybox getSkybox()
- Returns:
- Read/Writeable skybox of the day night cycle
-
setSpeed
public void setSpeed(float Speed)
- Parameters:
Speed
- New movement speed of the sun
-
setCenter
public void setCenter(javax.vecmath.Vector3f center)
Setting the center of the sun cycle. It makes sense to set this to the camera position, sothe sun rotates around the camera.- Parameters:
center
- Center position to rotate around
-
getCenter
public javax.vecmath.Vector3f getCenter()
- Returns:
- Write/readable center of the sun as 3d vector
-
isDay
public boolean isDay()
- Returns:
- Is currently day or night
-
-