Skip to content

five-on-it / apps/client/src/renderer/marks / TyreMarks

Class: TyreMarks ​

Defined in: apps/client/src/renderer/marks.ts:45

The tyre marks of a scene.

Constructors ​

Constructor ​

new TyreMarks(capacity, life?): TyreMarks

Defined in: apps/client/src/renderer/marks.ts:67

Room for capacity quads, each fading over life seconds.

Parameters ​

capacity ​

number

life? ​

number = MARK_SECONDS

Returns ​

TyreMarks

Properties ​

colors ​

readonly colors: Float32Array

Defined in: apps/client/src/renderer/marks.ts:49

Corner colours with their opacity, 16 floats a quad.


dirty ​

dirty: boolean = false

Defined in: apps/client/src/renderer/marks.ts:55

Set when the arrays changed and need uploading.


indices ​

readonly indices: Uint32Array

Defined in: apps/client/src/renderer/marks.ts:51

Triangle indices, fixed: two a quad.


laid ​

laid: number = 0

Defined in: apps/client/src/renderer/marks.ts:53

Quads laid since the start.


positions ​

readonly positions: Float32Array

Defined in: apps/client/src/renderer/marks.ts:47

Corner positions, 12 floats a quad; a free slot is all zeros (nothing drawn).

Accessors ​

live ​

Get Signature ​

get live(): number

Defined in: apps/client/src/renderer/marks.ts:82

Quads on the ground now.

Returns ​

number

Methods ​

end() ​

end(trail): void

Defined in: apps/client/src/renderer/marks.ts:150

The wheel trail stopped sliding: its next mark starts afresh.

Parameters ​

trail ​

string

Returns ​

void


extend() ​

extend(trail, x, y, z, width, loose, now): boolean

Defined in: apps/client/src/renderer/marks.ts:98

The wheel trail (a key per car and wheel) is at (x, y, z) and sliding: lays the stretch from where it last was, width across, once it is far enough on; the first look only starts the trail. Returns whether a quad was laid.

Parameters ​

trail ​

string

x ​

number

y ​

number

z ​

number

width ​

number

loose ​

boolean

now ​

number

Returns ​

boolean


newestOpacity() ​

newestOpacity(now): number

Defined in: apps/client/src/renderer/marks.ts:87

The opacity of the newest quad still on the ground, 0 when none is.

Parameters ​

now ​

number

Returns ​

number


splat() ​

splat(x, y, z, radius, angle, uneven, look, now): void

Defined in: apps/client/src/renderer/marks.ts:130

Lays a splat (a blood stain) at (x, y, z) in look: an uneven blot about radius across each way from its middle, turned by angle (rad), its four corners each a little nearer or further (uneven, 0..1 for each corner).

Parameters ​

x ​

number

y ​

number

z ​

number

radius ​

number

angle ​

number

uneven ​

readonly number[]

look ​

MarkLook

now ​

number

Returns ​

void


update() ​

update(now): number

Defined in: apps/client/src/renderer/marks.ts:159

Ages the marks to now, at most every FADE_STEP seconds (a fade that slow needs no more): rewrites their opacity, frees the slots of the faded ones and forgets the trails not extended for a second. Returns how many marks are left.

Parameters ​

now ​

number

Returns ​

number