@mml-io/3d-web-threejs 0.0.0-experimental-2a3c26b-20251217
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 +19 -0
- package/build/ThreeJSWorldRenderer.d.ts +55 -0
- package/build/ThreeJSWorldRenderer.d.ts.map +1 -0
- package/build/camera/ThreeJSCameraManager.d.ts +16 -0
- package/build/camera/ThreeJSCameraManager.d.ts.map +1 -0
- package/build/character/CanvasText.d.ts +35 -0
- package/build/character/CanvasText.d.ts.map +1 -0
- package/build/character/Character.d.ts +59 -0
- package/build/character/Character.d.ts.map +1 -0
- package/build/character/CharacterMaterial.d.ts +20 -0
- package/build/character/CharacterMaterial.d.ts.map +1 -0
- package/build/character/CharacterModel.d.ts +47 -0
- package/build/character/CharacterModel.d.ts.map +1 -0
- package/build/character/CharacterTooltip.d.ts +33 -0
- package/build/character/CharacterTooltip.d.ts.map +1 -0
- package/build/character/LowPolyModel.d.ts +2 -0
- package/build/character/LowPolyModel.d.ts.map +1 -0
- package/build/character/ThreeJSCharacterManager.d.ts +51 -0
- package/build/character/ThreeJSCharacterManager.d.ts.map +1 -0
- package/build/character/instancing/CharacterColourSamplingUtils.d.ts +15 -0
- package/build/character/instancing/CharacterColourSamplingUtils.d.ts.map +1 -0
- package/build/character/instancing/CharacterInstances.d.ts +92 -0
- package/build/character/instancing/CharacterInstances.d.ts.map +1 -0
- package/build/character/instancing/CharacterInstancingAnimationUtils.d.ts +8 -0
- package/build/character/instancing/CharacterInstancingAnimationUtils.d.ts.map +1 -0
- package/build/character/instancing/CharacterInstancingUtils.d.ts +4 -0
- package/build/character/instancing/CharacterInstancingUtils.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/InstancedEntity.d.ts +192 -0
- package/build/character/instancing/vendor/core/InstancedEntity.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/InstancedMesh2.d.ts +362 -0
- package/build/character/instancing/vendor/core/InstancedMesh2.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/InstancedMeshBVH.d.ts +146 -0
- package/build/character/instancing/vendor/core/InstancedMeshBVH.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/feature/Capacity.d.ts +14 -0
- package/build/character/instancing/vendor/core/feature/Capacity.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/feature/FrustumCulling.d.ts +38 -0
- package/build/character/instancing/vendor/core/feature/FrustumCulling.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/feature/Instances.d.ts +50 -0
- package/build/character/instancing/vendor/core/feature/Instances.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/feature/LOD.d.ts +90 -0
- package/build/character/instancing/vendor/core/feature/LOD.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/feature/Morph.d.ts +19 -0
- package/build/character/instancing/vendor/core/feature/Morph.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/feature/Raycasting.d.ts +8 -0
- package/build/character/instancing/vendor/core/feature/Raycasting.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/feature/Skeleton.d.ts +20 -0
- package/build/character/instancing/vendor/core/feature/Skeleton.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/feature/Uniforms.d.ts +43 -0
- package/build/character/instancing/vendor/core/feature/Uniforms.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/utils/GLInstancedBufferAttribute.d.ts +43 -0
- package/build/character/instancing/vendor/core/utils/GLInstancedBufferAttribute.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/utils/InstancedRenderList.d.ts +26 -0
- package/build/character/instancing/vendor/core/utils/InstancedRenderList.d.ts.map +1 -0
- package/build/character/instancing/vendor/core/utils/SquareDataTexture.d.ts +157 -0
- package/build/character/instancing/vendor/core/utils/SquareDataTexture.d.ts.map +1 -0
- package/build/character/instancing/vendor/index.d.ts +26 -0
- package/build/character/instancing/vendor/index.d.ts.map +1 -0
- package/build/character/instancing/vendor/shaders/ShaderChunk.d.ts +2 -0
- package/build/character/instancing/vendor/shaders/ShaderChunk.d.ts.map +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_color_pars_vertex.d.ts +2 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_color_pars_vertex.d.ts.map +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_color_vertex.d.ts +2 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_color_vertex.d.ts.map +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_material_color_pars_vertex.d.ts +2 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_material_color_pars_vertex.d.ts.map +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_material_color_vertex.d.ts +2 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_material_color_vertex.d.ts.map +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_pars_vertex.d.ts +2 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_pars_vertex.d.ts.map +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_skinning_pars_vertex.d.ts +2 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_skinning_pars_vertex.d.ts.map +1 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_vertex.d.ts +2 -0
- package/build/character/instancing/vendor/shaders/chunks/instanced_vertex.d.ts.map +1 -0
- package/build/character/instancing/vendor/utils/CreateFrom.d.ts +10 -0
- package/build/character/instancing/vendor/utils/CreateFrom.d.ts.map +1 -0
- package/build/character/instancing/vendor/utils/SortingUtils.d.ts +17 -0
- package/build/character/instancing/vendor/utils/SortingUtils.d.ts.map +1 -0
- package/build/character/loading/CharacterModelLoader.d.ts +12 -0
- package/build/character/loading/CharacterModelLoader.d.ts.map +1 -0
- package/build/character/loading/GLTFLoadingWorker.worker.d.ts +3 -0
- package/build/character/loading/GLTFLoadingWorker.worker.d.ts.map +1 -0
- package/build/character/loading/GLTFLoadingWorkerBrowserCache.d.ts +9 -0
- package/build/character/loading/GLTFLoadingWorkerBrowserCache.d.ts.map +1 -0
- package/build/character/loading/GLTFLoadingWorkerPool.d.ts +23 -0
- package/build/character/loading/GLTFLoadingWorkerPool.d.ts.map +1 -0
- package/build/character/loading/GLTFLoadingWorkerTypes.d.ts +19 -0
- package/build/character/loading/GLTFLoadingWorkerTypes.d.ts.map +1 -0
- package/build/collisions/ThreeJSCollisionManager.d.ts +18 -0
- package/build/collisions/ThreeJSCollisionManager.d.ts.map +1 -0
- package/build/composer.d.ts +108 -0
- package/build/composer.d.ts.map +1 -0
- package/build/ground-plane/GroundPlane.d.ts +10 -0
- package/build/ground-plane/GroundPlane.d.ts.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +10494 -0
- package/build/index.js.map +7 -0
- package/build/mml/ThreeJSMMLCompositionScene.d.ts +32 -0
- package/build/mml/ThreeJSMMLCompositionScene.d.ts.map +1 -0
- package/build/mml/ThreeJSMMLManager.d.ts +20 -0
- package/build/mml/ThreeJSMMLManager.d.ts.map +1 -0
- package/build/post-effects/PostProcessingManager.d.ts +102 -0
- package/build/post-effects/PostProcessingManager.d.ts.map +1 -0
- package/build/post-effects/bright-contrast-sat.d.ts +3 -0
- package/build/post-effects/bright-contrast-sat.d.ts.map +1 -0
- package/build/post-effects/gauss-grain.d.ts +3 -0
- package/build/post-effects/gauss-grain.d.ts.map +1 -0
- package/build/post-effects/n8-ssao/BlueNoise.d.ts +2 -0
- package/build/post-effects/n8-ssao/BlueNoise.d.ts.map +1 -0
- package/build/post-effects/n8-ssao/DepthDownSample.d.ts +18 -0
- package/build/post-effects/n8-ssao/DepthDownSample.d.ts.map +1 -0
- package/build/post-effects/n8-ssao/EffectCompositer.d.ts +40 -0
- package/build/post-effects/n8-ssao/EffectCompositer.d.ts.map +1 -0
- package/build/post-effects/n8-ssao/EffectShader.d.ts +32 -0
- package/build/post-effects/n8-ssao/EffectShader.d.ts.map +1 -0
- package/build/post-effects/n8-ssao/FullScreenTriangle.d.ts +12 -0
- package/build/post-effects/n8-ssao/FullScreenTriangle.d.ts.map +1 -0
- package/build/post-effects/n8-ssao/N8SSAOPass.d.ts +66 -0
- package/build/post-effects/n8-ssao/N8SSAOPass.d.ts.map +1 -0
- package/build/post-effects/n8-ssao/PoissionBlur.d.ts +31 -0
- package/build/post-effects/n8-ssao/PoissionBlur.d.ts.map +1 -0
- package/build/shaders/bayer-dither.d.ts +2 -0
- package/build/shaders/bayer-dither.d.ts.map +1 -0
- package/build/shaders/shader-helpers.d.ts +5 -0
- package/build/shaders/shader-helpers.d.ts.map +1 -0
- package/build/shaders/vertex-shader.d.ts +2 -0
- package/build/shaders/vertex-shader.d.ts.map +1 -0
- package/build/sun/Sun.d.ts +21 -0
- package/build/sun/Sun.d.ts.map +1 -0
- package/build/tweakpane/ThreeJSTweakPaneFolders.d.ts +31 -0
- package/build/tweakpane/ThreeJSTweakPaneFolders.d.ts.map +1 -0
- package/build/tweakpane/blades/collisionsStatsFolder.d.ts +10 -0
- package/build/tweakpane/blades/collisionsStatsFolder.d.ts.map +1 -0
- package/build/tweakpane/blades/effects/bcsFolder.d.ts +15 -0
- package/build/tweakpane/blades/effects/bcsFolder.d.ts.map +1 -0
- package/build/tweakpane/blades/effects/bloomAndGrain.d.ts +15 -0
- package/build/tweakpane/blades/effects/bloomAndGrain.d.ts.map +1 -0
- package/build/tweakpane/blades/effects/ssaoFolder.d.ts +52 -0
- package/build/tweakpane/blades/effects/ssaoFolder.d.ts.map +1 -0
- package/build/tweakpane/blades/effects/toneMappingFolder.d.ts +22 -0
- package/build/tweakpane/blades/effects/toneMappingFolder.d.ts.map +1 -0
- package/build/tweakpane/blades/environmentFolder.d.ts +58 -0
- package/build/tweakpane/blades/environmentFolder.d.ts.map +1 -0
- package/build/tweakpane/blades/postProcessingFolder.d.ts +34 -0
- package/build/tweakpane/blades/postProcessingFolder.d.ts.map +1 -0
- package/build/tweakpane/blades/rendererFolder.d.ts +17 -0
- package/build/tweakpane/blades/rendererFolder.d.ts.map +1 -0
- package/build/tweakpane/blades/rendererStatsFolder.d.ts +10 -0
- package/build/tweakpane/blades/rendererStatsFolder.d.ts.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Box3, Matrix4, Raycaster, Sphere, Vector3 } from "three";
|
|
2
|
+
import { MeshBVH } from "three-mesh-bvh";
|
|
3
|
+
import { LODLevel } from "./feature/LOD";
|
|
4
|
+
import { InstancedMesh2 } from "./InstancedMesh2";
|
|
5
|
+
export type onFrustumIntersectionCallback<T, U> = (nodeIndex: number) => void;
|
|
6
|
+
export type onFrustumIntersectionLODCallback<T, U> = (nodeIndex: number, level: number) => void;
|
|
7
|
+
export type onIntersectionCallback<T> = (nodeIndex: number) => void;
|
|
8
|
+
export type onIntersectionRayCallback<T> = (nodeIndex: number) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Parameters for configuring the BVH (Bounding Volume Hierarchy).
|
|
11
|
+
*/
|
|
12
|
+
export interface BVHParams {
|
|
13
|
+
/**
|
|
14
|
+
* Margin applied to accommodate animated or moving objects.
|
|
15
|
+
* Improves BVH update performance but slows down frustum culling and raycasting.
|
|
16
|
+
* For static objects, set to 0 to optimize culling and raycasting efficiency.
|
|
17
|
+
* @default 0
|
|
18
|
+
*/
|
|
19
|
+
margin?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Uses the geometry bounding sphere to compute instance bounding boxes.
|
|
22
|
+
* Otherwise it's calculated by applying the object's matrix to all 8 bounding box points.
|
|
23
|
+
* This is faster but less precise. Useful for moving objects.
|
|
24
|
+
* Only works if the geometry's bounding sphere is centered at the origin.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
getBBoxFromBSphere?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Enables accurate frustum culling by checking intersections without applying margin to the bounding box.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
accurateCulling?: boolean;
|
|
33
|
+
}
|
|
34
|
+
interface SphereTarget {
|
|
35
|
+
centerX: number;
|
|
36
|
+
centerY: number;
|
|
37
|
+
centerZ: number;
|
|
38
|
+
maxScale: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Class to manage BVH (Bounding Volume Hierarchy) for `InstancedMesh2`.
|
|
42
|
+
* Provides methods for managing bounding volumes, frustum culling, raycasting, and bounding box computation.
|
|
43
|
+
*/
|
|
44
|
+
export declare class InstancedMeshBVH {
|
|
45
|
+
/**
|
|
46
|
+
* The target `InstancedMesh2` object that the BVH is managing.
|
|
47
|
+
*/
|
|
48
|
+
target: InstancedMesh2;
|
|
49
|
+
/**
|
|
50
|
+
* The geometry bounding box of the target.
|
|
51
|
+
*/
|
|
52
|
+
geoBoundingBox: Box3;
|
|
53
|
+
/**
|
|
54
|
+
* The BVH instance used to organize bounding volumes.
|
|
55
|
+
*/
|
|
56
|
+
bvh: MeshBVH | null;
|
|
57
|
+
/**
|
|
58
|
+
* A map that stores the BVH nodes for each instance.
|
|
59
|
+
*/
|
|
60
|
+
nodesMap: Map<number, any>;
|
|
61
|
+
/**
|
|
62
|
+
* Enables accurate frustum culling by checking intersections without applying margin to the bounding box.
|
|
63
|
+
*/
|
|
64
|
+
accurateCulling: boolean;
|
|
65
|
+
protected LODsMap: Map<LODLevel<{}>[], Float32Array<ArrayBufferLike>>;
|
|
66
|
+
protected _margin: number;
|
|
67
|
+
protected _origin: Float32Array;
|
|
68
|
+
protected _dir: Float32Array;
|
|
69
|
+
protected _boxArray: Float32Array | null;
|
|
70
|
+
protected _cameraPos: Float32Array;
|
|
71
|
+
protected _getBoxFromSphere: boolean;
|
|
72
|
+
protected _geoBoundingSphere: Sphere | null;
|
|
73
|
+
protected _sphereTarget: SphereTarget | null;
|
|
74
|
+
/**
|
|
75
|
+
* @param target The target `InstancedMesh2`.
|
|
76
|
+
* @param margin The margin applied for bounding box calculations (default is 0).
|
|
77
|
+
* @param getBBoxFromBSphere Flag to determine if instance bounding boxes should be computed from the geometry bounding sphere. Faster but less precise (default is false).
|
|
78
|
+
* @param accurateCulling Flag to enable accurate frustum culling without considering margin (default is true).
|
|
79
|
+
*/
|
|
80
|
+
constructor(target: InstancedMesh2, margin?: number, getBBoxFromBSphere?: boolean, accurateCulling?: boolean);
|
|
81
|
+
/**
|
|
82
|
+
* Builds the BVH from the target mesh's instances using a top-down construction method.
|
|
83
|
+
* This approach is more efficient and accurate compared to incremental methods, which add one instance at a time.
|
|
84
|
+
* Note: Simplified implementation for three-mesh-bvh compatibility
|
|
85
|
+
*/
|
|
86
|
+
create(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Inserts an instance into the BVH.
|
|
89
|
+
* @param id The id of the instance to insert.
|
|
90
|
+
*/
|
|
91
|
+
insert(id: number): void;
|
|
92
|
+
/**
|
|
93
|
+
* Inserts a range of instances into the BVH.
|
|
94
|
+
* @param ids An array of ids to insert.
|
|
95
|
+
*/
|
|
96
|
+
insertRange(ids: number[]): void;
|
|
97
|
+
/**
|
|
98
|
+
* Moves an instance within the BVH.
|
|
99
|
+
* @param id The id of the instance to move.
|
|
100
|
+
*/
|
|
101
|
+
move(id: number): void;
|
|
102
|
+
/**
|
|
103
|
+
* Deletes an instance from the BVH.
|
|
104
|
+
* @param id The id of the instance to delete.
|
|
105
|
+
*/
|
|
106
|
+
delete(id: number): void;
|
|
107
|
+
/**
|
|
108
|
+
* Clears the BVH.
|
|
109
|
+
*/
|
|
110
|
+
clear(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Performs frustum culling to determine which instances are visible based on the provided projection matrix.
|
|
113
|
+
* @param projScreenMatrix The projection screen matrix for frustum culling.
|
|
114
|
+
* @param onFrustumIntersection Callback function invoked when an instance intersects the frustum.
|
|
115
|
+
* Note: Simplified implementation - BVH frustum culling disabled
|
|
116
|
+
*/
|
|
117
|
+
frustumCulling(projScreenMatrix: Matrix4, onFrustumIntersection: onFrustumIntersectionCallback<object, number>): void;
|
|
118
|
+
/**
|
|
119
|
+
* Performs frustum culling with Level of Detail (LOD) consideration.
|
|
120
|
+
* @param projScreenMatrix The projection screen matrix for frustum culling.
|
|
121
|
+
* @param cameraPosition The camera's position used for LOD calculations.
|
|
122
|
+
* @param levels An array of LOD levels.
|
|
123
|
+
* @param onFrustumIntersection Callback function invoked when an instance intersects the frustum.
|
|
124
|
+
* Note: Simplified implementation - BVH LOD culling disabled
|
|
125
|
+
*/
|
|
126
|
+
frustumCullingLOD(projScreenMatrix: Matrix4, cameraPosition: Vector3, levels: LODLevel[], onFrustumIntersection: onFrustumIntersectionLODCallback<object, number>): void;
|
|
127
|
+
/**
|
|
128
|
+
* Performs raycasting to check if a ray intersects any instances.
|
|
129
|
+
* @param raycaster The raycaster used for raycasting.
|
|
130
|
+
* @param onIntersection Callback function invoked when a ray intersects an instance.
|
|
131
|
+
* Note: Simplified implementation - BVH raycasting disabled
|
|
132
|
+
*/
|
|
133
|
+
raycast(raycaster: Raycaster, onIntersection: onIntersectionRayCallback<number>): void;
|
|
134
|
+
/**
|
|
135
|
+
* Checks if a given box intersects with any instance bounding box.
|
|
136
|
+
* @param target The target bounding box.
|
|
137
|
+
* @param onIntersection Callback function invoked when an intersection occurs.
|
|
138
|
+
* @returns `True` if there is an intersection, otherwise `false`.
|
|
139
|
+
* Note: Simplified implementation - BVH box intersection disabled
|
|
140
|
+
*/
|
|
141
|
+
intersectBox(target: Box3, onIntersection: onIntersectionCallback<number>): boolean;
|
|
142
|
+
protected getBox(id: number, array: Float32Array): Float32Array;
|
|
143
|
+
protected getSphereFromMatrix_centeredGeometry(id: number, array: Float32Array, target: SphereTarget): SphereTarget;
|
|
144
|
+
}
|
|
145
|
+
export {};
|
|
146
|
+
//# sourceMappingURL=InstancedMeshBVH.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstancedMeshBVH.d.ts","sourceRoot":"","sources":["../../../../../src/character/instancing/vendor/core/InstancedMeshBVH.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,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AY,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,sBAAsB,CAAC,MAAM,CAAC,GAAG,OAAO;IAM1F,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY;IAuB/D,SAAS,CAAC,oCAAoC,CAC5C,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,YAAY,GACnB,YAAY;CAyBhB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare module "../InstancedMesh2" {
|
|
2
|
+
interface InstancedMesh2 {
|
|
3
|
+
/**
|
|
4
|
+
* Resizes internal buffers to accommodate the specified capacity.
|
|
5
|
+
* This ensures that the buffers are large enough to handle the required number of instances.
|
|
6
|
+
* @param capacity The new capacity of the buffers.
|
|
7
|
+
* @returns The current `InstancedMesh2` instance.
|
|
8
|
+
*/
|
|
9
|
+
resizeBuffers(capacity: number): this;
|
|
10
|
+
/** @internal */ setInstancesArrayCount(count: number): void;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=Capacity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Capacity.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/feature/Capacity.ts"],"names":[],"mappings":"AAIA,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,cAAc;QACtB;;;;;WAKG;QACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACtC,gBAAgB,CAAC,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9D;CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Camera } from "three";
|
|
2
|
+
import { InstancedRenderItem } from "../utils/InstancedRenderList";
|
|
3
|
+
import { LODRenderList } from "./LOD";
|
|
4
|
+
/**
|
|
5
|
+
* A custom sorting callback for render items.
|
|
6
|
+
*/
|
|
7
|
+
export type CustomSortCallback = (list: InstancedRenderItem[]) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Callback invoked when an instance is within the frustum.
|
|
10
|
+
* @param index The index of the instance.
|
|
11
|
+
* @param camera The camera used for rendering.
|
|
12
|
+
* @param cameraLOD The camera used for LOD calculations (provided only if LODs are initialized).
|
|
13
|
+
* @param LODindex The LOD level of the instance (provided only if LODs are initialized and `sortObjects` is false).
|
|
14
|
+
* @returns True if the instance should be rendered, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export type OnFrustumEnterCallback = (index: number, camera: Camera, cameraLOD?: Camera, LODindex?: number) => boolean;
|
|
17
|
+
declare module "../InstancedMesh2" {
|
|
18
|
+
interface InstancedMesh2 {
|
|
19
|
+
/**
|
|
20
|
+
* Performs frustum culling and manages LOD visibility.
|
|
21
|
+
* @param camera The main camera used for rendering.
|
|
22
|
+
* @param cameraLOD An optional camera for LOD calculations. Defaults to the main camera.
|
|
23
|
+
*/
|
|
24
|
+
performFrustumCulling(camera: Camera, cameraLOD?: Camera): void;
|
|
25
|
+
/** @internal */ frustumCulling(camera: Camera): void;
|
|
26
|
+
/** @internal */ updateIndexArray(): void;
|
|
27
|
+
/** @internal */ updateRenderList(): void;
|
|
28
|
+
/** @internal */ BVHCulling(camera: Camera): void;
|
|
29
|
+
/** @internal */ linearCulling(camera: Camera): void;
|
|
30
|
+
/** @internal */ frustumCullingLOD(LODrenderList: LODRenderList, camera: Camera, cameraLOD: Camera): void;
|
|
31
|
+
/** @internal */ BVHCullingLOD(LODrenderList: LODRenderList, indexes: Uint32Array[], sortObjects: boolean, camera: Camera, cameraLOD: Camera): void;
|
|
32
|
+
/** @internal */ linearCullingLOD(LODrenderList: LODRenderList, indexes: Uint32Array[], sortObjects: boolean, camera: Camera, cameraLOD: Camera): void;
|
|
33
|
+
/** @internal */ getObjectLODIndexForDistance(levels: {
|
|
34
|
+
distance: number;
|
|
35
|
+
}[], distance: number): number;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=FrustumCulling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrustumCulling.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/feature/FrustumCulling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA+C,MAAM,OAAO,CAAC;AAI5E,OAAO,EAAE,mBAAmB,EAAuB,MAAM,8BAA8B,CAAC;AAExF,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAOtC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,IAAI,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,KACd,OAAO,CAAC;AAEb,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,cAAc;QACtB;;;;WAIG;QACH,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAEhE,gBAAgB,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtD,gBAAgB,CAAC,gBAAgB,IAAI,IAAI,CAAC;QAC1C,gBAAgB,CAAC,gBAAgB,IAAI,IAAI,CAAC;QAC1C,gBAAgB,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAClD,gBAAgB,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAErD,gBAAgB,CAAC,iBAAiB,CAChC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,IAAI,CAAC;QACR,gBAAgB,CAAC,aAAa,CAC5B,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,IAAI,CAAC;QACR,gBAAgB,CAAC,gBAAgB,CAC/B,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,IAAI,CAAC;QACR,gBAAgB,CAAC,4BAA4B,CAC3C,MAAM,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,EAAE,EAC9B,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC;KACX;CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { InstancedEntity } from "../InstancedEntity";
|
|
2
|
+
/**
|
|
3
|
+
* Represents an extended entity type with custom data.
|
|
4
|
+
*/
|
|
5
|
+
export type Entity<T> = InstancedEntity & T;
|
|
6
|
+
/**
|
|
7
|
+
* A callback function used to update or initialize an entity.
|
|
8
|
+
*/
|
|
9
|
+
export type UpdateEntityCallback<T = InstancedEntity> = (obj: Entity<T>, index: number) => void;
|
|
10
|
+
declare module "../InstancedMesh2" {
|
|
11
|
+
interface InstancedMesh2<TData = {}> {
|
|
12
|
+
/**
|
|
13
|
+
* Updates instances by applying a callback function to each instance. It calls `updateMatrix` for each instance.
|
|
14
|
+
* @param onUpdate A callback function to update each entity.
|
|
15
|
+
* @returns The current `InstancedMesh2` instance.
|
|
16
|
+
*/
|
|
17
|
+
updateInstances(onUpdate: UpdateEntityCallback<Entity<TData>>): this;
|
|
18
|
+
/**
|
|
19
|
+
* Updates instances position by applying a callback function to each instance. It calls `updateMatrixPosition` for each instance.
|
|
20
|
+
* This method updates only the position attributes of the matrix.
|
|
21
|
+
* @param onUpdate A callback function to update each entity.
|
|
22
|
+
* @returns The current `InstancedMesh2` instance.
|
|
23
|
+
*/
|
|
24
|
+
updateInstancesPosition(onUpdate: UpdateEntityCallback<Entity<TData>>): this;
|
|
25
|
+
/**
|
|
26
|
+
* Adds new instances and optionally initializes them using a callback function.
|
|
27
|
+
* @param count The number of new instances to add.
|
|
28
|
+
* @param onCreation An optional callback to initialize each new entity.
|
|
29
|
+
* @returns The current `InstancedMesh2` instance.
|
|
30
|
+
*/
|
|
31
|
+
addInstances(count: number, onCreation?: UpdateEntityCallback<Entity<TData>>): this;
|
|
32
|
+
/**
|
|
33
|
+
* Removes instances by their ids.
|
|
34
|
+
* @param ids The ids of the instances to remove.
|
|
35
|
+
* @returns The current `InstancedMesh2` instance.
|
|
36
|
+
*/
|
|
37
|
+
removeInstances(...ids: number[]): this;
|
|
38
|
+
/**
|
|
39
|
+
* Clears all instances and resets the instance count.
|
|
40
|
+
* @returns The current `InstancedMesh2` instance.
|
|
41
|
+
*/
|
|
42
|
+
clearInstances(): this;
|
|
43
|
+
/** @internal */ clearTempInstance(index: number): InstancedEntity;
|
|
44
|
+
/** @internal */ clearTempInstancePosition(index: number): InstancedEntity;
|
|
45
|
+
/** @internal */ clearInstance(instance: InstancedEntity): InstancedEntity;
|
|
46
|
+
/** @internal */ createEntities(start: number): this;
|
|
47
|
+
/** @internal */ addInstance(id: number, onCreation?: UpdateEntityCallback): void;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=Instances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Instances.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/feature/Instances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAKrD;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,eAAe,GAAG,CAAC,CAAC;AAC5C;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,eAAe,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAEhG,OAAO,QAAQ,mBAAmB,CAAC;IAEjC,UAAU,cAAc,CAAC,KAAK,GAAG,EAAE;QACjC;;;;WAIG;QACH,eAAe,CAAC,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;QACrE;;;;;WAKG;QACH,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;QAC7E;;;;;WAKG;QACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;QACpF;;;;WAIG;QACH,eAAe,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACxC;;;WAGG;QACH,cAAc,IAAI,IAAI,CAAC;QACvB,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC;QACnE,gBAAgB,CAAC,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC;QAC3E,gBAAgB,CAAC,aAAa,CAAC,QAAQ,EAAE,eAAe,GAAG,eAAe,CAAC;QAC3E,gBAAgB,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrD,gBAAgB,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;KACnF;CACF"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { BufferGeometry, Material } from "three";
|
|
2
|
+
import { InstancedMesh2 } from "../InstancedMesh2";
|
|
3
|
+
/**
|
|
4
|
+
* Represents information about Level of Detail (LOD).
|
|
5
|
+
* @template TData Type for additional instance data.
|
|
6
|
+
*/
|
|
7
|
+
export interface LODInfo<TData = {}> {
|
|
8
|
+
/**
|
|
9
|
+
* Render settings for the LOD.
|
|
10
|
+
*/
|
|
11
|
+
render: LODRenderList<TData>;
|
|
12
|
+
/**
|
|
13
|
+
* Shadow rendering settings for the LOD.
|
|
14
|
+
*/
|
|
15
|
+
shadowRender: LODRenderList<TData>;
|
|
16
|
+
/**
|
|
17
|
+
* List of `InstancedMesh2` associated to LODs.
|
|
18
|
+
*/
|
|
19
|
+
objects: InstancedMesh2<TData>[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Represents a list of render levels for LOD.
|
|
23
|
+
* @template TData Type for additional instance data.
|
|
24
|
+
*/
|
|
25
|
+
export interface LODRenderList<TData = {}> {
|
|
26
|
+
/**
|
|
27
|
+
* Array of LOD levels.
|
|
28
|
+
*/
|
|
29
|
+
levels: LODLevel<TData>[];
|
|
30
|
+
/**
|
|
31
|
+
* Array of instance counts per LOD level, used internally.
|
|
32
|
+
*/
|
|
33
|
+
count: number[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents a single LOD level.
|
|
37
|
+
* @template TData Type for additional instance data.
|
|
38
|
+
*/
|
|
39
|
+
export interface LODLevel<TData = {}> {
|
|
40
|
+
/**
|
|
41
|
+
* The squared distance at which this LOD level becomes active.
|
|
42
|
+
*/
|
|
43
|
+
distance: number;
|
|
44
|
+
/**
|
|
45
|
+
* Hysteresis value to prevent LOD flickering when transitioning.
|
|
46
|
+
*/
|
|
47
|
+
hysteresis: number;
|
|
48
|
+
/**
|
|
49
|
+
* The `InstancedMesh2` object associated with this LOD level.
|
|
50
|
+
*/
|
|
51
|
+
object: InstancedMesh2<TData>;
|
|
52
|
+
}
|
|
53
|
+
declare module "../InstancedMesh2" {
|
|
54
|
+
interface InstancedMesh2 {
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves the index of the LOD level for a given distance.
|
|
57
|
+
* @param levels The array of LOD levels.
|
|
58
|
+
* @param distance The squared distance from the camera to the object.
|
|
59
|
+
* @returns The index of the LOD level that should be used.
|
|
60
|
+
*/
|
|
61
|
+
getObjectLODIndexForDistance(levels: LODLevel[], distance: number): number;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the first LOD (using current geometry) distance and hysteresis.
|
|
64
|
+
* @param distance The distance for the first LOD.
|
|
65
|
+
* @param hysteresis The hysteresis value for the first LOD.
|
|
66
|
+
* @returns The current `InstancedMesh2` instance.
|
|
67
|
+
*/
|
|
68
|
+
setFirstLODDistance(distance?: number, hysteresis?: number): this;
|
|
69
|
+
/**
|
|
70
|
+
* Adds a new LOD level with the given geometry, material, and distance.
|
|
71
|
+
* @param geometry The geometry for the LOD level.
|
|
72
|
+
* @param material The material for the LOD level.
|
|
73
|
+
* @param distance The distance for this LOD level.
|
|
74
|
+
* @param hysteresis The hysteresis value for this LOD level.
|
|
75
|
+
* @returns The current `InstancedMesh2` instance.
|
|
76
|
+
*/
|
|
77
|
+
addLOD(geometry: BufferGeometry, material: Material | Material[], distance?: number, hysteresis?: number): this;
|
|
78
|
+
/**
|
|
79
|
+
* Adds a shadow-specific LOD level with the given geometry and distance.
|
|
80
|
+
* @param geometry The geometry for the shadow LOD.
|
|
81
|
+
* @param distance The distance for this LOD level.
|
|
82
|
+
* @param hysteresis The hysteresis value for this LOD level.
|
|
83
|
+
* @returns The current `InstancedMesh2` instance.
|
|
84
|
+
*/
|
|
85
|
+
addShadowLOD(geometry: BufferGeometry, distance?: number, hysteresis?: number): this;
|
|
86
|
+
/** @internal */ addLevel(renderList: LODRenderList, geometry: BufferGeometry, material: Material | Material[], distance: number, hysteresis: number): InstancedMesh2;
|
|
87
|
+
/** @internal */ patchLevel(obj: InstancedMesh2): void;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=LOD.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LOD.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/feature/LOD.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrF,gBAAgB,CAAC,QAAQ,CACvB,UAAU,EAAE,aAAa,EACzB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,QAAQ,GAAG,QAAQ,EAAE,EAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,cAAc,CAAC;QAClB,gBAAgB,CAAC,UAAU,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,CAAC;KACxD;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Mesh } from "three";
|
|
2
|
+
declare module "../InstancedMesh2" {
|
|
3
|
+
interface InstancedMesh2 {
|
|
4
|
+
/**
|
|
5
|
+
* Gets the morph target data for a specific instance.
|
|
6
|
+
* @param id The index of the instance.
|
|
7
|
+
* @param object Optional `Mesh` to store the morph target data.
|
|
8
|
+
* @returns The mesh object with updated morph target influences.
|
|
9
|
+
*/
|
|
10
|
+
getMorphAt(id: number, object?: Mesh): Mesh;
|
|
11
|
+
/**
|
|
12
|
+
* Sets the morph target influences for a specific instance.
|
|
13
|
+
* @param id The index of the instance.
|
|
14
|
+
* @param object The `Mesh` containing the morph target influences to apply.
|
|
15
|
+
*/
|
|
16
|
+
setMorphAt(id: number, object: Mesh): void;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Morph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Morph.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/feature/Morph.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,IAAI,EAAa,MAAM,OAAO,CAAC;AAIhE,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,cAAc;QACtB;;;;;WAKG;QACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;QAC5C;;;;WAIG;QACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;KAC5C;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Intersection, Raycaster } from "three";
|
|
2
|
+
declare module "../InstancedMesh2" {
|
|
3
|
+
interface InstancedMesh2 {
|
|
4
|
+
/** @internal */ raycastInstances(raycaster: Raycaster, result: Intersection[]): void;
|
|
5
|
+
/** @internal */ checkObjectIntersection(raycaster: Raycaster, objectIndex: number, result: Intersection[]): void;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Raycasting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Raycasting.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/feature/Raycasting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsB,SAAS,EAAmB,MAAM,OAAO,CAAC;AAIrF,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,cAAc;QACtB,gBAAgB,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;QACtF,gBAAgB,CAAC,uBAAuB,CACtC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,YAAY,EAAE,GACrB,IAAI,CAAC;KACT;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Matrix4, Skeleton } from "three";
|
|
2
|
+
declare module "../InstancedMesh2" {
|
|
3
|
+
interface InstancedMesh2 {
|
|
4
|
+
/**
|
|
5
|
+
* Initialize the skeleton of the instances.
|
|
6
|
+
* @param skeleton The skeleton to initialize.
|
|
7
|
+
* @param disableMatrixAutoUpdate Whether to disable the matrix auto update of the bones. Default is `true`.
|
|
8
|
+
*/
|
|
9
|
+
initSkeleton(skeleton: Skeleton, disableMatrixAutoUpdate?: boolean): void;
|
|
10
|
+
/**
|
|
11
|
+
* Set the bones of the skeleton to the instance at the specified index.
|
|
12
|
+
* @param id The index of the instance.
|
|
13
|
+
* @param updateBonesMatrices Whether to update the matrices of the bones. Default is `true`.
|
|
14
|
+
* @param excludeBonesSet An optional set of bone names to exclude from updates, skipping their local matrix updates.
|
|
15
|
+
*/
|
|
16
|
+
setBonesAt(id: number, updateBonesMatrices?: boolean): void;
|
|
17
|
+
/** internal */ multiplyBoneMatricesAt(instanceIndex: number, boneIndex: number, m1: Matrix4, m2: Matrix4): void;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=Skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/feature/Skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAK1C,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAU,cAAc;QACtB;;;;WAIG;QACH,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,uBAAuB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAC1E;;;;;WAKG;QACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAC5D,eAAe,CAAC,sBAAsB,CACpC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,OAAO,EACX,EAAE,EAAE,OAAO,GACV,IAAI,CAAC;KACT;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ChannelSize, UniformMap, UniformType, UniformValue, UniformValueObj } from "../utils/SquareDataTexture";
|
|
2
|
+
type UniformSchema = {
|
|
3
|
+
[x: string]: UniformType;
|
|
4
|
+
};
|
|
5
|
+
type UniformSchemaShader = {
|
|
6
|
+
vertex?: UniformSchema;
|
|
7
|
+
fragment?: UniformSchema;
|
|
8
|
+
};
|
|
9
|
+
type UniformSchemaResult = {
|
|
10
|
+
channels: ChannelSize;
|
|
11
|
+
pixelsPerInstance: number;
|
|
12
|
+
uniformMap: UniformMap;
|
|
13
|
+
fetchInFragmentShader: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare module "../InstancedMesh2" {
|
|
16
|
+
interface InstancedMesh2 {
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves a uniform value for a specific instance.
|
|
19
|
+
* @param id The index of the instance.
|
|
20
|
+
* @param name The name of the uniform.
|
|
21
|
+
* @param target Optional target object to store the uniform value.
|
|
22
|
+
* @returns The uniform value for the specified instance.
|
|
23
|
+
*/
|
|
24
|
+
getUniformAt(id: number, name: string, target?: UniformValueObj): UniformValue;
|
|
25
|
+
/**
|
|
26
|
+
* Sets a uniform value for a specific instance.
|
|
27
|
+
* @param id The index of the instance.
|
|
28
|
+
* @param name The name of the uniform.
|
|
29
|
+
* @param value The value to set for the uniform.
|
|
30
|
+
*/
|
|
31
|
+
setUniformAt(id: number, name: string, value: UniformValue): void;
|
|
32
|
+
/**
|
|
33
|
+
* Initializes per-instance uniforms using a schema.
|
|
34
|
+
* @param schema The schema defining the uniforms.
|
|
35
|
+
*/
|
|
36
|
+
initUniformsPerInstance(schema: UniformSchemaShader): void;
|
|
37
|
+
/** @internal */ getUniformSchemaResult(schema: UniformSchemaShader): UniformSchemaResult;
|
|
38
|
+
/** @internal */ getUniformOffset(size: number, tempOffset: number[]): number;
|
|
39
|
+
/** @internal */ getUniformSize(type: UniformType): number;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=Uniforms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Uniforms.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/feature/Uniforms.ts"],"names":[],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ffer attributes.
|
|
4
|
+
* This class was specifically created to allow updating instanced buffer attributes during the `onBeforeRender` callback,
|
|
5
|
+
* providing an efficient way to modify the buffer data dynamically before rendering.
|
|
6
|
+
*/
|
|
7
|
+
export declare class GLInstancedBufferAttribute extends GLBufferAttribute {
|
|
8
|
+
/**
|
|
9
|
+
* Indicates if this is an `isGLInstancedBufferAttribute`.
|
|
10
|
+
*/
|
|
11
|
+
isGLInstancedBufferAttribute: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The number of meshes that share the same attribute data.
|
|
14
|
+
*/
|
|
15
|
+
meshPerAttribute: number;
|
|
16
|
+
/**
|
|
17
|
+
* The data array that holds the attribute values.
|
|
18
|
+
*/
|
|
19
|
+
array: TypedArray;
|
|
20
|
+
protected _cacheArray: TypedArray;
|
|
21
|
+
/** @internal */ _needsUpdate: boolean;
|
|
22
|
+
/** @internal */ isInstancedBufferAttribute: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* @param gl The WebGL2RenderingContext used to create the buffer.
|
|
25
|
+
* @param type The type of data in the attribute.
|
|
26
|
+
* @param itemSize The number of elements per attribute.
|
|
27
|
+
* @param elementSize The size of individual elements in the array.
|
|
28
|
+
* @param array The data array that holds the attribute values.
|
|
29
|
+
* @param meshPerAttribute The number of meshes that share the same attribute data.
|
|
30
|
+
*/
|
|
31
|
+
constructor(gl: WebGL2RenderingContext, type: GLenum, itemSize: number, elementSize: 1 | 2 | 4, array: TypedArray, meshPerAttribute?: number);
|
|
32
|
+
/**
|
|
33
|
+
* Updates the buffer data.
|
|
34
|
+
* This method is designed to be called during the `onBeforeRender` callback.
|
|
35
|
+
* It ensures that the attribute data is updated just before the rendering process begins.
|
|
36
|
+
* @param renderer The WebGLRenderer used to render the scene.
|
|
37
|
+
* @param count The number of elements to update in the buffer.
|
|
38
|
+
*/
|
|
39
|
+
update(renderer: WebGLRenderer, count: number): void;
|
|
40
|
+
/** @internal */
|
|
41
|
+
clone(): this;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=GLInstancedBufferAttribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GLInstancedBufferAttribute.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/utils/GLInstancedBufferAttribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAErE;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,iBAAiB;IAC/D;;OAEG;IACI,4BAA4B,UAAQ;IAC3C;;OAEG;IACI,gBAAgB,EAAE,MAAM,CAAC;IAChC;;OAEG;IACI,KAAK,EAAE,UAAU,CAAC;IACzB,SAAS,CAAC,WAAW,EAAE,UAAU,CAAC;IAClC,gBAAgB,CAAC,YAAY,UAAS;IAGtC,gBAAgB,CAAC,0BAA0B,UAAQ;IAEnD;;;;;;;OAOG;gBAED,EAAE,EAAE,sBAAsB,EAC1B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EACtB,KAAK,EAAE,UAAU,EACjB,gBAAgB,SAAI;IAatB;;;;;;OAMG;IACI,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAgB3D,gBAAgB;IACT,KAAK,IAAI,IAAI;CAIrB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type InstancedRenderItem = {
|
|
2
|
+
index: number;
|
|
3
|
+
depth: number;
|
|
4
|
+
depthSort: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A class that creates and manages a list of render items, used to determine the rendering order based on depth.
|
|
8
|
+
*/
|
|
9
|
+
export declare class InstancedRenderList {
|
|
10
|
+
/**
|
|
11
|
+
* The main array that holds the list of render items for instanced rendering.
|
|
12
|
+
*/
|
|
13
|
+
array: InstancedRenderItem[];
|
|
14
|
+
protected pool: InstancedRenderItem[];
|
|
15
|
+
/**
|
|
16
|
+
* Adds a new render item to the list.
|
|
17
|
+
* @param depth The depth value used for sorting or determining the rendering order.
|
|
18
|
+
* @param index The unique instance id of the render item.
|
|
19
|
+
*/
|
|
20
|
+
push(depth: number, index: number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Resets the render list by clearing the array.
|
|
23
|
+
*/
|
|
24
|
+
reset(): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=InstancedRenderList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstancedRenderList.d.ts","sourceRoot":"","sources":["../../../../../../src/character/instancing/vendor/core/utils/InstancedRenderList.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtF;;GAEG;AACH,qBAAa,mBAAmB;IAC9B;;OAEG;IACI,KAAK,EAAE,mBAAmB,EAAE,CAAM;IACzC,SAAS,CAAC,IAAI,EAAE,mBAAmB,EAAE,CAAM;IAE3C;;;;OAIG;IACI,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAgB/C;;OAEG;IACI,KAAK,IAAI,IAAI;CAGrB"}
|