Class DayNightCycle


  • public class DayNightCycle
    extends GameObject
    Class that can simulate a day night cycle with skybox, fog and sun
    Author:
    Darius Dinger
    • 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 texture
        dayColor - Color of the Sun and fog at day
        eveTex - Evening skybox cube map texture
        eveColor - Color of the Sun and fog at evening
        nigTex - Night skybox cube map texture
        nigColor - Color of the Sun and fog at night
        sunTexture - TextureData of the sun
        moonTexture - 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 class GameObject
      • 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 class GameObject
      • 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