Surface

Surface

A grid-like surface shape

Constructor

new Surface(verts, vertsPerLineopt, verticallyClosedopt)

Parameters:
Name Type Attributes Default Description
verts Array.<number>

The vertices data array

vertsPerLine number <optional>
2

The number of vertices

verticallyClosed Boolean <optional>

Methods

(static) createFromHeightMap(heightMapopt, xScaleopt, yScaleopt, zScaleopt) → {Surface}

Create a Surface from a supplied height map in the form of a matrix

Parameters:
Name Type Attributes Default Description
heightMap Array.<number> <optional>

The height map

xScale number <optional>
1
yScale number <optional>
1
zScale number <optional>
1

(static) createTessellatedFlat(xSize, zSize, xCount, zCount) → {Surface}

Create a tessellated Surface typically useful for a waterplane to reduce z-fighting

Parameters:
Name Type Description
xSize number

x axis size in units

zSize number

z axis size in numbers

xCount number

x axis vertex count

zCount number

z axis vertex count

rebuild() → {Surface}

Builds or rebuilds the mesh data