FieldSource
Defined in: sdk/src/terrain/source.ts:65
An area’s ground: a field of heights (0 to 1 over range, from 0 to height by default), centred on the terrain, with its splatmap
and where its rain ran.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FieldSource(
field,data,splat,flow,range?,splat2?):FieldSource
Defined in: sdk/src/terrain/source.ts:71
Parameters
Section titled “Parameters”Pick<TerrainData, "sizeX" | "sizeZ" | "height" | "rockSlope" | "dirtHeight" | "snowHeight">
Splat | null
Float32Array<ArrayBufferLike> | null
range?
Section titled “range?”readonly [number, number] = ...
splat2?
Section titled “splat2?”Splat | null = null
Returns
Section titled “Returns”FieldSource
Properties
Section titled “Properties”bounds
Section titled “bounds”
readonlybounds: readonly [number,number,number,number]
Defined in: sdk/src/terrain/source.ts:67
The area the ground covers, [minX, minZ, maxX, maxZ] in the terrain’s space; null for an infinite one.
Implementation of
Section titled “Implementation of”
readonlyfield:Heightfield
Defined in: sdk/src/terrain/source.ts:72
infinite
Section titled “infinite”
readonlyinfinite:false=false
Defined in: sdk/src/terrain/source.ts:66
Whether the ground goes on for ever (no edge to clip, no area to bake).
Implementation of
Section titled “Implementation of”maxHeight
Section titled “maxHeight”
readonlymaxHeight:number
Defined in: sdk/src/terrain/source.ts:69
Implementation of
Section titled “Implementation of”minHeight
Section titled “minHeight”
readonlyminHeight:number
Defined in: sdk/src/terrain/source.ts:68
The least and the most the height can be: what the pages encode their heights over.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”ensureSplats()
Section titled “ensureSplats()”ensureSplats(
second):object
Defined in: sdk/src/terrain/source.ts:87
The splatmaps a brush paints into, made where the ground had none: the first from the paint the ground has now (by height and
slope), the second (layers 5 to 8) empty, and only when second says it is wanted. They are as fine as the field, to 1024 a side.
Parameters
Section titled “Parameters”second
Section titled “second”boolean
Returns
Section titled “Returns”object
a:
Splat
b:
Splat|null
height()
Section titled “height()”height(
x,z):number|null
Defined in: sdk/src/terrain/source.ts:126
The height at (x, z), or null off the area (or where a provider has not answered yet).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number | null
Implementation of
Section titled “Implementation of”normal()
Section titled “normal()”normal(
x,z): [number,number,number] |null
Defined in: sdk/src/terrain/source.ts:133
The ground’s normal at (x, z), or null off the area.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”[number, number, number] | null
Implementation of
Section titled “Implementation of”paint()
Section titled “paint()”paint(
x,z,h,ny):LayerWeights
Defined in: sdk/src/terrain/source.ts:139
The weights of the layers (up to eight; the first four by default grass, dirt, snow, rock) at (x, z), where the ground there is h high and faces ny up.
Parameters
Section titled “Parameters”number
number
number
number
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”splats()
Section titled “splats()”splats():
object
Defined in: sdk/src/terrain/source.ts:105
The splatmaps now, null where the ground has none.
Returns
Section titled “Returns”object
a:
Splat|null
b:
Splat|null
toData()
Section titled “toData()”toData():
FieldSourceData
Defined in: sdk/src/terrain/source.ts:114
The ground as data (its arrays are shared, not copied): FieldSource.fromData makes the same ground from it.
Returns
Section titled “Returns”FieldSourceData
fromData()
Section titled “fromData()”
staticfromData(d):FieldSource
Defined in: sdk/src/terrain/source.ts:122
Parameters
Section titled “Parameters”FieldSourceData
Returns
Section titled “Returns”FieldSource