GroundMesh

NodeMesh

Description

class GroundMesh extends Mesh

Constructor

new GroundMesh(name, scene)

Parameters

Name Type Description
name string
scene Scene

Members

generateOctree : boolean

subdivisions : number

subdivisionsX : number

subdivisionsY : number

Methods

getClassName() string

optimize(chunksCount, octreeBlocksSize) void

Parameters

Name Type Description
chunksCount number
optional octreeBlocksSize number

getHeightAtCoordinates(x, z) number

Returns a height (y) value in the Worl system :

the ground altitude at the coordinates (x, z) expressed in the World system.

Returns the ground y position if (x, z) are outside the ground surface.

Parameters

Name Type Description
x number
z number

getNormalAtCoordinates(x, z) Vector3

Returns a normalized vector (Vector3) orthogonal to the ground

at the ground coordinates (x, z) expressed in the World system.

Returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.

Parameters

Name Type Description
x number
z number

getNormalAtCoordinatesToRef(x, z, ref) GroundMesh

Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground

at the ground coordinates (x, z) expressed in the World system.

Doesn't uptade the reference Vector3 if (x, z) are outside the ground surface.

Returns the GroundMesh.

Parameters

Name Type Description
x number
z number
ref Vector3

updateCoordinateHeights() GroundMesh

Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()

if the ground has been updated.

This can be used in the render loop.

Returns the GroundMesh.

serialize(serializationObject) void

Parameters

Name Type Description
serializationObject any

static Parse(parsedMesh, scene) GroundMesh

Parameters

Name Type Description
parsedMesh any
scene Scene