Class TerrainNode
- java.lang.Object
-
- de.coreengine.rendering.renderable.terrain.TerrainNode
-
public class TerrainNode extends Object
Class that represents one node of the terrain quadtree- Author:
- Darius Dinger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TerrainNode.Direction
-
Constructor Summary
Constructors Constructor Description TerrainNode(TerrainNode parent, TerrainNode.Direction dir, javax.vecmath.Vector2f position, float size, int lod, Terrain terrain)
Creates a new terrain node and sets its position, size and lod
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TerrainNode[]
getChilds()
Gets all child nodes of this node.
If the node is a leaf, the childs will be returned anyway.TerrainNode.Direction
getDirection()
int
getLod()
Getting the lod level of this specific nodeTerrainNode
getNeighboursGeBottom()
Gets the greater or equal bottom neighbour node
returns null if its root node or neighbour is smallerTerrainNode
getNeighboursGeLeft()
Gets the greater or equal left neighbour node
returns null if its root node or neighbour is smallerTerrainNode
getNeighboursGeRight()
Gets the greater or equal right neighbour node
returns null if its root node or neighbour is smallerTerrainNode
getNeighboursGeTop()
Gets the greater or equal top neighbour node
returns null if its root node or neighbour is smallerTerrainNode
getParent()
javax.vecmath.Vector2f
getPosition()
Getting the position/offset of this chunk relative to the terrain (0, 0) coordinatefloat
getSize()
Getting the horizontal scaling/size of this terrain node (squared)boolean
isLeaf()
Is the node a leaf of the tree / has it children?
-
-
-
Constructor Detail
-
TerrainNode
public TerrainNode(TerrainNode parent, TerrainNode.Direction dir, javax.vecmath.Vector2f position, float size, int lod, Terrain terrain)
Creates a new terrain node and sets its position, size and lod- Parameters:
parent
- Parent node of this nodedir
- Id of the quad in the parent quadposition
- Position of the node in world space (x,z)size
- Size / horizontal scale of this terrain node (squared)lod
- Lod level of this nodeterrain
- Parent terrain instance, this node belongs to
-
-
Method Detail
-
getNeighboursGeTop
public TerrainNode getNeighboursGeTop()
Gets the greater or equal top neighbour node
returns null if its root node or neighbour is smaller- Returns:
- Top neighbour node or null
-
getNeighboursGeBottom
public TerrainNode getNeighboursGeBottom()
Gets the greater or equal bottom neighbour node
returns null if its root node or neighbour is smaller- Returns:
- Bottom neighbour node or null
-
getNeighboursGeLeft
public TerrainNode getNeighboursGeLeft()
Gets the greater or equal left neighbour node
returns null if its root node or neighbour is smaller- Returns:
- Left neighbour node or null
-
getNeighboursGeRight
public TerrainNode getNeighboursGeRight()
Gets the greater or equal right neighbour node
returns null if its root node or neighbour is smaller- Returns:
- Right neighbour node or null
-
isLeaf
public boolean isLeaf()
Is the node a leaf of the tree / has it children?- Returns:
- Wether the node is a leaf
-
getChilds
public TerrainNode[] getChilds()
Gets all child nodes of this node.
If the node is a leaf, the childs will be returned anyway.- Returns:
- Child nodes of this node
-
getSize
public float getSize()
Getting the horizontal scaling/size of this terrain node (squared)- Returns:
- Size of this node
-
getPosition
public javax.vecmath.Vector2f getPosition()
Getting the position/offset of this chunk relative to the terrain (0, 0) coordinate- Returns:
- This terrain nodes position
-
getLod
public int getLod()
Getting the lod level of this specific node- Returns:
- Lod level of this node
-
getDirection
public TerrainNode.Direction getDirection()
- Returns:
- Dir of the quad in the parent quad
-
getParent
public TerrainNode getParent()
- Returns:
- Parent node
-
-