@onerjs/core 8.52.4 → 8.52.6
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/Cameras/arcRotateCamera.pure.d.ts +6 -0
- package/Cameras/arcRotateCamera.pure.js +13 -0
- package/Cameras/arcRotateCamera.pure.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/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/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 +12 -10
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +20 -5
- 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/pbrBlockFinalLitComponents.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.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/pbrBlockFinalLitComponents.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.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() {
|
|
@@ -1422,13 +1498,27 @@ export class AbstractMesh extends TransformNode {
|
|
|
1422
1498
|
}
|
|
1423
1499
|
data = cache._outputData;
|
|
1424
1500
|
}
|
|
1425
|
-
else if ((options.applyMorph && this.morphTargetManager) ||
|
|
1501
|
+
else if ((options.applyMorph && this.morphTargetManager) ||
|
|
1502
|
+
(options.applySkeleton && this.skeleton) ||
|
|
1503
|
+
(options.applyBakedVertexAnimation && this.bakedVertexAnimationManager?.isEnabled)) {
|
|
1426
1504
|
data = data.slice();
|
|
1427
1505
|
}
|
|
1428
1506
|
if (options.applyMorph && this.morphTargetManager) {
|
|
1429
1507
|
ApplyMorph(data, kind, this.morphTargetManager);
|
|
1430
1508
|
}
|
|
1431
|
-
|
|
1509
|
+
const bakedVertexAnimationManager = this.bakedVertexAnimationManager;
|
|
1510
|
+
let bakedVertexAnimationApplied = false;
|
|
1511
|
+
if (options.applyBakedVertexAnimation && bakedVertexAnimationManager?.isEnabled) {
|
|
1512
|
+
const matricesIndicesData = getVertexData(VertexBuffer.MatricesIndicesKind);
|
|
1513
|
+
const matricesWeightsData = getVertexData(VertexBuffer.MatricesWeightsKind);
|
|
1514
|
+
if (matricesWeightsData && matricesIndicesData) {
|
|
1515
|
+
const needExtras = this.numBoneInfluencers > 4;
|
|
1516
|
+
const matricesIndicesExtraData = needExtras ? getVertexData(VertexBuffer.MatricesIndicesExtraKind) : null;
|
|
1517
|
+
const matricesWeightsExtraData = needExtras ? getVertexData(VertexBuffer.MatricesWeightsExtraKind) : null;
|
|
1518
|
+
bakedVertexAnimationApplied = ApplyBakedVertexAnimation(data, kind, bakedVertexAnimationManager, options.bakedVertexAnimationSettings ?? bakedVertexAnimationManager.animationParameters, matricesIndicesData, matricesWeightsData, matricesIndicesExtraData, matricesWeightsExtraData, this.numBoneInfluencers);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
if (!bakedVertexAnimationApplied && options.applySkeleton && this.skeleton) {
|
|
1432
1522
|
const matricesIndicesData = getVertexData(VertexBuffer.MatricesIndicesKind);
|
|
1433
1523
|
const matricesWeightsData = getVertexData(VertexBuffer.MatricesWeightsKind);
|
|
1434
1524
|
if (matricesWeightsData && matricesIndicesData) {
|