Class Water


  • public class Water
    extends Object
    Class that represents a renderable waterplate
    Author:
    Darius Dinger
    • Constructor Detail

      • Water

        public Water()
        Creating new water
    • Method Detail

      • setQuality

        public void setQuality​(float quality)
        Setting waters quality be rescaling the fraction and reflection texture. The rescaling is the WindowResolution * quality. So 1.0f is the best quality and to 0.0f it gets more pixelated.
        This action take performance so dont call it in the game loop!
        Parameters:
        quality - New water quality
      • getDudvMap

        public String getDudvMap()
        Returns:
        Waters dudv map for distortion
      • getNormalMap

        public String getNormalMap()
        Returns:
        Waters normal map
      • getTiling

        public float getTiling()
        Returns:
        Tiling for the maps (dudv/normal)
      • setOffset

        public void setOffset​(float offset)
        Parameters:
        offset - New offset of the dudv/normal map for wave animation
      • getOffset

        public float getOffset()
        Returns:
        Offset of the dudv/normal map for wave animation
      • getReflectionFbo

        public FrameBufferObject getReflectionFbo()
        Returns:
        Fbo to render reflection into
      • getRefractionFbo

        public FrameBufferObject getRefractionFbo()
        Returns:
        Fbo to render refraction into
      • getMultiplicativeColor

        public Color getMultiplicativeColor()
        Returns:
        Read/writeable multiplicative color part of the water. (watercolor = multiplicativeColor * color + additiveColor)
      • getAdditiveColor

        public Color getAdditiveColor()
        Returns:
        Read/writeable additive color part of the water. (color(x) = multiplicativeColor * x + additiveColor)
      • getSoftEdgeDepth

        public float getSoftEdgeDepth()
        Returns:
        Depth to begin softing edge
      • getWaveStrength

        public float getWaveStrength()
        Returns:
        Strength, the dudv map effects the water
      • setDudvMap

        public void setDudvMap​(String dudvMap)
        Parameters:
        dudvMap - New dudv map of the water
      • setNormalMap

        public void setNormalMap​(String normalMap)
        Parameters:
        normalMap - New normal map of the water
      • setTiling

        public void setTiling​(float tiling)
        Parameters:
        tiling - New tiling of the waters dudv/normal map
      • setSoftEdgeDepth

        public void setSoftEdgeDepth​(float sed)
        Parameters:
        sed - New depth to begin softing edge
      • setWaveStrength

        public void setWaveStrength​(float waveStrength)
        Parameters:
        waveStrength - New strength, the dudv map effects the water
      • setScale

        public void setScale​(float scale)
        Sets the water horizontal scale/size
        Parameters:
        scale - New scale of the water
      • setX

        public void setX​(float x)
        Sets the x position of the waters (0, 0) point
        Parameters:
        x - New x position
      • setY

        public void setY​(float y)
        Sets the y position of the waters (0, 0) point (sea level)
        Parameters:
        y - New y position
      • setZ

        public void setZ​(float z)
        Sets the z position of the waters (0, 0) point
        Parameters:
        z - New z position
      • getTransMat

        public javax.vecmath.Matrix4f getTransMat()
        Returns:
        Waters current transformation matrix
      • getScale

        public float getScale()
        Returns:
        Horizontal scale/size of the water
      • getX

        public float getX()
        Returns:
        X position of the water
      • getY

        public float getY()
        Returns:
        Y position of the water
      • getZ

        public float getZ()
        Returns:
        Z position of the water
      • getClipPlane

        public javax.vecmath.Vector4f getClipPlane()
        Returns:
        Clip plane for rendering refraction/reflection texture
      • getTransparency

        public float getTransparency()
        Setting the waters transparency (ration of reflectiona dn refraction). If the value is 1.0 the mix is 50/50. Under 1 is more transparent, over 1 is more reflective.
        Returns:
        Current waters transparency
      • setTransparency

        public void setTransparency​(float transparency)
        Setting the waters transparency (ration of reflectiona dn refraction). If the value is 1.0 the mix is 50/50. Under 1 is more transparent, over 1 is more reflective.
        Parameters:
        transparency - New transparency
      • getShineDamper

        public float getShineDamper()
        Get shine damper for specular lighting
        Returns:
        Water shine damper
      • setShineDamper

        public void setShineDamper​(float shineDamper)
        Set shine damper for specular lighting
        Parameters:
        shineDamper - Water shine damper
      • getShininess

        public float getShininess()
        Get shininess for specular lighting
        Returns:
        Water shininess
      • setShininess

        public void setShininess​(float shininess)
        Set shininess for specular lighting
        Parameters:
        shininess - Water shininess
      • setReflectionEnabled

        public void setReflectionEnabled​(boolean reflectionEnabled)
        Enable or disable reflection. So the water will reflect the environment. This will have effect on the performance.
        Parameters:
        reflectionEnabled - Should reflection be enabled
      • setRefractionEnabled

        public void setRefractionEnabled​(boolean refractionEnabled)
        Enable or disable refraction. So the water will refract theenvironment under the water. This will have effect on the performance.
        Parameters:
        refractionEnabled - Should refraction be enabled
      • isReflectionEnabled

        public boolean isReflectionEnabled()
        Returns:
        Is reflection of the water enabled
      • isRefractionEnabled

        public boolean isRefractionEnabled()
        Returns:
        Is refraction of the water enabled