Renderer · class

TrampleField

Explained in Hello world.

class TrampleField
import { TrampleField } from '@driftengine/core';

Constructor

new

constructor( /** * Seconds for a press to fade away completely. * * Pressed foliage fades back to its original position after a few seconds: * long enough that a trail is visible behind a character at speed, * short enough that a field does not stay combed for the rest of the run. */ recoverySec?: number)
ParameterTypeDescription
/** * Seconds for a press to fade away completely. * * Pressed foliage fades back to its original position after a few seconds: * long enough that a trail is visible behind a character at speed
* short enough that a field does not stay combed for the rest of the run. */ recoverySec?: number

Properties

NameTypeDescription
datareadonlyFloat32Array<ArrayBuffer>[x, y, z, strength] per slot; strength 0 means empty.

Methods

press

press(x: number, y: number, z: number): void

Record a press, or deepen the one already there.

ParameterTypeDescription
xnumber
ynumber
znumber
More

Allocation-free: called every frame the character is on the ground.

update

update(frameDt: number): void

Let every press recover. Once per rendered frame.

ParameterTypeDescription
frameDtnumber

strengthAt

strengthAt(x: number, y: number, z: number, radiusM: number): number

How pressed a point is, 0–1. For tests and for anything not on the GPU.

ParameterTypeDescription
xnumber
ynumber
znumber
radiusMnumber