@needle-tools/three-mesh-effects 0.0.0-stage → 0.1.0-alpha
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/LICENSE +21 -0
- package/README.md +88 -3
- package/build/deformation-runtime.js +2143 -0
- package/build/deformation-runtime.js.map +7 -0
- package/build/impostor-runtime-needle-engine.js +42 -0
- package/build/impostor-runtime-needle-engine.js.map +7 -0
- package/build/impostor-runtime.js +1333 -0
- package/build/impostor-runtime.js.map +7 -0
- package/build/internal/deformation/cloth-surface.js +288 -0
- package/build/internal/deformation/cloth-surface.js.map +7 -0
- package/build/internal/deformation/fur-surface.js +130 -0
- package/build/internal/deformation/fur-surface.js.map +7 -0
- package/build/internal/deformation/ik-constraints.js +44 -0
- package/build/internal/deformation/ik-constraints.js.map +7 -0
- package/build/internal/deformation/joints-json.js +197 -0
- package/build/internal/deformation/joints-json.js.map +7 -0
- package/build/internal/deformation/limits.js +16 -0
- package/build/internal/deformation/limits.js.map +7 -0
- package/build/internal/deformation/motion-settings.js +12 -0
- package/build/internal/deformation/motion-settings.js.map +7 -0
- package/build/internal/deformation/pin-cloth.js +196 -0
- package/build/internal/deformation/pin-cloth.js.map +7 -0
- package/build/internal/deformation/pin-ik.js +650 -0
- package/build/internal/deformation/pin-ik.js.map +7 -0
- package/build/internal/deformation/pin-types.js +12 -0
- package/build/internal/deformation/pin-types.js.map +7 -0
- package/build/internal/deformation/pin-wiggle.js +249 -0
- package/build/internal/deformation/pin-wiggle.js.map +7 -0
- package/build/internal/deformation/pose-slots.js +84 -0
- package/build/internal/deformation/pose-slots.js.map +7 -0
- package/build/internal/deformation/pose-timeline.js +210 -0
- package/build/internal/deformation/pose-timeline.js.map +7 -0
- package/build/internal/deformation/rig-drivers.js +48 -0
- package/build/internal/deformation/rig-drivers.js.map +7 -0
- package/build/internal/deformation/rig-extension.js +334 -0
- package/build/internal/deformation/rig-extension.js.map +7 -0
- package/build/internal/deformation/rig-runtime.js +2141 -0
- package/build/internal/deformation/rig-runtime.js.map +7 -0
- package/build/internal/deformation/wind.js +34 -0
- package/build/internal/deformation/wind.js.map +7 -0
- package/build/internal/impostor/impostor-metadata.js +77 -0
- package/build/internal/impostor/impostor-metadata.js.map +7 -0
- package/build/internal/impostor/impostor-node-material.js +1331 -0
- package/build/internal/impostor/impostor-node-material.js.map +7 -0
- package/build/internal/impostor/impostor-runtime-support.js +162 -0
- package/build/internal/impostor/impostor-runtime-support.js.map +7 -0
- package/build/internal/impostor/octahedral.js +232 -0
- package/build/internal/impostor/octahedral.js.map +7 -0
- package/build/internal/pixel-impostor/pixel-impostor-display.js +728 -0
- package/build/internal/pixel-impostor/pixel-impostor-display.js.map +7 -0
- package/build/internal/pixel-impostor/pixel-impostor-metadata.js +71 -0
- package/build/internal/pixel-impostor/pixel-impostor-metadata.js.map +7 -0
- package/build/internal/pixel-impostor/pixel-impostor-runtime.js +150 -0
- package/build/internal/pixel-impostor/pixel-impostor-runtime.js.map +7 -0
- package/build/internal/public/deformation-runtime.js +2143 -0
- package/build/internal/public/deformation-runtime.js.map +7 -0
- package/build/internal/public/impostor-runtime-needle-engine.js +42 -0
- package/build/internal/public/impostor-runtime-needle-engine.js.map +7 -0
- package/build/internal/public/impostor-runtime.js +1333 -0
- package/build/internal/public/impostor-runtime.js.map +7 -0
- package/build/internal/public/pixel-impostor-runtime.js +876 -0
- package/build/internal/public/pixel-impostor-runtime.js.map +7 -0
- package/build/internal/public/wrap-effects.js +5640 -0
- package/build/internal/public/wrap-effects.js.map +7 -0
- package/build/internal/rendering/skin-projection.js +4630 -0
- package/build/internal/rendering/skin-projection.js.map +7 -0
- package/build/internal/rendering/surface-query.js +4519 -0
- package/build/internal/rendering/surface-query.js.map +7 -0
- package/build/internal/rendering/wireframe.js +112 -0
- package/build/internal/rendering/wireframe.js.map +7 -0
- package/build/internal/rendering/wrap-preview-settings.js +126 -0
- package/build/internal/rendering/wrap-preview-settings.js.map +7 -0
- package/build/internal/rendering/wrap-preview.js +5610 -0
- package/build/internal/rendering/wrap-preview.js.map +7 -0
- package/build/internal/rendering/wrap-skin.js +4746 -0
- package/build/internal/rendering/wrap-skin.js.map +7 -0
- package/build/pixel-impostor-runtime.js +876 -0
- package/build/pixel-impostor-runtime.js.map +7 -0
- package/build/types/deformation/cloth-surface.d.ts +39 -0
- package/build/types/deformation/cloth-surface.js +1 -0
- package/build/types/deformation/fur-surface.d.ts +27 -0
- package/build/types/deformation/fur-surface.js +1 -0
- package/build/types/deformation/ik-constraints.d.ts +18 -0
- package/build/types/deformation/ik-constraints.js +1 -0
- package/build/types/deformation/joints-json.d.ts +17 -0
- package/build/types/deformation/joints-json.js +1 -0
- package/build/types/deformation/limits.d.ts +23 -0
- package/build/types/deformation/limits.js +1 -0
- package/build/types/deformation/motion-settings.d.ts +9 -0
- package/build/types/deformation/motion-settings.js +1 -0
- package/build/types/deformation/pin-cloth.d.ts +28 -0
- package/build/types/deformation/pin-cloth.js +1 -0
- package/build/types/deformation/pin-ik.d.ts +37 -0
- package/build/types/deformation/pin-ik.js +1 -0
- package/build/types/deformation/pin-types.d.ts +53 -0
- package/build/types/deformation/pin-types.js +1 -0
- package/build/types/deformation/pin-wiggle.d.ts +16 -0
- package/build/types/deformation/pin-wiggle.js +1 -0
- package/build/types/deformation/pose-slots.d.ts +41 -0
- package/build/types/deformation/pose-slots.js +1 -0
- package/build/types/deformation/pose-timeline.d.ts +65 -0
- package/build/types/deformation/pose-timeline.js +1 -0
- package/build/types/deformation/rig-drivers.d.ts +19 -0
- package/build/types/deformation/rig-drivers.js +1 -0
- package/build/types/deformation/rig-extension.d.ts +33 -0
- package/build/types/deformation/rig-extension.js +1 -0
- package/build/types/deformation/rig-runtime.d.ts +95 -0
- package/build/types/deformation/rig-runtime.js +1 -0
- package/build/types/deformation/wind.d.ts +16 -0
- package/build/types/deformation/wind.js +1 -0
- package/build/types/impostor/impostor-metadata.d.ts +61 -0
- package/build/types/impostor/impostor-metadata.js +1 -0
- package/build/types/impostor/impostor-node-material.d.ts +140 -0
- package/build/types/impostor/impostor-node-material.js +1 -0
- package/build/types/impostor/impostor-runtime-support.d.ts +52 -0
- package/build/types/impostor/impostor-runtime-support.js +1 -0
- package/build/types/impostor/octahedral.d.ts +84 -0
- package/build/types/impostor/octahedral.js +1 -0
- package/build/types/pixel-impostor/pixel-impostor-display.d.ts +48 -0
- package/build/types/pixel-impostor/pixel-impostor-display.js +1 -0
- package/build/types/pixel-impostor/pixel-impostor-metadata.d.ts +34 -0
- package/build/types/pixel-impostor/pixel-impostor-metadata.js +1 -0
- package/build/types/pixel-impostor/pixel-impostor-runtime.d.ts +18 -0
- package/build/types/pixel-impostor/pixel-impostor-runtime.js +1 -0
- package/build/types/public/deformation-runtime.d.ts +3 -0
- package/build/types/public/deformation-runtime.js +1 -0
- package/build/types/public/impostor-runtime-needle-engine.d.ts +31 -0
- package/build/types/public/impostor-runtime-needle-engine.js +1 -0
- package/build/types/public/impostor-runtime.d.ts +6 -0
- package/build/types/public/impostor-runtime.js +1 -0
- package/build/types/public/pixel-impostor-runtime.d.ts +3 -0
- package/build/types/public/pixel-impostor-runtime.js +1 -0
- package/build/types/public/wrap-effects.d.ts +4 -0
- package/build/types/public/wrap-effects.js +1 -0
- package/build/types/rendering/skin-projection.d.ts +44 -0
- package/build/types/rendering/skin-projection.js +1 -0
- package/build/types/rendering/surface-query.d.ts +66 -0
- package/build/types/rendering/surface-query.js +1 -0
- package/build/types/rendering/wireframe.d.ts +25 -0
- package/build/types/rendering/wireframe.js +1 -0
- package/build/types/rendering/wrap-preview-settings.d.ts +22 -0
- package/build/types/rendering/wrap-preview-settings.js +1 -0
- package/build/types/rendering/wrap-preview.d.ts +39 -0
- package/build/types/rendering/wrap-preview.js +1 -0
- package/build/types/rendering/wrap-skin.d.ts +14 -0
- package/build/types/rendering/wrap-skin.js +1 -0
- package/build/wrap-effects.js +5640 -0
- package/build/wrap-effects.js.map +7 -0
- package/package.json +94 -6
- package/src/deformation/cloth-surface.ts +223 -0
- package/src/deformation/fur-surface.ts +129 -0
- package/src/deformation/ik-constraints.ts +37 -0
- package/src/deformation/joints-json.ts +94 -0
- package/src/deformation/limits.ts +25 -0
- package/src/deformation/motion-settings.ts +9 -0
- package/src/deformation/pin-cloth.ts +149 -0
- package/src/deformation/pin-ik.ts +582 -0
- package/src/deformation/pin-types.ts +22 -0
- package/src/deformation/pin-wiggle.ts +119 -0
- package/src/deformation/pose-slots.ts +106 -0
- package/src/deformation/pose-timeline.ts +242 -0
- package/src/deformation/rig-drivers.ts +32 -0
- package/src/deformation/rig-extension.ts +87 -0
- package/src/deformation/rig-runtime.ts +416 -0
- package/src/deformation/wind.ts +36 -0
- package/src/impostor/impostor-metadata.js +137 -0
- package/src/impostor/impostor-node-material.js +1581 -0
- package/src/impostor/impostor-runtime-support.js +139 -0
- package/src/impostor/octahedral.js +280 -0
- package/src/pixel-impostor/pixel-impostor-display.js +794 -0
- package/src/pixel-impostor/pixel-impostor-metadata.js +74 -0
- package/src/pixel-impostor/pixel-impostor-runtime.js +78 -0
- package/src/public/deformation-runtime.ts +3 -0
- package/src/public/impostor-runtime-needle-engine.js +56 -0
- package/src/public/impostor-runtime.js +21 -0
- package/src/public/pixel-impostor-runtime.js +5 -0
- package/src/public/wrap-effects.js +21 -0
- package/src/rendering/skin-projection.js +113 -0
- package/src/rendering/surface-query.js +88 -0
- package/src/rendering/wireframe.js +115 -0
- package/src/rendering/wrap-preview-settings.js +123 -0
- package/src/rendering/wrap-preview.js +645 -0
- package/src/rendering/wrap-skin.js +109 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Matrix4, Quaternion, Vector3 } from 'three';
|
|
2
|
+
import type { PinPose, PinRecord } from './pin-types.js';
|
|
3
|
+
export interface BoneDriver {
|
|
4
|
+
id: string;
|
|
5
|
+
influences: readonly {
|
|
6
|
+
id: string;
|
|
7
|
+
weight: number;
|
|
8
|
+
}[];
|
|
9
|
+
}
|
|
10
|
+
/** Drivers reference actual fitted bones, never hidden authoring nodes. The
|
|
11
|
+
* driven bone's reference frame remains independently FK editable. */
|
|
12
|
+
export declare function driverDelta(driver: BoneDriver, pins: readonly PinRecord[], reference: readonly PinRecord[]): {
|
|
13
|
+
affine: Matrix4;
|
|
14
|
+
rotation: Quaternion;
|
|
15
|
+
scale: Vector3;
|
|
16
|
+
};
|
|
17
|
+
export declare function drivenPose(pose: PinPose, driver: BoneDriver, pins: readonly PinRecord[], reference: readonly PinRecord[]): PinPose;
|
|
18
|
+
export declare function referencePose(pose: PinPose, driver: BoneDriver, pins: readonly PinRecord[], reference: readonly PinRecord[]): PinPose;
|
|
19
|
+
export declare function driveRig(pins: readonly PinRecord[], reference: readonly PinRecord[], drivers: readonly BoneDriver[]): PinRecord[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/deformation/rig-drivers.ts';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type JointsRig } from './joints-json.js';
|
|
2
|
+
import type { ClothCollider, ClothLink } from './pin-cloth.js';
|
|
3
|
+
export declare const NEEDLE_DEFORMATION_RIG = "NEEDLE_deformation_rig";
|
|
4
|
+
export interface RigDescriptor extends JointsRig {
|
|
5
|
+
version: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
6
|
+
joints: {
|
|
7
|
+
node: number;
|
|
8
|
+
parent: number | null;
|
|
9
|
+
mass: number;
|
|
10
|
+
}[];
|
|
11
|
+
chains: {
|
|
12
|
+
endpoint: number;
|
|
13
|
+
joints: number[];
|
|
14
|
+
mode: 'ik' | 'secondary' | 'cloth' | 'fur';
|
|
15
|
+
}[];
|
|
16
|
+
helpers?: {
|
|
17
|
+
node: number;
|
|
18
|
+
influences: {
|
|
19
|
+
node: number;
|
|
20
|
+
weight: number;
|
|
21
|
+
}[];
|
|
22
|
+
}[];
|
|
23
|
+
cloth?: {
|
|
24
|
+
links: ClothLink[];
|
|
25
|
+
colliders: ClothCollider[];
|
|
26
|
+
};
|
|
27
|
+
furSurface?: {
|
|
28
|
+
heightTexture: number;
|
|
29
|
+
texCoord?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Validate before allocating runtime objects or accepting node references. */
|
|
33
|
+
export declare function parseRigDescriptor(value: unknown, nodeCount: number, textureCount?: number): RigDescriptor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/deformation/rig-extension.ts';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Object3D, type AnimationClip, type Texture } from 'three';
|
|
2
|
+
import type { GLTF, GLTFLoader, GLTFParser } from 'three/addons/loaders/GLTFLoader.js';
|
|
3
|
+
import type { PinRecord } from './pin-types.js';
|
|
4
|
+
import { type RigDescriptor } from './rig-extension.js';
|
|
5
|
+
import { type BoneDriver } from './rig-drivers.js';
|
|
6
|
+
import { FurSurface } from './fur-surface.js';
|
|
7
|
+
/** Lightweight articulated runtime. Skinning stays on the renderer's GPU;
|
|
8
|
+
* only the small joint graph is solved on the CPU, with no voxel dependency. */
|
|
9
|
+
export declare class DeformationRigRuntime {
|
|
10
|
+
readonly scene: Object3D;
|
|
11
|
+
readonly descriptor: RigDescriptor;
|
|
12
|
+
readonly clips: readonly AnimationClip[];
|
|
13
|
+
/** Stable pin IDs mapped to the glTF bone nodes. Edit a bone for FK. */
|
|
14
|
+
readonly bones: Map<string, Object3D<import("three").Object3DEventMap>>;
|
|
15
|
+
/** Scene-local goal objects for IK and secondary controls. Move one before `update()`. */
|
|
16
|
+
readonly targets: Map<string, Object3D<import("three").Object3DEventMap>>;
|
|
17
|
+
readonly parents: Map<string, string>;
|
|
18
|
+
readonly masses: Map<string, number>;
|
|
19
|
+
readonly helpers: {
|
|
20
|
+
bone: Object3D;
|
|
21
|
+
influences: {
|
|
22
|
+
id: string;
|
|
23
|
+
weight: number;
|
|
24
|
+
}[];
|
|
25
|
+
}[];
|
|
26
|
+
private helperReferences;
|
|
27
|
+
private referencePins;
|
|
28
|
+
private localFrames;
|
|
29
|
+
private fittedDrivers;
|
|
30
|
+
get drivers(): readonly BoneDriver[];
|
|
31
|
+
private articulated;
|
|
32
|
+
private springs;
|
|
33
|
+
private cloth;
|
|
34
|
+
private clothMeshes;
|
|
35
|
+
readonly furSurface: FurSurface | null;
|
|
36
|
+
private mixer;
|
|
37
|
+
private base;
|
|
38
|
+
private displayed;
|
|
39
|
+
private disposed;
|
|
40
|
+
private dirty;
|
|
41
|
+
private targetFrames;
|
|
42
|
+
private editedTargets;
|
|
43
|
+
private mixedPoseWeights;
|
|
44
|
+
private mixingStaticPoses;
|
|
45
|
+
private animationFrames;
|
|
46
|
+
windStrength: number;
|
|
47
|
+
activePose: number;
|
|
48
|
+
constructor(scene: Object3D, descriptor: RigDescriptor, nodes: readonly Object3D[], clips: readonly AnimationClip[], helperNodes?: readonly Object3D[]);
|
|
49
|
+
/** Supply a Fur height atlas. The loader calls this for embedded atlases. */
|
|
50
|
+
setFurHeightMap(texture: Texture | null): void;
|
|
51
|
+
/** Keep ordinary glTF materials on renderers without the Fur node shader. */
|
|
52
|
+
setPortableMaterials(portable: boolean): void;
|
|
53
|
+
/** Joint records in the last displayed frame, including secondary motion. */
|
|
54
|
+
get pins(): readonly PinRecord[];
|
|
55
|
+
/** Return stable pin IDs from the root of the selected chain to its endpoint. */
|
|
56
|
+
chain(id: string): string[];
|
|
57
|
+
/** Clear accumulated spring and Cloth motion after a pose or editor reset. */
|
|
58
|
+
resetSecondary(): void;
|
|
59
|
+
private prepareClothMeshes;
|
|
60
|
+
private updateClothMeshes;
|
|
61
|
+
/** Select an exported `Pose N` clip and reset its IK goals and secondary motion. */
|
|
62
|
+
selectPose(slot: number): void;
|
|
63
|
+
get poseWeights(): ReadonlyMap<number, number>;
|
|
64
|
+
/** Change the editable reference pose without interrupting secondary motion. */
|
|
65
|
+
preparePose(slot: number): void;
|
|
66
|
+
/** Mix the GLB's standard static pose clips, then simulate on that fitted frame. */
|
|
67
|
+
previewPoseWeights(weights: ReadonlyMap<number, number>, seconds: number): void;
|
|
68
|
+
/** Adapter for editors: authored state stays in the caller's action history. */
|
|
69
|
+
setPins(pins: readonly PinRecord[]): void;
|
|
70
|
+
/** Display a caller-supplied fitted frame. Workbench playback uses the clips. */
|
|
71
|
+
previewPins(pins: readonly PinRecord[]): void;
|
|
72
|
+
private localFrame;
|
|
73
|
+
private rememberAnimationFrame;
|
|
74
|
+
/** PropertyMixer skips unchanged values. Recover their clip-only components
|
|
75
|
+
* rather than feeding last frame's secondary motion back into animation. */
|
|
76
|
+
private animationFrame;
|
|
77
|
+
private rememberDisplayedAnimationFrame;
|
|
78
|
+
private apply;
|
|
79
|
+
/** Call after an external AnimationMixer/TransformControls, before rendering.
|
|
80
|
+
* Targets are scene-local Object3Ds; moving an independent bone never moves them. */
|
|
81
|
+
update(seconds: number): void;
|
|
82
|
+
private advanceSecondary;
|
|
83
|
+
dispose(): void;
|
|
84
|
+
}
|
|
85
|
+
/** GLTFLoader plugin that validates a rig extension and binds its scene runtime. */
|
|
86
|
+
export declare class NeedleDeformationRigLoaderPlugin {
|
|
87
|
+
readonly parser: GLTFParser;
|
|
88
|
+
readonly name = "NEEDLE_deformation_rig";
|
|
89
|
+
constructor(parser: GLTFParser);
|
|
90
|
+
afterRoot(gltf: GLTF): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
/** Register the rig plugin before loading a GLB. Returns the same loader. */
|
|
93
|
+
export declare function registerNeedleDeformationRigLoader(loader: GLTFLoader): GLTFLoader;
|
|
94
|
+
/** Return the runtime attached to a loaded glTF scene, if it has the extension. */
|
|
95
|
+
export declare function getDeformationRig(scene: Object3D): DeformationRigRuntime | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/deformation/rig-runtime.ts';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
export declare const MAX_WIND_STRENGTH = 4;
|
|
3
|
+
/** A single weather control drives pin motion and surface pressure. Sparse pin
|
|
4
|
+
* loads stay bounded; fabric pressure has room to grow through a storm. */
|
|
5
|
+
export declare function windProfile(strength: number): {
|
|
6
|
+
label: string;
|
|
7
|
+
load: number;
|
|
8
|
+
surfaceLoad: number;
|
|
9
|
+
gust: number;
|
|
10
|
+
crosswind: number;
|
|
11
|
+
gustRate: number;
|
|
12
|
+
};
|
|
13
|
+
/** Deterministic scene-local prevailing wind with slow gusts and spatially
|
|
14
|
+
* varying eddies. Force is an acceleration scaled to the model's size, so a
|
|
15
|
+
* tiny prop and a large character respond comparably at the same setting. */
|
|
16
|
+
export declare function windAcceleration(seconds: number, strength: number, scale: number, position: readonly number[]): Vector3;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/deformation/wind.ts';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} ImpostorDescriptor
|
|
3
|
+
* @property {1} version
|
|
4
|
+
* @property {'hemisphere' | 'full' | 'single'} mapping
|
|
5
|
+
* @property {number} frames
|
|
6
|
+
* @property {readonly [number, number, number]=} captureDirection
|
|
7
|
+
* @property {number} frameResolution
|
|
8
|
+
* @property {number} padding
|
|
9
|
+
* @property {number} radius
|
|
10
|
+
* @property {readonly [number, number, number]} boundsMin
|
|
11
|
+
* @property {readonly [number, number, number]} boundsMax
|
|
12
|
+
* @property {readonly [number, number, number]} center
|
|
13
|
+
* @property {readonly number[]} viewBounds
|
|
14
|
+
* @property {'captured-alpha+sdf-material' | 'sdf-base-alpha'} coverageEncoding
|
|
15
|
+
* @property {number} captureAlphaCutoff
|
|
16
|
+
* @property {number} alphaCutoff
|
|
17
|
+
* @property {number} blendZone
|
|
18
|
+
* @property {number} parallaxSteps
|
|
19
|
+
* @property {boolean} depthDerivedWeights
|
|
20
|
+
* @property {boolean} castShadow
|
|
21
|
+
* @property {boolean} receiveShadow
|
|
22
|
+
* @property {{occlusion: number, roughness: number, metalness: number}} material
|
|
23
|
+
* @property {{version: 4, layout: 'compact-atlas-v4', depthEncoding: 'lossless-geometry10-rgba', materialFrameResolution: number, emissive: boolean}=} compression
|
|
24
|
+
*/
|
|
25
|
+
/** @param {unknown} value @returns {ImpostorDescriptor | null} */
|
|
26
|
+
export function parseImpostorDescriptor(value: unknown): ImpostorDescriptor | null;
|
|
27
|
+
/** Primitive extension declaring an explicitly-bound Needle mesh impostor. */
|
|
28
|
+
export const NEEDLE_MESH_IMPOSTOR: "NEEDLE_mesh_impostor";
|
|
29
|
+
export type ImpostorDescriptor = {
|
|
30
|
+
version: 1;
|
|
31
|
+
mapping: "hemisphere" | "full" | "single";
|
|
32
|
+
frames: number;
|
|
33
|
+
captureDirection?: readonly [number, number, number] | undefined;
|
|
34
|
+
frameResolution: number;
|
|
35
|
+
padding: number;
|
|
36
|
+
radius: number;
|
|
37
|
+
boundsMin: readonly [number, number, number];
|
|
38
|
+
boundsMax: readonly [number, number, number];
|
|
39
|
+
center: readonly [number, number, number];
|
|
40
|
+
viewBounds: readonly number[];
|
|
41
|
+
coverageEncoding: "captured-alpha+sdf-material" | "sdf-base-alpha";
|
|
42
|
+
captureAlphaCutoff: number;
|
|
43
|
+
alphaCutoff: number;
|
|
44
|
+
blendZone: number;
|
|
45
|
+
parallaxSteps: number;
|
|
46
|
+
depthDerivedWeights: boolean;
|
|
47
|
+
castShadow: boolean;
|
|
48
|
+
receiveShadow: boolean;
|
|
49
|
+
material: {
|
|
50
|
+
occlusion: number;
|
|
51
|
+
roughness: number;
|
|
52
|
+
metalness: number;
|
|
53
|
+
};
|
|
54
|
+
compression?: {
|
|
55
|
+
version: 4;
|
|
56
|
+
layout: "compact-atlas-v4";
|
|
57
|
+
depthEncoding: "lossless-geometry10-rgba";
|
|
58
|
+
materialFrameResolution: number;
|
|
59
|
+
emissive: boolean;
|
|
60
|
+
} | undefined;
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/impostor/impostor-metadata.js';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reports whether a renderer can compile Baker's TSL impostor material.
|
|
3
|
+
* WebGPURenderer supports node materials directly. Classic WebGLRenderer
|
|
4
|
+
* integrations must advertise that they installed a compatible nodes handler.
|
|
5
|
+
*
|
|
6
|
+
* @param {ImpostorRenderer | undefined} renderer
|
|
7
|
+
*/
|
|
8
|
+
export function rendererSupportsImpostorNodeMaterials(renderer: ImpostorRenderer | undefined): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* @param {ImpostorDescriptor} descriptor
|
|
11
|
+
* @param {Partial<ImpostorRuntimeFeatures>=} input
|
|
12
|
+
* @returns {ResolvedImpostorRuntimeFeatures}
|
|
13
|
+
*/
|
|
14
|
+
export function resolveImpostorRuntimeFeatures(descriptor: ImpostorDescriptor, input?: Partial<ImpostorRuntimeFeatures> | undefined): ResolvedImpostorRuntimeFeatures;
|
|
15
|
+
/**
|
|
16
|
+
* Installs a backend-neutral TSL material. WebGPURenderer compiles this graph
|
|
17
|
+
* to WGSL on WebGPU and GLSL on its WebGL2 compatibility backend.
|
|
18
|
+
*
|
|
19
|
+
* @param {import('three').Object3D} root
|
|
20
|
+
* @param {Map<import('three').Object3D, {descriptor: unknown, maps: {
|
|
21
|
+
* baseColor: import('three').Texture,
|
|
22
|
+
* normalDepth: import('three').Texture,
|
|
23
|
+
* material?: import('three').Texture | null,
|
|
24
|
+
* emissive?: import('three').Texture | null,
|
|
25
|
+
* geometry?: import('three').Texture | null,
|
|
26
|
+
* }}>} bindings
|
|
27
|
+
* @param {Partial<ImpostorRuntimeFeatures>=} inputFeatures
|
|
28
|
+
* @param {ImpostorRenderer=} renderer
|
|
29
|
+
*/
|
|
30
|
+
export function upgradeImpostorScene(root: import("three").Object3D, bindings?: Map<import("three").Object3D, {
|
|
31
|
+
descriptor: unknown;
|
|
32
|
+
maps: {
|
|
33
|
+
baseColor: import("three").Texture;
|
|
34
|
+
normalDepth: import("three").Texture;
|
|
35
|
+
material?: import("three").Texture | null;
|
|
36
|
+
emissive?: import("three").Texture | null;
|
|
37
|
+
geometry?: import("three").Texture | null;
|
|
38
|
+
};
|
|
39
|
+
}>, inputFeatures?: Partial<ImpostorRuntimeFeatures> | undefined, renderer?: ImpostorRenderer | undefined): number;
|
|
40
|
+
/**
|
|
41
|
+
* Registers the Needle impostor material plugin on a Three.js GLTFLoader.
|
|
42
|
+
*
|
|
43
|
+
* @template {import('three/addons/loaders/GLTFLoader.js').GLTFLoader} T
|
|
44
|
+
* @param {T} loader
|
|
45
|
+
* @param {ConstructorParameters<typeof NeedleImpostorLoaderPlugin>[1]=} options
|
|
46
|
+
* @returns {T}
|
|
47
|
+
*/
|
|
48
|
+
export function registerNeedleImpostorLoader<T extends import("three/addons/loaders/GLTFLoader.js").GLTFLoader>(loader: T, options?: ConstructorParameters<typeof NeedleImpostorLoaderPlugin>[1] | undefined): T;
|
|
49
|
+
/**
|
|
50
|
+
* @param {ImpostorDescriptor} descriptor
|
|
51
|
+
* @param {{
|
|
52
|
+
* baseColor: import('three').Texture,
|
|
53
|
+
* normalDepth: import('three').Texture,
|
|
54
|
+
* orm?: import('three').Texture | null,
|
|
55
|
+
* emissive: import('three').Texture | null,
|
|
56
|
+
* geometry?: import('three').Texture | null,
|
|
57
|
+
* viewBounds: import('three').DataTexture,
|
|
58
|
+
* }} maps
|
|
59
|
+
* @param {Partial<ImpostorRuntimeFeatures>=} inputFeatures
|
|
60
|
+
* @param {ImpostorRenderer=} renderer
|
|
61
|
+
* @returns {MeshStandardNodeMaterial | ShaderMaterial}
|
|
62
|
+
*/
|
|
63
|
+
export function createPbrImpostorNodeMaterial(descriptor: ImpostorDescriptor, maps: {
|
|
64
|
+
baseColor: import("three").Texture;
|
|
65
|
+
normalDepth: import("three").Texture;
|
|
66
|
+
orm?: import("three").Texture | null;
|
|
67
|
+
emissive: import("three").Texture | null;
|
|
68
|
+
geometry?: import("three").Texture | null;
|
|
69
|
+
viewBounds: import("three").DataTexture;
|
|
70
|
+
}, inputFeatures?: Partial<ImpostorRuntimeFeatures> | undefined, renderer?: ImpostorRenderer | undefined): MeshStandardNodeMaterial | ShaderMaterial;
|
|
71
|
+
export const DEFAULT_IMPOSTOR_RUNTIME_FEATURES: Readonly<{
|
|
72
|
+
interpolation: true;
|
|
73
|
+
reprojection: true;
|
|
74
|
+
depthWeights: true;
|
|
75
|
+
perspectiveCorrection: true;
|
|
76
|
+
cellCorrection: false;
|
|
77
|
+
boundedReprojection: true;
|
|
78
|
+
}>;
|
|
79
|
+
export const IMPOSTOR_RUNTIME_SAMPLE_LIMITS: Readonly<{
|
|
80
|
+
raySamples: 32;
|
|
81
|
+
depthSamples: 8;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Three.js GLTFLoader plugin that upgrades Needle impostor nodes after their
|
|
85
|
+
* atlas textures have loaded. Register KTX2Loader on GLTFLoader as usual when
|
|
86
|
+
* loading compressed impostors; uncompressed GLBs need no extra texture setup.
|
|
87
|
+
*/
|
|
88
|
+
export class NeedleImpostorLoaderPlugin {
|
|
89
|
+
/**
|
|
90
|
+
* @param {unknown} parser GLTFLoader parser supplied by `loader.register()`.
|
|
91
|
+
* @param {{
|
|
92
|
+
* onUpgrade?: (count: number, result: import('three/addons/loaders/GLTFLoader.js').GLTF) => void,
|
|
93
|
+
* features?: Partial<ImpostorRuntimeFeatures>,
|
|
94
|
+
* renderer?: ImpostorRenderer,
|
|
95
|
+
* }=} options
|
|
96
|
+
*/
|
|
97
|
+
constructor(parser: unknown, options?: {
|
|
98
|
+
onUpgrade?: (count: number, result: import("three/addons/loaders/GLTFLoader.js").GLTF) => void;
|
|
99
|
+
features?: Partial<ImpostorRuntimeFeatures>;
|
|
100
|
+
renderer?: ImpostorRenderer;
|
|
101
|
+
} | undefined);
|
|
102
|
+
name: string;
|
|
103
|
+
parser: unknown;
|
|
104
|
+
options: {
|
|
105
|
+
onUpgrade?: (count: number, result: import("three/addons/loaders/GLTFLoader.js").GLTF) => void;
|
|
106
|
+
features?: Partial<ImpostorRuntimeFeatures>;
|
|
107
|
+
renderer?: ImpostorRenderer;
|
|
108
|
+
};
|
|
109
|
+
/** @param {import('three/addons/loaders/GLTFLoader.js').GLTF} result */
|
|
110
|
+
afterRoot(result: import("three/addons/loaders/GLTFLoader.js").GLTF): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
export type ImpostorRenderer = {
|
|
113
|
+
isWebGPURenderer?: boolean | undefined;
|
|
114
|
+
isWebGLRenderer?: boolean | undefined;
|
|
115
|
+
capabilities?: (object & {
|
|
116
|
+
supportsNodeMaterials?: boolean;
|
|
117
|
+
}) | undefined;
|
|
118
|
+
};
|
|
119
|
+
export type ImpostorRuntimeFeatures = {
|
|
120
|
+
interpolation: boolean;
|
|
121
|
+
reprojection: boolean;
|
|
122
|
+
depthWeights: boolean;
|
|
123
|
+
perspectiveCorrection: boolean;
|
|
124
|
+
cellCorrection: boolean;
|
|
125
|
+
boundedReprojection: boolean;
|
|
126
|
+
raySamples: number;
|
|
127
|
+
depthSamples: number;
|
|
128
|
+
blendZone: number;
|
|
129
|
+
};
|
|
130
|
+
export type ResolvedImpostorRuntimeFeatures = {
|
|
131
|
+
requested: ImpostorRuntimeFeatures;
|
|
132
|
+
effective: Pick<ImpostorRuntimeFeatures, "interpolation" | "reprojection" | "depthWeights" | "perspectiveCorrection" | "cellCorrection" | "boundedReprojection">;
|
|
133
|
+
profile: Pick<ImpostorRuntimeFeatures, "interpolation" | "reprojection" | "depthWeights" | "perspectiveCorrection" | "cellCorrection" | "boundedReprojection" | "raySamples" | "depthSamples"> & {
|
|
134
|
+
frameSamples: number;
|
|
135
|
+
blendZone: number;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
import type { ImpostorDescriptor } from './impostor-metadata.js';
|
|
139
|
+
import { MeshStandardNodeMaterial } from 'three/webgpu';
|
|
140
|
+
import { ShaderMaterial } from 'three/webgpu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/impostor/impostor-node-material.js';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Restricts barycentric interpolation to a compact fraction of each angular
|
|
3
|
+
* transition. A value of one preserves ordinary linear barycentrics. Smaller
|
|
4
|
+
* values create an exact single-view region around each capture while the
|
|
5
|
+
* active transition remains continuous and normalized.
|
|
6
|
+
*
|
|
7
|
+
* Along a triangle edge, `blendZone` is exactly the fraction of that edge over
|
|
8
|
+
* which both endpoint captures contribute.
|
|
9
|
+
*
|
|
10
|
+
* @param {readonly [number, number, number]} inputWeights
|
|
11
|
+
* @param {number} blendZone
|
|
12
|
+
* @returns {[number, number, number]}
|
|
13
|
+
*/
|
|
14
|
+
export function applyImpostorBlendZone(inputWeights: readonly [number, number, number], blendZone: number): [number, number, number];
|
|
15
|
+
/**
|
|
16
|
+
* Keeps the angular onset of a previously occluded contour approximately
|
|
17
|
+
* stable as the atlas grid gets denser. The returned value is the temperature
|
|
18
|
+
* used by the normalized log-sum-exp union in the runtime shader.
|
|
19
|
+
*
|
|
20
|
+
* @param {number} frames
|
|
21
|
+
*/
|
|
22
|
+
export function impostorContourUnionSharpness(frames: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* CPU mirror of the runtime's continuous geometric confidence. A binary
|
|
25
|
+
* half-texel cutoff made individual pixels (and sometimes entire thin
|
|
26
|
+
* features) switch reconstruction paths at one camera angle. The fade keeps
|
|
27
|
+
* the same bounded rejection while making angular motion continuous.
|
|
28
|
+
*
|
|
29
|
+
* @param {boolean} startedOutOfBounds
|
|
30
|
+
* @param {number} rayError
|
|
31
|
+
* @param {number} footprint
|
|
32
|
+
* @param {boolean=} reprojectionActive
|
|
33
|
+
*/
|
|
34
|
+
export function reprojectedSampleConfidence(startedOutOfBounds: boolean, rayError: number, footprint: number, reprojectionActive?: boolean | undefined): number;
|
|
35
|
+
/**
|
|
36
|
+
* Mirrors the runtime coverage contribution used after depth reprojection.
|
|
37
|
+
* Validity can remove a frame from a pixel, but it must never renormalize the
|
|
38
|
+
* remaining frame to full opacity. Preserving angular support prevents a
|
|
39
|
+
* surface visible in only one capture from appearing as a second opaque layer.
|
|
40
|
+
*
|
|
41
|
+
* @param {readonly [number, number, number]} visibilityWeights
|
|
42
|
+
* @param {readonly [number, number, number]} correctedValidity
|
|
43
|
+
* @returns {[number, number, number]}
|
|
44
|
+
*/
|
|
45
|
+
export function resolveImpostorCoverageWeights(visibilityWeights: readonly [number, number, number], correctedValidity: readonly [number, number, number]): [number, number, number];
|
|
46
|
+
/** @param {ImpostorDescriptor} descriptor */
|
|
47
|
+
export function createImpostorViewBoundsTexture(descriptor: ImpostorDescriptor): DataTexture;
|
|
48
|
+
export { parseImpostorDescriptor } from "./impostor-metadata.js";
|
|
49
|
+
export const REPROJECTION_CONFIDENCE_INNER_TEXELS: 0.25;
|
|
50
|
+
export const REPROJECTION_CONFIDENCE_OUTER_TEXELS: 16;
|
|
51
|
+
import type { ImpostorDescriptor } from './impostor-metadata.js';
|
|
52
|
+
import { DataTexture } from 'three';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/impostor/impostor-runtime-support.js';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encodes a local-space point into the orthographic capture depth used by the
|
|
3
|
+
* normal/depth atlas. Capture cameras sit at `direction * 2r` and cover the
|
|
4
|
+
* interval from +r to -r along their forward axis.
|
|
5
|
+
*
|
|
6
|
+
* @param {[number, number, number]} point
|
|
7
|
+
* @param {[number, number, number]} direction Unit capture direction.
|
|
8
|
+
* @param {number} radius
|
|
9
|
+
*/
|
|
10
|
+
export function captureDepthFromPoint(point: [number, number, number], direction: [number, number, number], radius: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Intersects a runtime point-to-camera ray with the capture-depth plane
|
|
13
|
+
* `dot(P, captureDirection) = radius - 2 * radius * depth`.
|
|
14
|
+
*
|
|
15
|
+
* This is the fixed-point step solved by the runtime parallax shader. It is
|
|
16
|
+
* deliberately expressed independently here so sign and scale regressions are
|
|
17
|
+
* caught by browserless tests.
|
|
18
|
+
*
|
|
19
|
+
* @param {[number, number, number]} rayOrigin
|
|
20
|
+
* @param {[number, number, number]} rayDirection Unit point-to-camera ray.
|
|
21
|
+
* @param {[number, number, number]} captureDirection Unit capture direction.
|
|
22
|
+
* @param {number} depth
|
|
23
|
+
* @param {number} radius
|
|
24
|
+
* @returns {[number, number, number]}
|
|
25
|
+
*/
|
|
26
|
+
export function intersectRayWithCaptureDepth(rayOrigin: [number, number, number], rayDirection: [number, number, number], captureDirection: [number, number, number], depth: number, radius: number): [number, number, number];
|
|
27
|
+
/**
|
|
28
|
+
* Decodes a regular or upper-hemisphere octahedral grid coordinate.
|
|
29
|
+
* Y is the up axis used throughout the baker and preview runtime.
|
|
30
|
+
*
|
|
31
|
+
* @param {[number, number]} coordinate normalized 0..1 grid coordinate
|
|
32
|
+
* @param {'hemisphere' | 'full'} mapping
|
|
33
|
+
* @returns {[number, number, number]}
|
|
34
|
+
*/
|
|
35
|
+
export function gridToDirection(coordinate: [number, number], mapping: "hemisphere" | "full"): [number, number, number];
|
|
36
|
+
/**
|
|
37
|
+
* @param {[number, number, number]} input
|
|
38
|
+
* @param {'hemisphere' | 'full'} mapping
|
|
39
|
+
* @returns {[number, number]}
|
|
40
|
+
*/
|
|
41
|
+
export function directionToGrid(input: [number, number, number], mapping: "hemisphere" | "full"): [number, number];
|
|
42
|
+
/**
|
|
43
|
+
* Finds the authored grid direction with the smallest spherical angle to an
|
|
44
|
+
* arbitrary view. Octahedral coordinates are not equal-area, so independently
|
|
45
|
+
* rounding U/V is not guaranteed to choose the closest capture near folds.
|
|
46
|
+
* The production grids contain at most 24² views; an exact dot-product search
|
|
47
|
+
* is both cheap and unambiguous for an interaction that runs on orbit release.
|
|
48
|
+
*
|
|
49
|
+
* @param {[number, number, number]} inputDirection
|
|
50
|
+
* @param {'hemisphere' | 'full'} mapping
|
|
51
|
+
* @param {number} frames
|
|
52
|
+
*/
|
|
53
|
+
export function nearestOctahedralCapture(inputDirection: [number, number, number], mapping: "hemisphere" | "full", frames: number): {
|
|
54
|
+
frame: [number, number];
|
|
55
|
+
direction: [number, number, number];
|
|
56
|
+
dot: number;
|
|
57
|
+
angleDegrees: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Projects a spherical direction beyond the latest sample. OrbitControls'
|
|
61
|
+
* residual release motion supplies the two samples; values above one look
|
|
62
|
+
* ahead in the same direction, so a fast release cannot select the capture
|
|
63
|
+
* behind its visible trajectory.
|
|
64
|
+
*
|
|
65
|
+
* @param {[number, number, number]} startDirection
|
|
66
|
+
* @param {[number, number, number]} endDirection
|
|
67
|
+
* @param {number} multiplier 1 returns the end sample, 1.5 projects half of
|
|
68
|
+
* the sampled angular motion beyond it.
|
|
69
|
+
* @returns {[number, number, number]}
|
|
70
|
+
*/
|
|
71
|
+
export function extrapolateSphericalDirection(startDirection: [number, number, number], endDirection: [number, number, number], multiplier: number): [number, number, number];
|
|
72
|
+
/**
|
|
73
|
+
* Returns the three vertices and barycentric weights of the grid triangle
|
|
74
|
+
* containing a direction. The diagonal is chosen consistently on CPU and GPU.
|
|
75
|
+
*
|
|
76
|
+
* @param {[number, number, number]} direction
|
|
77
|
+
* @param {'hemisphere' | 'full'} mapping
|
|
78
|
+
* @param {number} frames
|
|
79
|
+
*/
|
|
80
|
+
export function selectOctahedralFrames(direction: [number, number, number], mapping: "hemisphere" | "full", frames: number): {
|
|
81
|
+
frames: [[number, number], [number, number], [number, number]];
|
|
82
|
+
weights: [number, number, number];
|
|
83
|
+
};
|
|
84
|
+
export const PERSPECTIVE_RAY_PLANE_SIGN: -1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/impostor/octahedral.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the shader alternative to the exported voxel shell. The box supplies
|
|
3
|
+
* interpolated ray-entry positions; the fragment node walks the packed solid
|
|
4
|
+
* volume and returns the first occupied cell in a single draw/pass.
|
|
5
|
+
*
|
|
6
|
+
* @param {THREE.Object3D} asset
|
|
7
|
+
* @param {THREE.Box3} bounds
|
|
8
|
+
* @param {Record<string, unknown>} descriptor
|
|
9
|
+
*/
|
|
10
|
+
export function createPixelImpostorRaycastPreview(asset: THREE.Object3D, bounds: THREE.Box3, descriptor: Record<string, unknown>): THREE.Group<THREE.Object3DEventMap> | null;
|
|
11
|
+
/**
|
|
12
|
+
* Install the same voxel, screen-snap, and raycast TSL display used by the
|
|
13
|
+
* workbench. Register the pixel glTF loader before loading the GLB. Call
|
|
14
|
+
* `updateViewport()` after a resize and `dispose()` before discarding the scene.
|
|
15
|
+
*
|
|
16
|
+
* @param {THREE.Object3D} asset Loaded glTF scene.
|
|
17
|
+
* @param {{mode?: 'geometry'|'vertex-snap'|'raycast'|'screen-pixels',
|
|
18
|
+
* binding?:Record<string,unknown>, attach?:boolean,
|
|
19
|
+
* renderer?: {getPixelRatio?: () => number, domElement?: HTMLCanvasElement},
|
|
20
|
+
* pixelSize?: number, snapMode?: 'nearest-grid'|'single-cell'|'center-only',
|
|
21
|
+
* splatScale?: number, antialias?: boolean, pbr?: boolean,
|
|
22
|
+
* projectedNormalMix?: number}=} options
|
|
23
|
+
*/
|
|
24
|
+
export function createPixelImpostorDisplay(asset: THREE.Object3D, options?: {
|
|
25
|
+
mode?: "geometry" | "vertex-snap" | "raycast" | "screen-pixels";
|
|
26
|
+
binding?: Record<string, unknown>;
|
|
27
|
+
attach?: boolean;
|
|
28
|
+
renderer?: {
|
|
29
|
+
getPixelRatio?: () => number;
|
|
30
|
+
domElement?: HTMLCanvasElement;
|
|
31
|
+
};
|
|
32
|
+
pixelSize?: number;
|
|
33
|
+
snapMode?: "nearest-grid" | "single-cell" | "center-only";
|
|
34
|
+
splatScale?: number;
|
|
35
|
+
antialias?: boolean;
|
|
36
|
+
pbr?: boolean;
|
|
37
|
+
projectedNormalMix?: number;
|
|
38
|
+
} | undefined): {
|
|
39
|
+
preview: THREE.Group<THREE.Object3DEventMap>;
|
|
40
|
+
setMode: (next: "raycast" | "vertex-snap" | "geometry" | "screen-pixels") => any;
|
|
41
|
+
updateViewport: () => void;
|
|
42
|
+
/** @param {boolean} enabled */
|
|
43
|
+
setPbr(enabled: boolean): void;
|
|
44
|
+
/** @param {boolean} enabled */
|
|
45
|
+
setAntialias(enabled: boolean): void;
|
|
46
|
+
dispose(): void;
|
|
47
|
+
};
|
|
48
|
+
import * as THREE from 'three';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/pixel-impostor/pixel-impostor-display.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} PixelImpostorDescriptor
|
|
3
|
+
* @property {1 | 2 | 3} version
|
|
4
|
+
* @property {[number, number, number]} dimensions
|
|
5
|
+
* @property {number} atlasColumns
|
|
6
|
+
* @property {number} atlasRows
|
|
7
|
+
* @property {[number, number, number]} volumeMin
|
|
8
|
+
* @property {[number, number, number]} volumeSize
|
|
9
|
+
* @property {[number, number, number]} occupiedMin
|
|
10
|
+
* @property {[number, number, number]} occupiedSize
|
|
11
|
+
* @property {number} alphaCutoff
|
|
12
|
+
* @property {'dense' | 'sparse'} storage
|
|
13
|
+
* @property {number=} surfaceCount
|
|
14
|
+
* @property {[number, number]=} surfaceAtlasSize
|
|
15
|
+
* @property {[number, number]=} indexAtlasSize
|
|
16
|
+
*/
|
|
17
|
+
/** @param {unknown} value @returns {PixelImpostorDescriptor | null} */
|
|
18
|
+
export function parsePixelImpostorDescriptor(value: unknown): PixelImpostorDescriptor | null;
|
|
19
|
+
export const NEEDLE_PIXEL_IMPOSTOR: "NEEDLE_pixel_impostor";
|
|
20
|
+
export type PixelImpostorDescriptor = {
|
|
21
|
+
version: 1 | 2 | 3;
|
|
22
|
+
dimensions: [number, number, number];
|
|
23
|
+
atlasColumns: number;
|
|
24
|
+
atlasRows: number;
|
|
25
|
+
volumeMin: [number, number, number];
|
|
26
|
+
volumeSize: [number, number, number];
|
|
27
|
+
occupiedMin: [number, number, number];
|
|
28
|
+
occupiedSize: [number, number, number];
|
|
29
|
+
alphaCutoff: number;
|
|
30
|
+
storage: "dense" | "sparse";
|
|
31
|
+
surfaceCount?: number | undefined;
|
|
32
|
+
surfaceAtlasSize?: [number, number] | undefined;
|
|
33
|
+
indexAtlasSize?: [number, number] | undefined;
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/pixel-impostor/pixel-impostor-metadata.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Register pixel atlas loading before calling `loadAsync`; returns the same loader.
|
|
2
|
+
* @template {import('three/addons/loaders/GLTFLoader.js').GLTFLoader} T
|
|
3
|
+
* @param {T} loader @returns {T}
|
|
4
|
+
*/
|
|
5
|
+
export function registerNeedlePixelImpostorLoader<T extends import("three/addons/loaders/GLTFLoader.js").GLTFLoader>(loader: T): T;
|
|
6
|
+
/**
|
|
7
|
+
* Three.js GLTFLoader plugin for versioned pixel impostor atlas bindings.
|
|
8
|
+
* It leaves the portable voxel shell intact. Use `createPixelImpostorDisplay`
|
|
9
|
+
* after loading to select the workbench's TSL display modes.
|
|
10
|
+
*/
|
|
11
|
+
export class NeedlePixelImpostorLoaderPlugin {
|
|
12
|
+
/** @param {unknown} parser */
|
|
13
|
+
constructor(parser: unknown);
|
|
14
|
+
name: string;
|
|
15
|
+
parser: unknown;
|
|
16
|
+
/** @param {import('three/addons/loaders/GLTFLoader.js').GLTF} result */
|
|
17
|
+
afterRoot(result: import("three/addons/loaders/GLTFLoader.js").GLTF): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/pixel-impostor/pixel-impostor-runtime.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { DeformationRigRuntime, NeedleDeformationRigLoaderPlugin, registerNeedleDeformationRigLoader, getDeformationRig } from '../deformation/rig-runtime.js';
|
|
2
|
+
export { NEEDLE_DEFORMATION_RIG, parseRigDescriptor, type RigDescriptor } from '../deformation/rig-extension.js';
|
|
3
|
+
export type { PinRecord, PinPose, Point, Rotation, IKTarget } from '../deformation/pin-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/public/deformation-runtime.ts';
|