Terrain · class

TerrainMaterials

Explained in Terrain.

class TerrainMaterials
import { TerrainMaterials } from '@driftengine/terrain';

Constructor

new

constructor(options: TerrainMaterialsOptions)
ParameterTypeDescription
optionsTerrainMaterialsOptions

Properties

NameTypeDescription
materialsreadonlyreadonly TerrainMaterial[]
widthreadonlynumber
depthreadonlynumber
weightsreadonlyFloat32Array
shinesreadonlybooleanWhether any material shines, so a patch built from this uploads a specular buffer only if one is wanted — the promise MeshData.specular makes and the reason it is optional.
glowsreadonlybooleanThe same question for emissive, and for the same reason.

Methods

colorAt

colorAt(u: number, v: number, out: Float32Array): Float32Array

The blended colour at a point in the field's 0..1 extent.

ParameterTypeDescription
unumber
vnumber
outFloat32Array

emissiveAt

emissiveAt(u: number, v: number): number

The blended self-illumination, on the same weights the colour used.

ParameterTypeDescription
unumber
vnumber

specularAt

specularAt(u: number, v: number): number

The blended highlight, likewise.

ParameterTypeDescription
unumber
vnumber