@adatechnology/game-characters-three 0.8.0 → 0.8.1
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/dist/{chunk-3CHBEUHW.js → chunk-XSMP7T6O.js} +32 -79
- package/dist/chunk-XSMP7T6O.js.map +1 -0
- package/dist/index.d.ts +106 -63
- package/dist/index.global.js +1071 -132
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{testing-DyQw8dCw.d.ts → testing-CsC-BhNN.d.ts} +205 -3
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-3CHBEUHW.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Three, R as RichRig,
|
|
2
|
-
export {
|
|
1
|
+
import { T as Three, B as BestSpec, a as BestPose, P as PersonSpec, b as PersonCharacter, c as PersonGroupSpec, L as LegRig, A as ArmRig, d as PersonExtra, R as RichRig, e as BloodLook, F as FluidsBridge, C as CharacterSound, f as AvatarItemUsePose, g as AvatarViewMode, h as ReachView, i as PlayerAvatar } from './testing-CsC-BhNN.js';
|
|
2
|
+
export { j as AVATAR_AREA_ID, k as AreaContext, l as AvatarEvent, m as AvatarTestOptions, n as AvatarUpdate, o as BODY_MATERIAL_DEF, p as BODY_SOUNDS, q as BloodAge, r as BloodLookOptions, s as BloodSink, t as BodySegment, u as BodySoundRule, v as CHARACTERS_AREA_ID, w as CharacterSoundOptions, x as CharacterSoundSink, y as CharacterSoundStyle, z as CharactersTestOptions, D as FilmSink, E as FluidsBridgeOptions, H as HIT_PRESETS, G as HitPreset, I as PERSON_ITEM_PREFIX, J as PLAYER_SOUNDS, K as PlayPoseOptions, M as PlayerAvatarColors, N as PlayerAvatarOptions, O as PlayerAvatarSpec, Q as PoseTargets, S as ProfessionCard, U as RigAnimator, V as RigAnimatorOptions, W as UNDEAD_VOICES, X as UNDEAD_VOICE_SOURCES, Y as UndeadCard, Z as UndeadLike, _ as UndeadVoice, $ as VoiceMoment, a0 as VoiceStep, a1 as WoundSpray, a2 as ZOMBIE_ITEM_PREFIX, a3 as bloodLookOfAge, a4 as createAvatarTestModule, a5 as createCharacterSound, a6 as createCharactersTestModule, a7 as createFluidsBridge, a8 as createPlayerAvatar, a9 as createRigAnimator, aa as personSpecOf, ab as registerBodyMaterial } from './testing-CsC-BhNN.js';
|
|
3
3
|
import { BodySpec, SegmentId, PoseClip, PoseClipEvent, FirstPersonClip } from '@adatechnology/game-characters';
|
|
4
4
|
import * as THREE_NS from 'three';
|
|
5
5
|
import { LightBudget, SourceHandle } from '@adatechnology/game-render-three';
|
|
@@ -563,12 +563,13 @@ type BestBuilderOptions = {
|
|
|
563
563
|
readonly random?: () => number;
|
|
564
564
|
};
|
|
565
565
|
type BestBuilder = {
|
|
566
|
-
|
|
567
|
-
|
|
566
|
+
/** The body's root (`userData.rig` holds its `BestRig`); a lying body comes wrapped in a group. */
|
|
567
|
+
build(spec: BestSpec): THREE_NS.Group;
|
|
568
|
+
TYPES: Record<string, BestPose>;
|
|
568
569
|
/** Level of detail: 1 full, 0.5, 0.28 (segments and sphere resolution scale with it). */
|
|
569
570
|
setLOD(factor: number): void;
|
|
570
571
|
/** The shirt material of the last body built (the bake marks it as material 1). */
|
|
571
|
-
topM():
|
|
572
|
+
topM(): THREE_NS.MeshLambertMaterial | null;
|
|
572
573
|
};
|
|
573
574
|
declare const createBestBuilder: (host: Three, { types, random }: BestBuilderOptions) => BestBuilder;
|
|
574
575
|
|
|
@@ -586,58 +587,96 @@ type PersonBuilderOptions = {
|
|
|
586
587
|
readonly lights?: LightBudget;
|
|
587
588
|
};
|
|
588
589
|
type PersonBuilder = {
|
|
589
|
-
build(spec:
|
|
590
|
-
pose(character:
|
|
591
|
-
zombify(character:
|
|
592
|
-
buildPerson(person:
|
|
593
|
-
root:
|
|
594
|
-
chars:
|
|
590
|
+
build(spec: PersonSpec, index?: number): PersonCharacter;
|
|
591
|
+
pose(character: PersonCharacter, zombie: boolean, walk: number, time: number): void;
|
|
592
|
+
zombify(character: PersonCharacter, category?: string): void;
|
|
593
|
+
buildPerson(person: PersonGroupSpec, zombie: boolean): {
|
|
594
|
+
root: THREE_NS.Group;
|
|
595
|
+
chars: PersonCharacter[];
|
|
595
596
|
};
|
|
596
597
|
};
|
|
597
598
|
declare const createPersonBuilder: (host: Three, options?: PersonBuilderOptions) => PersonBuilder;
|
|
598
599
|
|
|
599
|
-
type
|
|
600
|
-
|
|
600
|
+
type Obj = THREE_NS.Object3D;
|
|
601
|
+
type Geo = THREE_NS.BufferGeometry;
|
|
602
|
+
type Mat = THREE_NS.Material;
|
|
603
|
+
type MatOptions = THREE_NS.MeshStandardMaterialParameters;
|
|
604
|
+
/** Where a stain goes: the skin (wet, shiny) or cloth. */
|
|
605
|
+
type StainKind = 'skin' | 'cloth';
|
|
606
|
+
type PersonKitOptions = {
|
|
607
|
+
/** The stream the blood stains and the person's own phase draw from. The page used one shared `rng(77)` for the whole cast. */
|
|
608
|
+
readonly random: () => number;
|
|
609
|
+
/** A canvas for the plaid texture (default: the document's). */
|
|
610
|
+
readonly createCanvas?: () => HTMLCanvasElement;
|
|
611
|
+
};
|
|
612
|
+
/** The page's primitives: materials are cached by colour, `add` puts a mesh in a parent, and the `ball`/`ring`/`limb` shapes of the anatomical body. */
|
|
613
|
+
declare const createPersonKit: (host: Three, { random: R, createCanvas }: PersonKitOptions) => {
|
|
614
|
+
THREE: typeof THREE_NS;
|
|
601
615
|
PI: number;
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
cmat:
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
616
|
+
SEG: number;
|
|
617
|
+
R: () => number;
|
|
618
|
+
scaleHex: (hex: number, factor: number) => number;
|
|
619
|
+
Bx: (x: number, y: number, z: number) => THREE_NS.BoxGeometry;
|
|
620
|
+
add: (parent: Obj, geo: Geo, m: Mat, x: number, y: number, z: number, rx?: number, ry?: number, rz?: number) => THREE_NS.Mesh;
|
|
621
|
+
cmat: (c: number, o?: MatOptions) => THREE_NS.MeshStandardMaterial;
|
|
622
|
+
ball: (parent: Obj, r: number, m: Mat, x?: number, y?: number, z?: number) => THREE_NS.Mesh<THREE_NS.BufferGeometry<THREE_NS.NormalBufferAttributes>, THREE_NS.Material | THREE_NS.Material[], THREE_NS.Object3DEventMap>;
|
|
623
|
+
ring: (parent: Obj, r: number, h: number, m: Mat, y: number, sx?: number, sz?: number) => THREE_NS.Mesh<THREE_NS.BufferGeometry<THREE_NS.NormalBufferAttributes>, THREE_NS.Material | THREE_NS.Material[], THREE_NS.Object3DEventMap>;
|
|
624
|
+
cap: (r: number, len?: number) => THREE_NS.SphereGeometry;
|
|
625
|
+
limb: (parent: Obj, r1: number, r2: number, len: number, m: Mat) => THREE_NS.Mesh<THREE_NS.BufferGeometry<THREE_NS.NormalBufferAttributes>, THREE_NS.Material | THREE_NS.Material[], THREE_NS.Object3DEventMap>;
|
|
626
|
+
mlimb: (parent: Obj, prof: readonly number[], len: number, m: Mat) => THREE_NS.Mesh<THREE_NS.BufferGeometry<THREE_NS.NormalBufferAttributes>, THREE_NS.Material | THREE_NS.Material[], THREE_NS.Object3DEventMap>;
|
|
627
|
+
torsoGeo: (fem: boolean) => THREE_NS.LatheGeometry;
|
|
628
|
+
splat: (parent: Obj, x: number, y: number, z: number, r: number, color: number, n?: number, out?: Obj[] | null, kind?: StainKind) => Obj;
|
|
629
|
+
stainM: (c: number, o?: MatOptions) => THREE_NS.MeshStandardMaterial;
|
|
630
|
+
chessTex: (c1: THREE_NS.ColorRepresentation, c2: THREE_NS.ColorRepresentation) => THREE_NS.CanvasTexture;
|
|
631
|
+
};
|
|
632
|
+
type PersonKit = ReturnType<typeof createPersonKit>;
|
|
633
|
+
|
|
634
|
+
type Common$3 = {
|
|
635
|
+
THREE: PersonKit['THREE'];
|
|
636
|
+
PI: number;
|
|
637
|
+
add: PersonKit['add'];
|
|
638
|
+
Bx: PersonKit['Bx'];
|
|
639
|
+
cmat: PersonKit['cmat'];
|
|
640
|
+
};
|
|
641
|
+
type ExtraContext = Common$3 & {
|
|
642
|
+
U: THREE_NS.Group;
|
|
643
|
+
Hd: THREE_NS.Group;
|
|
644
|
+
root: THREE_NS.Group;
|
|
645
|
+
ring: PersonKit['ring'];
|
|
646
|
+
torsoGeo: PersonKit['torsoGeo'];
|
|
647
|
+
legs: LegRig[];
|
|
648
|
+
arms: ArmRig[];
|
|
612
649
|
fem: boolean;
|
|
613
|
-
topM:
|
|
614
|
-
m:
|
|
615
|
-
e:
|
|
650
|
+
topM: THREE_NS.Material;
|
|
651
|
+
m: THREE_NS.Material;
|
|
652
|
+
e: PersonExtra;
|
|
616
653
|
k: string;
|
|
617
|
-
sp:
|
|
618
|
-
splat:
|
|
654
|
+
sp: PersonSpec;
|
|
655
|
+
splat: PersonKit['splat'];
|
|
619
656
|
R: () => number;
|
|
620
|
-
ball:
|
|
621
|
-
cap:
|
|
622
|
-
hc:
|
|
623
|
-
headG:
|
|
624
|
-
fig:
|
|
625
|
-
upper:
|
|
626
|
-
skinM:
|
|
657
|
+
ball: PersonKit['ball'];
|
|
658
|
+
cap: PersonKit['cap'];
|
|
659
|
+
hc: THREE_NS.Material;
|
|
660
|
+
headG: THREE_NS.Group;
|
|
661
|
+
fig: THREE_NS.Group;
|
|
662
|
+
upper: THREE_NS.Group;
|
|
663
|
+
skinM: THREE_NS.MeshStandardMaterial;
|
|
627
664
|
};
|
|
628
665
|
/** Clothing and gear by id (`sp.ex` entries `[id, colour?]`), each drawn onto the body parts it names. */
|
|
629
666
|
declare const EXTRAS: Record<string, (context: ExtraContext) => void>;
|
|
630
667
|
|
|
631
|
-
type
|
|
632
|
-
THREE:
|
|
668
|
+
type Common$2 = {
|
|
669
|
+
THREE: PersonKit['THREE'];
|
|
633
670
|
PI: number;
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
671
|
+
add: PersonKit['add'];
|
|
672
|
+
Bx: PersonKit['Bx'];
|
|
673
|
+
cmat: PersonKit['cmat'];
|
|
674
|
+
};
|
|
675
|
+
type FaceContext = Common$2 & {
|
|
676
|
+
Hd: THREE_NS.Object3D;
|
|
677
|
+
hc: THREE_NS.Material;
|
|
678
|
+
sp: PersonSpec;
|
|
679
|
+
f: readonly string[];
|
|
641
680
|
scaleHex: (hex: number, factor: number) => number;
|
|
642
681
|
};
|
|
643
682
|
/** Face features in the order the page draws them (the order is part of the scene hash): `ids` are the `sp.face` entries that switch one on. */
|
|
@@ -646,17 +685,19 @@ declare const FACE_FEATURES: {
|
|
|
646
685
|
apply: ({ Bx, Hd, THREE, add, cmat, f }: FaceContext) => void;
|
|
647
686
|
}[];
|
|
648
687
|
|
|
649
|
-
type
|
|
650
|
-
THREE:
|
|
688
|
+
type Common$1 = {
|
|
689
|
+
THREE: PersonKit['THREE'];
|
|
651
690
|
PI: number;
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
691
|
+
add: PersonKit['add'];
|
|
692
|
+
Bx: PersonKit['Bx'];
|
|
693
|
+
cmat: PersonKit['cmat'];
|
|
694
|
+
};
|
|
695
|
+
type HatContext = Common$1 & {
|
|
696
|
+
Hd: THREE_NS.Object3D;
|
|
697
|
+
cap: PersonKit['cap'];
|
|
698
|
+
c: THREE_NS.Material;
|
|
658
699
|
k: string;
|
|
659
|
-
sp:
|
|
700
|
+
sp: PersonSpec;
|
|
660
701
|
};
|
|
661
702
|
/** Hats by kind (`sp.hat.k`); `c` is the hat's material. */
|
|
662
703
|
declare const HATS: {
|
|
@@ -664,16 +705,18 @@ declare const HATS: {
|
|
|
664
705
|
apply: ({ Bx, Hd, PI, add, c, cap, k }: HatContext) => void;
|
|
665
706
|
}[];
|
|
666
707
|
|
|
667
|
-
type
|
|
668
|
-
THREE:
|
|
708
|
+
type Common = {
|
|
709
|
+
THREE: PersonKit['THREE'];
|
|
669
710
|
PI: number;
|
|
670
|
-
add:
|
|
671
|
-
Bx:
|
|
672
|
-
cmat:
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
711
|
+
add: PersonKit['add'];
|
|
712
|
+
Bx: PersonKit['Bx'];
|
|
713
|
+
cmat: PersonKit['cmat'];
|
|
714
|
+
};
|
|
715
|
+
type HandItemContext = Common & {
|
|
716
|
+
g: THREE_NS.Group;
|
|
717
|
+
metal: THREE_NS.Material;
|
|
718
|
+
dark: THREE_NS.Material;
|
|
719
|
+
woodM: THREE_NS.Material;
|
|
677
720
|
/** The host's LightBudget: the flare asks it for a light instead of creating a PointLight. */
|
|
678
721
|
lights?: LightBudget;
|
|
679
722
|
/** Where an item that took a source from `lights` leaves it, so the builder can hand it to whoever removes the person. */
|
|
@@ -1155,4 +1198,4 @@ type TwoBone = {
|
|
|
1155
1198
|
*/
|
|
1156
1199
|
declare const solveTwoBone: (root: THREE_NS.Vector3, target: THREE_NS.Vector3, upper: number, lower: number, pole: THREE_NS.Vector3, out: TwoBone) => TwoBone;
|
|
1157
1200
|
|
|
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 };
|
|
1201
|
+
export { ACCESSORY_BIT, type AccessoryAttach, ArmRig, 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, LegRig, type LimbEffects, type LimbLaunch, PENDULUM, type Pendulum, type PersonBuilder, type PersonBuilderOptions, PersonCharacter, PersonExtra, PersonGroupSpec, PersonSpec, 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 };
|