Class Terrain
- java.lang.Object
-
- de.coreengine.rendering.renderable.terrain.Terrain
-
public class Terrain extends Object
Class that represents a terrain in the scene- Author:
- Darius Dinger
-
-
Constructor Summary
Constructors Constructor Description Terrain()
Creates a new terrain with default values, defined in the configuration file
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
alignTo(javax.vecmath.Vector3f pos)
Aligning the terrain quadtree to the position pos.TerrainConfig
getConfig()
Grassland
getGrassland()
float
getScale()
com.bulletphysics.collision.shapes.CollisionShape
getShape()
TerrainNode
getTerrainQuadtree()
Returning the terrain quadtree (the root nodes of the tree)javax.vecmath.Matrix4f
getTransMat()
float
getX()
float
getY()
float
getZ()
boolean
isGrasslandEnabled()
void
recalcCollisionShape(int resolution)
Recalculate the terrain collision shapevoid
setConfig(TerrainConfig config)
Setting the new configuration of the terrainvoid
setGrasslandEnabled(boolean grasslandEnabled)
void
setScale(float scale)
Sets the terrain horizontal scale/sizevoid
setX(float x)
Sets the x position of the terrains (0, 0) pointvoid
setY(float y)
Sets the y position of the terrains (0, 0) pointvoid
setZ(float z)
Sets the z position of the terrains (0, 0) point
-
-
-
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
-
-