@babylonjs/core 9.9.1 → 9.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/AudioV2/abstractAudio/audioEngineV2.d.ts +34 -1
  2. package/AudioV2/abstractAudio/audioEngineV2.js +54 -0
  3. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  4. package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.d.ts +12 -0
  5. package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +18 -0
  6. package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -1
  7. package/AudioV2/abstractAudio/index.d.ts +1 -0
  8. package/AudioV2/abstractAudio/index.js +1 -0
  9. package/AudioV2/abstractAudio/index.js.map +1 -1
  10. package/AudioV2/abstractAudio/pure.d.ts +1 -0
  11. package/AudioV2/abstractAudio/pure.js +1 -0
  12. package/AudioV2/abstractAudio/pure.js.map +1 -1
  13. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +7 -1
  14. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +12 -0
  15. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
  16. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +14 -0
  17. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
  18. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +4 -0
  19. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
  20. package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
  21. package/AudioV2/abstractAudio/subProperties/spatialAudio.js +12 -0
  22. package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
  23. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +2 -0
  24. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +4 -0
  25. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -1
  26. package/AudioV2/webAudio/webAudioEngine.js +2 -1
  27. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  28. package/Engines/abstractEngine.pure.js +2 -2
  29. package/Engines/abstractEngine.pure.js.map +1 -1
  30. package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.d.ts +3 -0
  31. package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +16 -1
  32. package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
  33. package/FrameGraph/Tasks/Layers/selectionOutlineTask.d.ts +2 -1
  34. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +5 -2
  35. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
  36. package/Gizmos/index.d.ts +1 -0
  37. package/Gizmos/index.js +1 -0
  38. package/Gizmos/index.js.map +1 -1
  39. package/Gizmos/pure.d.ts +1 -0
  40. package/Gizmos/pure.js +1 -0
  41. package/Gizmos/pure.js.map +1 -1
  42. package/Gizmos/spatialAudioGizmo.d.ts +55 -0
  43. package/Gizmos/spatialAudioGizmo.js +151 -0
  44. package/Gizmos/spatialAudioGizmo.js.map +1 -0
  45. package/Layers/selectionOutlineLayer.pure.d.ts +9 -2
  46. package/Layers/selectionOutlineLayer.pure.js +29 -6
  47. package/Layers/selectionOutlineLayer.pure.js.map +1 -1
  48. package/Layers/thinEffectLayer.d.ts +1 -0
  49. package/Layers/thinEffectLayer.js +7 -4
  50. package/Layers/thinEffectLayer.js.map +1 -1
  51. package/Layers/thinSelectionOutlineLayer.d.ts +17 -3
  52. package/Layers/thinSelectionOutlineLayer.js +82 -17
  53. package/Layers/thinSelectionOutlineLayer.js.map +1 -1
  54. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +5 -0
  55. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +54 -1
  56. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  57. package/Materials/PBR/openpbrMaterial.pure.d.ts +13 -0
  58. package/Materials/PBR/openpbrMaterial.pure.js +17 -0
  59. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  60. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.d.ts +2 -1
  61. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js +3 -2
  62. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js.map +1 -1
  63. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +32 -2
  64. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +180 -22
  65. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  66. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +54 -10
  67. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +130 -13
  68. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  69. package/Meshes/abstractMesh.pure.d.ts +5 -1
  70. package/Meshes/abstractMesh.pure.js +92 -2
  71. package/Meshes/abstractMesh.pure.js.map +1 -1
  72. package/Meshes/thinInstanceMesh.pure.js +143 -2
  73. package/Meshes/thinInstanceMesh.pure.js.map +1 -1
  74. package/Meshes/thinInstanceMesh.types.d.ts +2 -1
  75. package/Meshes/thinInstanceMesh.types.js.map +1 -1
  76. package/Misc/tools.pure.js +1 -1
  77. package/Misc/tools.pure.js.map +1 -1
  78. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +12 -1
  79. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  80. package/Rendering/geometryBufferRenderer.pure.js +8 -0
  81. package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
  82. package/Rendering/objectRenderer.js +4 -2
  83. package/Rendering/objectRenderer.js.map +1 -1
  84. package/Shaders/ShadersInclude/gaussianSplatting.js +54 -5
  85. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  86. package/Shaders/gaussianSplatting.vertex.js +14 -3
  87. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  88. package/Shaders/gaussianSplattingVoxel.vertex.js +1 -0
  89. package/Shaders/gaussianSplattingVoxel.vertex.js.map +1 -1
  90. package/Shaders/selectionOutline.fragment.js +16 -4
  91. package/Shaders/selectionOutline.fragment.js.map +1 -1
  92. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +56 -5
  93. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  94. package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +2 -3
  95. package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
  96. package/ShadersWGSL/gaussianSplatting.vertex.js +14 -3
  97. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  98. package/ShadersWGSL/gaussianSplattingVoxel.vertex.js +1 -0
  99. package/ShadersWGSL/gaussianSplattingVoxel.vertex.js.map +1 -1
  100. package/ShadersWGSL/selectionOutline.fragment.js +14 -2
  101. package/ShadersWGSL/selectionOutline.fragment.js.map +1 -1
  102. package/XR/features/WebXRBodyTracking.pure.d.ts +16 -0
  103. package/XR/features/WebXRBodyTracking.pure.js +167 -30
  104. package/XR/features/WebXRBodyTracking.pure.js.map +1 -1
  105. package/package.json +1 -1
@@ -4,6 +4,138 @@ import { Logger } from "../Misc/logger.js";
4
4
  import { BoundingInfo } from "../Culling/boundingInfo.js";
5
5
  import { Mesh } from "../Meshes/mesh.pure.js";
6
6
  import { VertexBuffer, Buffer } from "../Buffers/buffer.pure.js";
7
+ const BakedVertexAnimationSettingsInstancedKind = "bakedVertexAnimationSettingsInstanced";
8
+ function HasCpuReadableBakedVertexAnimationData(mesh) {
9
+ const textureData = mesh.bakedVertexAnimationManager?.texture?.getInternalTexture()?._bufferView;
10
+ return textureData instanceof Float32Array || textureData instanceof Uint16Array;
11
+ }
12
+ function ExtractMinAndMaxToRef(data, count, minimum, maximum) {
13
+ minimum.setAll(Number.POSITIVE_INFINITY);
14
+ maximum.setAll(Number.NEGATIVE_INFINITY);
15
+ for (let index = 0; index < count * 3; index += 3) {
16
+ const x = data[index];
17
+ const y = data[index + 1];
18
+ const z = data[index + 2];
19
+ if (x < minimum.x) {
20
+ minimum.x = x;
21
+ }
22
+ if (y < minimum.y) {
23
+ minimum.y = y;
24
+ }
25
+ if (z < minimum.z) {
26
+ minimum.z = z;
27
+ }
28
+ if (x > maximum.x) {
29
+ maximum.x = x;
30
+ }
31
+ if (y > maximum.y) {
32
+ maximum.y = y;
33
+ }
34
+ if (z > maximum.z) {
35
+ maximum.z = z;
36
+ }
37
+ }
38
+ }
39
+ function ApplyBoundingBiasToMinAndMax(minimum, maximum, bias) {
40
+ if (!bias) {
41
+ return;
42
+ }
43
+ minimum.x -= minimum.x * bias.x + bias.y;
44
+ minimum.y -= minimum.y * bias.x + bias.y;
45
+ minimum.z -= minimum.z * bias.x + bias.y;
46
+ maximum.x += maximum.x * bias.x + bias.y;
47
+ maximum.y += maximum.y * bias.x + bias.y;
48
+ maximum.z += maximum.z * bias.x + bias.y;
49
+ }
50
+ function UpdateTransformedMinAndMaxToRef(minimum, maximum, matrix, globalMinimum, globalMaximum) {
51
+ const corner = TmpVectors.Vector3[7];
52
+ const transformed = TmpVectors.Vector3[8];
53
+ for (let x = 0; x < 2; ++x) {
54
+ for (let y = 0; y < 2; ++y) {
55
+ for (let z = 0; z < 2; ++z) {
56
+ corner.set(x ? maximum.x : minimum.x, y ? maximum.y : minimum.y, z ? maximum.z : minimum.z);
57
+ Vector3.TransformCoordinatesToRef(corner, matrix, transformed);
58
+ globalMinimum.minimizeInPlace(transformed);
59
+ globalMaximum.maximizeInPlace(transformed);
60
+ }
61
+ }
62
+ }
63
+ }
64
+ function UpdateTransformedDataMinAndMaxToRef(data, count, matrix, globalMinimum, globalMaximum) {
65
+ const transformed = TmpVectors.Vector3[7];
66
+ for (let index = 0; index < count * 3; index += 3) {
67
+ Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], matrix, transformed);
68
+ globalMinimum.minimizeInPlace(transformed);
69
+ globalMaximum.maximizeInPlace(transformed);
70
+ }
71
+ }
72
+ function UpdateRawBoundingVectors(vectors, rawBoundingInfo) {
73
+ vectors.length = 0;
74
+ for (let v = 0; v < rawBoundingInfo.boundingBox.vectors.length; ++v) {
75
+ vectors.push(rawBoundingInfo.boundingBox.vectors[v].clone());
76
+ }
77
+ }
78
+ function TryUpdateBakedVertexAnimationThinInstanceBoundingInfo(mesh, vectors, applyMorph) {
79
+ const storage = mesh._userThinInstanceBuffersStorage;
80
+ const bakedVertexAnimationSettingsData = storage?.data[BakedVertexAnimationSettingsInstancedKind];
81
+ const bakedVertexAnimationSettingsStride = storage?.strides[BakedVertexAnimationSettingsInstancedKind];
82
+ if (!bakedVertexAnimationSettingsData || !bakedVertexAnimationSettingsStride || bakedVertexAnimationSettingsStride < 4 || !HasCpuReadableBakedVertexAnimationData(mesh)) {
83
+ return false;
84
+ }
85
+ const matrixData = mesh._thinInstanceDataStorage.matrixData;
86
+ if (!matrixData) {
87
+ return false;
88
+ }
89
+ const cache = {};
90
+ const settings = TmpVectors.Vector4[0];
91
+ const rawMinimum = TmpVectors.Vector3[1];
92
+ const rawMaximum = TmpVectors.Vector3[2];
93
+ const globalMinimum = TmpVectors.Vector3[3];
94
+ const globalMaximum = TmpVectors.Vector3[4];
95
+ const localMinimum = TmpVectors.Vector3[5];
96
+ const localMaximum = TmpVectors.Vector3[6];
97
+ const matrix = TmpVectors.Matrix[2];
98
+ const bias = mesh.geometry ? mesh.geometry.boundingBias : null;
99
+ const vertexCount = mesh.getTotalVertices();
100
+ rawMinimum.setAll(Number.POSITIVE_INFINITY);
101
+ rawMaximum.setAll(Number.NEGATIVE_INFINITY);
102
+ globalMinimum.setAll(Number.POSITIVE_INFINITY);
103
+ globalMaximum.setAll(Number.NEGATIVE_INFINITY);
104
+ for (let index = 0; index < mesh._thinInstanceDataStorage.instancesCount; ++index) {
105
+ const settingsOffset = index * bakedVertexAnimationSettingsStride;
106
+ settings.set(bakedVertexAnimationSettingsData[settingsOffset], bakedVertexAnimationSettingsData[settingsOffset + 1], bakedVertexAnimationSettingsData[settingsOffset + 2], bakedVertexAnimationSettingsData[settingsOffset + 3]);
107
+ const positionData = mesh._getData({
108
+ applyMorph,
109
+ applyBakedVertexAnimation: true,
110
+ bakedVertexAnimationSettings: settings,
111
+ updatePositionsArray: false,
112
+ cache,
113
+ }, null, VertexBuffer.PositionKind);
114
+ if (!positionData) {
115
+ return false;
116
+ }
117
+ ExtractMinAndMaxToRef(positionData, vertexCount, localMinimum, localMaximum);
118
+ ApplyBoundingBiasToMinAndMax(localMinimum, localMaximum, bias);
119
+ rawMinimum.minimizeInPlace(localMinimum);
120
+ rawMaximum.maximizeInPlace(localMaximum);
121
+ Matrix.FromArrayToRef(matrixData, index * 16, matrix);
122
+ if (bias) {
123
+ UpdateTransformedMinAndMaxToRef(localMinimum, localMaximum, matrix, globalMinimum, globalMaximum);
124
+ }
125
+ else {
126
+ UpdateTransformedDataMinAndMaxToRef(positionData, vertexCount, matrix, globalMinimum, globalMaximum);
127
+ }
128
+ }
129
+ if (!isFinite(rawMinimum.x) || !isFinite(globalMinimum.x)) {
130
+ return false;
131
+ }
132
+ const boundingInfo = mesh.getBoundingInfo();
133
+ boundingInfo.reConstruct(globalMinimum, globalMaximum);
134
+ mesh.rawBoundingInfo = new BoundingInfo(rawMinimum, rawMaximum);
135
+ UpdateRawBoundingVectors(vectors, mesh.rawBoundingInfo);
136
+ mesh._updateBoundingInfo();
137
+ return true;
138
+ }
7
139
  let _Registered = false;
8
140
  /**
9
141
  * Register side effects for thinInstanceMesh.
@@ -240,14 +372,23 @@ export function RegisterThinInstanceMesh() {
240
372
  }
241
373
  return this._thinInstanceDataStorage.worldMatrices;
242
374
  };
243
- Mesh.prototype.thinInstanceRefreshBoundingInfo = function (forceRefreshParentInfo = false, applySkeleton = false, applyMorph = false) {
375
+ Mesh.prototype.thinInstanceRefreshBoundingInfo = function (forceRefreshParentInfo = false, applySkeleton = false, applyMorph = false, applyBakedVertexAnimation = false) {
244
376
  if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {
245
377
  return;
246
378
  }
247
379
  const vectors = this._thinInstanceDataStorage.boundingVectors;
248
380
  if (forceRefreshParentInfo || !this.rawBoundingInfo) {
249
381
  vectors.length = 0;
250
- this.refreshBoundingInfo(applySkeleton, applyMorph);
382
+ if (applyBakedVertexAnimation && TryUpdateBakedVertexAnimationThinInstanceBoundingInfo(this, vectors, applyMorph)) {
383
+ return;
384
+ }
385
+ const useBakedVertexAnimation = applyBakedVertexAnimation && this.bakedVertexAnimationManager?.isEnabled && HasCpuReadableBakedVertexAnimationData(this);
386
+ if (useBakedVertexAnimation) {
387
+ this.refreshBoundingInfo({ applySkeleton, applyMorph, applyBakedVertexAnimation: true, updatePositionsArray: false });
388
+ }
389
+ else {
390
+ this.refreshBoundingInfo(applySkeleton, applyMorph);
391
+ }
251
392
  const boundingInfo = this.getBoundingInfo();
252
393
  this.rawBoundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);
253
394
  }
@@ -1 +1 @@
1
- {"version":3,"file":"thinInstanceMesh.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/thinInstanceMesh.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE9D,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MA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C;gBACvD,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;gBAC3D,IAAI,CAAC,+BAA+B,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;gBAErI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,+BAA+B,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC,CAAC;YACtF,CAAC;QACL,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,CAAC,SAAS,CAAC,kCAAkC,GAAG;QAChD,IAAI,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC;YACxC,IAAI,CAAC,+BAA+B,GAAG;gBACnC,IAAI,EAAE,EAAE;gBACR,KAAK,EAAE,EAAE;gBACT,aAAa,EAAE,EAAE;gBACjB,OAAO,EAAE,EAAE;aACd,CAAC;QACN,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,CAAC,SAAS,CAAC,gCAAgC,GAAG;QAC9C,IAAI,IAAI,CAAC,wBAAwB,EAAE,YAAY,EAAE,CAAC;YAC9C,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YACrD,IAAI,CAAC,wBAAwB,CAAC,YAAY,GAAG,IAAI,CAAC;QACtD,CAAC;QACD,IAAI,IAAI,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,CAAC;YACtD,IAAI,CAAC,wBAAwB,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;YAC7D,IAAI,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAC9D,CAAC;IACL,CAAC,CAAC;AACN,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable, type DeepImmutableObject } from \"../types\";\r\nimport { Vector3, TmpVectors, Matrix } from \"../Maths/math.vector.pure\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { BoundingInfo } from \"core/Culling/boundingInfo\";\r\nimport { Mesh } from \"../Meshes/mesh.pure\";\r\nimport { VertexBuffer, Buffer } from \"../Buffers/buffer.pure\";\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for thinInstanceMesh.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterThinInstanceMesh(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Mesh.prototype.thinInstanceAdd = function (matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh: boolean = true): number {\r\n if (!this.getScene().getEngine().getCaps().instancedArrays) {\r\n Logger.Error(\"Thin Instances are not supported on this device as Instanced Array extension not supported\");\r\n return -1;\r\n }\r\n\r\n this._thinInstanceUpdateBufferSize(\"matrix\", Array.isArray(matrix) ? matrix.length : 1);\r\n\r\n const index = this._thinInstanceDataStorage.instancesCount;\r\n\r\n if (Array.isArray(matrix)) {\r\n for (let i = 0; i < matrix.length; ++i) {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix[i], i === matrix.length - 1 && refresh);\r\n }\r\n } else {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix, refresh);\r\n }\r\n\r\n return index;\r\n };\r\n\r\n Mesh.prototype.thinInstanceAddSelf = function (refresh: boolean = true): number {\r\n return this.thinInstanceAdd(Matrix.IdentityReadOnly, refresh);\r\n };\r\n\r\n Mesh.prototype.thinInstanceRegisterAttribute = function (kind: string, stride: number): void {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n this.removeVerticesData(kind);\r\n\r\n this._thinInstanceInitializeUserStorage();\r\n\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = stride * Math.max(32, this._thinInstanceDataStorage.instancesCount); // Initial size\r\n this._userThinInstanceBuffersStorage.data[kind] = new Float32Array(this._userThinInstanceBuffersStorage.sizes[kind]);\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(\r\n this.getEngine(),\r\n this._userThinInstanceBuffersStorage.data[kind],\r\n kind,\r\n true,\r\n false,\r\n stride,\r\n true\r\n );\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n };\r\n\r\n Mesh.prototype.thinInstanceSetMatrixAt = function (index: number, matrix: DeepImmutableObject<Matrix>, refresh: boolean = true): boolean {\r\n if (!this._thinInstanceDataStorage.matrixData || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n matrix.copyToArray(matrixData, index * 16);\r\n\r\n if (this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices[index] = matrix as Matrix;\r\n }\r\n\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(\"matrix\");\r\n\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n }\r\n\r\n return true;\r\n };\r\n\r\n Mesh.prototype.thinInstanceSetAttributeAt = function (kind: string, index: number, value: Array<number>, refresh: boolean = true): boolean {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.data[kind] || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n\r\n this._thinInstanceUpdateBufferSize(kind, 0); // make sur the buffer for the kind attribute is big enough\r\n\r\n this._userThinInstanceBuffersStorage.data[kind].set(value, index * this._userThinInstanceBuffersStorage.strides[kind]);\r\n\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(kind);\r\n }\r\n\r\n return true;\r\n };\r\n\r\n Object.defineProperty(Mesh.prototype, \"thinInstanceCount\", {\r\n get: function (this: Mesh) {\r\n return this._thinInstanceDataStorage.instancesCount;\r\n },\r\n set: function (this: Mesh, value: number) {\r\n const matrixData = this._thinInstanceDataStorage.matrixData ?? this.source?._thinInstanceDataStorage.matrixData;\r\n const numMaxInstances = matrixData ? matrixData.length / 16 : 0;\r\n\r\n if (value <= numMaxInstances) {\r\n this._thinInstanceDataStorage.instancesCount = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n\r\n Mesh.prototype._thinInstanceCreateMatrixBuffer = function (kind: string, buffer: Float32Array, staticBuffer: boolean = true): Buffer {\r\n const matrixBuffer = new Buffer(this.getEngine(), buffer, !staticBuffer, 16, false, true);\r\n\r\n for (let i = 0; i < 4; i++) {\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(kind + i, i * 4, 4));\r\n }\r\n\r\n return matrixBuffer;\r\n };\r\n\r\n Mesh.prototype.thinInstanceSetBuffer = function (kind: string, buffer: Nullable<Float32Array>, stride: number = 0, staticBuffer: boolean = true): void {\r\n stride = stride || 16;\r\n\r\n if (kind === \"matrix\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n this._thinInstanceDataStorage.matrixBufferSize = buffer ? buffer.length : 32 * stride;\r\n this._thinInstanceDataStorage.matrixData = buffer;\r\n this._thinInstanceDataStorage.worldMatrices = null;\r\n\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", buffer, staticBuffer);\r\n\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n } else {\r\n this._thinInstanceDataStorage.instancesCount = 0;\r\n if (!this.doNotSyncBoundingInfo) {\r\n // mesh has no more thin instances, so need to recompute the bounding box because it's the regular mesh that will now be displayed\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n } else if (kind === \"previousMatrix\") {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = null;\r\n this._thinInstanceDataStorage.previousMatrixData = buffer;\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", buffer, staticBuffer);\r\n }\r\n } else if (kind === \"splatIndex\" && buffer) {\r\n this._thinInstanceInitializeUserStorage();\r\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\r\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\r\n const splatInstancesBuffer = new Buffer(this.getEngine(), buffer, true, 16, false, true);\r\n this._thinInstanceDataStorage.matrixBuffer = splatInstancesBuffer;\r\n for (let i = 0; i < 4; i++) {\r\n this.setVerticesBuffer(splatInstancesBuffer.createVertexBuffer(kind + i, i * 4, 4));\r\n }\r\n } else {\r\n // color for instanced mesh is ColorInstanceKind and not ColorKind because of native that needs to do the differenciation\r\n // hot switching kind here to preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (buffer === null) {\r\n if (this._userThinInstanceBuffersStorage?.data[kind]) {\r\n this.removeVerticesData(kind);\r\n delete this._userThinInstanceBuffersStorage.data[kind];\r\n delete this._userThinInstanceBuffersStorage.strides[kind];\r\n delete this._userThinInstanceBuffersStorage.sizes[kind];\r\n delete this._userThinInstanceBuffersStorage.vertexBuffers[kind];\r\n }\r\n } else {\r\n this._thinInstanceInitializeUserStorage();\r\n\r\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), buffer, kind, !staticBuffer, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n }\r\n };\r\n\r\n Mesh.prototype.thinInstanceBufferUpdated = function (kind: string): void {\r\n if (kind === \"matrix\") {\r\n if (this.thinInstanceAllowAutomaticStaticBufferRecreation && this._thinInstanceDataStorage.matrixBuffer && !this._thinInstanceDataStorage.matrixBuffer.isUpdatable()) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._thinInstanceDataStorage.matrixData!, 0, this._thinInstanceDataStorage.instancesCount);\r\n } else if (kind === \"previousMatrix\") {\r\n if (\r\n this.thinInstanceAllowAutomaticStaticBufferRecreation &&\r\n this._thinInstanceDataStorage.previousMatrixBuffer &&\r\n !this._thinInstanceDataStorage.previousMatrixBuffer.isUpdatable()\r\n ) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.updateDirectly(this._thinInstanceDataStorage.previousMatrixData!, 0, this._thinInstanceDataStorage.instancesCount);\r\n } else if (kind === \"splatIndex\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0, this._thinInstanceDataStorage.instancesCount);\r\n } else {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (this._userThinInstanceBuffersStorage?.vertexBuffers[kind]) {\r\n if (this.thinInstanceAllowAutomaticStaticBufferRecreation && !this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.isUpdatable()) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0);\r\n }\r\n }\r\n };\r\n\r\n Mesh.prototype.thinInstancePartialBufferUpdate = function (kind: string, dataOrLength: Float32Array | number, offset: number): void {\r\n if (kind === \"matrix\") {\r\n if (this._thinInstanceDataStorage.matrixBuffer) {\r\n if (typeof dataOrLength === \"number\") {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(\r\n new Float32Array(\r\n this._thinInstanceDataStorage.matrixData!.buffer,\r\n this._thinInstanceDataStorage.matrixData!.byteOffset + offset * 16 * Float32Array.BYTES_PER_ELEMENT,\r\n dataOrLength * 16\r\n ),\r\n offset * 16\r\n );\r\n } else {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(dataOrLength, offset);\r\n }\r\n }\r\n } else {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (this._userThinInstanceBuffersStorage?.vertexBuffers[kind]) {\r\n const buffer = this._userThinInstanceBuffersStorage.vertexBuffers[kind]!;\r\n if (typeof dataOrLength === \"number\") {\r\n const data = new Float32Array(\r\n this._userThinInstanceBuffersStorage.data[kind].buffer,\r\n this._userThinInstanceBuffersStorage.data[kind].byteOffset + offset * this._userThinInstanceBuffersStorage.strides[kind] * Float32Array.BYTES_PER_ELEMENT,\r\n dataOrLength * this._userThinInstanceBuffersStorage.strides[kind]\r\n );\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.updateDirectly(data, offset * this._userThinInstanceBuffersStorage.strides[kind]);\r\n } else {\r\n buffer.updateDirectly(dataOrLength, offset);\r\n }\r\n }\r\n }\r\n };\r\n\r\n Mesh.prototype.thinInstanceGetWorldMatrices = function (): Matrix[] {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return [];\r\n }\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n if (!this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices = [] as Matrix[];\r\n\r\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n this._thinInstanceDataStorage.worldMatrices[i] = Matrix.FromArray(matrixData, i * 16);\r\n }\r\n }\r\n\r\n return this._thinInstanceDataStorage.worldMatrices;\r\n };\r\n\r\n Mesh.prototype.thinInstanceRefreshBoundingInfo = function (forceRefreshParentInfo: boolean = false, applySkeleton: boolean = false, applyMorph: boolean = false) {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return;\r\n }\r\n\r\n const vectors = this._thinInstanceDataStorage.boundingVectors;\r\n\r\n if (forceRefreshParentInfo || !this.rawBoundingInfo) {\r\n vectors.length = 0;\r\n this.refreshBoundingInfo(applySkeleton, applyMorph);\r\n const boundingInfo = this.getBoundingInfo();\r\n this.rawBoundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n\r\n const boundingInfo = this.getBoundingInfo();\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n if (vectors.length === 0) {\r\n for (let v = 0; v < boundingInfo.boundingBox.vectors.length; ++v) {\r\n vectors.push(boundingInfo.boundingBox.vectors[v].clone());\r\n }\r\n }\r\n\r\n TmpVectors.Vector3[0].setAll(Number.POSITIVE_INFINITY); // min\r\n TmpVectors.Vector3[1].setAll(Number.NEGATIVE_INFINITY); // max\r\n\r\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n Matrix.FromArrayToRef(matrixData, i * 16, TmpVectors.Matrix[0]);\r\n\r\n for (let v = 0; v < vectors.length; ++v) {\r\n Vector3.TransformCoordinatesToRef(vectors[v], TmpVectors.Matrix[0], TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[0].minimizeInPlace(TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[1].maximizeInPlace(TmpVectors.Vector3[2]);\r\n }\r\n }\r\n\r\n boundingInfo.reConstruct(TmpVectors.Vector3[0], TmpVectors.Vector3[1]);\r\n\r\n this._updateBoundingInfo();\r\n };\r\n\r\n Mesh.prototype._thinInstanceRecreateBuffer = function (kind: string, staticBuffer: boolean = true) {\r\n if (kind === \"matrix\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", this._thinInstanceDataStorage.matrixData, staticBuffer);\r\n } else if (kind === \"previousMatrix\") {\r\n if (this._scene.needsPreviousWorldMatrices) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\r\n \"previousWorld\",\r\n this._thinInstanceDataStorage.previousMatrixData ?? this._thinInstanceDataStorage.matrixData,\r\n staticBuffer\r\n );\r\n }\r\n } else {\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]?.dispose();\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(\r\n this.getEngine(),\r\n this._userThinInstanceBuffersStorage.data[kind],\r\n kind,\r\n !staticBuffer,\r\n false,\r\n this._userThinInstanceBuffersStorage.strides[kind],\r\n true\r\n );\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n };\r\n\r\n Mesh.prototype._thinInstanceUpdateBufferSize = function (kind: string, numInstances: number = 1) {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n const kindIsMatrix = kind === \"matrix\";\r\n\r\n if (!kindIsMatrix && (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.strides[kind])) {\r\n return;\r\n }\r\n\r\n const stride = kindIsMatrix ? 16 : this._userThinInstanceBuffersStorage.strides[kind];\r\n const currentSize = kindIsMatrix ? this._thinInstanceDataStorage.matrixBufferSize : this._userThinInstanceBuffersStorage.sizes[kind];\r\n let data = kindIsMatrix ? this._thinInstanceDataStorage.matrixData : this._userThinInstanceBuffersStorage.data[kind];\r\n\r\n const bufferSize = (this._thinInstanceDataStorage.instancesCount + numInstances) * stride;\r\n\r\n let newSize = currentSize;\r\n\r\n while (newSize < bufferSize) {\r\n newSize *= 2;\r\n }\r\n\r\n if (!data || currentSize != newSize) {\r\n if (!data) {\r\n data = new Float32Array(newSize);\r\n } else {\r\n const newData = new Float32Array(newSize);\r\n newData.set(data, 0);\r\n data = newData;\r\n }\r\n\r\n if (kindIsMatrix) {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", data, false);\r\n this._thinInstanceDataStorage.matrixData = data;\r\n this._thinInstanceDataStorage.matrixBufferSize = newSize;\r\n if (this._scene.needsPreviousWorldMatrices && !this._thinInstanceDataStorage.previousMatrixData) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", data, false);\r\n }\r\n } else {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]?.dispose();\r\n\r\n this._userThinInstanceBuffersStorage.data[kind] = data;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = newSize;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), data, kind, true, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n }\r\n };\r\n\r\n Mesh.prototype._thinInstanceInitializeUserStorage = function () {\r\n if (!this._userThinInstanceBuffersStorage) {\r\n this._userThinInstanceBuffersStorage = {\r\n data: {},\r\n sizes: {},\r\n vertexBuffers: {},\r\n strides: {},\r\n };\r\n }\r\n };\r\n\r\n Mesh.prototype._disposeThinInstanceSpecificData = function () {\r\n if (this._thinInstanceDataStorage?.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n }\r\n if (this._thinInstanceDataStorage?.previousMatrixBuffer) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = null;\r\n }\r\n };\r\n}\r\n"]}
1
+ {"version":3,"file":"thinInstanceMesh.pure.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/thinInstanceMesh.pure.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAG7D,OAAO,EAAgB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE9D,MAAM,yCAAyC,GAAG,uCAAuC,CAAC;AAE1F,SAAS,sCAAsC,CAAC,IAAU;IACtD,MAAM,WAAW,GAAG,IAAI,CAAC,2BAA2B,EAAE,OAAO,EAAE,kBAAkB,EAAE,EAAE,WAAW,CAAC;IAEjG,OAAO,WAAW,YAAY,YAAY,IAAI,WAAW,YAAY,WAAW,CAAC;AACrF,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAgB,EAAE,KAAa,EAAE,OAAgB,EAAE,OAAgB;IAC9F,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAEzC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACh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,CAAC,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;gBAErI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,+BAA+B,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC,CAAC;YACtF,CAAC;QACL,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,CAAC,SAAS,CAAC,kCAAkC,GAAG;QAChD,IAAI,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC;YACxC,IAAI,CAAC,+BAA+B,GAAG;gBACnC,IAAI,EAAE,EAAE;gBACR,KAAK,EAAE,EAAE;gBACT,aAAa,EAAE,EAAE;gBACjB,OAAO,EAAE,EAAE;aACd,CAAC;QACN,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,CAAC,SAAS,CAAC,gCAAgC,GAAG;QAC9C,IAAI,IAAI,CAAC,wBAAwB,EAAE,YAAY,EAAE,CAAC;YAC9C,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YACrD,IAAI,CAAC,wBAAwB,CAAC,YAAY,GAAG,IAAI,CAAC;QACtD,CAAC;QACD,IAAI,IAAI,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,CAAC;YACtD,IAAI,CAAC,wBAAwB,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;YAC7D,IAAI,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,IAAI,CAAC;QAC9D,CAAC;IACL,CAAC,CAAC;AACN,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable, type DeepImmutableObject, type FloatArray } from \"../types\";\r\nimport { type Vector2, Vector3, TmpVectors, Matrix } from \"../Maths/math.vector.pure\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { BoundingInfo } from \"core/Culling/boundingInfo\";\r\nimport { Mesh } from \"../Meshes/mesh.pure\";\r\nimport { VertexBuffer, Buffer } from \"../Buffers/buffer.pure\";\r\n\r\nconst BakedVertexAnimationSettingsInstancedKind = \"bakedVertexAnimationSettingsInstanced\";\r\n\r\nfunction HasCpuReadableBakedVertexAnimationData(mesh: Mesh): boolean {\r\n const textureData = mesh.bakedVertexAnimationManager?.texture?.getInternalTexture()?._bufferView;\r\n\r\n return textureData instanceof Float32Array || textureData instanceof Uint16Array;\r\n}\r\n\r\nfunction ExtractMinAndMaxToRef(data: FloatArray, count: number, minimum: Vector3, maximum: Vector3): void {\r\n minimum.setAll(Number.POSITIVE_INFINITY);\r\n maximum.setAll(Number.NEGATIVE_INFINITY);\r\n\r\n for (let index = 0; index < count * 3; index += 3) {\r\n const x = data[index];\r\n const y = data[index + 1];\r\n const z = data[index + 2];\r\n\r\n if (x < minimum.x) {\r\n minimum.x = x;\r\n }\r\n if (y < minimum.y) {\r\n minimum.y = y;\r\n }\r\n if (z < minimum.z) {\r\n minimum.z = z;\r\n }\r\n if (x > maximum.x) {\r\n maximum.x = x;\r\n }\r\n if (y > maximum.y) {\r\n maximum.y = y;\r\n }\r\n if (z > maximum.z) {\r\n maximum.z = z;\r\n }\r\n }\r\n}\r\n\r\nfunction ApplyBoundingBiasToMinAndMax(minimum: Vector3, maximum: Vector3, bias: Nullable<Vector2>): void {\r\n if (!bias) {\r\n return;\r\n }\r\n\r\n minimum.x -= minimum.x * bias.x + bias.y;\r\n minimum.y -= minimum.y * bias.x + bias.y;\r\n minimum.z -= minimum.z * bias.x + bias.y;\r\n maximum.x += maximum.x * bias.x + bias.y;\r\n maximum.y += maximum.y * bias.x + bias.y;\r\n maximum.z += maximum.z * bias.x + bias.y;\r\n}\r\n\r\nfunction UpdateTransformedMinAndMaxToRef(minimum: Vector3, maximum: Vector3, matrix: Matrix, globalMinimum: Vector3, globalMaximum: Vector3): void {\r\n const corner = TmpVectors.Vector3[7];\r\n const transformed = TmpVectors.Vector3[8];\r\n\r\n for (let x = 0; x < 2; ++x) {\r\n for (let y = 0; y < 2; ++y) {\r\n for (let z = 0; z < 2; ++z) {\r\n corner.set(x ? maximum.x : minimum.x, y ? maximum.y : minimum.y, z ? maximum.z : minimum.z);\r\n Vector3.TransformCoordinatesToRef(corner, matrix, transformed);\r\n globalMinimum.minimizeInPlace(transformed);\r\n globalMaximum.maximizeInPlace(transformed);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction UpdateTransformedDataMinAndMaxToRef(data: FloatArray, count: number, matrix: Matrix, globalMinimum: Vector3, globalMaximum: Vector3): void {\r\n const transformed = TmpVectors.Vector3[7];\r\n\r\n for (let index = 0; index < count * 3; index += 3) {\r\n Vector3.TransformCoordinatesFromFloatsToRef(data[index], data[index + 1], data[index + 2], matrix, transformed);\r\n globalMinimum.minimizeInPlace(transformed);\r\n globalMaximum.maximizeInPlace(transformed);\r\n }\r\n}\r\n\r\nfunction UpdateRawBoundingVectors(vectors: Vector3[], rawBoundingInfo: BoundingInfo): void {\r\n vectors.length = 0;\r\n\r\n for (let v = 0; v < rawBoundingInfo.boundingBox.vectors.length; ++v) {\r\n vectors.push(rawBoundingInfo.boundingBox.vectors[v].clone());\r\n }\r\n}\r\n\r\nfunction TryUpdateBakedVertexAnimationThinInstanceBoundingInfo(mesh: Mesh, vectors: Vector3[], applyMorph: boolean): boolean {\r\n const storage = mesh._userThinInstanceBuffersStorage;\r\n const bakedVertexAnimationSettingsData = storage?.data[BakedVertexAnimationSettingsInstancedKind];\r\n const bakedVertexAnimationSettingsStride = storage?.strides[BakedVertexAnimationSettingsInstancedKind];\r\n\r\n if (!bakedVertexAnimationSettingsData || !bakedVertexAnimationSettingsStride || bakedVertexAnimationSettingsStride < 4 || !HasCpuReadableBakedVertexAnimationData(mesh)) {\r\n return false;\r\n }\r\n\r\n const matrixData = mesh._thinInstanceDataStorage.matrixData;\r\n if (!matrixData) {\r\n return false;\r\n }\r\n\r\n const cache = {};\r\n const settings = TmpVectors.Vector4[0];\r\n const rawMinimum = TmpVectors.Vector3[1];\r\n const rawMaximum = TmpVectors.Vector3[2];\r\n const globalMinimum = TmpVectors.Vector3[3];\r\n const globalMaximum = TmpVectors.Vector3[4];\r\n const localMinimum = TmpVectors.Vector3[5];\r\n const localMaximum = TmpVectors.Vector3[6];\r\n const matrix = TmpVectors.Matrix[2];\r\n const bias = mesh.geometry ? mesh.geometry.boundingBias : null;\r\n const vertexCount = mesh.getTotalVertices();\r\n\r\n rawMinimum.setAll(Number.POSITIVE_INFINITY);\r\n rawMaximum.setAll(Number.NEGATIVE_INFINITY);\r\n globalMinimum.setAll(Number.POSITIVE_INFINITY);\r\n globalMaximum.setAll(Number.NEGATIVE_INFINITY);\r\n\r\n for (let index = 0; index < mesh._thinInstanceDataStorage.instancesCount; ++index) {\r\n const settingsOffset = index * bakedVertexAnimationSettingsStride;\r\n settings.set(\r\n bakedVertexAnimationSettingsData[settingsOffset],\r\n bakedVertexAnimationSettingsData[settingsOffset + 1],\r\n bakedVertexAnimationSettingsData[settingsOffset + 2],\r\n bakedVertexAnimationSettingsData[settingsOffset + 3]\r\n );\r\n\r\n const positionData = mesh._getData(\r\n {\r\n applyMorph,\r\n applyBakedVertexAnimation: true,\r\n bakedVertexAnimationSettings: settings,\r\n updatePositionsArray: false,\r\n cache,\r\n },\r\n null,\r\n VertexBuffer.PositionKind\r\n );\r\n\r\n if (!positionData) {\r\n return false;\r\n }\r\n\r\n ExtractMinAndMaxToRef(positionData, vertexCount, localMinimum, localMaximum);\r\n ApplyBoundingBiasToMinAndMax(localMinimum, localMaximum, bias);\r\n rawMinimum.minimizeInPlace(localMinimum);\r\n rawMaximum.maximizeInPlace(localMaximum);\r\n\r\n Matrix.FromArrayToRef(matrixData, index * 16, matrix);\r\n if (bias) {\r\n UpdateTransformedMinAndMaxToRef(localMinimum, localMaximum, matrix, globalMinimum, globalMaximum);\r\n } else {\r\n UpdateTransformedDataMinAndMaxToRef(positionData, vertexCount, matrix, globalMinimum, globalMaximum);\r\n }\r\n }\r\n\r\n if (!isFinite(rawMinimum.x) || !isFinite(globalMinimum.x)) {\r\n return false;\r\n }\r\n\r\n const boundingInfo = mesh.getBoundingInfo();\r\n boundingInfo.reConstruct(globalMinimum, globalMaximum);\r\n mesh.rawBoundingInfo = new BoundingInfo(rawMinimum, rawMaximum);\r\n UpdateRawBoundingVectors(vectors, mesh.rawBoundingInfo);\r\n\r\n mesh._updateBoundingInfo();\r\n\r\n return true;\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Register side effects for thinInstanceMesh.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterThinInstanceMesh(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n Mesh.prototype.thinInstanceAdd = function (matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh: boolean = true): number {\r\n if (!this.getScene().getEngine().getCaps().instancedArrays) {\r\n Logger.Error(\"Thin Instances are not supported on this device as Instanced Array extension not supported\");\r\n return -1;\r\n }\r\n\r\n this._thinInstanceUpdateBufferSize(\"matrix\", Array.isArray(matrix) ? matrix.length : 1);\r\n\r\n const index = this._thinInstanceDataStorage.instancesCount;\r\n\r\n if (Array.isArray(matrix)) {\r\n for (let i = 0; i < matrix.length; ++i) {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix[i], i === matrix.length - 1 && refresh);\r\n }\r\n } else {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix, refresh);\r\n }\r\n\r\n return index;\r\n };\r\n\r\n Mesh.prototype.thinInstanceAddSelf = function (refresh: boolean = true): number {\r\n return this.thinInstanceAdd(Matrix.IdentityReadOnly, refresh);\r\n };\r\n\r\n Mesh.prototype.thinInstanceRegisterAttribute = function (kind: string, stride: number): void {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n this.removeVerticesData(kind);\r\n\r\n this._thinInstanceInitializeUserStorage();\r\n\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = stride * Math.max(32, this._thinInstanceDataStorage.instancesCount); // Initial size\r\n this._userThinInstanceBuffersStorage.data[kind] = new Float32Array(this._userThinInstanceBuffersStorage.sizes[kind]);\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(\r\n this.getEngine(),\r\n this._userThinInstanceBuffersStorage.data[kind],\r\n kind,\r\n true,\r\n false,\r\n stride,\r\n true\r\n );\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n };\r\n\r\n Mesh.prototype.thinInstanceSetMatrixAt = function (index: number, matrix: DeepImmutableObject<Matrix>, refresh: boolean = true): boolean {\r\n if (!this._thinInstanceDataStorage.matrixData || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n matrix.copyToArray(matrixData, index * 16);\r\n\r\n if (this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices[index] = matrix as Matrix;\r\n }\r\n\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(\"matrix\");\r\n\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n }\r\n\r\n return true;\r\n };\r\n\r\n Mesh.prototype.thinInstanceSetAttributeAt = function (kind: string, index: number, value: Array<number>, refresh: boolean = true): boolean {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.data[kind] || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n\r\n this._thinInstanceUpdateBufferSize(kind, 0); // make sur the buffer for the kind attribute is big enough\r\n\r\n this._userThinInstanceBuffersStorage.data[kind].set(value, index * this._userThinInstanceBuffersStorage.strides[kind]);\r\n\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(kind);\r\n }\r\n\r\n return true;\r\n };\r\n\r\n Object.defineProperty(Mesh.prototype, \"thinInstanceCount\", {\r\n get: function (this: Mesh) {\r\n return this._thinInstanceDataStorage.instancesCount;\r\n },\r\n set: function (this: Mesh, value: number) {\r\n const matrixData = this._thinInstanceDataStorage.matrixData ?? this.source?._thinInstanceDataStorage.matrixData;\r\n const numMaxInstances = matrixData ? matrixData.length / 16 : 0;\r\n\r\n if (value <= numMaxInstances) {\r\n this._thinInstanceDataStorage.instancesCount = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n });\r\n\r\n Mesh.prototype._thinInstanceCreateMatrixBuffer = function (kind: string, buffer: Float32Array, staticBuffer: boolean = true): Buffer {\r\n const matrixBuffer = new Buffer(this.getEngine(), buffer, !staticBuffer, 16, false, true);\r\n\r\n for (let i = 0; i < 4; i++) {\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(kind + i, i * 4, 4));\r\n }\r\n\r\n return matrixBuffer;\r\n };\r\n\r\n Mesh.prototype.thinInstanceSetBuffer = function (kind: string, buffer: Nullable<Float32Array>, stride: number = 0, staticBuffer: boolean = true): void {\r\n stride = stride || 16;\r\n\r\n if (kind === \"matrix\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n this._thinInstanceDataStorage.matrixBufferSize = buffer ? buffer.length : 32 * stride;\r\n this._thinInstanceDataStorage.matrixData = buffer;\r\n this._thinInstanceDataStorage.worldMatrices = null;\r\n\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", buffer, staticBuffer);\r\n\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n } else {\r\n this._thinInstanceDataStorage.instancesCount = 0;\r\n if (!this.doNotSyncBoundingInfo) {\r\n // mesh has no more thin instances, so need to recompute the bounding box because it's the regular mesh that will now be displayed\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n } else if (kind === \"previousMatrix\") {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = null;\r\n this._thinInstanceDataStorage.previousMatrixData = buffer;\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", buffer, staticBuffer);\r\n }\r\n } else if (kind === \"splatIndex\" && buffer) {\r\n this._thinInstanceInitializeUserStorage();\r\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\r\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\r\n const splatInstancesBuffer = new Buffer(this.getEngine(), buffer, true, 16, false, true);\r\n this._thinInstanceDataStorage.matrixBuffer = splatInstancesBuffer;\r\n for (let i = 0; i < 4; i++) {\r\n this.setVerticesBuffer(splatInstancesBuffer.createVertexBuffer(kind + i, i * 4, 4));\r\n }\r\n } else {\r\n // color for instanced mesh is ColorInstanceKind and not ColorKind because of native that needs to do the differenciation\r\n // hot switching kind here to preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (buffer === null) {\r\n if (this._userThinInstanceBuffersStorage?.data[kind]) {\r\n this.removeVerticesData(kind);\r\n delete this._userThinInstanceBuffersStorage.data[kind];\r\n delete this._userThinInstanceBuffersStorage.strides[kind];\r\n delete this._userThinInstanceBuffersStorage.sizes[kind];\r\n delete this._userThinInstanceBuffersStorage.vertexBuffers[kind];\r\n }\r\n } else {\r\n this._thinInstanceInitializeUserStorage();\r\n\r\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), buffer, kind, !staticBuffer, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n }\r\n };\r\n\r\n Mesh.prototype.thinInstanceBufferUpdated = function (kind: string): void {\r\n if (kind === \"matrix\") {\r\n if (this.thinInstanceAllowAutomaticStaticBufferRecreation && this._thinInstanceDataStorage.matrixBuffer && !this._thinInstanceDataStorage.matrixBuffer.isUpdatable()) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._thinInstanceDataStorage.matrixData!, 0, this._thinInstanceDataStorage.instancesCount);\r\n } else if (kind === \"previousMatrix\") {\r\n if (\r\n this.thinInstanceAllowAutomaticStaticBufferRecreation &&\r\n this._thinInstanceDataStorage.previousMatrixBuffer &&\r\n !this._thinInstanceDataStorage.previousMatrixBuffer.isUpdatable()\r\n ) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.updateDirectly(this._thinInstanceDataStorage.previousMatrixData!, 0, this._thinInstanceDataStorage.instancesCount);\r\n } else if (kind === \"splatIndex\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0, this._thinInstanceDataStorage.instancesCount);\r\n } else {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (this._userThinInstanceBuffersStorage?.vertexBuffers[kind]) {\r\n if (this.thinInstanceAllowAutomaticStaticBufferRecreation && !this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.isUpdatable()) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0);\r\n }\r\n }\r\n };\r\n\r\n Mesh.prototype.thinInstancePartialBufferUpdate = function (kind: string, dataOrLength: Float32Array | number, offset: number): void {\r\n if (kind === \"matrix\") {\r\n if (this._thinInstanceDataStorage.matrixBuffer) {\r\n if (typeof dataOrLength === \"number\") {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(\r\n new Float32Array(\r\n this._thinInstanceDataStorage.matrixData!.buffer,\r\n this._thinInstanceDataStorage.matrixData!.byteOffset + offset * 16 * Float32Array.BYTES_PER_ELEMENT,\r\n dataOrLength * 16\r\n ),\r\n offset * 16\r\n );\r\n } else {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(dataOrLength, offset);\r\n }\r\n }\r\n } else {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (this._userThinInstanceBuffersStorage?.vertexBuffers[kind]) {\r\n const buffer = this._userThinInstanceBuffersStorage.vertexBuffers[kind]!;\r\n if (typeof dataOrLength === \"number\") {\r\n const data = new Float32Array(\r\n this._userThinInstanceBuffersStorage.data[kind].buffer,\r\n this._userThinInstanceBuffersStorage.data[kind].byteOffset + offset * this._userThinInstanceBuffersStorage.strides[kind] * Float32Array.BYTES_PER_ELEMENT,\r\n dataOrLength * this._userThinInstanceBuffersStorage.strides[kind]\r\n );\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.updateDirectly(data, offset * this._userThinInstanceBuffersStorage.strides[kind]);\r\n } else {\r\n buffer.updateDirectly(dataOrLength, offset);\r\n }\r\n }\r\n }\r\n };\r\n\r\n Mesh.prototype.thinInstanceGetWorldMatrices = function (): Matrix[] {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return [];\r\n }\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n if (!this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices = [] as Matrix[];\r\n\r\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n this._thinInstanceDataStorage.worldMatrices[i] = Matrix.FromArray(matrixData, i * 16);\r\n }\r\n }\r\n\r\n return this._thinInstanceDataStorage.worldMatrices;\r\n };\r\n\r\n Mesh.prototype.thinInstanceRefreshBoundingInfo = function (\r\n forceRefreshParentInfo: boolean = false,\r\n applySkeleton: boolean = false,\r\n applyMorph: boolean = false,\r\n applyBakedVertexAnimation: boolean = false\r\n ) {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return;\r\n }\r\n\r\n const vectors = this._thinInstanceDataStorage.boundingVectors;\r\n\r\n if (forceRefreshParentInfo || !this.rawBoundingInfo) {\r\n vectors.length = 0;\r\n if (applyBakedVertexAnimation && TryUpdateBakedVertexAnimationThinInstanceBoundingInfo(this, vectors, applyMorph)) {\r\n return;\r\n }\r\n\r\n const useBakedVertexAnimation = applyBakedVertexAnimation && this.bakedVertexAnimationManager?.isEnabled && HasCpuReadableBakedVertexAnimationData(this);\r\n if (useBakedVertexAnimation) {\r\n this.refreshBoundingInfo({ applySkeleton, applyMorph, applyBakedVertexAnimation: true, updatePositionsArray: false });\r\n } else {\r\n this.refreshBoundingInfo(applySkeleton, applyMorph);\r\n }\r\n const boundingInfo = this.getBoundingInfo();\r\n this.rawBoundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n\r\n const boundingInfo = this.getBoundingInfo();\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n if (vectors.length === 0) {\r\n for (let v = 0; v < boundingInfo.boundingBox.vectors.length; ++v) {\r\n vectors.push(boundingInfo.boundingBox.vectors[v].clone());\r\n }\r\n }\r\n\r\n TmpVectors.Vector3[0].setAll(Number.POSITIVE_INFINITY); // min\r\n TmpVectors.Vector3[1].setAll(Number.NEGATIVE_INFINITY); // max\r\n\r\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n Matrix.FromArrayToRef(matrixData, i * 16, TmpVectors.Matrix[0]);\r\n\r\n for (let v = 0; v < vectors.length; ++v) {\r\n Vector3.TransformCoordinatesToRef(vectors[v], TmpVectors.Matrix[0], TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[0].minimizeInPlace(TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[1].maximizeInPlace(TmpVectors.Vector3[2]);\r\n }\r\n }\r\n\r\n boundingInfo.reConstruct(TmpVectors.Vector3[0], TmpVectors.Vector3[1]);\r\n\r\n this._updateBoundingInfo();\r\n };\r\n\r\n Mesh.prototype._thinInstanceRecreateBuffer = function (kind: string, staticBuffer: boolean = true) {\r\n if (kind === \"matrix\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", this._thinInstanceDataStorage.matrixData, staticBuffer);\r\n } else if (kind === \"previousMatrix\") {\r\n if (this._scene.needsPreviousWorldMatrices) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\r\n \"previousWorld\",\r\n this._thinInstanceDataStorage.previousMatrixData ?? this._thinInstanceDataStorage.matrixData,\r\n staticBuffer\r\n );\r\n }\r\n } else {\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]?.dispose();\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(\r\n this.getEngine(),\r\n this._userThinInstanceBuffersStorage.data[kind],\r\n kind,\r\n !staticBuffer,\r\n false,\r\n this._userThinInstanceBuffersStorage.strides[kind],\r\n true\r\n );\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n };\r\n\r\n Mesh.prototype._thinInstanceUpdateBufferSize = function (kind: string, numInstances: number = 1) {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n const kindIsMatrix = kind === \"matrix\";\r\n\r\n if (!kindIsMatrix && (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.strides[kind])) {\r\n return;\r\n }\r\n\r\n const stride = kindIsMatrix ? 16 : this._userThinInstanceBuffersStorage.strides[kind];\r\n const currentSize = kindIsMatrix ? this._thinInstanceDataStorage.matrixBufferSize : this._userThinInstanceBuffersStorage.sizes[kind];\r\n let data = kindIsMatrix ? this._thinInstanceDataStorage.matrixData : this._userThinInstanceBuffersStorage.data[kind];\r\n\r\n const bufferSize = (this._thinInstanceDataStorage.instancesCount + numInstances) * stride;\r\n\r\n let newSize = currentSize;\r\n\r\n while (newSize < bufferSize) {\r\n newSize *= 2;\r\n }\r\n\r\n if (!data || currentSize != newSize) {\r\n if (!data) {\r\n data = new Float32Array(newSize);\r\n } else {\r\n const newData = new Float32Array(newSize);\r\n newData.set(data, 0);\r\n data = newData;\r\n }\r\n\r\n if (kindIsMatrix) {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", data, false);\r\n this._thinInstanceDataStorage.matrixData = data;\r\n this._thinInstanceDataStorage.matrixBufferSize = newSize;\r\n if (this._scene.needsPreviousWorldMatrices && !this._thinInstanceDataStorage.previousMatrixData) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", data, false);\r\n }\r\n } else {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]?.dispose();\r\n\r\n this._userThinInstanceBuffersStorage.data[kind] = data;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = newSize;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), data, kind, true, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n }\r\n };\r\n\r\n Mesh.prototype._thinInstanceInitializeUserStorage = function () {\r\n if (!this._userThinInstanceBuffersStorage) {\r\n this._userThinInstanceBuffersStorage = {\r\n data: {},\r\n sizes: {},\r\n vertexBuffers: {},\r\n strides: {},\r\n };\r\n }\r\n };\r\n\r\n Mesh.prototype._disposeThinInstanceSpecificData = function () {\r\n if (this._thinInstanceDataStorage?.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n }\r\n if (this._thinInstanceDataStorage?.previousMatrixBuffer) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = null;\r\n }\r\n };\r\n}\r\n"]}
@@ -88,8 +88,9 @@ declare module "./mesh.pure.js" {
88
88
  * @param forceRefreshParentInfo true to force recomputing the mesh bounding info and use it to compute the aggregated bounding info
89
89
  * @param applySkeleton defines whether to apply the skeleton before computing the bounding info
90
90
  * @param applyMorph defines whether to apply the morph target before computing the bounding info
91
+ * @param applyBakedVertexAnimation defines whether to apply baked vertex animation before computing the bounding info
91
92
  */
92
- thinInstanceRefreshBoundingInfo(forceRefreshParentInfo?: boolean, applySkeleton?: boolean, applyMorph?: boolean): void;
93
+ thinInstanceRefreshBoundingInfo(forceRefreshParentInfo?: boolean, applySkeleton?: boolean, applyMorph?: boolean, applyBakedVertexAnimation?: boolean): void;
93
94
  /** @internal */
94
95
  _thinInstanceInitializeUserStorage(): void;
95
96
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"thinInstanceMesh.types.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/thinInstanceMesh.types.ts"],"names":[],"mappings":"","sourcesContent":["import { type Nullable, type DeepImmutableObject } from \"../types\";\r\nimport { type Matrix } from \"../Maths/math.vector\";\r\nimport { type VertexBuffer, type Buffer } from \"../Buffers/buffer\";\r\ndeclare module \"./mesh.pure\" {\r\n /** @internal */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Mesh {\r\n /**\r\n * Gets or sets a boolean defining if we want picking to pick thin instances as well\r\n */\r\n thinInstanceEnablePicking: boolean;\r\n\r\n /**\r\n * Indicates that a buffer created as static should be recreated if the buffer is updated (by calling thinInstanceSetMatrixAt or thinInstanceSetAttributeAt, for eg.)\r\n * If this flag is false (the default behavior), a buffer created as \"static\" won't show any update done to it, and will stay the same as it was created.\r\n * Note however that recreating a buffer each time there's a change will have some performance cost, that's why it is set to false by default.\r\n * You should set this flag to true only if your static buffers should change infrequently. If they change frequently, you should create your buffers as \"dynamic\" instead.\r\n */\r\n thinInstanceAllowAutomaticStaticBufferRecreation: boolean;\r\n\r\n /**\r\n * Creates a new thin instance\r\n * @param matrix the matrix or array of matrices (position, rotation, scale) of the thin instance(s) to create\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n * @returns the thin instance index number. If you pass an array of matrices, other instance indexes are index+1, index+2, etc\r\n */\r\n thinInstanceAdd(matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh?: boolean): number;\r\n\r\n /**\r\n * Adds the transformation (matrix) of the current mesh as a thin instance\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n * @returns the thin instance index number\r\n */\r\n thinInstanceAddSelf(refresh?: boolean): number;\r\n\r\n /**\r\n * Registers a custom attribute to be used with thin instances\r\n * @param kind name of the attribute\r\n * @param stride size in floats of the attribute\r\n */\r\n thinInstanceRegisterAttribute(kind: string, stride: number): void;\r\n\r\n /**\r\n * Sets the matrix of a thin instance\r\n * @param index index of the thin instance\r\n * @param matrix matrix to set\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n */\r\n thinInstanceSetMatrixAt(index: number, matrix: DeepImmutableObject<Matrix>, refresh?: boolean): void;\r\n\r\n /**\r\n * Sets the value of a custom attribute for a thin instance\r\n * @param kind name of the attribute\r\n * @param index index of the thin instance\r\n * @param value value to set\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n */\r\n thinInstanceSetAttributeAt(kind: string, index: number, value: Array<number>, refresh?: boolean): void;\r\n\r\n /**\r\n * Gets / sets the number of thin instances to display. Note that you can't set a number higher than what the underlying buffer can handle.\r\n */\r\n thinInstanceCount: number;\r\n\r\n /**\r\n * Sets a buffer to be used with thin instances. This method is a faster way to setup multiple instances than calling thinInstanceAdd repeatedly\r\n * @param kind name of the attribute. Use \"matrix\" to setup the buffer of matrices\r\n * @param buffer buffer to set\r\n * @param stride size in floats of each value of the buffer\r\n * @param staticBuffer indicates that the buffer is static, so that you won't change it after it is set (better performances - true by default)\r\n */\r\n thinInstanceSetBuffer(kind: string, buffer: Nullable<Float32Array>, stride?: number, staticBuffer?: boolean): void;\r\n\r\n /**\r\n * Gets the list of world matrices\r\n * @returns an array containing all the world matrices from the thin instances\r\n */\r\n thinInstanceGetWorldMatrices(): Matrix[];\r\n\r\n /**\r\n * Synchronize the gpu buffers with a thin instance buffer. Call this method if you update later on the buffers passed to thinInstanceSetBuffer\r\n * @param kind name of the attribute to update. Use \"matrix\" to update the buffer of matrices\r\n */\r\n thinInstanceBufferUpdated(kind: string): void;\r\n\r\n /**\r\n * Applies a partial update to a buffer directly on the GPU\r\n * Note that the buffer located on the CPU is NOT updated! It's up to you to update it (or not) with the same data you pass to this method\r\n * @param kind name of the attribute to update. Use \"matrix\" to update the buffer of matrices\r\n * @param dataOrLength the data to set in the GPU buffer, or the length (in elements) of data to update starting from the offset.\r\n * If you pass a length (number), it is the number of elements to update. For example, if kind is \"matrix\" and you pass 2 as length, it will update 2 matrices (2*16 floats) in the GPU buffer starting from the offset; in this case {@link offset} should also be expressed as a number of elements.\r\n * If you pass a Float32Array, {@link offset} is interpreted in floats in the underlying GPU buffer, consistent with low-level buffer update methods such as updateDirectly.\r\n * @param offset the offset in the GPU buffer where to update the data:\r\n * - when {@link dataOrLength} is a number, this is an element offset (for example, a matrix index);\r\n * - when {@link dataOrLength} is a Float32Array, this is a float offset in the underlying buffer.\r\n */\r\n thinInstancePartialBufferUpdate(kind: string, dataOrLength: Float32Array | number, offset: number): void;\r\n\r\n /**\r\n * Refreshes the bounding info, taking into account all the thin instances defined\r\n * @param forceRefreshParentInfo true to force recomputing the mesh bounding info and use it to compute the aggregated bounding info\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\r\n */\r\n thinInstanceRefreshBoundingInfo(forceRefreshParentInfo?: boolean, applySkeleton?: boolean, applyMorph?: boolean): void;\r\n\r\n /** @internal */\r\n _thinInstanceInitializeUserStorage(): void;\r\n\r\n /** @internal */\r\n _thinInstanceUpdateBufferSize(kind: string, numInstances?: number): void;\r\n\r\n /** @internal */\r\n _thinInstanceCreateMatrixBuffer(kind: string, buffer: Nullable<Float32Array>, staticBuffer: boolean): Buffer;\r\n\r\n /** @internal */\r\n _thinInstanceRecreateBuffer(kind: string, staticBuffer?: boolean): void;\r\n\r\n /** @internal */\r\n _userThinInstanceBuffersStorage: {\r\n /** @internal */\r\n data: { [key: string]: Float32Array };\r\n /** @internal */\r\n sizes: { [key: string]: number };\r\n /** @internal */\r\n vertexBuffers: { [key: string]: Nullable<VertexBuffer> };\r\n /** @internal */\r\n strides: { [key: string]: number };\r\n };\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"thinInstanceMesh.types.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/thinInstanceMesh.types.ts"],"names":[],"mappings":"","sourcesContent":["import { type Nullable, type DeepImmutableObject } from \"../types\";\r\nimport { type Matrix } from \"../Maths/math.vector\";\r\nimport { type VertexBuffer, type Buffer } from \"../Buffers/buffer\";\r\ndeclare module \"./mesh.pure\" {\r\n /** @internal */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Mesh {\r\n /**\r\n * Gets or sets a boolean defining if we want picking to pick thin instances as well\r\n */\r\n thinInstanceEnablePicking: boolean;\r\n\r\n /**\r\n * Indicates that a buffer created as static should be recreated if the buffer is updated (by calling thinInstanceSetMatrixAt or thinInstanceSetAttributeAt, for eg.)\r\n * If this flag is false (the default behavior), a buffer created as \"static\" won't show any update done to it, and will stay the same as it was created.\r\n * Note however that recreating a buffer each time there's a change will have some performance cost, that's why it is set to false by default.\r\n * You should set this flag to true only if your static buffers should change infrequently. If they change frequently, you should create your buffers as \"dynamic\" instead.\r\n */\r\n thinInstanceAllowAutomaticStaticBufferRecreation: boolean;\r\n\r\n /**\r\n * Creates a new thin instance\r\n * @param matrix the matrix or array of matrices (position, rotation, scale) of the thin instance(s) to create\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n * @returns the thin instance index number. If you pass an array of matrices, other instance indexes are index+1, index+2, etc\r\n */\r\n thinInstanceAdd(matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh?: boolean): number;\r\n\r\n /**\r\n * Adds the transformation (matrix) of the current mesh as a thin instance\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n * @returns the thin instance index number\r\n */\r\n thinInstanceAddSelf(refresh?: boolean): number;\r\n\r\n /**\r\n * Registers a custom attribute to be used with thin instances\r\n * @param kind name of the attribute\r\n * @param stride size in floats of the attribute\r\n */\r\n thinInstanceRegisterAttribute(kind: string, stride: number): void;\r\n\r\n /**\r\n * Sets the matrix of a thin instance\r\n * @param index index of the thin instance\r\n * @param matrix matrix to set\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n */\r\n thinInstanceSetMatrixAt(index: number, matrix: DeepImmutableObject<Matrix>, refresh?: boolean): void;\r\n\r\n /**\r\n * Sets the value of a custom attribute for a thin instance\r\n * @param kind name of the attribute\r\n * @param index index of the thin instance\r\n * @param value value to set\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n */\r\n thinInstanceSetAttributeAt(kind: string, index: number, value: Array<number>, refresh?: boolean): void;\r\n\r\n /**\r\n * Gets / sets the number of thin instances to display. Note that you can't set a number higher than what the underlying buffer can handle.\r\n */\r\n thinInstanceCount: number;\r\n\r\n /**\r\n * Sets a buffer to be used with thin instances. This method is a faster way to setup multiple instances than calling thinInstanceAdd repeatedly\r\n * @param kind name of the attribute. Use \"matrix\" to setup the buffer of matrices\r\n * @param buffer buffer to set\r\n * @param stride size in floats of each value of the buffer\r\n * @param staticBuffer indicates that the buffer is static, so that you won't change it after it is set (better performances - true by default)\r\n */\r\n thinInstanceSetBuffer(kind: string, buffer: Nullable<Float32Array>, stride?: number, staticBuffer?: boolean): void;\r\n\r\n /**\r\n * Gets the list of world matrices\r\n * @returns an array containing all the world matrices from the thin instances\r\n */\r\n thinInstanceGetWorldMatrices(): Matrix[];\r\n\r\n /**\r\n * Synchronize the gpu buffers with a thin instance buffer. Call this method if you update later on the buffers passed to thinInstanceSetBuffer\r\n * @param kind name of the attribute to update. Use \"matrix\" to update the buffer of matrices\r\n */\r\n thinInstanceBufferUpdated(kind: string): void;\r\n\r\n /**\r\n * Applies a partial update to a buffer directly on the GPU\r\n * Note that the buffer located on the CPU is NOT updated! It's up to you to update it (or not) with the same data you pass to this method\r\n * @param kind name of the attribute to update. Use \"matrix\" to update the buffer of matrices\r\n * @param dataOrLength the data to set in the GPU buffer, or the length (in elements) of data to update starting from the offset.\r\n * If you pass a length (number), it is the number of elements to update. For example, if kind is \"matrix\" and you pass 2 as length, it will update 2 matrices (2*16 floats) in the GPU buffer starting from the offset; in this case {@link offset} should also be expressed as a number of elements.\r\n * If you pass a Float32Array, {@link offset} is interpreted in floats in the underlying GPU buffer, consistent with low-level buffer update methods such as updateDirectly.\r\n * @param offset the offset in the GPU buffer where to update the data:\r\n * - when {@link dataOrLength} is a number, this is an element offset (for example, a matrix index);\r\n * - when {@link dataOrLength} is a Float32Array, this is a float offset in the underlying buffer.\r\n */\r\n thinInstancePartialBufferUpdate(kind: string, dataOrLength: Float32Array | number, offset: number): void;\r\n\r\n /**\r\n * Refreshes the bounding info, taking into account all the thin instances defined\r\n * @param forceRefreshParentInfo true to force recomputing the mesh bounding info and use it to compute the aggregated bounding info\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\r\n * @param applyBakedVertexAnimation defines whether to apply baked vertex animation before computing the bounding info\r\n */\r\n thinInstanceRefreshBoundingInfo(forceRefreshParentInfo?: boolean, applySkeleton?: boolean, applyMorph?: boolean, applyBakedVertexAnimation?: boolean): void;\r\n\r\n /** @internal */\r\n _thinInstanceInitializeUserStorage(): void;\r\n\r\n /** @internal */\r\n _thinInstanceUpdateBufferSize(kind: string, numInstances?: number): void;\r\n\r\n /** @internal */\r\n _thinInstanceCreateMatrixBuffer(kind: string, buffer: Nullable<Float32Array>, staticBuffer: boolean): Buffer;\r\n\r\n /** @internal */\r\n _thinInstanceRecreateBuffer(kind: string, staticBuffer?: boolean): void;\r\n\r\n /** @internal */\r\n _userThinInstanceBuffersStorage: {\r\n /** @internal */\r\n data: { [key: string]: Float32Array };\r\n /** @internal */\r\n sizes: { [key: string]: number };\r\n /** @internal */\r\n vertexBuffers: { [key: string]: Nullable<VertexBuffer> };\r\n /** @internal */\r\n strides: { [key: string]: number };\r\n };\r\n }\r\n}\r\n"]}
@@ -1222,7 +1222,7 @@ Tools._DefaultCdnUrl = "https://cdn.babylonjs.com";
1222
1222
  * When set, unversioned CDN URLs will be rewritten to include this version prefix.
1223
1223
  * @internal
1224
1224
  */
1225
- Tools._CdnVersion = "9.9.1";
1225
+ Tools._CdnVersion = "9.9.2";
1226
1226
  /**
1227
1227
  * @internal
1228
1228
  */