@mml-io/3d-web-client-core 0.24.2 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/build/camera/CameraManager.d.ts +47 -11
  2. package/build/camera/CameraManager.d.ts.map +1 -0
  3. package/build/character/AnimationMixer.d.ts +74 -0
  4. package/build/character/AnimationMixer.d.ts.map +1 -0
  5. package/build/character/CharacterManager.d.ts +30 -43
  6. package/build/character/CharacterManager.d.ts.map +1 -0
  7. package/build/character/CharacterState.d.ts +1 -0
  8. package/build/character/CharacterState.d.ts.map +1 -0
  9. package/build/character/LocalController.d.ts +12 -8
  10. package/build/character/LocalController.d.ts.map +1 -0
  11. package/build/character/RemoteController.d.ts +14 -10
  12. package/build/character/RemoteController.d.ts.map +1 -0
  13. package/build/character/Spawning.d.ts +1 -0
  14. package/build/character/Spawning.d.ts.map +1 -0
  15. package/build/character/types.d.ts +8 -0
  16. package/build/character/types.d.ts.map +1 -0
  17. package/build/character/url-position.d.ts +9 -3
  18. package/build/character/url-position.d.ts.map +1 -0
  19. package/build/collisions/CollisionsManager.d.ts +24 -15
  20. package/build/collisions/CollisionsManager.d.ts.map +1 -0
  21. package/build/collisions/getRelativePositionAndRotationRelativeToObject.d.ts +3 -2
  22. package/build/collisions/getRelativePositionAndRotationRelativeToObject.d.ts.map +1 -0
  23. package/build/error-screen/ErrorScreen.d.ts +1 -0
  24. package/build/error-screen/ErrorScreen.d.ts.map +1 -0
  25. package/build/helpers/math-helpers.d.ts +3 -2
  26. package/build/helpers/math-helpers.d.ts.map +1 -0
  27. package/build/index.d.ts +8 -11
  28. package/build/index.d.ts.map +1 -0
  29. package/build/index.js +2460 -11917
  30. package/build/index.js.map +4 -4
  31. package/build/input/EventHandlerCollection.d.ts +1 -0
  32. package/build/input/EventHandlerCollection.d.ts.map +1 -0
  33. package/build/input/KeyInputManager.d.ts +1 -0
  34. package/build/input/KeyInputManager.d.ts.map +1 -0
  35. package/build/input/VirtualJoystick.d.ts +1 -0
  36. package/build/input/VirtualJoystick.d.ts.map +1 -0
  37. package/build/loading-screen/LoadingScreen.d.ts +1 -0
  38. package/build/loading-screen/LoadingScreen.d.ts.map +1 -0
  39. package/build/math/Box.d.ts +2 -1
  40. package/build/math/Box.d.ts.map +1 -0
  41. package/build/math/EulXYZ.d.ts +7 -1
  42. package/build/math/EulXYZ.d.ts.map +1 -0
  43. package/build/math/Line.d.ts +1 -0
  44. package/build/math/Line.d.ts.map +1 -0
  45. package/build/math/Matr4.d.ts +24 -3
  46. package/build/math/Matr4.d.ts.map +1 -0
  47. package/build/math/Quat.d.ts +8 -1
  48. package/build/math/Quat.d.ts.map +1 -0
  49. package/build/math/Ray.d.ts +1 -0
  50. package/build/math/Ray.d.ts.map +1 -0
  51. package/build/math/Vect3.d.ts +4 -3
  52. package/build/math/Vect3.d.ts.map +1 -0
  53. package/build/math/index.d.ts +1 -0
  54. package/build/math/index.d.ts.map +1 -0
  55. package/build/math/radToDeg.d.ts +1 -0
  56. package/build/math/radToDeg.d.ts.map +1 -0
  57. package/build/rendering/IRenderer.d.ts +141 -0
  58. package/build/rendering/IRenderer.d.ts.map +1 -0
  59. package/build/tweakpane/TweakPane.d.ts +11 -28
  60. package/build/tweakpane/TweakPane.d.ts.map +1 -0
  61. package/build/tweakpane/blades/cameraFolder.d.ts +5 -49
  62. package/build/tweakpane/blades/cameraFolder.d.ts.map +1 -0
  63. package/build/tweakpane/blades/characterControlsFolder.d.ts +5 -59
  64. package/build/tweakpane/blades/characterControlsFolder.d.ts.map +1 -0
  65. package/build/tweakpane/tweakPaneActivity.d.ts +1 -0
  66. package/build/tweakpane/tweakPaneActivity.d.ts.map +1 -0
  67. package/build/tweakpane/tweakPaneStyle.d.ts +1 -0
  68. package/build/tweakpane/tweakPaneStyle.d.ts.map +1 -0
  69. package/package.json +4 -14
  70. package/build/character/CanvasText.d.ts +0 -34
  71. package/build/character/Character.d.ts +0 -71
  72. package/build/character/CharacterMaterial.d.ts +0 -19
  73. package/build/character/CharacterModel.d.ts +0 -44
  74. package/build/character/CharacterTooltip.d.ts +0 -32
  75. package/build/character/LowPolyModel.d.ts +0 -1
  76. package/build/character/instancing/CharacterColourSamplingUtils.d.ts +0 -14
  77. package/build/character/instancing/CharacterInstances.d.ts +0 -92
  78. package/build/character/instancing/CharacterInstancingAnimationUtils.d.ts +0 -7
  79. package/build/character/instancing/CharacterInstancingUtils.d.ts +0 -3
  80. package/build/character/instancing/vendor/core/InstancedEntity.d.ts +0 -191
  81. package/build/character/instancing/vendor/core/InstancedMesh2.d.ts +0 -361
  82. package/build/character/instancing/vendor/core/InstancedMeshBVH.d.ts +0 -145
  83. package/build/character/instancing/vendor/core/feature/Capacity.d.ts +0 -13
  84. package/build/character/instancing/vendor/core/feature/FrustumCulling.d.ts +0 -37
  85. package/build/character/instancing/vendor/core/feature/Instances.d.ts +0 -49
  86. package/build/character/instancing/vendor/core/feature/LOD.d.ts +0 -89
  87. package/build/character/instancing/vendor/core/feature/Morph.d.ts +0 -18
  88. package/build/character/instancing/vendor/core/feature/Raycasting.d.ts +0 -7
  89. package/build/character/instancing/vendor/core/feature/Skeleton.d.ts +0 -19
  90. package/build/character/instancing/vendor/core/feature/Uniforms.d.ts +0 -42
  91. package/build/character/instancing/vendor/core/utils/GLInstancedBufferAttribute.d.ts +0 -42
  92. package/build/character/instancing/vendor/core/utils/InstancedRenderList.d.ts +0 -25
  93. package/build/character/instancing/vendor/core/utils/SquareDataTexture.d.ts +0 -156
  94. package/build/character/instancing/vendor/index.d.ts +0 -25
  95. package/build/character/instancing/vendor/shaders/ShaderChunk.d.ts +0 -1
  96. package/build/character/instancing/vendor/shaders/chunks/instanced_color_pars_vertex.d.ts +0 -1
  97. package/build/character/instancing/vendor/shaders/chunks/instanced_color_vertex.d.ts +0 -1
  98. package/build/character/instancing/vendor/shaders/chunks/instanced_material_color_pars_vertex.d.ts +0 -1
  99. package/build/character/instancing/vendor/shaders/chunks/instanced_material_color_vertex.d.ts +0 -1
  100. package/build/character/instancing/vendor/shaders/chunks/instanced_pars_vertex.d.ts +0 -1
  101. package/build/character/instancing/vendor/shaders/chunks/instanced_skinning_pars_vertex.d.ts +0 -1
  102. package/build/character/instancing/vendor/shaders/chunks/instanced_vertex.d.ts +0 -1
  103. package/build/character/instancing/vendor/utils/CreateFrom.d.ts +0 -9
  104. package/build/character/instancing/vendor/utils/SortingUtils.d.ts +0 -16
  105. package/build/character/loading/CharacterModelLoader.d.ts +0 -11
  106. package/build/character/loading/GLTFLoadingWorker.worker.d.ts +0 -2
  107. package/build/character/loading/GLTFLoadingWorkerBrowserCache.d.ts +0 -8
  108. package/build/character/loading/GLTFLoadingWorkerPool.d.ts +0 -22
  109. package/build/character/loading/GLTFLoadingWorkerTypes.d.ts +0 -18
  110. package/build/ground-plane/GroundPlane.d.ts +0 -9
  111. package/build/mml/MMLCompositionScene.d.ts +0 -29
  112. package/build/rendering/PostProcessingManager.d.ts +0 -92
  113. package/build/rendering/composer.d.ts +0 -104
  114. package/build/rendering/post-effects/bright-contrast-sat.d.ts +0 -2
  115. package/build/rendering/post-effects/gauss-grain.d.ts +0 -2
  116. package/build/rendering/post-effects/n8-ssao/BlueNoise.d.ts +0 -1
  117. package/build/rendering/post-effects/n8-ssao/DepthDownSample.d.ts +0 -17
  118. package/build/rendering/post-effects/n8-ssao/EffectCompositer.d.ts +0 -39
  119. package/build/rendering/post-effects/n8-ssao/EffectShader.d.ts +0 -31
  120. package/build/rendering/post-effects/n8-ssao/FullScreenTriangle.d.ts +0 -11
  121. package/build/rendering/post-effects/n8-ssao/N8SSAOPass.d.ts +0 -65
  122. package/build/rendering/post-effects/n8-ssao/PoissionBlur.d.ts +0 -30
  123. package/build/rendering/shaders/bayer-dither.d.ts +0 -1
  124. package/build/rendering/shaders/shader-helpers.d.ts +0 -4
  125. package/build/rendering/shaders/vertex-shader.d.ts +0 -1
  126. package/build/sun/Sun.d.ts +0 -18
  127. package/build/time/TimeManager.d.ts +0 -20
  128. package/build/tweakpane/blades/characterFolder.d.ts +0 -20
  129. package/build/tweakpane/blades/effects/bcsFolder.d.ts +0 -12
  130. package/build/tweakpane/blades/effects/bloomAndGrain.d.ts +0 -12
  131. package/build/tweakpane/blades/effects/ssaoFolder.d.ts +0 -49
  132. package/build/tweakpane/blades/effects/toneMappingFolder.d.ts +0 -18
  133. package/build/tweakpane/blades/environmentFolder.d.ts +0 -53
  134. package/build/tweakpane/blades/postProcessingFolder.d.ts +0 -31
  135. package/build/tweakpane/blades/rendererFolder.d.ts +0 -13
  136. package/build/tweakpane/blades/rendererStatsFolder.d.ts +0 -10
@@ -1,361 +0,0 @@
1
- import { BindMode, Box3, BufferGeometry, Camera, Color, ColorRepresentation, DataTexture, InstancedBufferAttribute, Material, Matrix4, Mesh, Object3D, Object3DEventMap, Scene, Skeleton, Sphere, Vector3, WebGLProgramParametersWithUniforms, WebGLRenderer } from "three";
2
- import { ColorPartName } from "../../../CharacterModel";
3
- import { CustomSortCallback, OnFrustumEnterCallback } from "./feature/FrustumCulling";
4
- import { Entity } from "./feature/Instances";
5
- import { LODInfo } from "./feature/LOD";
6
- import { InstancedEntity } from "./InstancedEntity";
7
- import { BVHParams, InstancedMeshBVH } from "./InstancedMeshBVH";
8
- import { GLInstancedBufferAttribute } from "./utils/GLInstancedBufferAttribute";
9
- import { SquareDataTexture } from "./utils/SquareDataTexture";
10
- /**
11
- * Parameters for configuring an `InstancedMesh2` instance.
12
- */
13
- export interface InstancedMesh2Params {
14
- /**
15
- * Determines the maximum number of instances that buffers can hold.
16
- * The buffers will be expanded automatically if necessary.
17
- * @default 1000
18
- */
19
- capacity?: number;
20
- /**
21
- * Determines whether to create an array of `InstancedEntity` to easily manipulate instances at the cost of more memory.
22
- * @default false
23
- */
24
- createEntities?: boolean;
25
- /**
26
- * Determines whether `InstancedEntity` can use the `rotation` property.
27
- * If `true` `quaternion` and `rotation` will be synchronized, affecting performance.
28
- * @default false
29
- */
30
- allowsEuler?: boolean;
31
- /**
32
- * WebGL renderer instance.
33
- * If not provided, buffers will be initialized during the first render, resulting in no instances being rendered initially.
34
- * @default null
35
- */
36
- renderer?: WebGLRenderer;
37
- }
38
- /**
39
- * Alternative `InstancedMesh` class to support additional features like frustum culling, fast raycasting, LOD and more.
40
- * @template TData Type for additional instance data.
41
- * @template TGeometry Type extending `BufferGeometry`.
42
- * @template TMaterial Type extending `Material` or an array of `Material`.
43
- * @template TEventMap Type extending `Object3DEventMap`.
44
- */
45
- export declare class InstancedMesh2<TData = {}, TGeometry extends BufferGeometry = BufferGeometry, TMaterial extends Material | Material[] = Material | Material[], TEventMap extends Object3DEventMap = Object3DEventMap> extends Mesh<TGeometry, TMaterial, TEventMap> {
46
- /**
47
- * The number of instances rendered in the last frame.
48
- */
49
- count: number;
50
- /**
51
- * @defaultValue `InstancedMesh2`
52
- */
53
- readonly type = "InstancedMesh2";
54
- /**
55
- * Indicates if this is an `InstancedMesh2`.
56
- */
57
- readonly isInstancedMesh2 = true;
58
- /**
59
- * An array of `Entity` representing individual instances.
60
- * This array is only initialized if `createEntities` is set to `true` in the constructor parameters.
61
- */
62
- instances: Entity<TData>[] | null;
63
- /**
64
- * Attribute storing indices of the instances to be rendered.
65
- */
66
- instanceIndex: GLInstancedBufferAttribute | null;
67
- /**
68
- * Texture storing matrices for instances.
69
- */
70
- matricesTexture: SquareDataTexture;
71
- /**
72
- * Texture storing colors for instances.
73
- */
74
- colorsTexture: SquareDataTexture | null;
75
- /**
76
- * Texture storing multiple colors per instance for per-material coloring.
77
- * Stores 8 colors per instance (hair, shirt_short, shirt_long, pants_short, pants_long, shoes, skin, lips)
78
- * Each row stores 2 colors (8 floats), so we need 4 pixels per instance (4 * 2 = 8 colors)
79
- */
80
- materialColorsTexture: SquareDataTexture | null;
81
- /**
82
- * Texture storing morph target influences for instances.
83
- */
84
- morphTexture: DataTexture | null;
85
- /**
86
- * Texture storing bones for instances.
87
- */
88
- boneTexture: SquareDataTexture | null;
89
- /**
90
- * Texture storing custom uniforms per instance.
91
- */
92
- uniformsTexture: SquareDataTexture | null;
93
- /**
94
- * This bounding box encloses all instances, which can be calculated with `computeBoundingBox` method.
95
- * Bounding box isn't computed by default. It needs to be explicitly computed, otherwise it's `null`.
96
- */
97
- boundingBox: Box3 | null;
98
- /**
99
- * This bounding sphere encloses all instances, which can be calculated with `computeBoundingSphere` method.
100
- * Bounding sphere is computed during its first render. You may need to recompute it if an instance is transformed.
101
- */
102
- boundingSphere: Sphere | null;
103
- /**
104
- * BVH structure for optimized culling and intersection testing.
105
- * It's possible to create the BVH using the `computeBVH` method. Once created it will be updated automatically.
106
- */
107
- bvh: InstancedMeshBVH | null;
108
- /**
109
- * Custom sort function for instances.
110
- * It's possible to create the radix sort using the `createRadixSort` method.
111
- * @default null
112
- */
113
- customSort: CustomSortCallback | null;
114
- /**
115
- * Flag indicating if raycasting should only consider the last frame frustum culled instances.
116
- * This is ignored if the bvh has been created.
117
- * @default false
118
- */
119
- raycastOnlyFrustum: boolean;
120
- /**
121
- * Array storing visibility and availability for instances.
122
- * [visible0, active0, visible1, active1, ...]
123
- */
124
- readonly availabilityArray: boolean[];
125
- /**
126
- * Contains data for managing LOD, allowing different levels of detail for rendering and shadow casting.
127
- */
128
- LODinfo: LODInfo<TData> | null;
129
- /**
130
- * Flag indicating whether to automatically perform frustum culling before rendering.
131
- * @default true
132
- */
133
- autoUpdate: boolean;
134
- /**
135
- * Either `AttachedBindMode` or `DetachedBindMode`. `AttachedBindMode` means the skinned mesh shares the same world space as the skeleton.
136
- * This is not true when using `DetachedBindMode` which is useful when sharing a skeleton across multiple skinned meshes.
137
- * @default `AttachedBindMode`
138
- */
139
- bindMode: BindMode;
140
- /**
141
- * The base matrix that is used for the bound bone transforms.
142
- */
143
- bindMatrix: Matrix4 | null;
144
- /**
145
- * The base matrix that is used for resetting the bound bone transforms.
146
- */
147
- bindMatrixInverse: Matrix4 | null;
148
- /**
149
- * Skeleton representing the bone hierarchy of the skinned mesh.
150
- */
151
- skeleton: Skeleton | null;
152
- /**
153
- * Callback function called if an instance is inside the frustum.
154
- */
155
- onFrustumEnter: OnFrustumEnterCallback | null;
156
- /** @internal */ _renderer: WebGLRenderer | null;
157
- /** @internal */ _instancesCount: number;
158
- /** @internal */ _instancesArrayCount: number;
159
- /** @internal */ _perObjectFrustumCulled: boolean;
160
- /** @internal */ _sortObjects: boolean;
161
- /** @internal */ _capacity: number;
162
- /** @internal */ _indexArrayNeedsUpdate: boolean;
163
- /** @internal */ _geometry: TGeometry;
164
- /** @internal */ _parentLOD: InstancedMesh2;
165
- protected readonly _allowsEuler: boolean;
166
- protected readonly _tempInstance: InstancedEntity;
167
- protected _useOpacity: boolean;
168
- protected _currentMaterial: Material | null;
169
- protected _customProgramCacheKeyBase: (() => string) | null;
170
- protected _onBeforeCompileBase: ((parameters: WebGLProgramParametersWithUniforms, renderer: WebGLRenderer) => void) | null;
171
- protected _propertiesGetBase: ((obj: unknown) => unknown) | null;
172
- protected _propertiesGetMap: WeakMap<Material, (obj: unknown) => unknown>;
173
- protected _properties: WeakMap<Material, unknown>;
174
- protected _freeIds: number[];
175
- protected _createEntities: boolean;
176
- /** @internal */ isInstancedMesh: boolean;
177
- /** @internal */ instanceMatrix: InstancedBufferAttribute;
178
- /** @internal */ instanceColor: null;
179
- /**
180
- * The capacity of the instance buffers.
181
- */
182
- get capacity(): number;
183
- /**
184
- * The number of active instances.
185
- */
186
- get instancesCount(): number;
187
- /**
188
- * Determines if per-instance frustum culling is enabled.
189
- * @default true
190
- */
191
- get perObjectFrustumCulled(): boolean;
192
- set perObjectFrustumCulled(value: boolean);
193
- /**
194
- * Determines if objects should be sorted before rendering.
195
- * @default false
196
- */
197
- get sortObjects(): boolean;
198
- set sortObjects(value: boolean);
199
- /**
200
- * An instance of `BufferGeometry` (or derived classes), defining the object's structure.
201
- */
202
- get geometry(): TGeometry;
203
- set geometry(value: TGeometry);
204
- /** @internal */
205
- constructor(geometry: TGeometry, material: TMaterial, params?: InstancedMesh2Params, LOD?: InstancedMesh2);
206
- constructor(geometry: TGeometry, material: TMaterial, params?: InstancedMesh2Params);
207
- onBeforeShadow(renderer: WebGLRenderer, scene: Scene, camera: Camera, shadowCamera: Camera, geometry: BufferGeometry, depthMaterial: Material, group: any): void;
208
- onBeforeRender(renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: any): void;
209
- onAfterShadow(renderer: WebGLRenderer, scene: Scene, camera: Camera, shadowCamera: Camera, geometry: BufferGeometry, depthMaterial: Material, group: any): void;
210
- onAfterRender(renderer: WebGLRenderer, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: any): void;
211
- protected isFirstGroup(materialIndex: number): boolean;
212
- protected isLastGroup(materialIndex: number): boolean;
213
- protected initIndexAttribute(): void;
214
- protected initMatricesTexture(): void;
215
- protected initColorsTexture(): void;
216
- protected initMaterialColorsTexture(): void;
217
- materialsNeedsUpdate(): void;
218
- protected patchGeometry(geometry: TGeometry): void;
219
- protected _customProgramCacheKey: () => string;
220
- protected _onBeforeCompile: (shader: WebGLProgramParametersWithUniforms, renderer: WebGLRenderer) => void;
221
- protected patchMaterial(renderer: WebGLRenderer, material: Material): void;
222
- protected unpatchMaterial(renderer: WebGLRenderer, material: Material): void;
223
- /**
224
- * Creates and computes the BVH (Bounding Volume Hierarchy) for the instances.
225
- * It's recommended to create it when all the instance matrices have been assigned.
226
- * Once created it will be updated automatically.
227
- * @param config Optional configuration parameters object. See `BVHParams` for details.
228
- */
229
- computeBVH(config?: BVHParams): void;
230
- /**
231
- * Disposes of the BVH structure.
232
- */
233
- disposeBVH(): void;
234
- /**
235
- * Sets the local transformation matrix for a specific instance.
236
- * @param id The index of the instance.
237
- * @param matrix A `Matrix4` representing the local transformation to apply to the instance.
238
- */
239
- setMatrixAt(id: number, matrix: Matrix4): void;
240
- /**
241
- * Gets the local transformation matrix of a specific instance.
242
- * @param id The index of the instance.
243
- * @param matrix Optional `Matrix4` to store the result.
244
- * @returns The transformation matrix of the instance.
245
- */
246
- getMatrixAt(id: number, matrix?: Matrix4): Matrix4;
247
- /**
248
- * Retrieves the position of a specific instance.
249
- * @param index The index of the instance.
250
- * @param target Optional `Vector3` to store the result.
251
- * @returns The position of the instance as a `Vector3`.
252
- */
253
- getPositionAt(index: number, target?: Vector3): Vector3;
254
- /** @internal */
255
- getPositionAndMaxScaleOnAxisAt(index: number, position: Vector3): number;
256
- /** @internal */
257
- applyMatrixAtToSphere(index: number, sphere: Sphere, center: Vector3, radius: number): void;
258
- /**
259
- * Sets the visibility of a specific instance.
260
- * @param id The index of the instance.
261
- * @param visible Whether the instance should be visible.
262
- */
263
- setVisibilityAt(id: number, visible: boolean): void;
264
- /**
265
- * Gets the visibility of a specific instance.
266
- * @param id The index of the instance.
267
- * @returns Whether the instance is visible.
268
- */
269
- getVisibilityAt(id: number): boolean;
270
- /**
271
- * Sets the availability of a specific instance.
272
- * @param id The index of the instance.
273
- * @param active Whether the instance is active (not deleted).
274
- */
275
- setActiveAt(id: number, active: boolean): void;
276
- /**
277
- * Gets the availability of a specific instance.
278
- * @param id The index of the instance.
279
- * @returns Whether the instance is active (not deleted).
280
- */
281
- getActiveAt(id: number): boolean;
282
- /**
283
- * Indicates if a specific instance is visible and active.
284
- * @param id The index of the instance.
285
- * @returns Whether the instance is visible and active.
286
- */
287
- getActiveAndVisibilityAt(id: number): boolean;
288
- /**
289
- * Set if a specific instance is visible and active.
290
- * @param id The index of the instance.
291
- * @param value Whether the instance is active and active (not deleted).
292
- */
293
- setActiveAndVisibilityAt(id: number, value: boolean): void;
294
- /**
295
- * Sets the color of a specific instance.
296
- * @param id The index of the instance.
297
- * @param color The color to assign to the instance.
298
- */
299
- setColorAt(id: number, color: ColorRepresentation): void;
300
- /**
301
- * Gets the color of a specific instance.
302
- * @param id The index of the instance.
303
- * @param color Optional `Color` to store the result.
304
- * @returns The color of the instance.
305
- */
306
- getColorAt(id: number, color?: Color): Color;
307
- /**
308
- * Sets the opacity of a specific instance.
309
- * @param id The index of the instance.
310
- * @param value The opacity value to assign.
311
- */
312
- setOpacityAt(id: number, value: number): void;
313
- /**
314
- * Gets the opacity of a specific instance.
315
- * @param id The index of the instance.
316
- * @returns The opacity of the instance.
317
- */
318
- getOpacityAt(id: number): number;
319
- /**
320
- * Sets material-specific colors for an instance.
321
- * @param id The index of the instance.
322
- * @param materialColors Object containing colors for different materials.
323
- */
324
- setMaterialColorsAt(id: number, materialColors: Map<ColorPartName, Color>): void;
325
- /**
326
- * Gets material-specific colors for an instance.
327
- * @param id The index of the instance.
328
- * @returns Object containing colors for different materials.
329
- */
330
- getMaterialColorsAt(id: number): {
331
- hair: Color;
332
- shirt_short: Color;
333
- shirt_long: Color;
334
- pants_short: Color;
335
- pants_long: Color;
336
- shoes: Color;
337
- skin: Color;
338
- lips: Color;
339
- } | null;
340
- /**
341
- * Copies `position`, `quaternion`, and `scale` of a specific instance to the specified target `Object3D`.
342
- * @param id The index of the instance.
343
- * @param target The `Object3D` where to copy transformation data.
344
- */
345
- copyTo(id: number, target: Object3D): void;
346
- /**
347
- * Computes the bounding box that encloses all instances, and updates the `boundingBox` attribute.
348
- */
349
- computeBoundingBox(): void;
350
- /**
351
- * Computes the bounding sphere that encloses all instances, and updates the `boundingSphere` attribute.
352
- */
353
- computeBoundingSphere(): void;
354
- clone(recursive?: boolean): this;
355
- copy(argSource: Object3D, recursive?: boolean): this;
356
- /**
357
- * Frees the GPU-related resources allocated.
358
- */
359
- dispose(): void;
360
- updateMatrixWorld(force?: boolean): void;
361
- }
@@ -1,145 +0,0 @@
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 {};
@@ -1,13 +0,0 @@
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 {};
@@ -1,37 +0,0 @@
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
- }
@@ -1,49 +0,0 @@
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
- }