@aura3d/engine 4.2.0 → 4.3.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/aura3d-cli/cli-help.d.ts.map +1 -1
- package/dist/aura3d-cli/cli-help.js +4 -2
- package/dist/aura3d-cli/cli-help.js.map +1 -1
- package/dist/aura3d-cli/cli.js +80 -2
- package/dist/aura3d-cli/cli.js.map +1 -1
- package/dist/aura3d-cli/commands/assets/index.js +2 -2
- package/dist/aura3d-cli/commands/assets/index.js.map +1 -1
- package/dist/aura3d-cli/commands/meshyLedger.d.ts +125 -14
- package/dist/aura3d-cli/commands/meshyLedger.d.ts.map +1 -1
- package/dist/aura3d-cli/commands/meshyLedger.js +262 -35
- package/dist/aura3d-cli/commands/meshyLedger.js.map +1 -1
- package/dist/aura3d-cli/commands/prd13/run.js +19 -16
- package/dist/aura3d-cli/commands/prd13/run.js.map +1 -1
- package/dist/aura3d-cli/index.d.ts +8 -0
- package/dist/aura3d-cli/index.d.ts.map +1 -1
- package/dist/aura3d-cli/index.js +12 -0
- package/dist/aura3d-cli/index.js.map +1 -1
- package/dist/aura3d-cli/skin/analysis.d.ts +137 -0
- package/dist/aura3d-cli/skin/analysis.d.ts.map +1 -0
- package/dist/aura3d-cli/skin/analysis.js +382 -0
- package/dist/aura3d-cli/skin/analysis.js.map +1 -0
- package/dist/aura3d-cli/skin/command.d.ts +71 -0
- package/dist/aura3d-cli/skin/command.d.ts.map +1 -0
- package/dist/aura3d-cli/skin/command.js +186 -0
- package/dist/aura3d-cli/skin/command.js.map +1 -0
- package/dist/aura3d-cli/skin/glbEdit.d.ts +14 -0
- package/dist/aura3d-cli/skin/glbEdit.d.ts.map +1 -0
- package/dist/aura3d-cli/skin/glbEdit.js +152 -0
- package/dist/aura3d-cli/skin/glbEdit.js.map +1 -0
- package/dist/aura3d-cli/skin/gltf.d.ts +159 -0
- package/dist/aura3d-cli/skin/gltf.d.ts.map +1 -0
- package/dist/aura3d-cli/skin/gltf.js +379 -0
- package/dist/aura3d-cli/skin/gltf.js.map +1 -0
- package/dist/aura3d-cli/skin/rebuildLimbs.d.ts +31 -0
- package/dist/aura3d-cli/skin/rebuildLimbs.d.ts.map +1 -0
- package/dist/aura3d-cli/skin/rebuildLimbs.js +326 -0
- package/dist/aura3d-cli/skin/rebuildLimbs.js.map +1 -0
- package/dist/aura3d-cli/skin/repair.d.ts +41 -0
- package/dist/aura3d-cli/skin/repair.d.ts.map +1 -0
- package/dist/aura3d-cli/skin/repair.js +180 -0
- package/dist/aura3d-cli/skin/repair.js.map +1 -0
- package/dist/create-aura3d/index.js +1 -1
- package/dist/engine/agent-api/compiler/customMaterial.d.ts.map +1 -1
- package/dist/engine/agent-api/compiler/customMaterial.js +12 -1
- package/dist/engine/agent-api/compiler/customMaterial.js.map +1 -1
- package/dist/engine/agent-api/nodes/types.d.ts +6 -0
- package/dist/engine/agent-api/nodes/types.d.ts.map +1 -1
- package/dist/game/index.d.ts +2 -2
- package/dist/game/index.d.ts.map +1 -1
- package/dist/game/index.js +1 -1
- package/dist/game/index.js.map +1 -1
- package/dist/game/motion/handBounce.d.ts +206 -0
- package/dist/game/motion/handBounce.d.ts.map +1 -0
- package/dist/game/motion/handBounce.js +267 -0
- package/dist/game/motion/handBounce.js.map +1 -0
- package/dist/game/motion/index.d.ts +2 -0
- package/dist/game/motion/index.d.ts.map +1 -1
- package/dist/game/motion/index.js +1 -0
- package/dist/game/motion/index.js.map +1 -1
- package/dist/game/session/warmPrograms.d.ts +17 -0
- package/dist/game/session/warmPrograms.d.ts.map +1 -1
- package/dist/game/session/warmPrograms.js +18 -1
- package/dist/game/session/warmPrograms.js.map +1 -1
- package/dist/physics/ensure.d.ts +2 -0
- package/dist/physics/ensure.d.ts.map +1 -0
- package/dist/physics/ensure.js +4 -0
- package/dist/physics/ensure.js.map +1 -0
- package/dist/physics/index.d.ts +1 -0
- package/dist/physics/index.d.ts.map +1 -1
- package/dist/physics/index.js +1 -0
- package/dist/physics/index.js.map +1 -1
- package/dist/physics/world.d.ts +1 -0
- package/dist/physics/world.d.ts.map +1 -1
- package/dist/physics/world.js +1 -0
- package/dist/physics/world.js.map +1 -1
- package/dist/physics-rapier/index.d.ts +2 -0
- package/dist/physics-rapier/index.d.ts.map +1 -1
- package/dist/physics-rapier/index.js +12 -10
- package/dist/physics-rapier/index.js.map +1 -1
- package/dist/physics-rapier/rapierInit.d.ts +6 -0
- package/dist/physics-rapier/rapierInit.d.ts.map +1 -0
- package/dist/physics-rapier/rapierInit.js +12 -0
- package/dist/physics-rapier/rapierInit.js.map +1 -0
- package/dist/physics-rapier/rapierInit.lazy.d.ts +6 -0
- package/dist/physics-rapier/rapierInit.lazy.d.ts.map +1 -0
- package/dist/physics-rapier/rapierInit.lazy.js +19 -0
- package/dist/physics-rapier/rapierInit.lazy.js.map +1 -0
- package/dist/rendering/DepthPass.d.ts.map +1 -1
- package/dist/rendering/DepthPass.js +30 -8
- package/dist/rendering/DepthPass.js.map +1 -1
- package/dist/rendering/ForwardPass.d.ts.map +1 -1
- package/dist/rendering/ForwardPass.js +7 -0
- package/dist/rendering/ForwardPass.js.map +1 -1
- package/dist/rendering/Renderer.d.ts +0 -2
- package/dist/rendering/Renderer.d.ts.map +1 -1
- package/dist/rendering/Renderer.js +6 -16
- package/dist/rendering/Renderer.js.map +1 -1
- package/dist/rendering/contracts/output.d.ts +9 -1
- package/dist/rendering/contracts/output.d.ts.map +1 -1
- package/dist/rendering/contracts/output.js.map +1 -1
- package/dist/rendering/output/OutputPass.d.ts +2 -0
- package/dist/rendering/output/OutputPass.d.ts.map +1 -1
- package/dist/rendering/output/OutputPass.js +26 -3
- package/dist/rendering/output/OutputPass.js.map +1 -1
- package/dist/rendering/output/ToneMappingOperators.glsl.d.ts +3 -1
- package/dist/rendering/output/ToneMappingOperators.glsl.d.ts.map +1 -1
- package/dist/rendering/output/ToneMappingOperators.glsl.js +19 -1
- package/dist/rendering/output/ToneMappingOperators.glsl.js.map +1 -1
- package/dist/rendering/post/v2Stages.d.ts +2 -7
- package/dist/rendering/post/v2Stages.d.ts.map +1 -1
- package/dist/rendering/post/v2Stages.js +2 -17
- package/dist/rendering/post/v2Stages.js.map +1 -1
- package/dist/rendering/post/vignetteColor.d.ts +8 -0
- package/dist/rendering/post/vignetteColor.d.ts.map +1 -0
- package/dist/rendering/post/vignetteColor.js +18 -0
- package/dist/rendering/post/vignetteColor.js.map +1 -0
- package/dist/rendering/renderer/PostprocessExecution.d.ts +10 -0
- package/dist/rendering/renderer/PostprocessExecution.d.ts.map +1 -1
- package/dist/rendering/renderer/PostprocessExecution.js +38 -38
- package/dist/rendering/renderer/PostprocessExecution.js.map +1 -1
- package/dist/rendering/renderer/coreOutputPostRoute.d.ts +25 -17
- package/dist/rendering/renderer/coreOutputPostRoute.d.ts.map +1 -1
- package/dist/rendering/renderer/coreOutputPostRoute.js +27 -18
- package/dist/rendering/renderer/coreOutputPostRoute.js.map +1 -1
- package/dist/rendering/renderer/qrSubFlags.d.ts +1 -1
- package/dist/rendering/renderer/qrSubFlags.d.ts.map +1 -1
- package/dist/rendering/renderer/qrSubFlags.js +2 -8
- package/dist/rendering/renderer/qrSubFlags.js.map +1 -1
- package/dist/rendering/shaders/chunks/author/index.d.ts.map +1 -1
- package/dist/rendering/shaders/chunks/author/index.js +7 -0
- package/dist/rendering/shaders/chunks/author/index.js.map +1 -1
- package/dist/rendering/shaders/chunks/author/shadow.glsl.d.ts +11 -0
- package/dist/rendering/shaders/chunks/author/shadow.glsl.d.ts.map +1 -0
- package/dist/rendering/shaders/chunks/author/shadow.glsl.js +57 -0
- package/dist/rendering/shaders/chunks/author/shadow.glsl.js.map +1 -0
- package/dist/rendering/shadows/DirectionalCascadeFitter.d.ts +20 -0
- package/dist/rendering/shadows/DirectionalCascadeFitter.d.ts.map +1 -1
- package/dist/rendering/shadows/DirectionalCascadeFitter.js +80 -7
- package/dist/rendering/shadows/DirectionalCascadeFitter.js.map +1 -1
- package/dist/rendering/shadows/Prd02DepthShaderLibrary.d.ts.map +1 -1
- package/dist/rendering/shadows/Prd02DepthShaderLibrary.js +9 -1
- package/dist/rendering/shadows/Prd02DepthShaderLibrary.js.map +1 -1
- package/dist/rendering/shadows/ShadowSystem.d.ts.map +1 -1
- package/dist/rendering/shadows/ShadowSystem.js +7 -2
- package/dist/rendering/shadows/ShadowSystem.js.map +1 -1
- package/dist/rendering/webgl2/LdrPostprocessShader.d.ts +2 -0
- package/dist/rendering/webgl2/LdrPostprocessShader.d.ts.map +1 -1
- package/dist/rendering/webgl2/LdrPostprocessShader.js +25 -3
- package/dist/rendering/webgl2/LdrPostprocessShader.js.map +1 -1
- package/dist/rendering/webgl2/LegacyPost.d.ts +11 -2
- package/dist/rendering/webgl2/LegacyPost.d.ts.map +1 -1
- package/dist/rendering/webgl2/LegacyPost.js +191 -16
- package/dist/rendering/webgl2/LegacyPost.js.map +1 -1
- package/package.json +33 -26
- package/templates/cinematic-scene/package.json +2 -2
- package/templates/mini-game/package.json +2 -2
- package/templates/product-viewer/package.json +2 -2
- package/templates/production-asset-inspector/package.json +1 -1
- package/templates/production-material-studio/package.json +1 -1
- package/templates/production-product-configurator/package.json +1 -1
- package/templates/production-product-viewer/package.json +1 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
export type HandBounceVec3 = readonly [number, number, number];
|
|
2
|
+
export interface HandBounceGait {
|
|
3
|
+
/** Seconds per bounce. */
|
|
4
|
+
readonly period: number;
|
|
5
|
+
/** Palm height above the floor at the meet (top of the bounce). */
|
|
6
|
+
readonly palmTop: number;
|
|
7
|
+
/** Palm height above the floor at the push (lowest the hand is asked to reach). */
|
|
8
|
+
readonly palmPush: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HandBounceOptions {
|
|
11
|
+
/** Which hand bounces the ball. Mirrors the overlay's bone roles. Default "right". */
|
|
12
|
+
readonly hand?: "left" | "right";
|
|
13
|
+
/** Default 0.13 (a basketball). The ball centre is on the floor plus this radius at the bounce. */
|
|
14
|
+
readonly ballRadius?: number;
|
|
15
|
+
/** World Y of the floor. Palm heights are relative to it. Default 0. */
|
|
16
|
+
readonly floorY?: number;
|
|
17
|
+
/** How far below the shoulder the arm alone can reach. Palm targets are clamped to it. Default 0.55. */
|
|
18
|
+
readonly armReach?: number;
|
|
19
|
+
/** Palm centroid rides this far above the ball crown while in contact. Default 0.09. */
|
|
20
|
+
readonly ballGap?: number;
|
|
21
|
+
/** Standing profile; defaults are the Aura Hoops numbers (0.46 s, palm 1.02 to 0.62 m). */
|
|
22
|
+
readonly standing?: Partial<HandBounceGait>;
|
|
23
|
+
/** Running profile (lower apex, shorter period); defaults 0.30 s, palm 0.92 to 0.60 m. */
|
|
24
|
+
readonly running?: Partial<HandBounceGait>;
|
|
25
|
+
/** Horizontal speed (m/s) above which the running profile applies. Default 0.45. */
|
|
26
|
+
readonly runSpeed?: number;
|
|
27
|
+
/** Skeleton bone names; the overlay then names the bones that actually exist. */
|
|
28
|
+
readonly boneNames?: readonly string[];
|
|
29
|
+
/** Phase landmarks of one bounce (0 = palm meets ball at the top). */
|
|
30
|
+
readonly phases?: Partial<HandBouncePhases>;
|
|
31
|
+
}
|
|
32
|
+
export interface HandBouncePhases {
|
|
33
|
+
/** Palm and ball ride together down to here. Default 0.35. */
|
|
34
|
+
readonly rideEnd: number;
|
|
35
|
+
/** The palm turns around here while the ball keeps going down. Default 0.60. */
|
|
36
|
+
readonly palmTurn: number;
|
|
37
|
+
/** The ball meets the floor here. Default 0.66. */
|
|
38
|
+
readonly floorAt: number;
|
|
39
|
+
/** The palm is back on the ball and carries it again from here. Default 0.92. */
|
|
40
|
+
readonly catchFrom: number;
|
|
41
|
+
}
|
|
42
|
+
export interface HandBounceConfig {
|
|
43
|
+
readonly hand: "left" | "right";
|
|
44
|
+
readonly ballRadius: number;
|
|
45
|
+
readonly floorY: number;
|
|
46
|
+
readonly armReach: number;
|
|
47
|
+
readonly ballGap: number;
|
|
48
|
+
readonly standing: HandBounceGait;
|
|
49
|
+
readonly running: HandBounceGait;
|
|
50
|
+
readonly runSpeed: number;
|
|
51
|
+
readonly phases: HandBouncePhases;
|
|
52
|
+
/** Ball centre height at the floor contact. */
|
|
53
|
+
readonly floorBallY: number;
|
|
54
|
+
}
|
|
55
|
+
export interface HandBounceCycle {
|
|
56
|
+
/** Palm target height (world Y). */
|
|
57
|
+
readonly palmY: number;
|
|
58
|
+
/** Ball centre height following the cycle (before it is retargeted to the rendered palm). */
|
|
59
|
+
readonly ballY: number;
|
|
60
|
+
/** 0 to 1: how hard the body works into the push (crouch for a standing handler, waist bend for a runner). */
|
|
61
|
+
readonly effort: number;
|
|
62
|
+
}
|
|
63
|
+
export declare function resolveHandBounceConfig(options?: HandBounceOptions): HandBounceConfig;
|
|
64
|
+
/** Palm height, ball height and body effort for phase `t` (0..1). `shoulderY` is the live world Y of the dribbling shoulder. */
|
|
65
|
+
export declare function handBounceCycle(config: HandBounceConfig, t: number, shoulderY: number, moving?: boolean): HandBounceCycle;
|
|
66
|
+
/**
|
|
67
|
+
* Ball centre height for phase `t`. `palmY` is the palm the ball rides while in contact (pass the RENDERED palm so the ball
|
|
68
|
+
* cannot leave a hand that could not follow its target); `releaseY` is the ball height when it leaves the palm and `catchY`
|
|
69
|
+
* the height of the palm that receives it. In the air the ball falls to the floor and rebounds, so the bounce point is always
|
|
70
|
+
* `config.floorBallY`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function handBounceBallY(config: HandBounceConfig, t: number, palmY: number, releaseY: number, catchY: number): number;
|
|
73
|
+
/**
|
|
74
|
+
* 1 while the palm is on the ball (riding down, and the catch at the top), 0 while the ball is free in the air. Anything that
|
|
75
|
+
* offsets the ball from the palm (stride lead, outward nudge) is scaled by `1 - weight`, so the ball is glued to the palm at the
|
|
76
|
+
* contact points however fast the handler runs.
|
|
77
|
+
*/
|
|
78
|
+
export declare function handBounceContactWeight(config: HandBounceConfig, phase: number): number;
|
|
79
|
+
/** Horizontal ball position: on the palm at contact, drifting ahead with the handler's stride only while the ball is in the air. */
|
|
80
|
+
export declare function handBounceBallXZ(config: HandBounceConfig, palm: HandBounceVec3, holder: {
|
|
81
|
+
readonly x: number;
|
|
82
|
+
readonly z: number;
|
|
83
|
+
readonly vx: number;
|
|
84
|
+
readonly vz: number;
|
|
85
|
+
}, phase: number): {
|
|
86
|
+
x: number;
|
|
87
|
+
z: number;
|
|
88
|
+
};
|
|
89
|
+
/** Clamp a palm target into the arm's reach sphere around the shoulder (a target the arm cannot reach makes the hand miss the ball). */
|
|
90
|
+
export declare function clampPalmReach(shoulder: HandBounceVec3, target: HandBounceVec3, reach: number): [number, number, number];
|
|
91
|
+
/** Upper-body pitch angles (radians, forward positive) for a handler bouncing the ball: stationary handlers crouch into the push, runners bend at the waist. */
|
|
92
|
+
export declare function handBounceOverlayAngles(effort: number, moving: boolean, leanScale?: number): {
|
|
93
|
+
spine: number;
|
|
94
|
+
chest: number;
|
|
95
|
+
head: number;
|
|
96
|
+
};
|
|
97
|
+
export interface HandBounceOverlayBone {
|
|
98
|
+
/** Pitch about the actor's local X (radians, positive bends forward over the ball). */
|
|
99
|
+
readonly pitch: number;
|
|
100
|
+
}
|
|
101
|
+
export interface HandBounceOverlay {
|
|
102
|
+
/** "overlay" for a runner (apply on top of the locomotion clip), "pose" for a stationary handler (replace the pose). */
|
|
103
|
+
readonly mode: "overlay" | "pose";
|
|
104
|
+
/** Upper-body bones only. Leg, hip and foot bones are never named, so the clip keeps owning the stride. */
|
|
105
|
+
readonly bones: Readonly<Record<string, HandBounceOverlayBone>>;
|
|
106
|
+
readonly effort: number;
|
|
107
|
+
/** Bone names for the dribbling arm (resolved against `boneNames` when given) for the game's arm solver. */
|
|
108
|
+
readonly arm: {
|
|
109
|
+
readonly upper: string;
|
|
110
|
+
readonly forearm: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export interface HandBounceInput {
|
|
114
|
+
/** Horizontal speed in m/s or an explicit flag. */
|
|
115
|
+
readonly moving?: boolean;
|
|
116
|
+
readonly speed?: number;
|
|
117
|
+
/** World Y of the dribbling shoulder (live from the rig). */
|
|
118
|
+
readonly shoulderY: number;
|
|
119
|
+
/** The palm as rendered this frame, if the rig is live; the ball rides it. Without it the cycle's palm height is used. */
|
|
120
|
+
readonly palm?: HandBounceVec3;
|
|
121
|
+
readonly holder: {
|
|
122
|
+
readonly x: number;
|
|
123
|
+
readonly z: number;
|
|
124
|
+
readonly vx: number;
|
|
125
|
+
readonly vz: number;
|
|
126
|
+
};
|
|
127
|
+
/** Dead ball (check, inbound): phase is held at the meet and the ball sits in the palm. */
|
|
128
|
+
readonly hold?: boolean;
|
|
129
|
+
}
|
|
130
|
+
export interface HandBounceFrame {
|
|
131
|
+
readonly phase: number;
|
|
132
|
+
readonly moving: boolean;
|
|
133
|
+
readonly contact: number;
|
|
134
|
+
readonly effort: number;
|
|
135
|
+
readonly palmY: number;
|
|
136
|
+
readonly ball: [number, number, number];
|
|
137
|
+
readonly floorContact: boolean;
|
|
138
|
+
}
|
|
139
|
+
export interface HandBounceState {
|
|
140
|
+
readonly phase: number;
|
|
141
|
+
readonly moving: boolean;
|
|
142
|
+
readonly contact: number;
|
|
143
|
+
readonly effort: number;
|
|
144
|
+
readonly palmY: number;
|
|
145
|
+
readonly ball: readonly [number, number, number];
|
|
146
|
+
readonly releaseY: number;
|
|
147
|
+
readonly floorContact: boolean;
|
|
148
|
+
readonly active: boolean;
|
|
149
|
+
}
|
|
150
|
+
export interface HandBounceRelease {
|
|
151
|
+
readonly position: [number, number, number];
|
|
152
|
+
/** Finite-difference velocity of the ball at the hand: hand it to the pass or shot so the ball leaves without a pop. */
|
|
153
|
+
readonly velocity: [number, number, number];
|
|
154
|
+
}
|
|
155
|
+
export interface HandBounce {
|
|
156
|
+
readonly config: HandBounceConfig;
|
|
157
|
+
/** Advance one fixed step (dt > 0, no wall clock) and place the ball. */
|
|
158
|
+
step(dt: number, input: HandBounceInput): HandBounceFrame;
|
|
159
|
+
state(): HandBounceState;
|
|
160
|
+
/** Palm-free recipe for the body: waist bend, shoulder drop, head. Call after step(). */
|
|
161
|
+
overlay(leanScale?: number): HandBounceOverlay;
|
|
162
|
+
/** Leave the hand: current position and velocity for a pass, shot or drop. Stops the cycle. */
|
|
163
|
+
release(): HandBounceRelease;
|
|
164
|
+
/** Take a loose ball: the cycle resumes at the catch so the palm receives the ball where it is. */
|
|
165
|
+
pickup(ball: HandBounceVec3): void;
|
|
166
|
+
reset(): void;
|
|
167
|
+
}
|
|
168
|
+
export declare function createHandBounce(options?: HandBounceOptions): HandBounce;
|
|
169
|
+
export interface HandBounceSample {
|
|
170
|
+
readonly phase: number;
|
|
171
|
+
readonly palm: HandBounceVec3;
|
|
172
|
+
readonly ball: HandBounceVec3;
|
|
173
|
+
/** False when the ball is not in dribble state (loose, shot, pass): such samples are skipped. */
|
|
174
|
+
readonly dribbling?: boolean;
|
|
175
|
+
}
|
|
176
|
+
export interface HandBounceReport {
|
|
177
|
+
readonly samples: number;
|
|
178
|
+
/** Max palm-to-ball distance at the meet and the catch (m). */
|
|
179
|
+
readonly meetMax: number;
|
|
180
|
+
/** Max palm-to-ball distance at the floor contact (m); NaN when no sample touched the floor. */
|
|
181
|
+
readonly floorContactMax: number;
|
|
182
|
+
/** Highest palm height at the floor contact (m above the floor). */
|
|
183
|
+
readonly floorContactPalmHeightMax: number;
|
|
184
|
+
/** Lowest ball centre minus the ball radius over the floor: 0 when the ball bounces exactly on the floor. */
|
|
185
|
+
readonly floorError: number;
|
|
186
|
+
/** Max palm-to-ball distance over every dribble sample. */
|
|
187
|
+
readonly maxDistance: number;
|
|
188
|
+
readonly floorSamples: number;
|
|
189
|
+
readonly meetSamples: number;
|
|
190
|
+
}
|
|
191
|
+
export interface HandBounceLimits {
|
|
192
|
+
readonly meet: number;
|
|
193
|
+
readonly floorContact: number;
|
|
194
|
+
readonly floorError: number;
|
|
195
|
+
readonly maxDistance: number;
|
|
196
|
+
}
|
|
197
|
+
/** Limits the Aura Hoops dribble is held to. */
|
|
198
|
+
export declare const DEFAULT_HAND_BOUNCE_LIMITS: HandBounceLimits;
|
|
199
|
+
/** Probe: feed per-frame palm and ball world positions of a dribble; returns the distances the game must keep small. Call it from QA hooks and tools/game-checks. */
|
|
200
|
+
export declare function measureHandBall(samples: readonly HandBounceSample[], options?: HandBounceOptions & {
|
|
201
|
+
readonly limits?: Partial<HandBounceLimits>;
|
|
202
|
+
}): HandBounceReport & {
|
|
203
|
+
readonly ok: boolean;
|
|
204
|
+
readonly failures: readonly string[];
|
|
205
|
+
};
|
|
206
|
+
//# sourceMappingURL=handBounce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handBounce.d.ts","sourceRoot":"","sources":["../../../../../packages/game/src/motion/handBounce.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,sFAAsF;IACtF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,mGAAmG;IACnG,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,wGAAwG;IACxG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wFAAwF;IACxF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5C,0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AAgB,EAAE,EACpC,OAAO,GAAE,iBAAiB,GAAG;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAAO,GAChF,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAgDnF"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { resolveBone } from "./boneAttach.js";
|
|
2
|
+
const lerp = (a, b, t) => a + (b - a) * t;
|
|
3
|
+
const smoothstep = (t) => (t <= 0 ? 0 : t >= 1 ? 1 : t * t * (3 - 2 * t));
|
|
4
|
+
export function resolveHandBounceConfig(options = {}) {
|
|
5
|
+
const ballRadius = options.ballRadius ?? 0.13;
|
|
6
|
+
const floorY = options.floorY ?? 0;
|
|
7
|
+
return {
|
|
8
|
+
hand: options.hand ?? "right",
|
|
9
|
+
ballRadius,
|
|
10
|
+
floorY,
|
|
11
|
+
armReach: options.armReach ?? 0.55,
|
|
12
|
+
ballGap: options.ballGap ?? 0.09,
|
|
13
|
+
standing: { period: 0.46, palmTop: 1.02, palmPush: 0.62, ...options.standing },
|
|
14
|
+
running: { period: 0.3, palmTop: 0.92, palmPush: 0.6, ...options.running },
|
|
15
|
+
runSpeed: options.runSpeed ?? 0.45,
|
|
16
|
+
phases: { rideEnd: 0.35, palmTurn: 0.6, floorAt: 0.66, catchFrom: 0.92, ...options.phases },
|
|
17
|
+
floorBallY: floorY + ballRadius
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Palm height, ball height and body effort for phase `t` (0..1). `shoulderY` is the live world Y of the dribbling shoulder. */
|
|
21
|
+
export function handBounceCycle(config, t, shoulderY, moving = false) {
|
|
22
|
+
const gait = moving ? config.running : config.standing;
|
|
23
|
+
const { rideEnd, palmTurn, floorAt } = config.phases;
|
|
24
|
+
const top = Math.min(config.floorY + gait.palmTop, shoulderY - 0.3);
|
|
25
|
+
const push = Math.max(config.floorY + gait.palmPush, shoulderY - config.armReach);
|
|
26
|
+
const low = push - 0.04;
|
|
27
|
+
let palmY;
|
|
28
|
+
let effort;
|
|
29
|
+
if (t < rideEnd) {
|
|
30
|
+
const s = t / rideEnd;
|
|
31
|
+
effort = Math.pow(s, 1.6);
|
|
32
|
+
palmY = lerp(top, push, effort);
|
|
33
|
+
}
|
|
34
|
+
else if (t < palmTurn) {
|
|
35
|
+
const s = (t - rideEnd) / (palmTurn - rideEnd);
|
|
36
|
+
effort = 1;
|
|
37
|
+
palmY = lerp(push, low, 1 - (1 - s) * (1 - s));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const s = (t - palmTurn) / (1 - palmTurn);
|
|
41
|
+
effort = t < floorAt ? 1 : 1 - smoothstep((t - floorAt) / (1 - floorAt));
|
|
42
|
+
palmY = lerp(low, top, smoothstep(s));
|
|
43
|
+
}
|
|
44
|
+
return { palmY, ballY: handBounceBallY(config, t, palmY, push - config.ballGap, top - config.ballGap), effort };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Ball centre height for phase `t`. `palmY` is the palm the ball rides while in contact (pass the RENDERED palm so the ball
|
|
48
|
+
* cannot leave a hand that could not follow its target); `releaseY` is the ball height when it leaves the palm and `catchY`
|
|
49
|
+
* the height of the palm that receives it. In the air the ball falls to the floor and rebounds, so the bounce point is always
|
|
50
|
+
* `config.floorBallY`.
|
|
51
|
+
*/
|
|
52
|
+
export function handBounceBallY(config, t, palmY, releaseY, catchY) {
|
|
53
|
+
const { rideEnd, floorAt, catchFrom } = config.phases;
|
|
54
|
+
if (t < rideEnd)
|
|
55
|
+
return palmY - config.ballGap;
|
|
56
|
+
if (t < floorAt) {
|
|
57
|
+
const s = (t - rideEnd) / (floorAt - rideEnd);
|
|
58
|
+
return lerp(releaseY, config.floorBallY, Math.pow(s, 1.2));
|
|
59
|
+
}
|
|
60
|
+
if (t >= catchFrom)
|
|
61
|
+
return palmY - config.ballGap;
|
|
62
|
+
const s = (t - floorAt) / (catchFrom - floorAt);
|
|
63
|
+
return lerp(config.floorBallY, catchY, 1 - Math.pow(1 - s, 1.7));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 1 while the palm is on the ball (riding down, and the catch at the top), 0 while the ball is free in the air. Anything that
|
|
67
|
+
* offsets the ball from the palm (stride lead, outward nudge) is scaled by `1 - weight`, so the ball is glued to the palm at the
|
|
68
|
+
* contact points however fast the handler runs.
|
|
69
|
+
*/
|
|
70
|
+
export function handBounceContactWeight(config, phase) {
|
|
71
|
+
const { rideEnd, floorAt, catchFrom } = config.phases;
|
|
72
|
+
const t = ((phase % 1) + 1) % 1;
|
|
73
|
+
if (t < rideEnd)
|
|
74
|
+
return 1;
|
|
75
|
+
if (t < floorAt)
|
|
76
|
+
return 1 - smoothstep((t - rideEnd) / 0.1);
|
|
77
|
+
if (t < catchFrom)
|
|
78
|
+
return smoothstep((t - floorAt - 0.1) / (catchFrom - floorAt - 0.1));
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
/** Horizontal ball position: on the palm at contact, drifting ahead with the handler's stride only while the ball is in the air. */
|
|
82
|
+
export function handBounceBallXZ(config, palm, holder, phase) {
|
|
83
|
+
const free = 1 - handBounceContactWeight(config, phase);
|
|
84
|
+
const ox = palm[0] - holder.x;
|
|
85
|
+
const oz = palm[2] - holder.z;
|
|
86
|
+
const olen = Math.hypot(ox, oz) || 1;
|
|
87
|
+
return {
|
|
88
|
+
x: palm[0] + (ox / olen) * 0.02 * free + holder.vx * 0.04 * free,
|
|
89
|
+
z: palm[2] + (oz / olen) * 0.02 * free + holder.vz * 0.04 * free
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Clamp a palm target into the arm's reach sphere around the shoulder (a target the arm cannot reach makes the hand miss the ball). */
|
|
93
|
+
export function clampPalmReach(shoulder, target, reach) {
|
|
94
|
+
const dx = target[0] - shoulder[0];
|
|
95
|
+
const dy = target[1] - shoulder[1];
|
|
96
|
+
const dz = target[2] - shoulder[2];
|
|
97
|
+
const d = Math.hypot(dx, dy, dz);
|
|
98
|
+
if (d <= reach || d < 1e-9)
|
|
99
|
+
return [target[0], target[1], target[2]];
|
|
100
|
+
const k = reach / d;
|
|
101
|
+
return [shoulder[0] + dx * k, shoulder[1] + dy * k, shoulder[2] + dz * k];
|
|
102
|
+
}
|
|
103
|
+
/** Upper-body pitch angles (radians, forward positive) for a handler bouncing the ball: stationary handlers crouch into the push, runners bend at the waist. */
|
|
104
|
+
export function handBounceOverlayAngles(effort, moving, leanScale = 1) {
|
|
105
|
+
if (moving) {
|
|
106
|
+
const lean = (1.28 + 0.77 * effort) * leanScale;
|
|
107
|
+
return { spine: lean * 0.55, chest: lean * 0.45, head: -lean * 0.6 };
|
|
108
|
+
}
|
|
109
|
+
return { spine: (0.2 + 0.3 * effort) * leanScale, chest: (0.12 + 0.2 * effort) * leanScale, head: -0.22 };
|
|
110
|
+
}
|
|
111
|
+
const SIDE_PREFIX = { left: "left", right: "right" };
|
|
112
|
+
export function createHandBounce(options = {}) {
|
|
113
|
+
const config = resolveHandBounceConfig(options);
|
|
114
|
+
const side = SIDE_PREFIX[config.hand];
|
|
115
|
+
const names = options.boneNames;
|
|
116
|
+
const pick = (role, fallback) => (names ? resolveBone(names, role) ?? fallback : fallback);
|
|
117
|
+
const spineName = pick("spine", "Spine");
|
|
118
|
+
const chestName = names ? names.find((n) => /chest/i.test(n) && !/upper/i.test(n)) ?? spineName : "Chest";
|
|
119
|
+
const headName = pick("head", "Head");
|
|
120
|
+
const armUpper = pick(`${side}UpperArm`, config.hand === "left" ? "LeftUpperArm" : "RightUpperArm");
|
|
121
|
+
const armFore = pick(`${side}Forearm`, config.hand === "left" ? "LeftForearm" : "RightForearm");
|
|
122
|
+
let phase = 0;
|
|
123
|
+
let moving = false;
|
|
124
|
+
let releaseY = config.floorBallY + 0.4;
|
|
125
|
+
let active = false;
|
|
126
|
+
let contact = 1;
|
|
127
|
+
let effort = 0;
|
|
128
|
+
let palmY = config.floorY + config.standing.palmTop;
|
|
129
|
+
let ball = [0, config.floorBallY, 0];
|
|
130
|
+
let prevBall;
|
|
131
|
+
let lastDt = 1 / 60;
|
|
132
|
+
let floorContact = false;
|
|
133
|
+
const frame = () => ({ phase, moving, contact, effort, palmY, ball: [ball[0], ball[1], ball[2]], floorContact });
|
|
134
|
+
return {
|
|
135
|
+
config,
|
|
136
|
+
step(dt, input) {
|
|
137
|
+
if (!(dt > 0))
|
|
138
|
+
throw new Error("createHandBounce.step: dt must be a positive fixed step");
|
|
139
|
+
moving = input.moving ?? (input.speed ?? 0) > config.runSpeed;
|
|
140
|
+
const gait = moving ? config.running : config.standing;
|
|
141
|
+
if (!active) {
|
|
142
|
+
active = true;
|
|
143
|
+
phase = 0;
|
|
144
|
+
prevBall = undefined;
|
|
145
|
+
}
|
|
146
|
+
phase = input.hold ? 0 : (phase + dt / gait.period) % 1;
|
|
147
|
+
const cyc = handBounceCycle(config, phase, input.shoulderY, moving);
|
|
148
|
+
effort = input.hold ? 0 : cyc.effort;
|
|
149
|
+
contact = handBounceContactWeight(config, phase);
|
|
150
|
+
prevBall = [ball[0], ball[1], ball[2]];
|
|
151
|
+
lastDt = dt;
|
|
152
|
+
if (input.palm) {
|
|
153
|
+
const palm = input.palm;
|
|
154
|
+
if (input.hold) {
|
|
155
|
+
ball = [palm[0], palm[1], palm[2]];
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const at = handBounceBallXZ(config, palm, input.holder, phase);
|
|
159
|
+
if (phase < config.phases.rideEnd)
|
|
160
|
+
releaseY = palm[1] - config.ballGap;
|
|
161
|
+
ball = [at.x, handBounceBallY(config, phase, palm[1], releaseY, palm[1] - config.ballGap), at.z];
|
|
162
|
+
}
|
|
163
|
+
palmY = palm[1];
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
palmY = cyc.palmY;
|
|
167
|
+
ball = [input.holder.x, cyc.ballY, input.holder.z];
|
|
168
|
+
}
|
|
169
|
+
floorContact = ball[1] <= config.floorBallY + 0.02;
|
|
170
|
+
return frame();
|
|
171
|
+
},
|
|
172
|
+
state() {
|
|
173
|
+
return { phase, moving, contact, effort, palmY, ball: [ball[0], ball[1], ball[2]], releaseY, floorContact, active };
|
|
174
|
+
},
|
|
175
|
+
overlay(leanScale = 1) {
|
|
176
|
+
const a = handBounceOverlayAngles(effort, moving, leanScale);
|
|
177
|
+
return {
|
|
178
|
+
mode: moving ? "overlay" : "pose",
|
|
179
|
+
effort,
|
|
180
|
+
bones: { [spineName]: { pitch: a.spine }, [chestName]: { pitch: a.chest }, [headName]: { pitch: a.head } },
|
|
181
|
+
arm: { upper: armUpper, forearm: armFore }
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
release() {
|
|
185
|
+
const dt = Math.max(lastDt, 1e-6);
|
|
186
|
+
const p = prevBall ?? ball;
|
|
187
|
+
active = false;
|
|
188
|
+
return {
|
|
189
|
+
position: [ball[0], ball[1], ball[2]],
|
|
190
|
+
velocity: [(ball[0] - p[0]) / dt, (ball[1] - p[1]) / dt, (ball[2] - p[2]) / dt]
|
|
191
|
+
};
|
|
192
|
+
},
|
|
193
|
+
pickup(at) {
|
|
194
|
+
active = true;
|
|
195
|
+
phase = config.phases.catchFrom;
|
|
196
|
+
releaseY = at[1];
|
|
197
|
+
ball = [at[0], at[1], at[2]];
|
|
198
|
+
prevBall = undefined;
|
|
199
|
+
},
|
|
200
|
+
reset() {
|
|
201
|
+
phase = 0;
|
|
202
|
+
active = false;
|
|
203
|
+
moving = false;
|
|
204
|
+
prevBall = undefined;
|
|
205
|
+
ball = [0, config.floorBallY, 0];
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/** Limits the Aura Hoops dribble is held to. */
|
|
210
|
+
export const DEFAULT_HAND_BOUNCE_LIMITS = { meet: 0.12, floorContact: 0.55, floorError: 0.02, maxDistance: 0.9 };
|
|
211
|
+
/** Probe: feed per-frame palm and ball world positions of a dribble; returns the distances the game must keep small. Call it from QA hooks and tools/game-checks. */
|
|
212
|
+
export function measureHandBall(samples, options = {}) {
|
|
213
|
+
const config = resolveHandBounceConfig(options);
|
|
214
|
+
const limits = { ...DEFAULT_HAND_BOUNCE_LIMITS, ...options.limits };
|
|
215
|
+
let meetMax = 0;
|
|
216
|
+
let floorMax = Number.NaN;
|
|
217
|
+
let floorPalm = Number.NaN;
|
|
218
|
+
let maxDistance = 0;
|
|
219
|
+
let lowest = Infinity;
|
|
220
|
+
let floorSamples = 0;
|
|
221
|
+
let meetSamples = 0;
|
|
222
|
+
let used = 0;
|
|
223
|
+
for (const s of samples) {
|
|
224
|
+
if (s.dribbling === false)
|
|
225
|
+
continue;
|
|
226
|
+
used += 1;
|
|
227
|
+
const d = Math.hypot(s.palm[0] - s.ball[0], s.palm[1] - s.ball[1], s.palm[2] - s.ball[2]);
|
|
228
|
+
maxDistance = Math.max(maxDistance, d);
|
|
229
|
+
lowest = Math.min(lowest, s.ball[1]);
|
|
230
|
+
const t = ((s.phase % 1) + 1) % 1;
|
|
231
|
+
if (t < 0.04 || t > config.phases.catchFrom + 0.01) {
|
|
232
|
+
meetMax = Math.max(meetMax, d);
|
|
233
|
+
meetSamples += 1;
|
|
234
|
+
}
|
|
235
|
+
if (s.ball[1] <= config.floorBallY + 0.02) {
|
|
236
|
+
floorMax = Number.isNaN(floorMax) ? d : Math.max(floorMax, d);
|
|
237
|
+
const h = s.palm[1] - config.floorY;
|
|
238
|
+
floorPalm = Number.isNaN(floorPalm) ? h : Math.max(floorPalm, h);
|
|
239
|
+
floorSamples += 1;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const floorError = used === 0 ? Number.NaN : Math.abs(lowest - config.floorBallY);
|
|
243
|
+
const failures = [];
|
|
244
|
+
if (used === 0)
|
|
245
|
+
failures.push("no dribble samples");
|
|
246
|
+
if (meetSamples > 0 && meetMax > limits.meet)
|
|
247
|
+
failures.push(`palm to ball at the meet ${meetMax.toFixed(3)} m > ${limits.meet} m`);
|
|
248
|
+
if (floorSamples > 0 && floorMax > limits.floorContact)
|
|
249
|
+
failures.push(`palm to ball at the floor contact ${floorMax.toFixed(3)} m > ${limits.floorContact} m`);
|
|
250
|
+
if (used > 0 && floorError > limits.floorError)
|
|
251
|
+
failures.push(`ball centre misses the floor by ${floorError.toFixed(3)} m > ${limits.floorError} m`);
|
|
252
|
+
if (maxDistance > limits.maxDistance)
|
|
253
|
+
failures.push(`ball strays ${maxDistance.toFixed(3)} m from the hand > ${limits.maxDistance} m`);
|
|
254
|
+
return {
|
|
255
|
+
samples: used,
|
|
256
|
+
meetMax,
|
|
257
|
+
floorContactMax: floorMax,
|
|
258
|
+
floorContactPalmHeightMax: floorPalm,
|
|
259
|
+
floorError,
|
|
260
|
+
maxDistance,
|
|
261
|
+
floorSamples,
|
|
262
|
+
meetSamples,
|
|
263
|
+
ok: failures.length === 0,
|
|
264
|
+
failures
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=handBounce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handBounce.js","sourceRoot":"","sources":["../../../../../packages/game/src/motion/handBounce.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAsE3C,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1E,MAAM,UAAU,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE1F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MAAM,CAAC,UAAU,CAAC,CAAC;IAClF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,IAAI,KAAK,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACpD,IAAI,WAAW,GAAG,CAAC,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI;QAAE,QAAQ,CAAC,IAAI,CAAC,4BAA4B,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;IACnI,IAAI,YAAY,GAAG,CAAC,IAAI,QAAQ,GAAG,MAAM,CAAC,YAAY;QAAE,QAAQ,CAAC,IAAI,CAAC,qCAAqC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,YAAY,IAAI,CAAC,CAAC;IAC/J,IAAI,IAAI,GAAG,CAAC,IAAI,UAAU,GAAG,MAAM,CAAC,UAAU;QAAE,QAAQ,CAAC,IAAI,CAAC,mCAAmC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC;IACrJ,IAAI,WAAW,GAAG,MAAM,CAAC,WAAW;QAAE,QAAQ,CAAC,IAAI,CAAC,eAAe,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,MAAM,CAAC,WAAW,IAAI,CAAC,CAAC;IACvI,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO;QACP,eAAe,EAAE,QAAQ;QACzB,yBAAyB,EAAE,SAAS;QACpC,UAAU;QACV,WAAW;QACX,YAAY;QACZ,WAAW;QACX,EAAE,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC;QACzB,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -16,4 +16,6 @@ export { runMotionGate } from "./motionGate.js";
|
|
|
16
16
|
export type { MotionGateOptions, MotionGateReport } from "./motionGate.js";
|
|
17
17
|
export { clearCameraEye, createCameraClearance } from "./cameraClear.js";
|
|
18
18
|
export type { CameraVec3, ClearEyeOptions, ClearEye, CameraClearanceOptions, CameraClearance } from "./cameraClear.js";
|
|
19
|
+
export { createHandBounce, resolveHandBounceConfig, handBounceCycle, handBounceBallY, handBounceContactWeight, handBounceBallXZ, clampPalmReach, handBounceOverlayAngles, measureHandBall, DEFAULT_HAND_BOUNCE_LIMITS } from "./handBounce.js";
|
|
20
|
+
export type { HandBounceVec3, HandBounceGait, HandBounceOptions, HandBouncePhases, HandBounceConfig, HandBounceCycle, HandBounceOverlayBone, HandBounceOverlay, HandBounceInput, HandBounceFrame, HandBounceState, HandBounceRelease, HandBounce, HandBounceSample, HandBounceReport, HandBounceLimits } from "./handBounce.js";
|
|
19
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/game/src/motion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACtI,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACpE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5H,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrG,YAAY,EACV,iBAAiB,EAAE,oBAAoB,EAAE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AC7C,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpH,OAAO,EACL,gBAAgB,EAAE,uBAAuB,EAAE,eAAe,EAAE,eAAe,EAAE,uBAAuB,EAAE,gBAAgB,EACtH,cAAc,EAAE,uBAAuB,EAAE,eAAe,EAAE,0BAA0B,EACrF,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAC7H,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,gBAAgB,EACrH,gBAAgB,EAAE,gBAAgB,EACnC,MAAM,cAAc,CAAC"}
|
|
@@ -7,4 +7,5 @@ export { checkDoubleFrame, detectSharedSkeleton, detectCoincidentModels, detectD
|
|
|
7
7
|
export { createFixedStepPresenter, createRecordBlend } from "./presenter.js";
|
|
8
8
|
export { runMotionGate } from "./motionGate.js";
|
|
9
9
|
export { clearCameraEye, createCameraClearance } from "./cameraClear.js";
|
|
10
|
+
export { createHandBounce, resolveHandBounceConfig, handBounceCycle, handBounceBallY, handBounceContactWeight, handBounceBallXZ, clampPalmReach, handBounceOverlayAngles, measureHandBall, DEFAULT_HAND_BOUNCE_LIMITS } from "./handBounce.js";
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/game/src/motion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,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AAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EACL,gBAAgB,EAAE,uBAAuB,EAAE,eAAe,EAAE,eAAe,EAAE,uBAAuB,EAAE,gBAAgB,EACtH,cAAc,EAAE,uBAAuB,EAAE,eAAe,EAAE,0BAA0B,EACrF,MAAM,cAAc,CAAC"}
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
* 5. A requested environment HDRI that is still loading is waited for (bounded), and steps 3 and 4 run again:
|
|
14
14
|
* when the HDRI lands, every material switches to its image-based-lighting program variant at once, which
|
|
15
15
|
* recompiles the whole scene and drops frames after the game believed it was settled.
|
|
16
|
+
* 6. Textures upgrade one material at a time after mount (`renderer.runtime.texturedMaterials`, status `pending` until the
|
|
17
|
+
* upload lands). A material that gains its texture switches to a textured program variant, which compiles
|
|
18
|
+
* asynchronously too, so the ground, the road or a facade can drop out for frames after the game believed it was
|
|
19
|
+
* settled. Pending upgrades are waited for (bounded) and steps 3 and 4 run again.
|
|
16
20
|
*
|
|
17
21
|
* Call it again after a large jump (a teleport) before capturing a frame.
|
|
18
22
|
*/
|
|
@@ -25,6 +29,11 @@ export interface WarmableApp {
|
|
|
25
29
|
readonly environment?: {
|
|
26
30
|
readonly hdriStatus?: string;
|
|
27
31
|
};
|
|
32
|
+
readonly runtime?: {
|
|
33
|
+
readonly texturedMaterials?: readonly {
|
|
34
|
+
readonly status?: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
28
37
|
};
|
|
29
38
|
};
|
|
30
39
|
}
|
|
@@ -39,6 +48,10 @@ export interface WarmProgramsOptions {
|
|
|
39
48
|
readonly waitForEnvironment?: boolean;
|
|
40
49
|
/** Upper bound on that wait, in milliseconds. Default 20000. */
|
|
41
50
|
readonly environmentTimeoutMs?: number;
|
|
51
|
+
/** Wait for materials whose texture upgrade is still `pending` (`renderer.runtime.texturedMaterials`) before settling. Default true. Needs `app.diagnostics`. */
|
|
52
|
+
readonly waitForTextures?: boolean;
|
|
53
|
+
/** Upper bound on that wait, in milliseconds. Default 20000. */
|
|
54
|
+
readonly textureTimeoutMs?: number;
|
|
42
55
|
}
|
|
43
56
|
export interface WarmProgramsResult {
|
|
44
57
|
/** Precompile passes that ran (0 when the app has no `precompile`). */
|
|
@@ -52,6 +65,10 @@ export interface WarmProgramsResult {
|
|
|
52
65
|
readonly environmentFrames: number;
|
|
53
66
|
/** False only when an HDRI was still pending when the wait timed out. */
|
|
54
67
|
readonly environmentReady: boolean;
|
|
68
|
+
/** Frames stepped while waiting for pending texture upgrades (0 when none was pending). */
|
|
69
|
+
readonly textureFrames: number;
|
|
70
|
+
/** False only when an upgrade was still pending when the wait timed out. */
|
|
71
|
+
readonly texturesReady: boolean;
|
|
55
72
|
readonly durationMs: number;
|
|
56
73
|
}
|
|
57
74
|
export declare function warmPrograms(app: WarmableApp, options?: WarmProgramsOptions): Promise<WarmProgramsResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warmPrograms.d.ts","sourceRoot":"","sources":["../../../../../packages/game/src/session/warmPrograms.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"warmPrograms.d.ts","sourceRoot":"","sources":["../../../../../packages/game/src/session/warmPrograms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,WAAW,CAAC,IAAI;QACd,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAClB,QAAQ,CAAC,WAAW,CAAC,EAA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AC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAID,wBAAsB,YAAY,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAyEnH"}
|
|
@@ -58,6 +58,23 @@ export async function warmPrograms(app, options = {}) {
|
|
|
58
58
|
}
|
|
59
59
|
await settleCounts();
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
let textureFrames = 0;
|
|
62
|
+
const texturesPending = () => (app.diagnostics?.().renderer?.runtime?.texturedMaterials ?? []).some((row) => row.status === "pending");
|
|
63
|
+
let texturesReady = true;
|
|
64
|
+
if (options.waitForTextures !== false && typeof app.diagnostics === "function" && texturesPending()) {
|
|
65
|
+
const deadline = now() + Math.max(0, options.textureTimeoutMs ?? 20_000);
|
|
66
|
+
while (texturesPending() && now() < deadline) {
|
|
67
|
+
await new Promise((resolve) => setTimeout(resolve, 40));
|
|
68
|
+
app.step(0);
|
|
69
|
+
textureFrames += 1;
|
|
70
|
+
}
|
|
71
|
+
texturesReady = !texturesPending();
|
|
72
|
+
if (typeof app.precompile === "function") {
|
|
73
|
+
await app.precompile();
|
|
74
|
+
passes += 1;
|
|
75
|
+
}
|
|
76
|
+
await settleCounts();
|
|
77
|
+
}
|
|
78
|
+
return { passes, frames, settleFrames, settled, environmentFrames, environmentReady, textureFrames, texturesReady, durationMs: now() - startedAt };
|
|
62
79
|
}
|
|
63
80
|
//# sourceMappingURL=warmPrograms.js.map
|