Class: Terrain

Terrain


new Terrain(heightMap, terrainSize, worldSize, minElevation, maxElevation, material [, subdivisions])

Terrain provides a terrain with dynamic LOD. The heightmapping itself happens in the Material.

Parameters:
Name Type Argument Description
heightMap Texture2D

The height map defining the height of the terrain.

terrainSize number

The size of the terrain's geometry. Generally smaller than the total world size of the height map.

worldSize number

The total world size covered by the heightmap.

minElevation number

The minimum elevation for the terrain (maps to heightmap value 0)

maxElevation number

The maximum elevation for the terrain (maps to heightmap value 1)

material Material

The Material to use when rendering the terrain.

subdivisions number <optional>

The amount of subdivisions per patch. Must be divisible by 4. Defaults to 32.

Properties:
Name Type Description
terrainSize number

The world size for the entire terrain.

Author:
  • derschmale <http://www.derschmale.com>

Extends

Members


euler

The rotation of the object.

Inherited From:

matrix

The matrix representing the transform.

Inherited From:

position

The position of the object.

Inherited From:

rotation

The rotation of the object.

Inherited From:

scale

The scale of the object.

Inherited From:

Methods


applyFunction(func)

Applies a function recursively to all child nodes.

Parameters:
Name Type Description
func

The function to call (using the traversed node as argument)

Inherited From:

applyFunctionConditional(func)

Applies a function recursively to all child nodes while the passed function returns true

Parameters:
Name Type Description
func

The function to call (using the traversed node as argument)

Inherited From:

attach()

Attaches a child SceneNode to this node.

Inherited From:

attachAfter(child, refChild)

Attaches a child SceneNode to this node.

Parameters:
Name Type Description
child SceneNode

The child to be attached.

refChild SceneNode

The scene node after which to add the new child.

Inherited From:

clone()

Creates a copy of the object.

Inherited From:
Overrides:

contains()

Returns whether or not a child is contained in a parent. This works recursively!

Inherited From:

copyTransform()

Copies the state of another Transform object

Inherited From:

destroy()

Removes the scene node from the scene and destroys it and all of its children.

Inherited From:

detach()

Removes a child SceneNode from this node.

Inherited From:

disableMatrixUpdates()

This disables listening to the position, rotation, etc. properties. If you need to change a lot of these properties, at once, it may be worth using this.

Inherited From:

enableMatrixUpdates()

This re-enables automatic matrix updates.

Inherited From:

findMaterialByName(name)

Queries the scene graph for a material with the given name

Parameters:
Name Type Description
name

The name of the Material

Inherited From:

findNodeByName()

Finds a scene node with the given name somewhere in this node's children.

Inherited From:

getChild()

Retrieves a child SceneNode with the given index.

Inherited From:

getChildIndex(child)

Returns the index of a child SceneNode.

Parameters:
Name Type Description
child
Inherited From:
Returns:
Type
*

isContainedIn()

Returns whether or not this scene node is contained by a parent. This works recursively.

Inherited From:

lookAt()

Orients the object in such a way as to face the target point.

Inherited From: