Class Terrain


  • public class Terrain
    extends Object
    Class that represents a terrain in the scene
    Author:
    Darius Dinger
    • Constructor Detail

      • Terrain

        public Terrain()
        Creates a new terrain with default values, defined in the configuration file
    • Method Detail

      • setConfig

        public void setConfig​(TerrainConfig config)
        Setting the new configuration of the terrain
        Parameters:
        config - New configuration
      • getConfig

        public TerrainConfig getConfig()
        Returns:
        Currents terrain configuration
      • getTerrainQuadtree

        public TerrainNode getTerrainQuadtree()
        Returning the terrain quadtree (the root nodes of the tree)
        Returns:
        Terrain root nodes
      • alignTo

        public void alignTo​(javax.vecmath.Vector3f pos)
        Aligning the terrain quadtree to the position pos. At pos the terrain has the highest lod. From pos the lod decreases.
        Parameters:
        pos - Position to align to
      • setScale

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

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

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

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

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

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

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

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

        public float getZ()
        Returns:
        Z position of the terrain
      • getGrassland

        public Grassland getGrassland()
        Returns:
        Grassland of the terrain
      • isGrasslandEnabled

        public boolean isGrasslandEnabled()
        Returns:
        Should grassland be rendered
      • setGrasslandEnabled

        public void setGrasslandEnabled​(boolean grasslandEnabled)
        Parameters:
        grasslandEnabled - Should grassland be rendered/updated
      • getShape

        public com.bulletphysics.collision.shapes.CollisionShape getShape()
        Returns:
        Collision shpe of the terrain. Only use in static rigid bodys!
      • recalcCollisionShape

        public void recalcCollisionShape​(int resolution)
        Recalculate the terrain collision shape
        Parameters:
        resolution - Number of quads per row/column of the shape