@babylonjs/core 9.9.1 → 9.10.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.
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +34 -1
- package/AudioV2/abstractAudio/audioEngineV2.js +54 -0
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.d.ts +12 -0
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +18 -0
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -1
- package/AudioV2/abstractAudio/index.d.ts +1 -0
- package/AudioV2/abstractAudio/index.js +1 -0
- package/AudioV2/abstractAudio/index.js.map +1 -1
- package/AudioV2/abstractAudio/pure.d.ts +1 -0
- package/AudioV2/abstractAudio/pure.js +1 -0
- package/AudioV2/abstractAudio/pure.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +7 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +12 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +14 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +4 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +12 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +2 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +4 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +2 -1
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/Engines/abstractEngine.pure.js +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +16 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.d.ts +2 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +5 -2
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
- package/Gizmos/index.d.ts +1 -0
- package/Gizmos/index.js +1 -0
- package/Gizmos/index.js.map +1 -1
- package/Gizmos/pure.d.ts +1 -0
- package/Gizmos/pure.js +1 -0
- package/Gizmos/pure.js.map +1 -1
- package/Gizmos/spatialAudioGizmo.d.ts +55 -0
- package/Gizmos/spatialAudioGizmo.js +151 -0
- package/Gizmos/spatialAudioGizmo.js.map +1 -0
- package/Layers/selectionOutlineLayer.pure.d.ts +9 -2
- package/Layers/selectionOutlineLayer.pure.js +29 -6
- package/Layers/selectionOutlineLayer.pure.js.map +1 -1
- package/Layers/thinEffectLayer.d.ts +1 -0
- package/Layers/thinEffectLayer.js +7 -4
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +17 -3
- package/Layers/thinSelectionOutlineLayer.js +82 -17
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +5 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +54 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.pure.d.ts +13 -0
- package/Materials/PBR/openpbrMaterial.pure.js +17 -0
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.d.ts +2 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js +3 -2
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +32 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +180 -22
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +54 -10
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +130 -13
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/abstractMesh.pure.d.ts +5 -1
- package/Meshes/abstractMesh.pure.js +92 -2
- package/Meshes/abstractMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.pure.js +143 -2
- package/Meshes/thinInstanceMesh.pure.js.map +1 -1
- package/Meshes/thinInstanceMesh.types.d.ts +2 -1
- package/Meshes/thinInstanceMesh.types.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +12 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/geometryBufferRenderer.pure.js +8 -0
- package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
- package/Rendering/objectRenderer.js +4 -2
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +54 -5
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +14 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingVoxel.vertex.js +1 -0
- package/Shaders/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/Shaders/selectionOutline.fragment.js +16 -4
- package/Shaders/selectionOutline.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +56 -5
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +2 -3
- package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +14 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js +1 -0
- package/ShadersWGSL/gaussianSplattingVoxel.vertex.js.map +1 -1
- package/ShadersWGSL/selectionOutline.fragment.js +14 -2
- package/ShadersWGSL/selectionOutline.fragment.js.map +1 -1
- package/XR/features/WebXRBodyTracking.pure.d.ts +16 -0
- package/XR/features/WebXRBodyTracking.pure.js +167 -30
- package/XR/features/WebXRBodyTracking.pure.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Observable } from "../Misc/observable.pure.js";
|
|
|
3
3
|
import { type Nullable, type FloatArray, type IndicesArray, type DeepImmutable } from "../types.js";
|
|
4
4
|
import { type Camera } from "../Cameras/camera.pure.js";
|
|
5
5
|
import { type Scene, type IDisposable } from "../scene.pure.js";
|
|
6
|
-
import { type Vector2, Matrix, Vector3 } from "../Maths/math.vector.pure.js";
|
|
6
|
+
import { type Vector2, type Vector4, Matrix, Vector3 } from "../Maths/math.vector.pure.js";
|
|
7
7
|
import { type Node } from "../node.js";
|
|
8
8
|
import { VertexBuffer } from "../Buffers/buffer.pure.js";
|
|
9
9
|
import { type IGetSetVerticesData } from "../Meshes/mesh.vertexData.js";
|
|
@@ -48,6 +48,10 @@ export interface IMeshDataOptions {
|
|
|
48
48
|
applySkeleton?: boolean;
|
|
49
49
|
/** Apply morph when computing the bounding info. Defaults to false. */
|
|
50
50
|
applyMorph?: boolean;
|
|
51
|
+
/** Apply baked vertex animation when computing data. Defaults to false. */
|
|
52
|
+
applyBakedVertexAnimation?: boolean;
|
|
53
|
+
/** Baked vertex animation settings to use instead of the manager's animationParameters. */
|
|
54
|
+
bakedVertexAnimationSettings?: DeepImmutable<Vector4>;
|
|
51
55
|
/** Update the cached positions stored as a Vector3 array. Defaults to true. */
|
|
52
56
|
updatePositionsArray?: boolean;
|
|
53
57
|
/**
|
|
@@ -16,6 +16,7 @@ import { extractMinAndMax } from "../Maths/math.functions.js";
|
|
|
16
16
|
import { Color3, Color4 } from "../Maths/math.color.pure.js";
|
|
17
17
|
import { Epsilon } from "../Maths/math.constants.js";
|
|
18
18
|
import { Axis } from "../Maths/math.axis.js";
|
|
19
|
+
import { Logger } from "../Misc/logger.js";
|
|
19
20
|
import { nativeOverride } from "../Misc/decorators.js";
|
|
20
21
|
import { AbstractEngine } from "../Engines/abstractEngine.pure.js";
|
|
21
22
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
@@ -87,6 +88,81 @@ function ApplySkeleton(data, kind, skeletonMatrices, matricesIndicesData, matric
|
|
|
87
88
|
tempVector.toArray(data, index);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
91
|
+
function BakedVertexAnimationModulo(value, divisor) {
|
|
92
|
+
return value - Math.floor(value / divisor) * divisor;
|
|
93
|
+
}
|
|
94
|
+
function BakedVertexAnimationHalfFloatToNumber(value) {
|
|
95
|
+
const sign = value & 0x8000 ? -1 : 1;
|
|
96
|
+
const exponent = (value & 0x7c00) >> 10;
|
|
97
|
+
const fraction = value & 0x03ff;
|
|
98
|
+
if (exponent === 0) {
|
|
99
|
+
return sign * Math.pow(2, -14) * (fraction / Math.pow(2, 10));
|
|
100
|
+
}
|
|
101
|
+
else if (exponent === 0x1f) {
|
|
102
|
+
return fraction ? NaN : sign * Infinity;
|
|
103
|
+
}
|
|
104
|
+
return sign * Math.pow(2, exponent - 15) * (1 + fraction / Math.pow(2, 10));
|
|
105
|
+
}
|
|
106
|
+
function GetBakedVertexAnimationFrame(animationSettings, time) {
|
|
107
|
+
const totalFrames = animationSettings.y - animationSettings.x + 1;
|
|
108
|
+
const normalizedTime = (time * animationSettings.w) / totalFrames;
|
|
109
|
+
const frameCorrection = normalizedTime < 1 ? 0 : 1;
|
|
110
|
+
const numOfFrames = totalFrames - frameCorrection;
|
|
111
|
+
let frameNum = BakedVertexAnimationModulo(normalizedTime - Math.floor(normalizedTime), 1) * numOfFrames;
|
|
112
|
+
frameNum = BakedVertexAnimationModulo(frameNum + animationSettings.z, numOfFrames);
|
|
113
|
+
return Math.floor(frameNum) + animationSettings.x + frameCorrection;
|
|
114
|
+
}
|
|
115
|
+
function ReadBakedVertexAnimationMatrixToRef(data, offset, matrix) {
|
|
116
|
+
if (data instanceof Float32Array) {
|
|
117
|
+
Matrix.FromArrayToRef(data, offset, matrix);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
matrix.copyFromFloats(BakedVertexAnimationHalfFloatToNumber(data[offset]), BakedVertexAnimationHalfFloatToNumber(data[offset + 1]), BakedVertexAnimationHalfFloatToNumber(data[offset + 2]), BakedVertexAnimationHalfFloatToNumber(data[offset + 3]), BakedVertexAnimationHalfFloatToNumber(data[offset + 4]), BakedVertexAnimationHalfFloatToNumber(data[offset + 5]), BakedVertexAnimationHalfFloatToNumber(data[offset + 6]), BakedVertexAnimationHalfFloatToNumber(data[offset + 7]), BakedVertexAnimationHalfFloatToNumber(data[offset + 8]), BakedVertexAnimationHalfFloatToNumber(data[offset + 9]), BakedVertexAnimationHalfFloatToNumber(data[offset + 10]), BakedVertexAnimationHalfFloatToNumber(data[offset + 11]), BakedVertexAnimationHalfFloatToNumber(data[offset + 12]), BakedVertexAnimationHalfFloatToNumber(data[offset + 13]), BakedVertexAnimationHalfFloatToNumber(data[offset + 14]), BakedVertexAnimationHalfFloatToNumber(data[offset + 15]));
|
|
121
|
+
}
|
|
122
|
+
function ApplyBakedVertexAnimation(data, kind, bakedVertexAnimationManager, animationSettings, matricesIndicesData, matricesWeightsData, matricesIndicesExtraData, matricesWeightsExtraData, numBoneInfluencers) {
|
|
123
|
+
const texture = bakedVertexAnimationManager.texture;
|
|
124
|
+
const internalTexture = texture?.getInternalTexture();
|
|
125
|
+
const textureData = internalTexture?._bufferView;
|
|
126
|
+
if (!(textureData instanceof Float32Array) && !(textureData instanceof Uint16Array)) {
|
|
127
|
+
Logger.Warn("Baked vertex animation bounding info requires CPU-readable Float32Array or Uint16Array texture data.", 1);
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
const textureSize = texture.getSize();
|
|
131
|
+
const frame = GetBakedVertexAnimationFrame(animationSettings, bakedVertexAnimationManager.time);
|
|
132
|
+
if (!isFinite(frame) || frame < 0 || frame >= textureSize.height) {
|
|
133
|
+
Logger.Warn("Baked vertex animation bounding info could not be refreshed because the computed frame is outside the texture.", 1);
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
const tempVector = TmpVectors.Vector3[0];
|
|
137
|
+
const finalMatrix = TmpVectors.Matrix[0];
|
|
138
|
+
const tempMatrix = TmpVectors.Matrix[1];
|
|
139
|
+
const textureFrameOffset = frame * textureSize.width * 4;
|
|
140
|
+
const transformFromFloatsToRef = kind === VertexBuffer.NormalKind ? Vector3.TransformNormalFromFloatsToRef : Vector3.TransformCoordinatesFromFloatsToRef;
|
|
141
|
+
for (let index = 0, matWeightIdx = 0; index < data.length; index += 3, matWeightIdx += 4) {
|
|
142
|
+
finalMatrix.reset();
|
|
143
|
+
let inf;
|
|
144
|
+
let weight;
|
|
145
|
+
for (inf = 0; inf < 4 && inf < numBoneInfluencers; inf++) {
|
|
146
|
+
weight = matricesWeightsData[matWeightIdx + inf];
|
|
147
|
+
if (weight > 0) {
|
|
148
|
+
ReadBakedVertexAnimationMatrixToRef(textureData, textureFrameOffset + Math.floor(matricesIndicesData[matWeightIdx + inf]) * 16, tempMatrix);
|
|
149
|
+
tempMatrix.scaleAndAddToRef(weight, finalMatrix);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (matricesIndicesExtraData && matricesWeightsExtraData) {
|
|
153
|
+
for (inf = 0; inf < 4 && inf + 4 < numBoneInfluencers; inf++) {
|
|
154
|
+
weight = matricesWeightsExtraData[matWeightIdx + inf];
|
|
155
|
+
if (weight > 0) {
|
|
156
|
+
ReadBakedVertexAnimationMatrixToRef(textureData, textureFrameOffset + Math.floor(matricesIndicesExtraData[matWeightIdx + inf]) * 16, tempMatrix);
|
|
157
|
+
tempMatrix.scaleAndAddToRef(weight, finalMatrix);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
transformFromFloatsToRef(data[index], data[index + 1], data[index + 2], finalMatrix, tempVector);
|
|
162
|
+
tempVector.toArray(data, index);
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
90
166
|
/** @internal */
|
|
91
167
|
class _FacetDataStorage {
|
|
92
168
|
constructor() {
|
|
@@ -1341,13 +1417,27 @@ export class AbstractMesh extends TransformNode {
|
|
|
1341
1417
|
}
|
|
1342
1418
|
data = cache._outputData;
|
|
1343
1419
|
}
|
|
1344
|
-
else if ((options.applyMorph && this.morphTargetManager) ||
|
|
1420
|
+
else if ((options.applyMorph && this.morphTargetManager) ||
|
|
1421
|
+
(options.applySkeleton && this.skeleton) ||
|
|
1422
|
+
(options.applyBakedVertexAnimation && this.bakedVertexAnimationManager?.isEnabled)) {
|
|
1345
1423
|
data = data.slice();
|
|
1346
1424
|
}
|
|
1347
1425
|
if (options.applyMorph && this.morphTargetManager) {
|
|
1348
1426
|
ApplyMorph(data, kind, this.morphTargetManager);
|
|
1349
1427
|
}
|
|
1350
|
-
|
|
1428
|
+
const bakedVertexAnimationManager = this.bakedVertexAnimationManager;
|
|
1429
|
+
let bakedVertexAnimationApplied = false;
|
|
1430
|
+
if (options.applyBakedVertexAnimation && bakedVertexAnimationManager?.isEnabled) {
|
|
1431
|
+
const matricesIndicesData = getVertexData(VertexBuffer.MatricesIndicesKind);
|
|
1432
|
+
const matricesWeightsData = getVertexData(VertexBuffer.MatricesWeightsKind);
|
|
1433
|
+
if (matricesWeightsData && matricesIndicesData) {
|
|
1434
|
+
const needExtras = this.numBoneInfluencers > 4;
|
|
1435
|
+
const matricesIndicesExtraData = needExtras ? getVertexData(VertexBuffer.MatricesIndicesExtraKind) : null;
|
|
1436
|
+
const matricesWeightsExtraData = needExtras ? getVertexData(VertexBuffer.MatricesWeightsExtraKind) : null;
|
|
1437
|
+
bakedVertexAnimationApplied = ApplyBakedVertexAnimation(data, kind, bakedVertexAnimationManager, options.bakedVertexAnimationSettings ?? bakedVertexAnimationManager.animationParameters, matricesIndicesData, matricesWeightsData, matricesIndicesExtraData, matricesWeightsExtraData, this.numBoneInfluencers);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
if (!bakedVertexAnimationApplied && options.applySkeleton && this.skeleton) {
|
|
1351
1441
|
const matricesIndicesData = getVertexData(VertexBuffer.MatricesIndicesKind);
|
|
1352
1442
|
const matricesWeightsData = getVertexData(VertexBuffer.MatricesWeightsKind);
|
|
1353
1443
|
if (matricesWeightsData && matricesIndicesData) {
|