@adatechnology/game-characters-three 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunk-3CHBEUHW.js +4661 -0
- package/dist/chunk-3CHBEUHW.js.map +1 -0
- package/dist/index.d.ts +328 -619
- package/dist/index.global.js +3387 -2083
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +592 -4236
- package/dist/index.js.map +1 -1
- package/dist/testing-DyQw8dCw.d.ts +606 -0
- package/dist/testing.d.ts +4 -0
- package/dist/testing.js +25 -0
- package/dist/testing.js.map +1 -0
- package/package.json +13 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { T as Three, R as RichRig, B as BloodLook, F as FluidsBridge, C as CharacterSound, A as AvatarItemUsePose, a as AvatarViewMode, b as ReachView, P as PlayerAvatar } from './testing-DyQw8dCw.js';
|
|
2
|
+
export { c as AVATAR_AREA_ID, d as AreaContext, e as AvatarEvent, f as AvatarTestOptions, g as AvatarUpdate, h as BODY_MATERIAL_DEF, i as BODY_SOUNDS, j as BloodAge, k as BloodLookOptions, l as BloodSink, m as BodySoundRule, n as CHARACTERS_AREA_ID, o as CharacterSoundOptions, p as CharacterSoundSink, q as CharacterSoundStyle, r as CharactersTestOptions, s as FilmSink, t as FluidsBridgeOptions, H as HIT_PRESETS, u as HitPreset, v as PERSON_ITEM_PREFIX, w as PLAYER_SOUNDS, x as PlayPoseOptions, y as PlayerAvatarColors, z as PlayerAvatarOptions, D as PlayerAvatarSpec, E as PoseTargets, G as ProfessionCard, I as RigAnimator, J as RigAnimatorOptions, U as UNDEAD_VOICES, K as UNDEAD_VOICE_SOURCES, L as UndeadCard, M as UndeadLike, N as UndeadVoice, V as VoiceMoment, O as VoiceStep, W as WoundSpray, Z as ZOMBIE_ITEM_PREFIX, Q as bloodLookOfAge, S as createAvatarTestModule, X as createCharacterSound, Y as createCharactersTestModule, _ as createFluidsBridge, $ as createPlayerAvatar, a0 as createRigAnimator, a1 as personSpecOf, a2 as registerBodyMaterial } from './testing-DyQw8dCw.js';
|
|
3
|
+
import { BodySpec, SegmentId, PoseClip, PoseClipEvent, FirstPersonClip } from '@adatechnology/game-characters';
|
|
1
4
|
import * as THREE_NS from 'three';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
5
|
+
import { LightBudget, SourceHandle } from '@adatechnology/game-render-three';
|
|
6
|
+
import { DestructionEvent, HandTargets } from '@adatechnology/game-contracts';
|
|
4
7
|
import { SoundRecipe, SoundBank } from '@adatechnology/game-audio';
|
|
5
8
|
|
|
6
|
-
/** The three.js namespace the host passes in: the package never imports three itself, so one script tag works. */
|
|
7
|
-
type Three = typeof THREE_NS;
|
|
8
|
-
|
|
9
9
|
/**
|
|
10
10
|
* The vertex-shader chunk of the instanced body, carried byte for byte from the game (G 65400 `bodyChunk`): the pose math of the 12 bones on the GPU.
|
|
11
11
|
* Per-instance attributes: iA = (x, z, yaw, phase) · iB = (height, build, stride, pose + 16 × ground height in mm) · iC = (missing-parts mask, infection 0..1,
|
|
@@ -20,22 +20,22 @@ type BodyChunkOptions = {
|
|
|
20
20
|
/** The chunk with the hip joint set (the only joint the shader holds as a constant); without options it is `BODY_CHUNK` itself. */
|
|
21
21
|
declare const createBodyChunk: ({ hipHeight }?: BodyChunkOptions) => string;
|
|
22
22
|
|
|
23
|
-
type Vec3 = readonly [number, number, number];
|
|
23
|
+
type Vec3$1 = readonly [number, number, number];
|
|
24
24
|
/**
|
|
25
25
|
* The joints the instanced body hangs from, by the game's names. `E` is the side with the negative x (bones 2, 4, 7 and 9), `D` the positive one
|
|
26
26
|
* (bones 3, 5, 8 and 10); the shader's `side` depends on it, so the sides are told apart by the sign of x, whatever a spec calls them.
|
|
27
27
|
*/
|
|
28
28
|
type BodyJoints = {
|
|
29
|
-
readonly hip: Vec3;
|
|
30
|
-
readonly neck: Vec3;
|
|
31
|
-
readonly shoulderE: Vec3;
|
|
32
|
-
readonly shoulderD: Vec3;
|
|
33
|
-
readonly elbowE: Vec3;
|
|
34
|
-
readonly elbowD: Vec3;
|
|
35
|
-
readonly thighE: Vec3;
|
|
36
|
-
readonly thighD: Vec3;
|
|
37
|
-
readonly kneeE: Vec3;
|
|
38
|
-
readonly kneeD: Vec3;
|
|
29
|
+
readonly hip: Vec3$1;
|
|
30
|
+
readonly neck: Vec3$1;
|
|
31
|
+
readonly shoulderE: Vec3$1;
|
|
32
|
+
readonly shoulderD: Vec3$1;
|
|
33
|
+
readonly elbowE: Vec3$1;
|
|
34
|
+
readonly elbowD: Vec3$1;
|
|
35
|
+
readonly thighE: Vec3$1;
|
|
36
|
+
readonly thighD: Vec3$1;
|
|
37
|
+
readonly kneeE: Vec3$1;
|
|
38
|
+
readonly kneeD: Vec3$1;
|
|
39
39
|
};
|
|
40
40
|
declare const jointsOf: (body: BodySpec) => BodyJoints;
|
|
41
41
|
type Geometry = THREE_NS.BufferGeometry;
|
|
@@ -51,6 +51,64 @@ type BuildInstancedBodyParams = {
|
|
|
51
51
|
*/
|
|
52
52
|
declare const buildInstancedBody: (host: Three, { segments, body }: BuildInstancedBodyParams) => Geometry;
|
|
53
53
|
|
|
54
|
+
/** Bones of the instanced body (`body-geometry.ts`) and texels per bone in the clip texture: a rotation and a displacement. */
|
|
55
|
+
declare const CLIP_BONES = 12;
|
|
56
|
+
declare const CLIP_TEXELS: number;
|
|
57
|
+
/** Rows sampled per second of a clip (the bake rate of the D12 ladder). */
|
|
58
|
+
declare const CLIP_RATE = 30;
|
|
59
|
+
/** Clips a texture may hold: the index is four bits of `iD.z`. */
|
|
60
|
+
declare const CLIP_LIMIT = 16;
|
|
61
|
+
type ClipLimp = 'left' | 'right' | 'drag';
|
|
62
|
+
/** A looping clip of the instanced body's walk, as numbers of the shader's own walk (`bodyAnim`) plus the gait styles of the identity extension. */
|
|
63
|
+
type SegmentClipSpec = {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
/** Rows of the clip: its cycles at 30 Hz. */
|
|
66
|
+
readonly frames: number;
|
|
67
|
+
/** Walk cycles the clip spans (a lurch is two). */
|
|
68
|
+
readonly cycles?: number;
|
|
69
|
+
/** 0 arms hanging as the wandering zombie, 1 raised toward the prey (blended per instance by the arms). */
|
|
70
|
+
readonly armRaise: number;
|
|
71
|
+
readonly sway?: number;
|
|
72
|
+
readonly bendPulse?: number;
|
|
73
|
+
readonly limp?: ClipLimp;
|
|
74
|
+
readonly stagger?: boolean;
|
|
75
|
+
};
|
|
76
|
+
type SegmentClipSet = {
|
|
77
|
+
readonly specs: readonly SegmentClipSpec[];
|
|
78
|
+
/** First row of each clip. */
|
|
79
|
+
readonly start: readonly number[];
|
|
80
|
+
readonly frames: readonly number[];
|
|
81
|
+
readonly cycles: readonly number[];
|
|
82
|
+
readonly rows: number;
|
|
83
|
+
/** RGBA32F, `CLIP_TEXELS` wide: per bone a quaternion (x, y, z, w) and a displacement (x, y, z, 0). */
|
|
84
|
+
readonly data: Float32Array;
|
|
85
|
+
};
|
|
86
|
+
declare const SEGMENT_CLIPS: readonly SegmentClipSpec[];
|
|
87
|
+
/** Samples the clips at 30 Hz into one table (the rows of every clip one after the other): pure, no GPU. */
|
|
88
|
+
declare const bakeSegmentClips: (specs?: readonly SegmentClipSpec[]) => SegmentClipSet;
|
|
89
|
+
/** What a body material needs of the clips: the texture and the three tables, as shared uniforms. */
|
|
90
|
+
type SegmentClipUniforms = {
|
|
91
|
+
readonly uClips: {
|
|
92
|
+
value: THREE_NS.DataTexture;
|
|
93
|
+
};
|
|
94
|
+
readonly uClipStart: {
|
|
95
|
+
value: number[];
|
|
96
|
+
};
|
|
97
|
+
readonly uClipFrames: {
|
|
98
|
+
value: number[];
|
|
99
|
+
};
|
|
100
|
+
readonly uClipCycles: {
|
|
101
|
+
value: number[];
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* The clip texture (economy ladder, step 3): RGBA32F, `CLIP_TEXELS` (24) wide, one row per sampled step, `NearestFilter` with no mipmaps: float texels are not
|
|
106
|
+
* filterable everywhere and a blend would mix neighbouring bones. The shader blends two rows itself.
|
|
107
|
+
*/
|
|
108
|
+
declare const createSegmentClipUniforms: (three: Three, set?: SegmentClipSet) => SegmentClipUniforms;
|
|
109
|
+
/** The index of a clip by id (the crowd picks its family by name). */
|
|
110
|
+
declare const clipIndexOf: (set: SegmentClipSet, id: string) => number;
|
|
111
|
+
|
|
54
112
|
type BodyMaterialParams = {
|
|
55
113
|
/** The depth material for shadows (true) or the lit body (false). */
|
|
56
114
|
readonly depth?: boolean;
|
|
@@ -59,12 +117,23 @@ type BodyMaterialParams = {
|
|
|
59
117
|
value: number;
|
|
60
118
|
};
|
|
61
119
|
readonly chunk?: BodyChunkOptions;
|
|
120
|
+
/** The distance material the point-light shadow pass reads (`customDistanceMaterial`); the vertices move the same way. */
|
|
121
|
+
readonly distance?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Adds the identity extension (T4b.7): the `iD` attribute drives the gait style, the stagger, the lean of a shove, the trousers palette and the wound splashes.
|
|
124
|
+
* Off, the shader text is the game's, and the program key is three's own.
|
|
125
|
+
*/
|
|
126
|
+
readonly identity?: boolean;
|
|
127
|
+
/** The material of an accessory batch: baked once at a reference pivot, moved and scaled per variant by `iAcc` (`vec4`: offset xyz, scale w). Implies `identity`. */
|
|
128
|
+
readonly accessory?: boolean;
|
|
129
|
+
/** The clip texture (`createSegmentClipUniforms`), shared by every material that reads it: a body flagged `clips` in its `iD` walks from the clips (T4b.7, step 3). */
|
|
130
|
+
readonly segmentClips?: SegmentClipUniforms;
|
|
62
131
|
};
|
|
63
132
|
/**
|
|
64
133
|
* The instanced body's material: the pose chunk in the vertex shader and the per-instance tints (skin by tone and infection, shirt, pants, hair,
|
|
65
134
|
* glowing eyes) in the fragment shader (G 65473 `bodyMaterial`).
|
|
66
135
|
*/
|
|
67
|
-
declare const createBodyMaterial: (three: Three, { depth, time, chunk }: BodyMaterialParams) => THREE_NS.Material;
|
|
136
|
+
declare const createBodyMaterial: (three: Three, { depth, distance, time, chunk, identity, accessory, segmentClips }: BodyMaterialParams) => THREE_NS.Material;
|
|
68
137
|
|
|
69
138
|
type BodyBatchOptions = {
|
|
70
139
|
/** Instances the batch can hold. */
|
|
@@ -73,6 +142,14 @@ type BodyBatchOptions = {
|
|
|
73
142
|
readonly time: {
|
|
74
143
|
value: number;
|
|
75
144
|
};
|
|
145
|
+
/** Adds the `iD` identity attribute and the extension of the shader (T4b.7); off, the batch is the game's. */
|
|
146
|
+
readonly identity?: boolean;
|
|
147
|
+
/** A batch of an accessory (baked once, moved per variant by `iAcc`): implies `identity`. */
|
|
148
|
+
readonly accessory?: boolean;
|
|
149
|
+
/** Walk bodies from the clip texture (`createSegmentClipUniforms`): needs `identity` and a look with `clips`. */
|
|
150
|
+
readonly segmentClips?: SegmentClipUniforms;
|
|
151
|
+
/** Also makes a depth-only mesh over the same geometry, drawn first (`batch.prepass`), so the lit pass shades the nearest body of each pixel only (the room's lights make a fragment dear). */
|
|
152
|
+
readonly depthPrepass?: boolean;
|
|
76
153
|
};
|
|
77
154
|
/** One instance: the 12 numbers of the shader's `iA`, `iB` and `iC`, the shirt colour and the eye colour (G 65509 `push`). */
|
|
78
155
|
type BodyInstance = {
|
|
@@ -91,9 +168,19 @@ type BodyInstance = {
|
|
|
91
168
|
};
|
|
92
169
|
/** Ground height (a pile of bodies, a jump); packed into `b[3]` next to the pose. */
|
|
93
170
|
readonly y?: number;
|
|
171
|
+
/** The `iD` identity (with `identity`), see `packIdentity`. */
|
|
172
|
+
readonly d?: readonly [number, number, number, number];
|
|
173
|
+
/** The `iAcc` pivot offset and scale (with `accessory`). */
|
|
174
|
+
readonly acc?: readonly [number, number, number, number];
|
|
175
|
+
};
|
|
176
|
+
/** A plain `Mesh` over an `InstancedBufferGeometry` (no `instanceMatrix`: 4 vertex attribute slots less); `count` mirrors the geometry's `instanceCount`. */
|
|
177
|
+
type BodyBatchMesh = THREE_NS.Mesh & {
|
|
178
|
+
count: number;
|
|
94
179
|
};
|
|
95
180
|
type BodyBatch = {
|
|
96
|
-
readonly mesh:
|
|
181
|
+
readonly mesh: BodyBatchMesh;
|
|
182
|
+
/** The depth-only mesh drawn before `mesh` (with `depthPrepass`); add it to the scene next to `mesh`. */
|
|
183
|
+
readonly prepass?: THREE_NS.Mesh;
|
|
97
184
|
readonly max: number;
|
|
98
185
|
readonly count: number;
|
|
99
186
|
begin(): void;
|
|
@@ -103,6 +190,86 @@ type BodyBatch = {
|
|
|
103
190
|
/** A batch of bodies drawn in one call (zombies, survivors, corpses). `begin`, `push` per body each frame, then `end` (G 65509 `BodyBatch`). */
|
|
104
191
|
declare const createBodyBatch: (three: Three, geometry: THREE_NS.BufferGeometry, options: BodyBatchOptions) => BodyBatch;
|
|
105
192
|
|
|
193
|
+
/** How the body shader's `iD` (identity) and `iAcc` (accessory pivot) attributes are packed: whole numbers in floats, so every field survives the GPU. */
|
|
194
|
+
declare const GAIT_STYLE: {
|
|
195
|
+
readonly NORMAL: 0;
|
|
196
|
+
readonly LIMP_LEFT: 1;
|
|
197
|
+
readonly LIMP_RIGHT: 2;
|
|
198
|
+
readonly DRAG: 3;
|
|
199
|
+
readonly LURCH: 4;
|
|
200
|
+
readonly SHAMBLE: 5;
|
|
201
|
+
};
|
|
202
|
+
type GaitStyle = (typeof GAIT_STYLE)[keyof typeof GAIT_STYLE];
|
|
203
|
+
/** The accessory bits of `iD.y` bits 7 to 10: the batch of each accessory kind is fixed, a body carries any mix. */
|
|
204
|
+
declare const ACCESSORY_BIT: {
|
|
205
|
+
readonly CAP: 1;
|
|
206
|
+
readonly HELMET: 2;
|
|
207
|
+
readonly BACKPACK: 4;
|
|
208
|
+
readonly EXTRA: 8;
|
|
209
|
+
};
|
|
210
|
+
/** Pose index of a body that is staggering (not in `INSTANCE_POSES`: the base chunk draws any unknown pose as the walk, the extension adds the stagger on top). */
|
|
211
|
+
declare const STAGGER_POSE = 8;
|
|
212
|
+
/** Trousers of the identity palette, 16 colours as hex (the shader and the impostor read the same table). */
|
|
213
|
+
declare const TROUSER_PALETTE: readonly [2832981, 3821432, 1842208, 4868686, 7035452, 8022600, 4147764, 5913130, 2764600, 6120818, 6958890, 4864594, 9077872, 2372154, 3485738, 5660778];
|
|
214
|
+
type IdentityLook = {
|
|
215
|
+
/** 2 bits per region (0 head, 1 torso, 2 left arm, 3 right arm, 4 left leg, 5 right leg): 0 none, 1 light, 2 severe. */
|
|
216
|
+
readonly wounds: number;
|
|
217
|
+
/** 0 old and dark to 15 fresh and bright. */
|
|
218
|
+
readonly freshness: number;
|
|
219
|
+
/** Index into `TROUSER_PALETTE`. */
|
|
220
|
+
readonly trousers: number;
|
|
221
|
+
readonly gaitStyle: number;
|
|
222
|
+
readonly accessories: number;
|
|
223
|
+
/** Clip indexes (4 bits each), the blend toward the second (0..1) and the clip speed step (0..15: 0.75 to 1.25). */
|
|
224
|
+
readonly clipA?: number;
|
|
225
|
+
readonly clipB?: number;
|
|
226
|
+
readonly clipBlend?: number;
|
|
227
|
+
readonly clipSpeed?: number;
|
|
228
|
+
/** Draw a walking body from the clip texture (needs the material's `segmentClips`); off, the shader's own walk. */
|
|
229
|
+
readonly clips?: boolean;
|
|
230
|
+
/** Lean toward a direction (radians) by an amount 0..1 (a shove, a thrown body's tumble). */
|
|
231
|
+
readonly leanAngle?: number;
|
|
232
|
+
readonly leanAmount?: number;
|
|
233
|
+
};
|
|
234
|
+
/** The bit of `iD.z` that turns the clip texture on for a body. */
|
|
235
|
+
declare const CLIPS_BIT = 1048576;
|
|
236
|
+
/** The four floats of `iD` for a look. */
|
|
237
|
+
declare const packIdentity: (look: IdentityLook) => readonly [number, number, number, number];
|
|
238
|
+
/** The look back from the four floats (tests and the impostor path). */
|
|
239
|
+
declare const unpackIdentity: ([x, y, z, w]: readonly [number, number, number, number]) => Required<IdentityLook>;
|
|
240
|
+
/** The speed factor of a clip speed step. */
|
|
241
|
+
declare const clipSpeedOf: (step: number) => number;
|
|
242
|
+
|
|
243
|
+
declare const createBodyChunkExt: ({ hipHeight, segmentClips }?: {
|
|
244
|
+
readonly hipHeight?: number;
|
|
245
|
+
readonly segmentClips?: boolean;
|
|
246
|
+
}) => string;
|
|
247
|
+
|
|
248
|
+
type AccessoryAttach = 'head' | 'torso';
|
|
249
|
+
/** One accessory drawn by the kit's own survivor builder: a hat of `HATS` (`hat`) or a piece of gear of `EXTRAS` (`extra`), in one colour. */
|
|
250
|
+
type KitAccessory = {
|
|
251
|
+
readonly id: string;
|
|
252
|
+
/** The bit of `iD.y` that says a body carries it (`ACCESSORY_BIT`). */
|
|
253
|
+
readonly bit: number;
|
|
254
|
+
readonly attach: AccessoryAttach;
|
|
255
|
+
readonly hat?: string;
|
|
256
|
+
readonly extra?: string;
|
|
257
|
+
readonly color: number;
|
|
258
|
+
};
|
|
259
|
+
/** The four accessory batches of the kit: a cap, a helmet, a backpack and a hood. */
|
|
260
|
+
declare const KIT_ACCESSORIES: readonly KitAccessory[];
|
|
261
|
+
/**
|
|
262
|
+
* The accessory geometry in a unit frame (the reference head or torso at the origin, one unit tall), tagged for the body shader: `bone`, `vcol` (own colour),
|
|
263
|
+
* `refPivot` and `ppivot`. A batch moves and scales it per variant with `iAcc` (`accessoryPlacement`): baked once, never per variant.
|
|
264
|
+
*/
|
|
265
|
+
declare const buildKitAccessory: (host: Three, accessory: KitAccessory) => THREE_NS.BufferGeometry;
|
|
266
|
+
/**
|
|
267
|
+
* The `iAcc` of a baked body for an accessory: where the accessory goes (the centre of the head, or of the torso) and how big (its height), read from the variant's
|
|
268
|
+
* own geometry, so the same accessory sits right on every one of the 20 variants. The head is the bone-1 vertices without the eyes, the torso the bone-0 ones;
|
|
269
|
+
* a body without them gets a zero scale, so the accessory is not drawn instead of showing up unscaled at the feet.
|
|
270
|
+
*/
|
|
271
|
+
declare const accessoryPlacement: (body: THREE_NS.BufferGeometry, attach: AccessoryAttach) => readonly [number, number, number, number];
|
|
272
|
+
|
|
106
273
|
/** Radial segments of the three instanced body geometries (G 65541 `BODY_LOD`): close, middle and far. */
|
|
107
274
|
declare const LOD_SEGMENTS: readonly [16, 10, 5];
|
|
108
275
|
/** Detail factors the rich builder bakes at for the same three levels (G ZVAR). */
|
|
@@ -188,10 +355,142 @@ declare const bakeVariants: (three: Three, builders: BakeBuilders, types: readon
|
|
|
188
355
|
readonly variants: BodyVariant[];
|
|
189
356
|
readonly byType: ReadonlyMap<string, readonly number[]>;
|
|
190
357
|
};
|
|
358
|
+
type VariantBatchesOptions = {
|
|
359
|
+
/** Identity on every batch (T4b.7). */
|
|
360
|
+
readonly identity?: boolean;
|
|
361
|
+
readonly segmentClips?: SegmentClipUniforms;
|
|
362
|
+
/** Which of the three levels cast a real shadow (default `LOD_CASTS_SHADOW`; `[true, false, false]` is the economy ladder's step 1). */
|
|
363
|
+
readonly castsShadow?: readonly [boolean, boolean, boolean];
|
|
364
|
+
/** Which of the three levels get a depth-only prepass (default none). */
|
|
365
|
+
readonly depthPrepass?: readonly [boolean, boolean, boolean];
|
|
366
|
+
};
|
|
191
367
|
/** The three batches of a variant (one per level of detail), sized for a horde. */
|
|
192
368
|
declare const createVariantBatches: (three: Three, variant: BodyVariant, time: {
|
|
193
369
|
value: number;
|
|
194
|
-
}) => readonly BodyBatch[];
|
|
370
|
+
}, options?: VariantBatchesOptions) => readonly BodyBatch[];
|
|
371
|
+
|
|
372
|
+
/** Views around the body and steps of the walk the atlas holds for each silhouette. */
|
|
373
|
+
declare const IMPOSTOR_ANGLES = 8;
|
|
374
|
+
declare const IMPOSTOR_FRAMES = 8;
|
|
375
|
+
type ImpostorBody = {
|
|
376
|
+
/** A far level of detail of a baked body (the 5-segment one). */
|
|
377
|
+
readonly geometry: THREE_NS.BufferGeometry;
|
|
378
|
+
/** The height of that body, which sets the cell the silhouette is drawn in (default the top of its bounding box). */
|
|
379
|
+
readonly height?: number;
|
|
380
|
+
};
|
|
381
|
+
type ImpostorAtlasOptions = {
|
|
382
|
+
/** Pixels of a cell (default 32 × 48). */
|
|
383
|
+
readonly cellWidth?: number;
|
|
384
|
+
readonly cellHeight?: number;
|
|
385
|
+
/** Cells in a row of the atlas (default 32). */
|
|
386
|
+
readonly columns?: number;
|
|
387
|
+
};
|
|
388
|
+
/** Where a silhouette's cell sits in the geometry units of its body: half the width, the bottom and the height. */
|
|
389
|
+
type ImpostorBox = {
|
|
390
|
+
readonly halfWidth: number;
|
|
391
|
+
readonly bottom: number;
|
|
392
|
+
readonly height: number;
|
|
393
|
+
};
|
|
394
|
+
type ImpostorAtlas = {
|
|
395
|
+
/** Bone, material class, shade and coverage per texel. */
|
|
396
|
+
readonly texture: THREE_NS.DataTexture;
|
|
397
|
+
/** The colour the baked body gives the texel (square root of the linear colour), alongside `texture`. */
|
|
398
|
+
readonly colorTexture: THREE_NS.DataTexture;
|
|
399
|
+
readonly silhouettes: number;
|
|
400
|
+
readonly cellWidth: number;
|
|
401
|
+
readonly cellHeight: number;
|
|
402
|
+
readonly columns: number;
|
|
403
|
+
readonly rows: number;
|
|
404
|
+
readonly boxes: readonly ImpostorBox[];
|
|
405
|
+
/** The bytes of the texture (RGBA8): bone, material class, shade, coverage. */
|
|
406
|
+
readonly pixels: Uint8Array;
|
|
407
|
+
readonly colorPixels: Uint8Array;
|
|
408
|
+
dispose(): void;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* The impostor atlas (economy ladder, step 2): each silhouette drawn on the CPU at 8 views and 8 steps of the walk from the far level of its baked body.
|
|
412
|
+
* A texel holds the bone (the group the shader tints and the missing limbs hide), the material class (skin, shirt, trousers...), the baked shade and the coverage;
|
|
413
|
+
* the colours are not in it, they come per instance. RGBA8 and `NearestFilter`: the bone is an index and must not be blended between texels.
|
|
414
|
+
*/
|
|
415
|
+
declare const bakeImpostorAtlas: (three: Three, bodies: readonly ImpostorBody[], options?: ImpostorAtlasOptions) => ImpostorAtlas;
|
|
416
|
+
|
|
417
|
+
type ImpostorBatchOptions = {
|
|
418
|
+
/** Instances the batch holds. */
|
|
419
|
+
readonly max: number;
|
|
420
|
+
/** The light the baked shade is multiplied by (the impostor is not lit by the scene; default 0.85 grey). */
|
|
421
|
+
readonly light?: {
|
|
422
|
+
readonly r: number;
|
|
423
|
+
readonly g: number;
|
|
424
|
+
readonly b: number;
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
/** One far body: the same `iA`, `iC` and shirt as the near body, the scale of its variant, its silhouette (the atlas block) and the ground height. */
|
|
428
|
+
type ImpostorInstance = {
|
|
429
|
+
readonly a: readonly [number, number, number, number];
|
|
430
|
+
/** Height and width scale (the near body's `b[0]` and `b[1]`). */
|
|
431
|
+
readonly scale: readonly [number, number];
|
|
432
|
+
readonly silhouette: number;
|
|
433
|
+
readonly y?: number;
|
|
434
|
+
readonly c: readonly [number, number, number, number];
|
|
435
|
+
readonly color: {
|
|
436
|
+
readonly r: number;
|
|
437
|
+
readonly g: number;
|
|
438
|
+
readonly b: number;
|
|
439
|
+
};
|
|
440
|
+
readonly d?: readonly [number, number, number, number];
|
|
441
|
+
};
|
|
442
|
+
type ImpostorBatch = {
|
|
443
|
+
readonly mesh: THREE_NS.Mesh & {
|
|
444
|
+
count: number;
|
|
445
|
+
};
|
|
446
|
+
readonly material: THREE_NS.ShaderMaterial;
|
|
447
|
+
readonly count: number;
|
|
448
|
+
begin(): void;
|
|
449
|
+
push(instance: ImpostorInstance): void;
|
|
450
|
+
end(): void;
|
|
451
|
+
};
|
|
452
|
+
/** The far bodies as one draw call: a standing quad per body that picks its cell of the atlas by the view angle and the walk phase, tinted per instance. */
|
|
453
|
+
declare const createImpostorBatch: (three: Three, atlas: ImpostorAtlas, { max, light }: ImpostorBatchOptions) => ImpostorBatch;
|
|
454
|
+
|
|
455
|
+
type Vec3 = readonly [number, number, number];
|
|
456
|
+
type PosedVertex = {
|
|
457
|
+
readonly position: Vec3;
|
|
458
|
+
readonly normal: Vec3;
|
|
459
|
+
};
|
|
460
|
+
type JointBone = {
|
|
461
|
+
readonly bone: number;
|
|
462
|
+
readonly pivot: Vec3;
|
|
463
|
+
readonly parentPivot: Vec3;
|
|
464
|
+
};
|
|
465
|
+
/**
|
|
466
|
+
* The walk of the instanced shader (`bodyAnim`, pose 0) for one vertex on the CPU, at the cycle step `step` of `steps`, the arms half raised: the frames of the impostor atlas.
|
|
467
|
+
* It is the shader's own maths for the pose the impostor draws (the cascade of the joints, the knee bend, the arm swing and the lean), without the per-instance extras.
|
|
468
|
+
*/
|
|
469
|
+
declare const walkPoseVertex: (position: Vec3, normal: Vec3, { bone, pivot, parentPivot }: JointBone, step: number, steps: number) => PosedVertex;
|
|
470
|
+
|
|
471
|
+
type BlobShadowOptions = {
|
|
472
|
+
/** Shadows the batch can hold. */
|
|
473
|
+
readonly max: number;
|
|
474
|
+
/** Radius in metres of a body of height 1 (default 0.55). */
|
|
475
|
+
readonly radius?: number;
|
|
476
|
+
/** The darkness at the centre (default 0.42). */
|
|
477
|
+
readonly opacity?: number;
|
|
478
|
+
};
|
|
479
|
+
type BlobShadowBatch = {
|
|
480
|
+
readonly mesh: THREE_NS.Mesh & {
|
|
481
|
+
count: number;
|
|
482
|
+
};
|
|
483
|
+
readonly count: number;
|
|
484
|
+
begin(): void;
|
|
485
|
+
/** One shadow under a body at `x`, `z` on the ground height `y`, for a body `height` metres tall. */
|
|
486
|
+
push(x: number, y: number, z: number, height: number): void;
|
|
487
|
+
end(): void;
|
|
488
|
+
};
|
|
489
|
+
/**
|
|
490
|
+
* The shadow of a body that is too far for a real one (economy ladder, step 1): one dark disc per body on the ground, a single draw call.
|
|
491
|
+
* No depth write and no shadow map: it costs a quad per body.
|
|
492
|
+
*/
|
|
493
|
+
declare const createBlobShadowBatch: (three: Three, { max, radius, opacity }: BlobShadowOptions) => BlobShadowBatch;
|
|
195
494
|
|
|
196
495
|
/** Where a limb comes from: arms leave at chest height with the sleeve's colour, legs low and long with the trousers'. */
|
|
197
496
|
type LimbLaunch = {
|
|
@@ -252,86 +551,6 @@ type FlyingLimbs = {
|
|
|
252
551
|
/** Torn-off pieces that fly, bounce and stay on the ground, as one instanced mesh of capsules (G 67953 `fxLimb`, 68040 update). */
|
|
253
552
|
declare const createFlyingLimbs: (host: Three, { max, random, effects }: FlyingLimbsOptions) => FlyingLimbs;
|
|
254
553
|
|
|
255
|
-
type Euler3 = {
|
|
256
|
-
x: number;
|
|
257
|
-
y: number;
|
|
258
|
-
z: number;
|
|
259
|
-
};
|
|
260
|
-
type Node3 = {
|
|
261
|
-
rotation: Euler3;
|
|
262
|
-
position: {
|
|
263
|
-
x: number;
|
|
264
|
-
y: number;
|
|
265
|
-
z: number;
|
|
266
|
-
};
|
|
267
|
-
};
|
|
268
|
-
/** A limb of the rich body, as the Bestiário builds it: the group at the joint, the one below it (elbow, knee) and the rest angles. */
|
|
269
|
-
type RigArm = {
|
|
270
|
-
g: Node3;
|
|
271
|
-
el: Node3 & {
|
|
272
|
-
userData: Record<string, unknown>;
|
|
273
|
-
};
|
|
274
|
-
base: number;
|
|
275
|
-
eBase: number;
|
|
276
|
-
};
|
|
277
|
-
type RigLeg = {
|
|
278
|
-
g: Node3;
|
|
279
|
-
kn: Node3;
|
|
280
|
-
base: number;
|
|
281
|
-
kBase: number;
|
|
282
|
-
lost?: boolean;
|
|
283
|
-
};
|
|
284
|
-
/** What `RichBodyBuilder.build` leaves in `root.userData.rig` (the page's `rig`). */
|
|
285
|
-
type RichRig = {
|
|
286
|
-
readonly type: string;
|
|
287
|
-
readonly fig: Node3;
|
|
288
|
-
readonly upper: Node3;
|
|
289
|
-
readonly headG: Node3;
|
|
290
|
-
/** The neck cylinder, taken by identity; absent when the head is cut off. */
|
|
291
|
-
readonly neck?: Node3;
|
|
292
|
-
readonly arms: RigArm[];
|
|
293
|
-
readonly legs: RigLeg[];
|
|
294
|
-
readonly dangles: {
|
|
295
|
-
g: Node3;
|
|
296
|
-
el: Node3;
|
|
297
|
-
}[];
|
|
298
|
-
readonly flaps: (Node3 & {
|
|
299
|
-
userData: Record<string, unknown>;
|
|
300
|
-
})[];
|
|
301
|
-
readonly ph: number;
|
|
302
|
-
readonly dropBase: number;
|
|
303
|
-
readonly leanBase: number;
|
|
304
|
-
readonly hxBase: number;
|
|
305
|
-
/** Cascade state, made on the first call of `cascade`. */
|
|
306
|
-
cur?: Map<readonly [Node3 | Euler3, string, CascadeJoint], number>;
|
|
307
|
-
jl?: (readonly [Node3 | Euler3, string, CascadeJoint])[];
|
|
308
|
-
};
|
|
309
|
-
/** The names a pose may set (the Bestiário's `setPose`). All are optional: a joint a pose does not name keeps what it had. */
|
|
310
|
-
type PoseTargets = Partial<Record<'lean' | 'twist' | 'side' | 'drop' | 'headX' | 'headY' | 'headZ' | 'armR' | 'armL' | 'elbR' | 'elbL' | 'armRz' | 'armLz' | 'legL' | 'legR' | 'kneeL' | 'kneeR', number>>;
|
|
311
|
-
type RigAnimatorOptions = {
|
|
312
|
-
/** Gait profile by the type name the rig carries (`rig.type`); a type that is not here walks like the first type of the Bestiário (the slow one). */
|
|
313
|
-
readonly gaits?: Readonly<Record<string, GaitProfile>>;
|
|
314
|
-
/** Cascade rates per joint. Default: the engine's `CASCADE`. */
|
|
315
|
-
readonly cascade?: Readonly<Record<CascadeJoint, number>>;
|
|
316
|
-
};
|
|
317
|
-
type RigAnimator = {
|
|
318
|
-
/** The pose the gait swings around (legs `lost` stay out of the swing). */
|
|
319
|
-
restOf(rig: RichRig): RestPose$1;
|
|
320
|
-
/** The Bestiário's `animate0`: sets the joint rotations of one gait at `time`. `stride` ties cadence and swing to the ground speed. */
|
|
321
|
-
animate0(root: THREE_NS.Object3D, time: number, stride?: StrideParams): GaitSample | undefined;
|
|
322
|
-
/** `animate0` plus the bits that hang loose: the dangling forearm and the flaps of torn flesh. */
|
|
323
|
-
animate(root: THREE_NS.Object3D, time: number, stride?: StrideParams): void;
|
|
324
|
-
/** Moves every joint a fraction toward the value the animation left on it, from the hips to the head (the Bestiário's `cascade`). */
|
|
325
|
-
cascade(rig: RichRig, dt: number): void;
|
|
326
|
-
setPose(rig: RichRig, targets: PoseTargets): void;
|
|
327
|
-
lerpPose: typeof lerpPose;
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* The rich body's animator: the Bestiário's `animate0`, `animate`, `cascade`, `setPose` and `lerpPose` over the rig the best builder leaves in
|
|
331
|
-
* `root.userData.rig`. The gait maths is the engine's (`animateProfile`, pure CPU); this only reads the rest pose off the rig and writes the result back.
|
|
332
|
-
*/
|
|
333
|
-
declare const createRigAnimator: (options?: RigAnimatorOptions) => RigAnimator;
|
|
334
|
-
|
|
335
554
|
type BestTypeCard = {
|
|
336
555
|
/** The name `spec.type` looks the type up by (the Bestiário's `nome`). */
|
|
337
556
|
readonly name: string;
|
|
@@ -363,6 +582,8 @@ type PersonBuilderOptions = {
|
|
|
363
582
|
readonly reducedMotion?: boolean;
|
|
364
583
|
/** Eye colour of a zombified body by category (default the page's: lento, corredor, brutamonte). */
|
|
365
584
|
readonly zombieEyes?: Readonly<Record<string, number>>;
|
|
585
|
+
/** The host's LightBudget: what a person holds that gives light (the flare) is a source of it instead of a PointLight. The sources a person took are in `lightSources` of what `build` returns: `remove()` them when the person leaves. */
|
|
586
|
+
readonly lights?: LightBudget;
|
|
366
587
|
};
|
|
367
588
|
type PersonBuilder = {
|
|
368
589
|
build(spec: Record<string, any>, index?: number): any;
|
|
@@ -453,6 +674,10 @@ type HandItemContext = {
|
|
|
453
674
|
metal: any;
|
|
454
675
|
dark: any;
|
|
455
676
|
woodM: any;
|
|
677
|
+
/** The host's LightBudget: the flare asks it for a light instead of creating a PointLight. */
|
|
678
|
+
lights?: LightBudget;
|
|
679
|
+
/** Where an item that took a source from `lights` leaves it, so the builder can hand it to whoever removes the person. */
|
|
680
|
+
sources?: SourceHandle[];
|
|
456
681
|
};
|
|
457
682
|
/** Items held in a hand by kind (`sp.hand`, `sp.lhand`); `g` is the group on the hand's mount. */
|
|
458
683
|
declare const HAND_ITEMS: Record<string, (context: HandItemContext) => void>;
|
|
@@ -617,86 +842,6 @@ declare const gouge: (three: Three, materials: WoundMaterials, random: () => num
|
|
|
617
842
|
/** Arsenal `explodeSeg`: 14 chunks the size of the part, thrown from its centre along the blow. */
|
|
618
843
|
declare const explodeChunks: (three: Three, materials: WoundMaterials, random: () => number, box: THREE_NS.Box3, direction: THREE_NS.Vector3, fling: (chunk: THREE_NS.Object3D, velocity: THREE_NS.Vector3, spin: THREE_NS.Vector3) => void) => THREE_NS.Vector3;
|
|
619
844
|
|
|
620
|
-
/** The part of a fluid world the bridge needs; `FluidWorld` from `@adatechnology/game-fluids` has it. The package does not import the fluids packages. */
|
|
621
|
-
type BloodSink = {
|
|
622
|
-
splash(liquid: string, point: Vec3$1, liters: number, velocity?: Vec3$1): void;
|
|
623
|
-
};
|
|
624
|
-
/** Colours of one body's blood: the wet film and what it dries to (the infection age of a zombie: `ages.json`). */
|
|
625
|
-
type BloodLook = {
|
|
626
|
-
/** Liquid of the blood in the fluid world and in the film (default: the bridge's `liquid`). An old body can bleed `old_blood`. */
|
|
627
|
-
readonly liquid?: string;
|
|
628
|
-
readonly tint?: {
|
|
629
|
-
readonly fresh: number;
|
|
630
|
-
readonly dry: number;
|
|
631
|
-
};
|
|
632
|
-
/** How much of the blood is left, 0 to 1 (the age's `blood` factor): it scales the drops thrown into the film, so a dried-out body throws none. Default 1. */
|
|
633
|
-
readonly amount?: number;
|
|
634
|
-
};
|
|
635
|
-
/** The part of an infection age the look needs (`UndeadAge` of `@adatechnology/game-characters-undead` has all of it). */
|
|
636
|
-
type BloodAge = {
|
|
637
|
-
readonly id: string;
|
|
638
|
-
readonly blood: number;
|
|
639
|
-
readonly freshBloodColor: string;
|
|
640
|
-
readonly dryBloodColor: string;
|
|
641
|
-
};
|
|
642
|
-
type BloodLookOptions = {
|
|
643
|
-
/** Ages with a blood factor below this bleed `thinLiquid` (default 0.3: the old and the decrepit). */
|
|
644
|
-
readonly thinBelow?: number;
|
|
645
|
-
/** Liquid of the thin blood (default `old_blood`). */
|
|
646
|
-
readonly thinLiquid?: string;
|
|
647
|
-
};
|
|
648
|
-
/** The blood of an infection age: its fresh and dry colours (`ages.json`), its amount, and `old_blood` for the thin ones. */
|
|
649
|
-
declare const bloodLookOfAge: (age: BloodAge, options?: BloodLookOptions) => BloodLook;
|
|
650
|
-
/** A drop thrown into the running film of the liquids (`createFilmBridge(...)` of `@adatechnology/game-fluids-three` has it). The package does not import the fluids packages. */
|
|
651
|
-
type FilmSink = {
|
|
652
|
-
splat(splat: {
|
|
653
|
-
fluid: string;
|
|
654
|
-
point: Vec3$1;
|
|
655
|
-
direction?: Vec3$1;
|
|
656
|
-
speed?: number;
|
|
657
|
-
radius?: number;
|
|
658
|
-
count?: number;
|
|
659
|
-
tint?: {
|
|
660
|
-
fresh: number;
|
|
661
|
-
dry: number;
|
|
662
|
-
};
|
|
663
|
-
}): number;
|
|
664
|
-
};
|
|
665
|
-
/** What a `wound` throws into the film: the drops, how fast and how big. Defaults 3 drops at 2.5 m/s of 3.2 mm. */
|
|
666
|
-
type WoundSpray = {
|
|
667
|
-
readonly count?: number;
|
|
668
|
-
readonly speed?: number;
|
|
669
|
-
readonly radius?: number;
|
|
670
|
-
};
|
|
671
|
-
type FluidsBridgeOptions = {
|
|
672
|
-
readonly sink: BloodSink;
|
|
673
|
-
/** The running film: when given, a wound, a severed or destroyed segment and a split throw drops of blood into it, in the colours of the body's `BloodLook`. */
|
|
674
|
-
readonly film?: FilmSink;
|
|
675
|
-
/** Drops of a wound (`wound` change of a `body` event). */
|
|
676
|
-
readonly spray?: WoundSpray;
|
|
677
|
-
/** Drops thrown by a cut, a burst and a split (default 4, 7 and 10). */
|
|
678
|
-
readonly burstDrops?: Readonly<Record<'severed' | 'destroyed' | 'split', number>>;
|
|
679
|
-
/** Id of the blood in the fluid world. Default `blood`. */
|
|
680
|
-
readonly liquid?: string;
|
|
681
|
-
/** Metres per second a pressurised leak (a cut artery) throws its drops. Default 1.4. */
|
|
682
|
-
readonly spurtSpeed?: number;
|
|
683
|
-
};
|
|
684
|
-
type FluidsBridge = {
|
|
685
|
-
/** Reads a body's events: `leak` (bleeding) becomes blood on the surface below. Other events are ignored. */
|
|
686
|
-
handle(event: DestructionEvent): void;
|
|
687
|
-
/** The blood a cut, a burst or a split spills at once, at the world point the piece left from (and the drops it throws into the film, when there is one). */
|
|
688
|
-
burst(change: 'severed' | 'destroyed' | 'split', point: Vec3$1, look?: BloodLook, direction?: Vec3$1): void;
|
|
689
|
-
/** A wound that does not cut anything off (the `wound` change of the `body` event): drops of blood in the film, thrown along `direction` (default straight down). Returns how many found a grid. */
|
|
690
|
-
wound(point: Vec3$1, look?: BloodLook, direction?: Vec3$1): number;
|
|
691
|
-
/** Blood from the engine's own bleeders: `litersPerSecond` over `dt` seconds at `point`. */
|
|
692
|
-
bleed(point: Vec3$1, litersPerSecond: number, dt: number, direction?: Vec3$1, pressurized?: boolean): void;
|
|
693
|
-
};
|
|
694
|
-
/**
|
|
695
|
-
* Connects the wounds to the fluids packages, with the fluid world injected: the body keeps its own bleeders (rate, duration, spurt) and this turns them
|
|
696
|
-
* into blood, so the stains, pools and drying are the fluids' business and the character code draws none.
|
|
697
|
-
*/
|
|
698
|
-
declare const createFluidsBridge: ({ sink, film, spray, burstDrops, liquid, spurtSpeed }: FluidsBridgeOptions) => FluidsBridge;
|
|
699
|
-
|
|
700
845
|
/** The group that stands for one segment of the engine's tree on a drawn body, with what the wounds need to cut it off. */
|
|
701
846
|
type WoundNode = {
|
|
702
847
|
/** The group that leaves (its children go with it). */
|
|
@@ -725,83 +870,6 @@ type WoundBody = {
|
|
|
725
870
|
*/
|
|
726
871
|
declare const woundBodyOf: (root: THREE_NS.Object3D) => WoundBody | undefined;
|
|
727
872
|
|
|
728
|
-
/** One sound of a voice: the recipe and, for a sequence, the seconds after the first. */
|
|
729
|
-
type VoiceStep = {
|
|
730
|
-
readonly sound: string;
|
|
731
|
-
readonly delay?: number;
|
|
732
|
-
};
|
|
733
|
-
/**
|
|
734
|
-
* The voice of one undead type:
|
|
735
|
-
* - `origin` says where it comes from: `team` (the page has a sound for this very type), `rule` (the page's class rule applied to the type: the Brutamonte,
|
|
736
|
-
* a chase speed above 3.4, or a walker) or `extra` (the nearest sound of the pages to the voice line of `types.json`, the kit's choice);
|
|
737
|
-
* - `groan` / `gameGroan` is the groan of the art scene and of the game;
|
|
738
|
-
* - `idle` (a body that wanders or chases) and `alert` (it noticed the player or woke up) default to the groan; `special` is what the type does at its
|
|
739
|
-
* ability (the screamer's call, the leaper's jump), and `gameSpecial` its game version (the game has no leap sound, so the art scene's is kept).
|
|
740
|
-
*/
|
|
741
|
-
type UndeadVoice = {
|
|
742
|
-
readonly origin: 'team' | 'rule' | 'extra';
|
|
743
|
-
readonly groan: string;
|
|
744
|
-
readonly gameGroan: string;
|
|
745
|
-
readonly idle?: readonly VoiceStep[];
|
|
746
|
-
readonly alert?: readonly VoiceStep[];
|
|
747
|
-
readonly special?: readonly VoiceStep[];
|
|
748
|
-
readonly gameSpecial?: readonly VoiceStep[];
|
|
749
|
-
};
|
|
750
|
-
/** The voices of the 13 types of the Bestiario, by type id. */
|
|
751
|
-
declare const UNDEAD_VOICES: Readonly<Record<string, UndeadVoice>>;
|
|
752
|
-
declare const UNDEAD_VOICE_SOURCES: readonly string[];
|
|
753
|
-
type VoiceMoment = 'idle' | 'alert' | 'special';
|
|
754
|
-
type CharacterSoundStyle = 'art_scene' | 'game';
|
|
755
|
-
/** What a change of a body sounds like, by the `change` of the `body` event. A head or a jaw hit is brighter (`flesh_head`). */
|
|
756
|
-
type BodySoundRule = {
|
|
757
|
-
readonly sound: string;
|
|
758
|
-
readonly head?: string;
|
|
759
|
-
};
|
|
760
|
-
/** Art scene: bloodHit (cena L1084) is `flesh`, a cut is `sever` (L1127, L1143), a burst or an opened belly is `gore` (L1101, L1132). Game: the flesh class of `sfx`. */
|
|
761
|
-
declare const BODY_SOUNDS: Readonly<Record<CharacterSoundStyle, Readonly<Record<string, BodySoundRule>>>>;
|
|
762
|
-
/** What the player hears when a body grabs, bites or hurts him (cena L1350-L1352, at the listener). */
|
|
763
|
-
declare const PLAYER_SOUNDS: {
|
|
764
|
-
readonly grab: "grab";
|
|
765
|
-
readonly bite: "bite";
|
|
766
|
-
readonly hurt: "hurt";
|
|
767
|
-
};
|
|
768
|
-
/** The part of the host's sound a body needs: `play`, and `register` to put the banks in its engine (`createAudioSink(...)` has both). */
|
|
769
|
-
type CharacterSoundSink = {
|
|
770
|
-
play(request: SoundRequest): unknown;
|
|
771
|
-
register?(bank: unknown): void;
|
|
772
|
-
};
|
|
773
|
-
type CharacterSoundOptions = {
|
|
774
|
-
/** Which team answers (default `art_scene`, the kit mix). `game` plays the game's groans, scream and flesh, and the art scene for what the game lacks. */
|
|
775
|
-
readonly style?: CharacterSoundStyle;
|
|
776
|
-
/** Replaces a type's voice; `null` silences it. */
|
|
777
|
-
readonly voices?: Readonly<Record<string, UndeadVoice | null>>;
|
|
778
|
-
/** Replaces a `body` change's rule; `null` silences it. */
|
|
779
|
-
readonly body?: Readonly<Record<string, BodySoundRule | null>>;
|
|
780
|
-
/** The type used for an id that has no voice (default none: silent). */
|
|
781
|
-
readonly fallbackType?: string;
|
|
782
|
-
};
|
|
783
|
-
type CharacterSound = {
|
|
784
|
-
/** The steps a type plays at a moment. */
|
|
785
|
-
stepsOf(typeId: string, moment: VoiceMoment): readonly VoiceStep[];
|
|
786
|
-
/** Plays the voice of a type at a moment where the body is. Returns how many sounds were started or queued. */
|
|
787
|
-
voice(typeId: string, moment: VoiceMoment, position: Vec3$1, volume?: number): number;
|
|
788
|
-
/** Reads a `body` event of a body at `position`: a wound is flesh, a cut is `sever`, a burst or a split is `gore`. Other events are ignored. Returns true when a sound was asked for. */
|
|
789
|
-
body(event: DestructionEvent, position: Vec3$1, volume?: number): boolean;
|
|
790
|
-
/** The player is grabbed, bitten or hurt (heard at the listener). */
|
|
791
|
-
player(kind: keyof typeof PLAYER_SOUNDS, volume?: number): void;
|
|
792
|
-
/** Runs the sequences (the screamer's inhale, then the call): call it each frame. */
|
|
793
|
-
update(dt: number): void;
|
|
794
|
-
/** Sounds waiting for their time. */
|
|
795
|
-
readonly pending: () => number;
|
|
796
|
-
dispose(): void;
|
|
797
|
-
};
|
|
798
|
-
/**
|
|
799
|
-
* Plays the sounds of the bodies on the host's sound: the voices of the undead types (the Bestiario's 13), what a wound sounds like and what the player
|
|
800
|
-
* hears. The banks are registered in the host's engine, the sounds are positional, and the groans go through the engine's `undead_voice` limiter
|
|
801
|
-
* (five at once, one every 0.25 s, nearer than 40 m). The team sounds are the recipes of `./recipes`; the table of who says what is data.
|
|
802
|
-
*/
|
|
803
|
-
declare function createCharacterSound(sink: CharacterSoundSink, options?: CharacterSoundOptions): CharacterSound;
|
|
804
|
-
|
|
805
873
|
type WoundsOptions = {
|
|
806
874
|
readonly random: () => number;
|
|
807
875
|
/** Where the flying pieces land. Default: the parent of the body. */
|
|
@@ -840,336 +908,12 @@ type Wounds = {
|
|
|
840
908
|
*/
|
|
841
909
|
declare const createWounds: (three: Three, options: WoundsOptions) => Wounds;
|
|
842
910
|
|
|
843
|
-
/** A crowd on the instanced path: variants baked on demand from the rich builder, one batch per variant and level of detail, members walking a field. */
|
|
844
|
-
type Crowd = {
|
|
845
|
-
readonly group: THREE_NS.Group;
|
|
846
|
-
spawn(count: number): void;
|
|
847
|
-
clear(): void;
|
|
848
|
-
update(dt: number, camera: THREE_NS.Camera): void;
|
|
849
|
-
readonly count: number;
|
|
850
|
-
readonly bakeMs: number;
|
|
851
|
-
readonly drawCalls: number;
|
|
852
|
-
readonly triangles: number;
|
|
853
|
-
/** Triangles of one body at each level of detail (the budget the benchmark checks). */
|
|
854
|
-
trianglesPerLevel(typeId: string): readonly number[];
|
|
855
|
-
};
|
|
856
|
-
|
|
857
|
-
/** One undead type as the area needs it: the content pack's own record has all of these fields. */
|
|
858
|
-
type UndeadCard = {
|
|
859
|
-
readonly id: string;
|
|
860
|
-
readonly name: Readonly<Record<string, string>>;
|
|
861
|
-
readonly eye: {
|
|
862
|
-
readonly color: string;
|
|
863
|
-
};
|
|
864
|
-
readonly gait: Readonly<Record<string, number | boolean>>;
|
|
865
|
-
};
|
|
866
|
-
/** A profession of the people pack (look, accessories, what it holds). */
|
|
867
|
-
type ProfessionCard = {
|
|
868
|
-
readonly id: string;
|
|
869
|
-
readonly name: Readonly<Record<string, string>>;
|
|
870
|
-
readonly female?: boolean;
|
|
871
|
-
readonly look: {
|
|
872
|
-
readonly skin: string;
|
|
873
|
-
readonly hair: {
|
|
874
|
-
readonly style: string;
|
|
875
|
-
readonly color: string;
|
|
876
|
-
};
|
|
877
|
-
readonly hat?: {
|
|
878
|
-
readonly kind: string;
|
|
879
|
-
readonly color: string;
|
|
880
|
-
};
|
|
881
|
-
readonly face?: readonly string[];
|
|
882
|
-
readonly top: {
|
|
883
|
-
readonly color: string;
|
|
884
|
-
readonly sleeve: string;
|
|
885
|
-
readonly plaid?: string;
|
|
886
|
-
};
|
|
887
|
-
readonly pants: {
|
|
888
|
-
readonly color: string;
|
|
889
|
-
};
|
|
890
|
-
readonly shoes: string;
|
|
891
|
-
};
|
|
892
|
-
readonly accessories: readonly {
|
|
893
|
-
readonly id: string;
|
|
894
|
-
readonly color?: string;
|
|
895
|
-
}[];
|
|
896
|
-
readonly hand?: string;
|
|
897
|
-
readonly leftHand?: string;
|
|
898
|
-
};
|
|
899
|
-
/** The part of the undead engine the area uses (`createUndead(kit)` has all of it). */
|
|
900
|
-
type UndeadLike = {
|
|
901
|
-
create(spec: Pick<CharacterSpec, 'seed'> & Partial<CharacterSpec>, options?: {
|
|
902
|
-
readonly type?: string;
|
|
903
|
-
}): DamageCharacter;
|
|
904
|
-
turn(person: DamageCharacter, options?: {
|
|
905
|
-
readonly type?: string;
|
|
906
|
-
}): DamageCharacter;
|
|
907
|
-
traitsOf(character: DamageCharacter): {
|
|
908
|
-
readonly type: string;
|
|
909
|
-
readonly age?: string;
|
|
910
|
-
readonly speeds: Readonly<Record<string, number>>;
|
|
911
|
-
} | undefined;
|
|
912
|
-
speedFor(traits: {
|
|
913
|
-
readonly type: string;
|
|
914
|
-
readonly speeds: Readonly<Record<string, number>>;
|
|
915
|
-
}, context: {
|
|
916
|
-
readonly moment: string;
|
|
917
|
-
readonly limp?: boolean;
|
|
918
|
-
readonly crawling?: boolean;
|
|
919
|
-
}): number;
|
|
920
|
-
onDeath?(character: DamageCharacter): readonly {
|
|
921
|
-
readonly kind: string;
|
|
922
|
-
}[];
|
|
923
|
-
infect?(wound: 'bite' | 'scratch' | 'laceration' | undefined, random: () => number): {
|
|
924
|
-
advance(seconds: number): unknown;
|
|
925
|
-
readonly reanimated: boolean;
|
|
926
|
-
} | undefined;
|
|
927
|
-
};
|
|
928
|
-
type CharactersTestOptions = {
|
|
929
|
-
/** `en` or `pt-BR` (default). */
|
|
930
|
-
readonly locale?: string;
|
|
931
|
-
/** Builds the kit the area uses; called again when the bench changes the penetration model or the death rule. Default `createCharacters` with `packs`. */
|
|
932
|
-
readonly createKit?: (options: {
|
|
933
|
-
readonly penetration: 'physical' | 'team-game';
|
|
934
|
-
readonly deathRule: 'vitality-or-head' | 'head-only';
|
|
935
|
-
}) => CharacterKit;
|
|
936
|
-
/** Packs for the default kit (people, uniformed, undead). */
|
|
937
|
-
readonly packs?: readonly CharacterPack[];
|
|
938
|
-
readonly undeadTypes?: readonly UndeadCard[];
|
|
939
|
-
readonly createUndead?: (kit: CharacterKit) => UndeadLike;
|
|
940
|
-
readonly professions?: readonly ProfessionCard[];
|
|
941
|
-
/** Where the blood of the wounds goes (the room's fluid world: `room.fluids`). Without it the wounds draw no blood on the ground. */
|
|
942
|
-
readonly fluids?: BloodSink;
|
|
943
|
-
/** The running film of the liquids (the room's `room.film`): wounds throw drops of blood into it, in the colours `bloodOf` gives. Without it only the fluid world gets blood. */
|
|
944
|
-
readonly film?: FilmSink;
|
|
945
|
-
/** The sounds of the bodies on the room's engine (`host.audio`): wounds, cuts and the voices of the bench. `false` leaves the area silent. */
|
|
946
|
-
readonly sound?: false | CharacterSoundOptions;
|
|
947
|
-
/** The blood of a body by its infection age (`bloodLookOfAge` over the content's ages). Bodies without an age, and games without this option, bleed the liquid's own colours. */
|
|
948
|
-
readonly bloodOf?: (age: string) => BloodLook | undefined;
|
|
949
|
-
/** Seed of the draws of the area (default 1). */
|
|
950
|
-
readonly seed?: number;
|
|
951
|
-
/** Crowd types to bake for the instanced field, by undead id (default walker and runner). */
|
|
952
|
-
readonly crowdTypes?: readonly string[];
|
|
953
|
-
/** Triangles a baked body may have at each level of detail (default 2500, 800, 250, the Bancada de Hordas budget). Given explicitly, every level is a hard check. */
|
|
954
|
-
readonly triangleBudget?: readonly number[];
|
|
955
|
-
};
|
|
956
|
-
|
|
957
|
-
/** What a scenario needs of the room: the pass/fail line and time. The test room's `ScenarioContext` has both. */
|
|
958
|
-
type AreaContext = {
|
|
959
|
-
expect(condition: boolean, label: string, data?: Record<string, unknown>): void;
|
|
960
|
-
step(seconds: number): void;
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
declare const CHARACTERS_AREA_ID = "characters_area";
|
|
964
|
-
declare const ZOMBIE_ITEM_PREFIX = "zombie_";
|
|
965
|
-
declare const PERSON_ITEM_PREFIX = "person_";
|
|
966
|
-
/**
|
|
967
|
-
* The characters test area as a `TestableModule`: the undead types and the professions as bodies the room can shoot (each one a `DestructibleImpl` of the damage model, drawn with the
|
|
968
|
-
* rich builders, wounds, eyes and gait), a shooting lane, a crowd on the instanced path, and a bench with the damage rules, the hits, the protection, the moment and the layers.
|
|
969
|
-
* Everything comes in by option: the packs of content (people, undead) are the host page's, so this package knows no game.
|
|
970
|
-
*/
|
|
971
|
-
declare function createCharactersTestModule(options?: CharactersTestOptions): TestableModule<AreaContext> & {
|
|
972
|
-
readonly entries: ReadonlyMap<string, unknown>;
|
|
973
|
-
readonly crowd: Crowd | null;
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
/**
|
|
977
|
-
* What the "Hit" control of the bench does to the body: typical loads, in joules and millimetres, as the arsenal's calibre table gives them.
|
|
978
|
-
* `caliberId` is used only when the kit's table knows it (the `team-game` model).
|
|
979
|
-
*/
|
|
980
|
-
type HitPreset = {
|
|
981
|
-
readonly id: string;
|
|
982
|
-
readonly hit: Omit<BodyHit, 'point' | 'direction'>;
|
|
983
|
-
readonly range?: number;
|
|
984
|
-
};
|
|
985
|
-
declare const HIT_PRESETS: readonly HitPreset[];
|
|
986
|
-
|
|
987
|
-
/**
|
|
988
|
-
* The material the parts of a living body carry (`BODY_MATERIAL` of the engine), as a destruction world needs it declared: pass it in the world's material list
|
|
989
|
-
* (`worldOptions.materials` of the test room) before loading the characters area. The body model owns the damage; the world only needs the density and thermal data
|
|
990
|
-
* to raycast, blast and burn a body like any other object. Numbers are those of soft tissue (about 1050 kg/m3).
|
|
991
|
-
*/
|
|
992
|
-
declare const BODY_MATERIAL_DEF: {
|
|
993
|
-
readonly id: "flesh";
|
|
994
|
-
readonly density: 1050;
|
|
995
|
-
readonly hpPerKg: 15;
|
|
996
|
-
readonly penetration: 1.2;
|
|
997
|
-
readonly ductility: 0.8;
|
|
998
|
-
readonly fracture: "tear";
|
|
999
|
-
readonly fragmentSize: readonly [0.03, 0.1];
|
|
1000
|
-
readonly damageScale: {
|
|
1001
|
-
readonly slash: 1.6;
|
|
1002
|
-
};
|
|
1003
|
-
readonly hitDebris: "drips";
|
|
1004
|
-
readonly breakDebris: "drips";
|
|
1005
|
-
readonly thermal: {
|
|
1006
|
-
readonly ignitionC: 260;
|
|
1007
|
-
readonly flameC: 700;
|
|
1008
|
-
readonly fuelFraction: 0.25;
|
|
1009
|
-
readonly burnRate: 0.004;
|
|
1010
|
-
readonly conductivity: 0.5;
|
|
1011
|
-
readonly heatCapacity: 3.5;
|
|
1012
|
-
readonly smoke: "grey";
|
|
1013
|
-
};
|
|
1014
|
-
readonly tags: readonly ["organic", "body"];
|
|
1015
|
-
readonly compressive: 1000;
|
|
1016
|
-
};
|
|
1017
|
-
/** Puts the body material in a destruction world that does not know it yet (`room.world`); a world that has it is left alone. Call it before `room.loadModule`. */
|
|
1018
|
-
declare const registerBodyMaterial: (world: {
|
|
1019
|
-
readonly materials: Map<string, unknown>;
|
|
1020
|
-
}) => void;
|
|
1021
|
-
|
|
1022
|
-
/** The person builder's spec for a profession of the people pack (look and gear as numbers; the builder draws the rest). */
|
|
1023
|
-
declare const personSpecOf: (profession: ProfessionCard) => Record<string, any>;
|
|
1024
|
-
|
|
1025
911
|
/** The voice limiter group of the undead (`undead_voice`: five at once, one every 0.25 s, nearer than 40 m). */
|
|
1026
912
|
declare const UNDEAD_VOICE_GROUP = "undead_voice";
|
|
1027
913
|
/** The sounds of the game and of the art scene for the bodies, in one bank. */
|
|
1028
914
|
declare const CHARACTER_SOUNDS: readonly SoundRecipe[];
|
|
1029
915
|
declare const CHARACTER_SOUND_BANK: SoundBank;
|
|
1030
916
|
|
|
1031
|
-
/**
|
|
1032
|
-
* The eye the hands are seen from, given per call to `apply` (null or none is the body seen from outside: nothing changes). `reachBend` keeps the elbow bent where a hand is out of reach, the hand stopping
|
|
1033
|
-
* short instead of the arm locking; `keepOutside` pulls a hand back so it stays in front of the surface `contact` finds along the camera's forward.
|
|
1034
|
-
*/
|
|
1035
|
-
type ReachView = {
|
|
1036
|
-
readonly camera: THREE_NS.Object3D;
|
|
1037
|
-
/** The least interior bend of the elbow, radians, right then left. Default `ARM_REACH.viewBend`. */
|
|
1038
|
-
readonly reachBend?: readonly [number, number];
|
|
1039
|
-
readonly keepOutside?: {
|
|
1040
|
-
/** The distance to the surface from `origin` along `direction` within `maxDistance`, or null. */
|
|
1041
|
-
contact(origin: [number, number, number], direction: [number, number, number], maxDistance: number): number | null;
|
|
1042
|
-
/** Default `ARM_REACH.contactMargin`. */
|
|
1043
|
-
readonly margin?: number;
|
|
1044
|
-
/** Default `ARM_REACH.contactNearest`. */
|
|
1045
|
-
readonly nearest?: number;
|
|
1046
|
-
};
|
|
1047
|
-
};
|
|
1048
|
-
|
|
1049
|
-
type AvatarViewMode = 'first' | 'third';
|
|
1050
|
-
|
|
1051
|
-
type PlayerAvatarSpec = Record<string, unknown>;
|
|
1052
|
-
type PlayerAvatarOptions = {
|
|
1053
|
-
/** The body spec for the rich builder (`createBestBuilder.build`). Default: the team game's player (`player-avatar.json`). Merged over the default. */
|
|
1054
|
-
readonly spec?: PlayerAvatarSpec;
|
|
1055
|
-
/** Shirt colour, 0xRRGGBB. Default the team game's `PLAYER_COR`. */
|
|
1056
|
-
readonly shirtColor?: number;
|
|
1057
|
-
/** The clips `play(id)` finds. Default: a registry with `POSE_CLIPS`. */
|
|
1058
|
-
readonly clips?: PoseClipRegistry;
|
|
1059
|
-
/** Seconds to blend a clip in and out. Default 0.12. */
|
|
1060
|
-
readonly blend?: number;
|
|
1061
|
-
/** Seconds the body takes to go down (the shader's `fk` smoothstep). 0 is instant. Default 0.3. */
|
|
1062
|
-
readonly fallSeconds?: number;
|
|
1063
|
-
/** Smooth the joints with the Bestiário cascade (default true). */
|
|
1064
|
-
readonly cascade?: boolean;
|
|
1065
|
-
/**
|
|
1066
|
-
* How many times faster the cascade follows while a clip that does not loop plays: a strike is over in a third of a second, and at the walk's pace the joints would
|
|
1067
|
-
* still be on their way when it ends (a punch that never reaches the shoulder). 1 keeps the walk's pace. Default 5.
|
|
1068
|
-
*/
|
|
1069
|
-
readonly clipCascade?: number;
|
|
1070
|
-
/** Where the eye sits against the builder's eye point, in the head's frame (so it follows the head's scale and turn). Default [0, -0.068, 0]: about 1.70 m standing. */
|
|
1071
|
-
readonly eyeOffset?: readonly [number, number, number];
|
|
1072
|
-
/** How much of the walking and running bob of the body reaches the eye: 0 none, 1 all of it. Default 0.5. */
|
|
1073
|
-
readonly eyeBob?: number;
|
|
1074
|
-
};
|
|
1075
|
-
type AvatarEvent = PoseClipEvent & {
|
|
1076
|
-
clip: string;
|
|
1077
|
-
};
|
|
1078
|
-
type AvatarItemUsePose = {
|
|
1079
|
-
readonly id: string;
|
|
1080
|
-
readonly position: readonly [number, number, number];
|
|
1081
|
-
readonly rotation: readonly [number, number, number];
|
|
1082
|
-
/** How closed the other hand is (0 open to 1 closed) when it works on the item, as a hand turning a cap off opens between strokes; the room brings it there with `reach`. */
|
|
1083
|
-
readonly gripL?: number;
|
|
1084
|
-
};
|
|
1085
|
-
type AvatarUpdate = {
|
|
1086
|
-
/** Ground speed, m/s. Ties cadence and swing to the ground (the game's `walkCad` and `walkGait`). */
|
|
1087
|
-
speed?: number;
|
|
1088
|
-
/** Accepted for the game's state; the gait depends on the speed alone, as in the team game. */
|
|
1089
|
-
running?: boolean;
|
|
1090
|
-
crouch?: boolean;
|
|
1091
|
-
down?: boolean;
|
|
1092
|
-
/** Weapon in hand: both arms follow the aim (the game's arm code). Default false. */
|
|
1093
|
-
armed?: boolean;
|
|
1094
|
-
/** The camera pitch the game's `playerArmCode()` reads (`view.pitch`). */
|
|
1095
|
-
pitch?: number;
|
|
1096
|
-
/** Leg yaw toward the step while armed (the game's `P.hip`, radians). */
|
|
1097
|
-
hip?: number;
|
|
1098
|
-
/** Whether the player is carrying an item in the right hand. */
|
|
1099
|
-
holding?: boolean;
|
|
1100
|
-
/** Active scripted item use (`drink`, `sip`, `chug`, `pour`, `open`, `close`, `tilt`). */
|
|
1101
|
-
itemUse?: AvatarItemUsePose | null;
|
|
1102
|
-
/** Hands on a piece of furniture: `grip` closes on it with `progress`, `push` walks with it, `strain` strains against what does not give. */
|
|
1103
|
-
push?: {
|
|
1104
|
-
readonly phase: 'grip' | 'push' | 'strain';
|
|
1105
|
-
readonly progress: number;
|
|
1106
|
-
} | null;
|
|
1107
|
-
/** On a seat: `sit` folds the legs under hips `hip` metres above the feet, `lie` lays the body face up with the pelvis there, the head behind the facing. */
|
|
1108
|
-
seat?: {
|
|
1109
|
-
readonly pose: 'sit' | 'lie';
|
|
1110
|
-
readonly hip: number;
|
|
1111
|
-
} | null;
|
|
1112
|
-
/**
|
|
1113
|
-
* A hand on a door, lid or drawer: `reach` to the handle, `swing` with it (`pull` toward the body or pushed away), `release` back, `rattle` on a locked one.
|
|
1114
|
-
* `height` is the hand over the feet, metres (a fridge handle, a car door, a low drawer).
|
|
1115
|
-
*/
|
|
1116
|
-
door?: {
|
|
1117
|
-
readonly phase: 'reach' | 'swing' | 'release' | 'rattle';
|
|
1118
|
-
readonly progress: number;
|
|
1119
|
-
readonly height: number;
|
|
1120
|
-
readonly pull: boolean;
|
|
1121
|
-
} | null;
|
|
1122
|
-
};
|
|
1123
|
-
type PlayPoseOptions = {
|
|
1124
|
-
onEvent?: (event: AvatarEvent) => void;
|
|
1125
|
-
/** Overrides the avatar's blend for this clip. */
|
|
1126
|
-
blend?: number;
|
|
1127
|
-
};
|
|
1128
|
-
/** The colours the body was drawn with, for whatever has to match it (the first-person arms): skin, shirt, trousers and shoes as 0xRRGGBB, and whether the sleeves cover the forearms. */
|
|
1129
|
-
type PlayerAvatarColors = {
|
|
1130
|
-
skin: number;
|
|
1131
|
-
shirt: number;
|
|
1132
|
-
trousers: number;
|
|
1133
|
-
shoes: number;
|
|
1134
|
-
longSleeves: boolean;
|
|
1135
|
-
};
|
|
1136
|
-
type PlayerAvatar = {
|
|
1137
|
-
root: THREE_NS.Object3D;
|
|
1138
|
-
rig: RichRig;
|
|
1139
|
-
/** What the body wears, read from the body itself. */
|
|
1140
|
-
readonly colors: PlayerAvatarColors;
|
|
1141
|
-
/** The three.js namespace the body was made with, so what is made to fit it (the first-person arms) uses the same one. */
|
|
1142
|
-
readonly three: Three;
|
|
1143
|
-
update(dt: number, state?: AvatarUpdate): void;
|
|
1144
|
-
/**
|
|
1145
|
-
* The world position of the eyes, as `update` left them: sampled at its end, before any `reach()` (which turns the chest and would swing the head), and kept in the
|
|
1146
|
-
* body's own frame so it stays right when the host moves `root` afterwards. With `out` it fills that vector instead of making one.
|
|
1147
|
-
*/
|
|
1148
|
-
eye(out?: THREE_NS.Vector3): THREE_NS.Vector3;
|
|
1149
|
-
/** In 'first' with a camera, the head and neck are not drawn for that camera only (shadows, mirrors and every other camera still see them); 'third' draws them. */
|
|
1150
|
-
setView(mode: AvatarViewMode, camera: THREE_NS.Object3D | null): void;
|
|
1151
|
-
play(clip: string | PoseClip, options?: PlayPoseOptions): void;
|
|
1152
|
-
stop(): void;
|
|
1153
|
-
readonly playing: string | null;
|
|
1154
|
-
/** A socket at the hand: 'R' is the weapon hand (the puppet's right, at -x), 'L' the other one. */
|
|
1155
|
-
hand(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
1156
|
-
/** The joint of a shoulder ('R' the weapon side, at -x): where a long gun's stock rests, just inside it. */
|
|
1157
|
-
shoulder(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
1158
|
-
/**
|
|
1159
|
-
* Brings the hands to where the tool in them asks (`HandTargets`, world space) after `update`: shoulder, elbow and wrist each bend inside the human range, the chest turns and the shoulder
|
|
1160
|
-
* blade slides toward a hand out of reach. Null, a strike playing or the body going down leave the arms as `update` posed them. Call it after the tool is placed and the root moved.
|
|
1161
|
-
* `view` (given on each call, as the camera moves) is for the body seen from its own eyes: the elbows keep their bend and the hands stay out of walls; without it nothing changes.
|
|
1162
|
-
*/
|
|
1163
|
-
reach(targets: HandTargets | null, view?: ReachView | null): void;
|
|
1164
|
-
on(type: 'event', listener: (event: AvatarEvent) => void): () => void;
|
|
1165
|
-
dispose(): void;
|
|
1166
|
-
};
|
|
1167
|
-
/**
|
|
1168
|
-
* The player's body: the rich human of the Bestiário/Elenco, built with the team game's player spec (data, overridable), walking with the engine's gait tied
|
|
1169
|
-
* to the ground speed, with the crouch and the knock-down of the game's GPU pose code (`BODY_CHUNK`) and a pose-clip overlay (`play`).
|
|
1170
|
-
*/
|
|
1171
|
-
declare const createPlayerAvatar: (THREE: Three, options?: PlayerAvatarOptions) => PlayerAvatar;
|
|
1172
|
-
|
|
1173
917
|
/** What `@adatechnology/game-test-room` calls a `RoomAvatar`, restated here so this package does not depend on the room. */
|
|
1174
918
|
type RoomAvatarLike = {
|
|
1175
919
|
root: THREE_NS.Object3D;
|
|
@@ -1210,11 +954,13 @@ type RoomAvatarLike = {
|
|
|
1210
954
|
leg?: 'left' | 'right';
|
|
1211
955
|
hand?: 'left' | 'right';
|
|
1212
956
|
}): number | null;
|
|
957
|
+
/** The foot the walk put down since the last call (`RoomAvatar.footfall`), or null. */
|
|
958
|
+
footfall(): 'left' | 'right' | null;
|
|
1213
959
|
/** The avatar it wraps. */
|
|
1214
960
|
readonly avatar: PlayerAvatar;
|
|
1215
961
|
};
|
|
1216
962
|
type ToRoomAvatarOptions = {
|
|
1217
|
-
/** The third-person strike clips `strike` finds by id. Default `ATTACK_CLIPS` of game-characters-people. */
|
|
963
|
+
/** The third-person strike clips `strike` finds by id (`defaultCharacterClips()` of game-kit-defaults, or the game's own). Default `ATTACK_CLIPS` of game-characters-people, which is deprecated: pass them. */
|
|
1218
964
|
strikeClips?: readonly PoseClip[];
|
|
1219
965
|
/** The looping clip the body holds between punches (a clip of `strikeClips`), so a combo goes guard, punch, guard instead of dropping the hands each time; `false` for none. Default `'fight_guard'`. */
|
|
1220
966
|
guardClip?: string | false;
|
|
@@ -1231,43 +977,6 @@ type ToRoomAvatarOptions = {
|
|
|
1231
977
|
*/
|
|
1232
978
|
declare const toRoomAvatar: (avatar: PlayerAvatar, options?: ToRoomAvatarOptions) => RoomAvatarLike;
|
|
1233
979
|
|
|
1234
|
-
declare const AVATAR_AREA_ID = "avatar_area";
|
|
1235
|
-
type AvatarTestOptions = {
|
|
1236
|
-
/** The body under test (the example makes it with `createPlayerAvatar(THREE)` and gives the same one to the room). */
|
|
1237
|
-
avatar: PlayerAvatar;
|
|
1238
|
-
/** The text language when the host does not ask for one. Default `pt-BR`. */
|
|
1239
|
-
locale?: string;
|
|
1240
|
-
/** The clips offered as buttons. Default `POSE_CLIPS` (the two of the Bestiário); a game adds its strikes, such as `ATTACK_CLIPS` of game-characters-people. */
|
|
1241
|
-
clips?: readonly PoseClip[];
|
|
1242
|
-
/** Texts of the `phase` labels of `clips` by locale, merged over `POSE_CLIP_LOCALES` (for example `ATTACK_CLIP_LOCALES`). */
|
|
1243
|
-
clipLocales?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
1244
|
-
/** The room's view: `mode()` reads it, `set` changes it (`room.cameraMode` and `room.setCameraMode`). Without it the camera buttons only log. */
|
|
1245
|
-
camera?: {
|
|
1246
|
-
mode(): 'first' | 'third';
|
|
1247
|
-
set(mode: 'first' | 'third'): void;
|
|
1248
|
-
};
|
|
1249
|
-
/** The room's avatar state (`room.setAvatarState`): the module drives crouch, down and the armed arms through it. */
|
|
1250
|
-
state?: {
|
|
1251
|
-
set(state: {
|
|
1252
|
-
crouch?: boolean;
|
|
1253
|
-
down?: boolean;
|
|
1254
|
-
armed?: boolean | null;
|
|
1255
|
-
}): void;
|
|
1256
|
-
};
|
|
1257
|
-
};
|
|
1258
|
-
/**
|
|
1259
|
-
* The player's body as a `TestableModule` for the area `avatar_area`: bench buttons for the view (1st and 3rd person), crouch, fall and get up, the armed arms and every registered
|
|
1260
|
-
* pose clip (grab, bite), and metrics for the camera, the clip, its last event and the joints. Every action goes to the room's
|
|
1261
|
-
* log as JSON. It uses only the contracts: the body, the camera and the state come in by option, so the module knows no room.
|
|
1262
|
-
*/
|
|
1263
|
-
declare function createAvatarTestModule(options: AvatarTestOptions): TestableModule & {
|
|
1264
|
-
readonly state: {
|
|
1265
|
-
crouch: boolean;
|
|
1266
|
-
down: boolean;
|
|
1267
|
-
armed: boolean | null;
|
|
1268
|
-
};
|
|
1269
|
-
};
|
|
1270
|
-
|
|
1271
980
|
type Triple = [number, number, number];
|
|
1272
981
|
/**
|
|
1273
982
|
* A hand (or the foot) at rest, in the camera's space: x to the right, y up, the view looks down -z. `p` is the middle of the palm, `r` the Euler angles `[roll, yaw, pitch]` in the order YZX:
|
|
@@ -1446,4 +1155,4 @@ type TwoBone = {
|
|
|
1446
1155
|
*/
|
|
1447
1156
|
declare const solveTwoBone: (root: THREE_NS.Vector3, target: THREE_NS.Vector3, upper: number, lower: number, pole: THREE_NS.Vector3, out: TwoBone) => TwoBone;
|
|
1448
1157
|
|
|
1449
|
-
export {
|
|
1158
|
+
export { ACCESSORY_BIT, type AccessoryAttach, AvatarItemUsePose, AvatarViewMode, BAKE_NEUTRAL_POSE, BODY_CHUNK, type BakeBuilders, type BakeSpec, type BakedBody, type BestBuilder, type BestBuilderOptions, type BestTypeCard, type BlobShadowBatch, type BlobShadowOptions, BloodLook, type BodyBatch, type BodyBatchMesh, type BodyBatchOptions, type BodyChunkOptions, type BodyInstance, type BodyJoints, type BodyMaterialParams, type BodyVariant, type BuildInstancedBodyParams, CHARACTER_SOUNDS, CHARACTER_SOUND_BANK, CLIPS_BIT, CLIP_BONES, CLIP_LIMIT, CLIP_RATE, CLIP_TEXELS, CharacterSound, type ClipLimp, EXTRAS, type EyeOptions, type Eyes, FACE_FEATURES, FIRST_PERSON_BOB, FIRST_PERSON_COLORS, FIRST_PERSON_RIG, FIRST_PERSON_STANCES, type FirstPersonArms, type FirstPersonArmsOptions, type FirstPersonArmsState, type FirstPersonBob, type FirstPersonColors, type FirstPersonEvent, type FirstPersonRig, FluidsBridge, type FlyingLimb, type FlyingLimbs, type FlyingLimbsOptions, type FlyingPiece, type FlyingPieces, type FlyingPiecesOptions, GAIT_STYLE, type GaitStyle, HAND_ITEMS, HATS, IMPOSTOR_ANGLES, IMPOSTOR_FRAMES, type IdentityLook, type ImpostorAtlas, type ImpostorAtlasOptions, type ImpostorBatch, type ImpostorBatchOptions, type ImpostorBody, type ImpostorBox, type ImpostorInstance, KIT_ACCESSORIES, type KitAccessory, LOD_BAKE, LOD_BATCH_CAPACITY, LOD_CASTS_SHADOW, LOD_DISTANCES, LOD_SEGMENTS, type LimbEffects, type LimbLaunch, PENDULUM, type Pendulum, type PersonBuilder, type PersonBuilderOptions, PlayerAvatar, ReachView, type RestPose, RichRig, type RoomAvatarLike, SEGMENT_CLIPS, STAGGER_POSE, type SegmentClipSet, type SegmentClipSpec, type SegmentClipUniforms, type StanceDef, TROUSER_PALETTE, Three, type ToRoomAvatarOptions, type TwoBone, UNDEAD_VOICE_GROUP, type VariantBatchesOptions, type VariantType, type WoundBody, type WoundMaterials, type WoundNode, type Wounds, type WoundsOptions, accessoryPlacement, bakeBody, bakeImpostorAtlas, bakeSegmentClips, bakeVariants, blobGeometry, blobRadii, buildInstancedBody, buildKitAccessory, clipIndexOf, clipSpeedOf, createBestBuilder, createBlobShadowBatch, createBodyBatch, createBodyChunk, createBodyChunkExt, createBodyMaterial, createEye, createFirstPersonArms, createFlyingLimbs, createFlyingPieces, createGlowTexture, createImpostorBatch, createPendulum, createPersonBuilder, createSegmentClipUniforms, createVariantBatches, createWoundMaterials, createWounds, exitWound, explodeChunks, findEyes, gouge, jointsOf, lodAt, makeCut, makeStump, packIdentity, ringWound, solveTwoBone, starGeometry, stepPendulum, toRoomAvatar, unpackIdentity, walkPoseVertex, woundBodyOf, woundDecal };
|