@egret/engine 7.0.1-rc.3 → 7.0.2
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/Engine.js +7 -2
- package/dist/animation/sequenceResetTypes.d.ts +6 -0
- package/dist/animation/types.d.ts +6 -0
- package/dist/assetBundle.d.ts +2 -0
- package/dist/assetGroupTypes.d.ts +2 -0
- package/dist/audioCues.d.ts +4 -0
- package/dist/audioTypes.d.ts +13 -0
- package/dist/bitmapButtonTypes.d.ts +2 -0
- package/dist/bitmapFontTypes.d.ts +3 -0
- package/dist/bitmapResourceSlot.d.ts +1 -0
- package/dist/camera2d.js +10 -2
- package/dist/cameraTypes.d.ts +12 -0
- package/dist/contentTypes.d.ts +2 -0
- package/dist/createEngineForProfile.js +8 -5
- package/dist/fontContentTypes.d.ts +5 -0
- package/dist/gameClockTypes.d.ts +6 -0
- package/dist/gameRun.d.ts +3 -0
- package/dist/gamepadTypes.d.ts +8 -0
- package/dist/hoverInputTypes.d.ts +10 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2 -1
- package/dist/inputActions.d.ts +5 -0
- package/dist/internal/uiFactoryState.d.ts +4 -0
- package/dist/internal/uiFactoryState.js +18 -2
- package/dist/keyboardInput.d.ts +1 -0
- package/dist/keyboardInput.js +1 -0
- package/dist/keyboardInputTypes.d.ts +12 -0
- package/dist/kit.d.ts +3 -1
- package/dist/kit.js +2 -1
- package/dist/manifestResourceState.d.ts +1 -0
- package/dist/manifestResourceState.js +1 -0
- package/dist/manifestResourceTypes.d.ts +1 -0
- package/dist/motion.d.ts +2 -0
- package/dist/mouseInputTypes.d.ts +4 -0
- package/dist/particleEmitter.js +8 -0
- package/dist/particleTypes.d.ts +8 -0
- package/dist/physics2d.d.ts +2 -2
- package/dist/physics2d.js +1 -1
- package/dist/physics2dTypes.d.ts +55 -1
- package/dist/physics2dWorld.js +209 -9
- package/dist/pointerInput.d.ts +1 -0
- package/dist/pointerInput.js +1 -0
- package/dist/pointerInputTypes.d.ts +3 -0
- package/dist/random.d.ts +1 -0
- package/dist/rendering/packSharedDraws2D.js +53 -5
- package/dist/rendering/prepareSharedDraws2D.d.ts +2 -0
- package/dist/rendering/prepareSharedDraws2D.js +17 -6
- package/dist/rendering/sharedColor2D.d.ts +35 -1
- package/dist/rendering/sharedColor2D.js +131 -8
- package/dist/rendering/sharedEffects2D.js +16 -8
- package/dist/rendering/world3d/Animation3D.d.ts +9 -0
- package/dist/rendering/world3d/Animation3D.js +4 -0
- package/dist/rendering/world3d/AnimationTexture3D.d.ts +6 -0
- package/dist/rendering/world3d/AnimationTexture3D.js +2 -0
- package/dist/rendering/world3d/Batch3D.d.ts +4 -0
- package/dist/rendering/world3d/Batch3D.js +3 -0
- package/dist/rendering/world3d/Camera3D.d.ts +5 -0
- package/dist/rendering/world3d/Camera3D.js +3 -0
- package/dist/rendering/world3d/Character3D.d.ts +4 -0
- package/dist/rendering/world3d/Character3D.js +2 -0
- package/dist/rendering/world3d/Cloth3D.d.ts +18 -3
- package/dist/rendering/world3d/Cloth3D.js +6 -1
- package/dist/rendering/world3d/Compression3D.d.ts +1 -0
- package/dist/rendering/world3d/Compression3D.js +1 -0
- package/dist/rendering/world3d/Curves3D.d.ts +8 -0
- package/dist/rendering/world3d/Curves3D.js +5 -0
- package/dist/rendering/world3d/Decal3D.d.ts +2 -0
- package/dist/rendering/world3d/Decal3D.js +1 -0
- package/dist/rendering/world3d/Export3D.d.ts +13 -0
- package/dist/rendering/world3d/Export3D.js +263 -0
- package/dist/rendering/world3d/Geometry3D.d.ts +11 -1
- package/dist/rendering/world3d/Geometry3D.js +10 -1
- package/dist/rendering/world3d/GeometryBuilder3D.d.ts +2 -0
- package/dist/rendering/world3d/Gizmo3D.d.ts +5 -0
- package/dist/rendering/world3d/Gizmo3D.js +2 -0
- package/dist/rendering/world3d/Gltf3D.d.ts +6 -0
- package/dist/rendering/world3d/Gltf3D.js +25 -5
- package/dist/rendering/world3d/GpuParticles3D.d.ts +2 -0
- package/dist/rendering/world3d/GpuParticles3D.js +1 -0
- package/dist/rendering/world3d/Hdr3D.d.ts +2 -0
- package/dist/rendering/world3d/Hdr3D.js +1 -0
- package/dist/rendering/world3d/Jelly3D.d.ts +2 -0
- package/dist/rendering/world3d/Jelly3D.js +1 -0
- package/dist/rendering/world3d/Ktx23D.d.ts +3 -0
- package/dist/rendering/world3d/Light3D.d.ts +9 -0
- package/dist/rendering/world3d/Light3D.js +4 -0
- package/dist/rendering/world3d/Material3D.d.ts +10 -0
- package/dist/rendering/world3d/Material3D.js +2 -0
- package/dist/rendering/world3d/Mesh3D.d.ts +4 -0
- package/dist/rendering/world3d/Mesh3D.js +16 -2
- package/dist/rendering/world3d/Meshopt3D.d.ts +3 -0
- package/dist/rendering/world3d/Meshopt3D.js +1 -0
- package/dist/rendering/world3d/Navigation3D.d.ts +41 -1
- package/dist/rendering/world3d/Navigation3D.js +74 -2
- package/dist/rendering/world3d/Object3D.d.ts +11 -0
- package/dist/rendering/world3d/Object3D.js +10 -0
- package/dist/rendering/world3d/Particles3D.d.ts +5 -0
- package/dist/rendering/world3d/Particles3D.js +3 -0
- package/dist/rendering/world3d/Physics3D.d.ts +14 -0
- package/dist/rendering/world3d/Physics3D.js +5 -0
- package/dist/rendering/world3d/PhysicsHull3D.d.ts +2 -0
- package/dist/rendering/world3d/PhysicsHull3D.js +2 -0
- package/dist/rendering/world3d/PhysicsMesh3D.d.ts +2 -0
- package/dist/rendering/world3d/PhysicsMesh3D.js +2 -0
- package/dist/rendering/world3d/PhysicsRemote3D.d.ts +5 -0
- package/dist/rendering/world3d/PhysicsRemote3D.js +2 -0
- package/dist/rendering/world3d/Ragdoll3D.d.ts +5 -0
- package/dist/rendering/world3d/Ragdoll3D.js +2 -0
- package/dist/rendering/world3d/Raycast3D.d.ts +3 -0
- package/dist/rendering/world3d/Raycast3D.js +1 -0
- package/dist/rendering/world3d/RenderList3D.d.ts +3 -0
- package/dist/rendering/world3d/RenderList3D.js +12 -0
- package/dist/rendering/world3d/Retarget3D.d.ts +1 -0
- package/dist/rendering/world3d/Rig3D.d.ts +57 -0
- package/dist/rendering/world3d/Rig3D.js +219 -0
- package/dist/rendering/world3d/Sdf3D.d.ts +181 -0
- package/dist/rendering/world3d/Sdf3D.js +1136 -0
- package/dist/rendering/world3d/SdfLod3D.d.ts +17 -0
- package/dist/rendering/world3d/SdfLod3D.js +56 -0
- package/dist/rendering/world3d/Serialize3D.d.ts +17 -0
- package/dist/rendering/world3d/Serialize3D.js +22 -0
- package/dist/rendering/world3d/Simplify3D.d.ts +29 -0
- package/dist/rendering/world3d/Simplify3D.js +426 -0
- package/dist/rendering/world3d/StateMachine3D.d.ts +9 -0
- package/dist/rendering/world3d/StateMachine3D.js +3 -0
- package/dist/rendering/world3d/SurfaceMaterial3D.d.ts +26 -0
- package/dist/rendering/world3d/SurfaceMaterial3D.js +138 -0
- package/dist/rendering/world3d/Terrain3D.d.ts +21 -0
- package/dist/rendering/world3d/Terrain3D.js +25 -1
- package/dist/rendering/world3d/Text3D.d.ts +5 -0
- package/dist/rendering/world3d/Text3D.js +2 -0
- package/dist/rendering/world3d/Texture3D.d.ts +16 -1
- package/dist/rendering/world3d/Texture3D.js +19 -1
- package/dist/rendering/world3d/Trail3D.d.ts +3 -0
- package/dist/rendering/world3d/Trail3D.js +2 -0
- package/dist/rendering/world3d/Vehicle3D.d.ts +5 -0
- package/dist/rendering/world3d/Vehicle3D.js +2 -0
- package/dist/rendering/world3d/VolumetricFog3D.d.ts +2 -0
- package/dist/rendering/world3d/VolumetricFog3D.js +1 -0
- package/dist/rendering/world3d/Water3D.d.ts +2 -0
- package/dist/rendering/world3d/Water3D.js +1 -0
- package/dist/rendering/world3d/core3D.d.ts +2 -0
- package/dist/rendering/world3d/debug3D.d.ts +5 -0
- package/dist/rendering/world3d/debug3D.js +5 -0
- package/dist/rendering/world3d/geometries3D.d.ts +12 -0
- package/dist/rendering/world3d/geometries3D.js +5 -0
- package/dist/rendering/world3d/helpers3D.d.ts +2 -0
- package/dist/rendering/world3d/helpers3D.js +1 -0
- package/dist/rendering/world3d/index.d.ts +12 -0
- package/dist/rendering/world3d/index.js +6 -0
- package/dist/rendering/world3d/math3D.d.ts +36 -0
- package/dist/rendering/world3d/math3D.js +35 -0
- package/dist/rendering/world3d/primitives3D.d.ts +7 -0
- package/dist/rendering/world3d/primitives3D.js +1 -0
- package/dist/saveStore.d.ts +18 -3
- package/dist/saveStore.js +23 -4
- package/dist/semanticList.d.ts +4 -0
- package/dist/semanticList.js +1 -0
- package/dist/semanticTree.js +11 -4
- package/dist/semanticTypes.d.ts +8 -0
- package/dist/sequencePlaybackTypes.d.ts +3 -0
- package/dist/text.d.ts +1 -0
- package/dist/textTable.d.ts +41 -0
- package/dist/textTable.js +114 -0
- package/dist/tilemapTypes.d.ts +13 -0
- package/dist/timer.d.ts +34 -0
- package/dist/timer.js +119 -0
- package/dist/tweenTypes.d.ts +4 -0
- package/dist/ui/controlKeys.d.ts +4 -0
- package/dist/ui/controlKeys.js +1 -0
- package/dist/ui/controls.d.ts +6 -0
- package/dist/ui/controls.js +2 -0
- package/dist/ui/layerTypes.d.ts +7 -0
- package/dist/ui/rangeControl.d.ts +3 -0
- package/dist/ui/rangeControl.js +1 -0
- package/dist/ui/scrollControl.d.ts +12 -0
- package/dist/ui/scrollControl.js +5 -1
- package/dist/ui/stateControls.d.ts +8 -0
- package/dist/ui/stateControls.js +3 -0
- package/dist/ui/textEditor.d.ts +1 -0
- package/dist/ui/textEditor.js +1 -0
- package/dist/ui/textEditorTypes.d.ts +7 -0
- package/dist/ui/textFieldControl.d.ts +4 -0
- package/dist/ui/textFieldControl.js +1 -0
- package/dist/ui/theme.d.ts +5 -0
- package/dist/ui/theme.js +1 -0
- package/dist/ui/types.d.ts +20 -0
- package/dist/ui/uiRoot.js +38 -9
- package/dist/ui/uiRootModel.d.ts +3 -1
- package/dist/ui/uiRootModel.js +8 -2
- package/dist/videoTypes.d.ts +3 -0
- package/dist/web/BrowserAssetBundle.d.ts +2 -0
- package/dist/web/BrowserAudio.d.ts +34 -1
- package/dist/web/BrowserAudio.js +69 -39
- package/dist/web/BrowserFrameLoop.d.ts +4 -0
- package/dist/web/BrowserGame.d.ts +64 -2
- package/dist/web/BrowserGame.js +129 -8
- package/dist/web/BrowserGamepadInput.d.ts +3 -0
- package/dist/web/BrowserHoverInput.d.ts +1 -0
- package/dist/web/BrowserImageTextures.d.ts +6 -0
- package/dist/web/BrowserInputActions.d.ts +10 -0
- package/dist/web/BrowserInputActions.js +4 -1
- package/dist/web/BrowserPlay.d.ts +130 -2
- package/dist/web/BrowserPlay.js +366 -19
- package/dist/web/BrowserPreferences.d.ts +10 -0
- package/dist/web/BrowserPreferences.js +39 -0
- package/dist/web/BrowserSemantics.d.ts +2 -0
- package/dist/web/BrowserStatsPanel.d.ts +10 -0
- package/dist/web/BrowserStatsPanel.js +9 -3
- package/dist/web/BrowserStorage.d.ts +2 -0
- package/dist/web/BrowserTextEditor.d.ts +3 -0
- package/dist/web/BrowserTextInput.d.ts +6 -0
- package/dist/web/BrowserTextureProvider.d.ts +6 -0
- package/dist/web/BrowserVideo.d.ts +13 -1
- package/dist/web/BrowserVideo.js +28 -2
- package/dist/web/CanvasKitFontSetProvider.d.ts +3 -0
- package/dist/web/CanvasKitParagraphProvider.d.ts +4 -0
- package/dist/web/CanvasKitParagraphProvider.js +1 -0
- package/dist/web/ManifestByteSource.d.ts +4 -0
- package/dist/web/ManifestByteSource.js +1 -0
- package/dist/web/ManifestFontContentLoader.d.ts +1 -0
- package/dist/web/WebGL2Host.js +64 -25
- package/dist/web/WebGPUHost.d.ts +13 -0
- package/dist/web/WebGPUHost.js +117 -36
- package/dist/web/audio.d.ts +2 -2
- package/dist/web/audio.js +1 -1
- package/dist/web/editorFonts.d.ts +4 -0
- package/dist/web/game.d.ts +1 -1
- package/dist/web/imageProjections2D.d.ts +2 -0
- package/dist/web/kit.d.ts +1 -0
- package/dist/web/kit.js +1 -0
- package/dist/web/play.d.ts +6 -1
- package/dist/web/play.js +4 -1
- package/dist/web/playMusic.d.ts +33 -0
- package/dist/web/playMusic.js +194 -0
- package/dist/web/playTouch.d.ts +45 -0
- package/dist/web/playTouch.js +141 -0
- package/dist/web/playWidgets.d.ts +71 -0
- package/dist/web/playWidgets.js +431 -0
- package/dist/web/prepareSharedSubmission2D.js +9 -3
- package/dist/web/resources.d.ts +2 -0
- package/dist/web/sharedEffectShaders.d.ts +6 -2
- package/dist/web/sharedEffectShaders.js +23 -7
- package/dist/web/sharedSubmissionStorage2D.js +1 -1
- package/dist/web/sharedWebGL2Options.d.ts +3 -0
- package/dist/web/sharedWebGL2Options.js +8 -2
- package/dist/web/sharedWebGL2Shaders.d.ts +15 -2
- package/dist/web/sharedWebGL2Shaders.js +108 -14
- package/dist/web/sharedWebGPUOptions.d.ts +5 -1
- package/dist/web/sharedWebGPUOptions.js +6 -2
- package/dist/web/video.d.ts +1 -1
- package/dist/web/webgl2Native.d.ts +3 -1
- package/dist/web/webgl2Native.js +9 -5
- package/dist/web/webgl2Types.d.ts +18 -0
- package/dist/web/webgpuImageResidency.d.ts +5 -2
- package/dist/web/webgpuImageResidency.js +7 -3
- package/dist/web/webgpuRetentionPool.d.ts +2 -2
- package/dist/web/webgpuRetentionPool.js +2 -1
- package/dist/web/webgpuSharedPass.d.ts +1 -1
- package/dist/web/webgpuSharedPass.js +87 -5
- package/dist/web/webgpuSharedResolvePass.d.ts +1 -1
- package/dist/web/webgpuSharedResolvePass.js +9 -4
- package/dist/web/world3d/Audio3D.d.ts +18 -1
- package/dist/web/world3d/Audio3D.js +62 -3
- package/dist/web/world3d/BrowserPlay3D.d.ts +115 -2
- package/dist/web/world3d/BrowserPlay3D.js +448 -43
- package/dist/web/world3d/FlyControls3D.d.ts +4 -0
- package/dist/web/world3d/FlyControls3D.js +2 -0
- package/dist/web/world3d/FollowControls3D.d.ts +3 -0
- package/dist/web/world3d/FollowControls3D.js +2 -0
- package/dist/web/world3d/OrbitControls3D.d.ts +3 -0
- package/dist/web/world3d/OrbitControls3D.js +2 -0
- package/dist/web/world3d/TransformControls3D.d.ts +5 -2
- package/dist/web/world3d/TransformControls3D.js +7 -4
- package/dist/web/world3d/WebGL2Renderer3D.d.ts +3 -0
- package/dist/web/world3d/WebGL2Renderer3D.js +2 -0
- package/dist/web/world3d/WebGPURenderer3D.d.ts +2 -0
- package/dist/web/world3d/WebGPURenderer3D.js +1 -0
- package/dist/web/world3d/World3DView.d.ts +3 -0
- package/dist/web/world3d/World3DView.js +2 -0
- package/dist/web/world3d/app3D.d.ts +7 -0
- package/dist/web/world3d/app3D.js +1 -0
- package/dist/web/world3d/assets3D.d.ts +1 -0
- package/dist/web/world3d/atmosphere3D.d.ts +9 -0
- package/dist/web/world3d/atmosphere3D.js +19 -4
- package/dist/web/world3d/canvasFont3D.d.ts +21 -0
- package/dist/web/world3d/canvasFont3D.js +165 -0
- package/dist/web/world3d/frame3D.d.ts +2 -0
- package/dist/web/world3d/host3D.d.ts +1 -0
- package/dist/web/world3d/index.d.ts +4 -2
- package/dist/web/world3d/index.js +2 -1
- package/dist/web/world3d/loaders3D.d.ts +1 -0
- package/dist/web/world3d/markers3D.d.ts +4 -0
- package/dist/web/world3d/overlay3D.d.ts +19 -0
- package/dist/web/world3d/overlay3D.js +21 -4
- package/dist/web/world3d/post3D.d.ts +4 -0
- package/dist/web/world3d/post3D.js +3 -0
- package/dist/web/world3d/probe3D.d.ts +1 -0
- package/dist/web/world3d/stats3D.d.ts +3 -0
- package/dist/web/world3d/stats3D.js +1 -0
- package/dist/web/world3d/webGL2FrameMetrics3D.d.ts +5 -0
- package/dist/web/world3d/webgpu.d.ts +2 -0
- package/dist/web/world3d/webgpu.js +1 -0
- package/package.json +3 -3
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { Blending3D, ColorInput3D } from './Material3D.js';
|
|
2
2
|
import { InstancedMesh3D } from './Mesh3D.js';
|
|
3
3
|
import type { Texture3D } from './Texture3D.js';
|
|
4
|
+
/** The most particles an emitter holds, and the longest step it takes. */
|
|
4
5
|
export declare const PARTICLES3D_LIMITS: Readonly<{
|
|
5
6
|
readonly maxParticles: 262144;
|
|
6
7
|
readonly maxStepSeconds: 0.25;
|
|
7
8
|
}>;
|
|
9
|
+
/** The shape particles are born in. */
|
|
8
10
|
export type ParticleShape3D = 'point' | 'sphere' | 'box';
|
|
11
|
+
/** An emitter to make: how many particles and how often, how long they live, how they move, grow, change color and fade, and where they are born. */
|
|
9
12
|
export interface ParticleEmitterOptions3D {
|
|
10
13
|
/** Maximum number of live particles. */
|
|
11
14
|
readonly capacity?: number;
|
|
@@ -42,6 +45,7 @@ export interface ParticleEmitterOptions3D {
|
|
|
42
45
|
/** Stop emitting after this many seconds; 0 emits forever. */
|
|
43
46
|
readonly duration?: number;
|
|
44
47
|
}
|
|
48
|
+
/** Emits particles on the CPU: burst some, update it each frame, or reset it. */
|
|
45
49
|
export declare class ParticleEmitter3D extends InstancedMesh3D {
|
|
46
50
|
#private;
|
|
47
51
|
rate: number;
|
|
@@ -81,5 +85,6 @@ export declare class ParticleEmitter3D extends InstancedMesh3D {
|
|
|
81
85
|
reset(): void;
|
|
82
86
|
clone(): this;
|
|
83
87
|
}
|
|
88
|
+
/** Makes a particle emitter. */
|
|
84
89
|
export declare function createParticleEmitter3D(options?: ParticleEmitterOptions3D): ParticleEmitter3D;
|
|
85
90
|
//# sourceMappingURL=Particles3D.d.ts.map
|
|
@@ -7,6 +7,7 @@ import { setColor3D, createSpriteMaterial3D } from './Material3D.js';
|
|
|
7
7
|
import { mat4Invert, mat4MaxScaleOnAxis } from './math3D.js';
|
|
8
8
|
import { InstancedMesh3D } from './Mesh3D.js';
|
|
9
9
|
import { createQuadGeometry3D } from './primitives3D.js';
|
|
10
|
+
/** The most particles an emitter holds, and the longest step it takes. */
|
|
10
11
|
export const PARTICLES3D_LIMITS = Object.freeze({ maxParticles: 262144, maxStepSeconds: 0.25 });
|
|
11
12
|
function range(value, fallback, field) {
|
|
12
13
|
if (value === undefined)
|
|
@@ -22,6 +23,7 @@ function range(value, fallback, field) {
|
|
|
22
23
|
}
|
|
23
24
|
const STRIDE = 8; // px, py, pz, vx, vy, vz, age, life
|
|
24
25
|
const scratchInverse = new Float32Array(16);
|
|
26
|
+
/** Emits particles on the CPU: burst some, update it each frame, or reset it. */
|
|
25
27
|
export class ParticleEmitter3D extends InstancedMesh3D {
|
|
26
28
|
rate;
|
|
27
29
|
lifetime;
|
|
@@ -268,6 +270,7 @@ export class ParticleEmitter3D extends InstancedMesh3D {
|
|
|
268
270
|
throw new World3DError('WORLD3D_INPUT_INVALID', 'a particle emitter cannot be cloned; create a new one from the same options');
|
|
269
271
|
}
|
|
270
272
|
}
|
|
273
|
+
/** Makes a particle emitter. */
|
|
271
274
|
export function createParticleEmitter3D(options = {}) {
|
|
272
275
|
return new ParticleEmitter3D(options);
|
|
273
276
|
}
|
|
@@ -2,6 +2,7 @@ import type { Object3D } from './Object3D.js';
|
|
|
2
2
|
import { ConvexHullShape3D } from './PhysicsHull3D.js';
|
|
3
3
|
import { TriangleMeshShape3D } from './PhysicsMesh3D.js';
|
|
4
4
|
export declare const raycastExcludingBody3D: unique symbol;
|
|
5
|
+
/** The most bodies, substeps, solver steps, contacts a pair keeps and parts of a compound. */
|
|
5
6
|
export declare const PHYSICS3D_LIMITS: Readonly<{
|
|
6
7
|
readonly maxBodies: 16384;
|
|
7
8
|
readonly maxSubSteps: 8;
|
|
@@ -9,7 +10,9 @@ export declare const PHYSICS3D_LIMITS: Readonly<{
|
|
|
9
10
|
readonly maxCompoundChildren: 32;
|
|
10
11
|
readonly maxSolverSteps: 8;
|
|
11
12
|
}>;
|
|
13
|
+
/** Whether a body never moves, is moved by code, or is moved by the simulation. */
|
|
12
14
|
export type BodyType3D = 'static' | 'kinematic' | 'dynamic';
|
|
15
|
+
/** The shape of a body: a sphere, box, capsule, plane, convex hull, triangle mesh, or several moving as one. */
|
|
13
16
|
export type ShapeDefinition3D = {
|
|
14
17
|
readonly type: 'sphere';
|
|
15
18
|
readonly radius: number;
|
|
@@ -53,6 +56,7 @@ export interface CompoundChild3D {
|
|
|
53
56
|
readonly position?: readonly [number, number, number];
|
|
54
57
|
readonly quaternion?: readonly [number, number, number, number];
|
|
55
58
|
}
|
|
59
|
+
/** A body to add: its kind, shape and mass, where it is, its material and damping, its layers, and the node it moves. */
|
|
56
60
|
export interface RigidBodyOptions3D {
|
|
57
61
|
readonly type?: BodyType3D;
|
|
58
62
|
readonly shape: ShapeDefinition3D;
|
|
@@ -81,12 +85,14 @@ export interface RigidBodyOptions3D {
|
|
|
81
85
|
readonly node?: Object3D;
|
|
82
86
|
readonly userData?: unknown;
|
|
83
87
|
}
|
|
88
|
+
/** What a ray hit: the body, where, its normal and how far. */
|
|
84
89
|
export interface PhysicsRaycastHit3D {
|
|
85
90
|
readonly body: RigidBody3D;
|
|
86
91
|
readonly point: [number, number, number];
|
|
87
92
|
readonly normal: [number, number, number];
|
|
88
93
|
readonly distance: number;
|
|
89
94
|
}
|
|
95
|
+
/** What a cast shape hit: the body, how far it went, where, and the normal. */
|
|
90
96
|
export interface PhysicsShapeCastHit3D {
|
|
91
97
|
readonly body: RigidBody3D;
|
|
92
98
|
/** How far the shape travelled before touching. */
|
|
@@ -107,6 +113,7 @@ export interface PhysicsContact3D {
|
|
|
107
113
|
/** True in the first step the pair touches. */
|
|
108
114
|
readonly began: boolean;
|
|
109
115
|
}
|
|
116
|
+
/** A physics world to make: its gravity, its step and substeps, its solver iterations, and whether bodies sleep. */
|
|
110
117
|
export interface PhysicsWorldOptions3D {
|
|
111
118
|
readonly gravity?: readonly [number, number, number];
|
|
112
119
|
/** Length of one simulation step in seconds. */
|
|
@@ -122,6 +129,7 @@ export interface PhysicsWorldOptions3D {
|
|
|
122
129
|
readonly allowSleep?: boolean;
|
|
123
130
|
}
|
|
124
131
|
type Vec = Float64Array;
|
|
132
|
+
/** A body in a physics world: its kind, shape and mass, its material and layers, and calls that move and push it. */
|
|
125
133
|
export declare class RigidBody3D {
|
|
126
134
|
readonly id: number;
|
|
127
135
|
readonly type: BodyType3D;
|
|
@@ -174,7 +182,9 @@ export declare class RigidBody3D {
|
|
|
174
182
|
/** @internal Recompute the rotation matrix, world inertia and bounds from the pose. */
|
|
175
183
|
refresh(): void;
|
|
176
184
|
}
|
|
185
|
+
/** The kind of a joint: a point, a hinge, fixed, a distance or a slider. */
|
|
177
186
|
export type JointType3D = 'point' | 'hinge' | 'fixed' | 'distance' | 'slider';
|
|
187
|
+
/** A joint to make: its kind, the two bodies and anchors, its axis and limits, its motor and spring. */
|
|
178
188
|
export interface JointOptions3D {
|
|
179
189
|
readonly type: JointType3D;
|
|
180
190
|
readonly bodyA: RigidBody3D;
|
|
@@ -279,6 +289,7 @@ export declare class Joint3D {
|
|
|
279
289
|
get translation(): number;
|
|
280
290
|
get angle(): number;
|
|
281
291
|
}
|
|
292
|
+
/** A 3D physics world: add bodies and joints, step it, and cast rays and shapes through it. */
|
|
282
293
|
export declare class PhysicsWorld3D {
|
|
283
294
|
#private;
|
|
284
295
|
readonly gravity: Vec;
|
|
@@ -369,6 +380,7 @@ export declare class PhysicsWorld3D {
|
|
|
369
380
|
/** @internal Contacts of a free-standing shape against the world, for the character controller. */
|
|
370
381
|
probe(body: RigidBody3D, mask: number, visit: (nx: number, ny: number, nz: number, depth: number, other: RigidBody3D) => void): void;
|
|
371
382
|
}
|
|
383
|
+
/** A character controller to make: its radius and height, where it starts, the steepest slope it climbs, and what it collides with. */
|
|
372
384
|
export interface CharacterControllerOptions3D {
|
|
373
385
|
readonly radius?: number;
|
|
374
386
|
/** Total height including both caps. */
|
|
@@ -410,7 +422,9 @@ export declare class CharacterController3D {
|
|
|
410
422
|
/** Move by a world-space displacement, sliding along anything in the way. */
|
|
411
423
|
move(dx: number, dy: number, dz: number): void;
|
|
412
424
|
}
|
|
425
|
+
/** Makes a 3D physics world. */
|
|
413
426
|
export declare function createPhysicsWorld3D(options?: PhysicsWorldOptions3D): PhysicsWorld3D;
|
|
427
|
+
/** Makes a capsule that walks and slides along what it hits, for a character. */
|
|
414
428
|
export declare function createCharacterController3D(world: PhysicsWorld3D, options?: CharacterControllerOptions3D): CharacterController3D;
|
|
415
429
|
export {};
|
|
416
430
|
//# sourceMappingURL=Physics3D.d.ts.map
|
|
@@ -10,6 +10,7 @@ import { ConvexHullShape3D } from './PhysicsHull3D.js';
|
|
|
10
10
|
import { TriangleMeshShape3D } from './PhysicsMesh3D.js';
|
|
11
11
|
import { StaticTree, rayShape } from './PhysicsQueries3D.js';
|
|
12
12
|
export const raycastExcludingBody3D = Symbol('physics raycast excluding one body');
|
|
13
|
+
/** The most bodies, substeps, solver steps, contacts a pair keeps and parts of a compound. */
|
|
13
14
|
export const PHYSICS3D_LIMITS = Object.freeze({
|
|
14
15
|
maxBodies: 16384,
|
|
15
16
|
maxSubSteps: 8,
|
|
@@ -28,6 +29,7 @@ function cross(out, a, b) {
|
|
|
28
29
|
}
|
|
29
30
|
const clamp = (value, low, high) => (value < low ? low : value > high ? high : value);
|
|
30
31
|
let nextBodyId = 1;
|
|
32
|
+
/** A body in a physics world: its kind, shape and mass, its material and layers, and calls that move and push it. */
|
|
31
33
|
export class RigidBody3D {
|
|
32
34
|
id = nextBodyId++;
|
|
33
35
|
type;
|
|
@@ -1518,6 +1520,7 @@ function pivotVelocity(out, body, r) {
|
|
|
1518
1520
|
return out;
|
|
1519
1521
|
}
|
|
1520
1522
|
const SLOP = 0.01, BAUMGARTE = 0.15, SLEEP_LINEAR = 0.15, SLEEP_ANGULAR = 0.2, SLEEP_DELAY = 0.5;
|
|
1523
|
+
/** A 3D physics world: add bodies and joints, step it, and cast rays and shapes through it. */
|
|
1521
1524
|
export class PhysicsWorld3D {
|
|
1522
1525
|
gravity = v3(0, -9.81, 0);
|
|
1523
1526
|
fixedStep;
|
|
@@ -2826,9 +2829,11 @@ export class CharacterController3D {
|
|
|
2826
2829
|
}
|
|
2827
2830
|
}
|
|
2828
2831
|
}
|
|
2832
|
+
/** Makes a 3D physics world. */
|
|
2829
2833
|
export function createPhysicsWorld3D(options = {}) {
|
|
2830
2834
|
return new PhysicsWorld3D(options);
|
|
2831
2835
|
}
|
|
2836
|
+
/** Makes a capsule that walks and slides along what it hits, for a character. */
|
|
2832
2837
|
export function createCharacterController3D(world, options = {}) {
|
|
2833
2838
|
return new CharacterController3D(world, options);
|
|
2834
2839
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Geometry3D } from './Geometry3D.js';
|
|
2
|
+
/** The most points a convex hull keeps and is made from. */
|
|
2
3
|
export declare const PHYSICS_HULL3D_LIMITS: Readonly<{
|
|
3
4
|
readonly maxPoints: 64;
|
|
4
5
|
readonly maxInputPoints: 1048576;
|
|
5
6
|
}>;
|
|
7
|
+
/** A convex hull as a physics shape. */
|
|
6
8
|
export declare class ConvexHullShape3D {
|
|
7
9
|
/** Corner points, three floats each, around the body origin. */
|
|
8
10
|
readonly points: Float32Array;
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
// bevels and furniture.
|
|
6
6
|
import { World3DError } from './core3D.js';
|
|
7
7
|
import { Geometry3D } from './Geometry3D.js';
|
|
8
|
+
/** The most points a convex hull keeps and is made from. */
|
|
8
9
|
export const PHYSICS_HULL3D_LIMITS = Object.freeze({ maxPoints: 64, maxInputPoints: 1048576 });
|
|
10
|
+
/** A convex hull as a physics shape. */
|
|
9
11
|
export class ConvexHullShape3D {
|
|
10
12
|
/** Corner points, three floats each, around the body origin. */
|
|
11
13
|
points;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Geometry3D } from './Geometry3D.js';
|
|
2
2
|
import { Object3D } from './Object3D.js';
|
|
3
|
+
/** The most triangles a mesh shape has, and how many a leaf of its tree holds. */
|
|
3
4
|
export declare const PHYSICS_MESH3D_LIMITS: Readonly<{
|
|
4
5
|
readonly maxTriangles: 4194304;
|
|
5
6
|
readonly leafTriangles: 4;
|
|
6
7
|
}>;
|
|
8
|
+
/** A triangle mesh as a physics shape, for bodies that do not move. */
|
|
7
9
|
export declare class TriangleMeshShape3D {
|
|
8
10
|
#private;
|
|
9
11
|
/** Vertex positions, three floats each, in the shape's local space. */
|
|
@@ -7,7 +7,9 @@ import { World3DError } from './core3D.js';
|
|
|
7
7
|
import { Geometry3D } from './Geometry3D.js';
|
|
8
8
|
import { Mesh3D } from './Mesh3D.js';
|
|
9
9
|
import { Object3D } from './Object3D.js';
|
|
10
|
+
/** The most triangles a mesh shape has, and how many a leaf of its tree holds. */
|
|
10
11
|
export const PHYSICS_MESH3D_LIMITS = Object.freeze({ maxTriangles: 4194304, leafTriangles: 4 });
|
|
12
|
+
/** A triangle mesh as a physics shape, for bodies that do not move. */
|
|
11
13
|
export class TriangleMeshShape3D {
|
|
12
14
|
/** Vertex positions, three floats each, in the shape's local space. */
|
|
13
15
|
positions;
|
|
@@ -38,6 +38,7 @@ export type RemoteShape3D = {
|
|
|
38
38
|
readonly quaternion?: readonly [number, number, number, number];
|
|
39
39
|
}[];
|
|
40
40
|
};
|
|
41
|
+
/** A body to add to a physics world in a worker. */
|
|
41
42
|
export interface RemoteBodyOptions3D {
|
|
42
43
|
readonly type?: BodyType3D;
|
|
43
44
|
readonly shape: RemoteShape3D;
|
|
@@ -57,6 +58,7 @@ export interface RemoteBodyOptions3D {
|
|
|
57
58
|
readonly node?: Object3D;
|
|
58
59
|
readonly userData?: unknown;
|
|
59
60
|
}
|
|
61
|
+
/** A joint to add to a physics world in a worker. */
|
|
60
62
|
export interface RemoteJointOptions3D {
|
|
61
63
|
readonly type: JointType3D;
|
|
62
64
|
readonly bodyA: RemoteBody3D;
|
|
@@ -75,6 +77,7 @@ export interface RemoteJointOptions3D {
|
|
|
75
77
|
readonly damping?: number;
|
|
76
78
|
readonly collideConnected?: boolean;
|
|
77
79
|
}
|
|
80
|
+
/** What a ray hit in a physics world in a worker. */
|
|
78
81
|
export interface RemoteRaycastHit3D {
|
|
79
82
|
readonly body: RemoteBody3D;
|
|
80
83
|
readonly distance: number;
|
|
@@ -117,6 +120,7 @@ export declare class RemoteBody3D {
|
|
|
117
120
|
applyForce(x: number, y: number, z: number): void;
|
|
118
121
|
remove(): void;
|
|
119
122
|
}
|
|
123
|
+
/** A joint of a physics world in a worker; remove it to take it out. */
|
|
120
124
|
export declare class RemoteJoint3D {
|
|
121
125
|
#private;
|
|
122
126
|
readonly id: number;
|
|
@@ -169,6 +173,7 @@ export declare class PhysicsClient3D {
|
|
|
169
173
|
/** Stop listening and answer every waiting ray with nothing. The worker itself is the caller's to end. */
|
|
170
174
|
dispose(): void;
|
|
171
175
|
}
|
|
176
|
+
/** Connects to a physics world run in a worker, through a message port. */
|
|
172
177
|
export declare function connectPhysics3D(port: PhysicsPort3D, options?: PhysicsWorldOptions3D): PhysicsClient3D;
|
|
173
178
|
export {};
|
|
174
179
|
//# sourceMappingURL=PhysicsRemote3D.d.ts.map
|
|
@@ -306,6 +306,7 @@ export class RemoteBody3D {
|
|
|
306
306
|
this.#client.forget(this);
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
+
/** A joint of a physics world in a worker; remove it to take it out. */
|
|
309
310
|
export class RemoteJoint3D {
|
|
310
311
|
id;
|
|
311
312
|
#client;
|
|
@@ -528,6 +529,7 @@ export class PhysicsClient3D {
|
|
|
528
529
|
this.#bodies.clear();
|
|
529
530
|
}
|
|
530
531
|
}
|
|
532
|
+
/** Connects to a physics world run in a worker, through a message port. */
|
|
531
533
|
export function connectPhysics3D(port, options) {
|
|
532
534
|
return new PhysicsClient3D(port, options);
|
|
533
535
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Object3D } from './Object3D.js';
|
|
2
2
|
import type { Joint3D, PhysicsWorld3D, RigidBody3D, ShapeDefinition3D } from './Physics3D.js';
|
|
3
|
+
/** The most parts a ragdoll has. */
|
|
3
4
|
export declare const RAGDOLL3D_LIMITS: Readonly<{
|
|
4
5
|
readonly maxParts: 64;
|
|
5
6
|
}>;
|
|
7
|
+
/** How a ragdoll part is joined to its parent: the joint's kind, axis and limits. */
|
|
6
8
|
export interface RagdollJoint3D {
|
|
7
9
|
/** 'point' swings freely like a shoulder; 'hinge' bends one way like a knee. Defaults to 'point'. */
|
|
8
10
|
readonly type?: 'point' | 'hinge';
|
|
@@ -13,6 +15,7 @@ export interface RagdollJoint3D {
|
|
|
13
15
|
/** 'point': the widest swing in radians from the pose at activation. */
|
|
14
16
|
readonly coneLimit?: number;
|
|
15
17
|
}
|
|
18
|
+
/** One part of a ragdoll: its bone, shape and mass, its offset, its parent and its joint. */
|
|
16
19
|
export interface RagdollPart3D {
|
|
17
20
|
/** The bone this part moves, or its name under the ragdoll's root. */
|
|
18
21
|
readonly bone: Object3D | string;
|
|
@@ -28,6 +31,7 @@ export interface RagdollPart3D {
|
|
|
28
31
|
/** How this part is attached to its parent, at this part's bone. */
|
|
29
32
|
readonly joint?: RagdollJoint3D;
|
|
30
33
|
}
|
|
34
|
+
/** A ragdoll to make: its layers, friction, bounce and damping. */
|
|
31
35
|
export interface RagdollOptions3D {
|
|
32
36
|
readonly layer?: number;
|
|
33
37
|
readonly mask?: number;
|
|
@@ -65,5 +69,6 @@ export declare class Ragdoll3D {
|
|
|
65
69
|
update(): void;
|
|
66
70
|
dispose(): void;
|
|
67
71
|
}
|
|
72
|
+
/** Makes a ragdoll of physics bodies that a skeleton follows. */
|
|
68
73
|
export declare function createRagdoll3D(world: PhysicsWorld3D, root: Object3D, parts: readonly RagdollPart3D[], options?: RagdollOptions3D): Ragdoll3D;
|
|
69
74
|
//# sourceMappingURL=Ragdoll3D.d.ts.map
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// physics step. DOM-free and backend-independent.
|
|
5
5
|
import { World3DError, requireFinite3D } from './core3D.js';
|
|
6
6
|
import { mat4Compose, mat4Decompose, mat4Invert, mat4Multiply, quatNormalize } from './math3D.js';
|
|
7
|
+
/** The most parts a ragdoll has. */
|
|
7
8
|
export const RAGDOLL3D_LIMITS = Object.freeze({ maxParts: 64 });
|
|
8
9
|
const world = new Float32Array(16), local = new Float32Array(16), inverse = new Float32Array(16);
|
|
9
10
|
const place = new Float32Array(3), turn = new Float32Array(4), size = new Float32Array(3);
|
|
@@ -194,6 +195,7 @@ export class Ragdoll3D {
|
|
|
194
195
|
this.deactivate();
|
|
195
196
|
}
|
|
196
197
|
}
|
|
198
|
+
/** Makes a ragdoll of physics bodies that a skeleton follows. */
|
|
197
199
|
export function createRagdoll3D(world, root, parts, options = {}) {
|
|
198
200
|
return new Ragdoll3D(world, root, parts, options);
|
|
199
201
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Camera3D } from './Camera3D.js';
|
|
2
2
|
import { Mesh3D } from './Mesh3D.js';
|
|
3
3
|
import type { Object3D } from './Object3D.js';
|
|
4
|
+
/** What a ray hit: how far, where, the object, its face, its texture coordinate and its instance. */
|
|
4
5
|
export interface RaycastHit3D {
|
|
5
6
|
/** Distance from the ray origin in world units. */
|
|
6
7
|
readonly distance: number;
|
|
@@ -14,6 +15,7 @@ export interface RaycastHit3D {
|
|
|
14
15
|
/** Instance index for instanced meshes. */
|
|
15
16
|
readonly instanceId: number | undefined;
|
|
16
17
|
}
|
|
18
|
+
/** How a ray is cast: its near and far distances, its layers, and whether only the first hit is wanted. */
|
|
17
19
|
export interface RaycastOptions3D {
|
|
18
20
|
readonly near?: number;
|
|
19
21
|
readonly far?: number;
|
|
@@ -22,6 +24,7 @@ export interface RaycastOptions3D {
|
|
|
22
24
|
/** Stop at the first hit per mesh and skip sorting of further triangles. */
|
|
23
25
|
readonly firstHitOnly?: boolean;
|
|
24
26
|
}
|
|
27
|
+
/** Casts rays through a scene, from a point or from the camera through a screen point. */
|
|
25
28
|
export declare class Raycaster3D {
|
|
26
29
|
readonly origin: Float32Array<ArrayBuffer>;
|
|
27
30
|
readonly direction: Float32Array<ArrayBuffer>;
|
|
@@ -8,6 +8,7 @@ import { InstancedMesh3D, Mesh3D } from './Mesh3D.js';
|
|
|
8
8
|
const inverse = new Float32Array(16), instanceWorld = new Float32Array(16);
|
|
9
9
|
const localOrigin = new Float32Array(3), localDirection = new Float32Array(3);
|
|
10
10
|
const hit = new Float32Array(3), worldPoint = new Float32Array(3);
|
|
11
|
+
/** Casts rays through a scene, from a point or from the camera through a screen point. */
|
|
11
12
|
export class Raycaster3D {
|
|
12
13
|
origin = new Float32Array(3);
|
|
13
14
|
direction = new Float32Array([0, 0, -1]);
|
|
@@ -4,6 +4,7 @@ import { Light3D } from './Light3D.js';
|
|
|
4
4
|
import type { Material3D } from './Material3D.js';
|
|
5
5
|
import { Mesh3D } from './Mesh3D.js';
|
|
6
6
|
import type { Object3D, Scene3D } from './Object3D.js';
|
|
7
|
+
/** One thing to draw: its mesh, geometry and material, its range, its depth and order. */
|
|
7
8
|
export interface RenderItem3D {
|
|
8
9
|
mesh: Mesh3D;
|
|
9
10
|
geometry: Geometry3D;
|
|
@@ -19,12 +20,14 @@ export interface RenderItem3D {
|
|
|
19
20
|
/** What else must match for meshes to share an instanced draw: layers, receiving shadows, being instanceable at all. */
|
|
20
21
|
group?: number;
|
|
21
22
|
}
|
|
23
|
+
/** What building a render list counted: nodes visited, culled, and lights dropped. */
|
|
22
24
|
export interface RenderStats3D {
|
|
23
25
|
visited: number;
|
|
24
26
|
culled: number;
|
|
25
27
|
/** Point and spot lights past the renderer's limits that the last build left out. */
|
|
26
28
|
lightsDropped: number;
|
|
27
29
|
}
|
|
30
|
+
/** What a camera sees, sorted for drawing: opaque and transparent items, shadow casters and lights. */
|
|
28
31
|
export declare class RenderList3D {
|
|
29
32
|
#private;
|
|
30
33
|
readonly opaque: RenderItem3D[];
|
|
@@ -26,6 +26,7 @@ function compareTransparent(a, b) {
|
|
|
26
26
|
function foldable(material) {
|
|
27
27
|
return !material.billboard && !material.screenSpace && !material.wireframe;
|
|
28
28
|
}
|
|
29
|
+
/** What a camera sees, sorted for drawing: opaque and transparent items, shadow casters and lights. */
|
|
29
30
|
export class RenderList3D {
|
|
30
31
|
opaque = [];
|
|
31
32
|
transparent = [];
|
|
@@ -406,6 +407,17 @@ export class RenderList3D {
|
|
|
406
407
|
mesh.skeleton.update(this.#frame);
|
|
407
408
|
if (mesh instanceof ScreenLayer3D && mesh.autoUpdate)
|
|
408
409
|
mesh.refreshSource();
|
|
410
|
+
// Too far to be seen: neither drawn nor casting a shadow.
|
|
411
|
+
if (mesh.cullDistance < Infinity) {
|
|
412
|
+
const bounds = worldRenderSphere3D(mesh);
|
|
413
|
+
if (bounds && bounds[3] >= 0) {
|
|
414
|
+
const eye = camera.matrixWorld, away = Math.hypot(bounds[0] - eye[12], bounds[1] - eye[13], bounds[2] - eye[14]) - bounds[3];
|
|
415
|
+
if (away > mesh.cullDistance) {
|
|
416
|
+
this.stats.culled++;
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
409
421
|
if (mesh.castShadow)
|
|
410
422
|
this.#casters.push(mesh);
|
|
411
423
|
if ((mesh.layers & layerMask) === 0)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnimationClip3D } from './Animation3D.js';
|
|
2
2
|
import type { Object3D } from './Object3D.js';
|
|
3
|
+
/** How a clip is moved to another skeleton: from where to where, which bones match, the root, scale and frame rate. */
|
|
3
4
|
export interface RetargetOptions3D {
|
|
4
5
|
/** The rig the clip was made for, in its rest pose. */
|
|
5
6
|
readonly source: Object3D;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AnimationClip3D, AnimationMixer3D, type AnimationAction3D } from './Animation3D.js';
|
|
2
|
+
import { type Material3D } from './Material3D.js';
|
|
3
|
+
import { Bone3D, Mesh3D, Skeleton3D } from './Mesh3D.js';
|
|
4
|
+
import { Object3D } from './Object3D.js';
|
|
5
|
+
import { SdfShape3D, type SdfMeshOptions3D } from './Sdf3D.js';
|
|
6
|
+
type Vec3 = readonly [number, number, number];
|
|
7
|
+
/** A bone of a rig: where it turns, what it moves, and the bone it hangs from. */
|
|
8
|
+
export interface SdfBone3D {
|
|
9
|
+
/** Its name, by which clips move it. A pair made by `mirror` is named `name.L` (on +x) and `name.R`. */
|
|
10
|
+
readonly name: string;
|
|
11
|
+
/** The bone it hangs from, moving with it; the rig's root unless given. A pair hangs from the parent of its side. */
|
|
12
|
+
readonly parent?: string;
|
|
13
|
+
/** The joint, in the model's coordinates: where the bone turns, such as a shoulder or a hip. */
|
|
14
|
+
readonly at: Vec3;
|
|
15
|
+
/** The shapes this bone moves: the vertices nearest them follow it. A bone without parts only carries others. */
|
|
16
|
+
readonly parts?: SdfShape3D | readonly SdfShape3D[];
|
|
17
|
+
/** 'x' makes a pair from one side: `at` and `parts` on +x for `name.L`, mirrored across x for `name.R`. */
|
|
18
|
+
readonly mirror?: 'x';
|
|
19
|
+
}
|
|
20
|
+
/** How a rig is made: the options of its mesh, its material, and how wide a joint bends. */
|
|
21
|
+
export interface SdfRigOptions3D extends SdfMeshOptions3D {
|
|
22
|
+
/** The mesh's material; a standard one with vertex colours unless given. */
|
|
23
|
+
readonly material?: Material3D;
|
|
24
|
+
/**
|
|
25
|
+
* How far, in the model's units, the skin at a joint is shared between the bones on either side: a fiftieth of the
|
|
26
|
+
* model's size unless given. Larger bends more softly; smaller keeps parts stiff up to the joint.
|
|
27
|
+
*/
|
|
28
|
+
readonly blend?: number;
|
|
29
|
+
}
|
|
30
|
+
/** A pose key: a time in seconds, the bone's turn as Euler angles in radians, and optionally how far it moves. */
|
|
31
|
+
export type SdfPoseKey3D = readonly [time: number, rotation: Vec3, offset?: Vec3];
|
|
32
|
+
/** A model that moves: its root to add to a scene, its skinned mesh, its bones by name, and its animation. */
|
|
33
|
+
export interface SdfRig3D {
|
|
34
|
+
/** Add this to the scene and move it to move the model. */
|
|
35
|
+
readonly root: Object3D;
|
|
36
|
+
readonly mesh: Mesh3D;
|
|
37
|
+
readonly bones: Readonly<Record<string, Bone3D>>;
|
|
38
|
+
readonly skeleton: Skeleton3D;
|
|
39
|
+
readonly mixer: AnimationMixer3D;
|
|
40
|
+
/**
|
|
41
|
+
* A clip from poses of named bones: `{ 'leg.L': [[0, [0.4, 0, 0]], [0.5, [-0.4, 0, 0]], [1, [0.4, 0, 0]]] }`. A
|
|
42
|
+
* rotation is from the bone's rest pose; an offset moves it from where it rests. A clip loops cleanly when its last
|
|
43
|
+
* key of each bone equals its first.
|
|
44
|
+
*/
|
|
45
|
+
clip(name: string, duration: number, poses: Readonly<Record<string, readonly SdfPoseKey3D[]>>): AnimationClip3D;
|
|
46
|
+
/** Plays a clip, fading out what was playing over `fade` seconds (0.2 unless given). */
|
|
47
|
+
play(clip: AnimationClip3D, fade?: number): AnimationAction3D;
|
|
48
|
+
/** Moves the animation on; call once a frame. */
|
|
49
|
+
update(seconds: number): void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A rig of `shape`: its mesh, made as `createSdfGeometry3D` makes it, skinned to bones at the joints of the model.
|
|
53
|
+
* Every vertex follows at most four bones, those whose parts are nearest it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createSdfRig3D(shape: SdfShape3D, bones: readonly SdfBone3D[], options?: SdfRigOptions3D): SdfRig3D;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=Rig3D.d.ts.map
|