@onerjs/core 8.48.8 → 8.49.1
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/Animations/animation.d.ts +9 -0
- package/Animations/animation.js +9 -0
- package/Animations/animation.js.map +1 -1
- package/Animations/runtimeAnimation.js +28 -0
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Culling/ray.core.d.ts +2 -1
- package/Culling/ray.core.js +7 -5
- package/Culling/ray.core.js.map +1 -1
- package/Culling/ray.js +3 -0
- package/Culling/ray.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +2 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/Layers/thinEffectLayer.js +8 -1
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.js +8 -5
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +26 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +3 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Maths/math.vector.d.ts +1 -1
- package/Maths/math.vector.js +3 -3
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.d.ts +18 -4
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js +29 -4
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +48 -8
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +276 -26
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +2 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +6 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.d.ts +61 -7
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js +94 -11
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +15 -0
- package/Meshes/mesh.js +40 -1
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/transformNode.js +28 -5
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/sceneSerializer.js +2 -1
- package/Misc/sceneSerializer.js.map +1 -1
- package/Misc/tools.js +1 -1
- package/Misc/tools.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +14 -0
- package/Particles/baseParticleSystem.js +23 -0
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/computeShaderParticleSystem.js +6 -0
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +29 -18
- package/Particles/gpuParticleSystem.js +139 -31
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +0 -14
- package/Particles/thinParticleSystem.js +0 -23
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Particles/webgl2ParticleSystem.d.ts +1 -0
- package/Particles/webgl2ParticleSystem.js +9 -0
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/Shaders/gpuUpdateParticles.vertex.js +12 -0
- package/Shaders/gpuUpdateParticles.vertex.js.map +1 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js +15 -1
- package/ShadersWGSL/gpuUpdateParticles.compute.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +11 -0
- package/scene.js +14 -0
- package/scene.js.map +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Nullable } from "../../types.js";
|
|
2
2
|
import { type Scene } from "../../scene.js";
|
|
3
3
|
import { Mesh } from "../mesh.js";
|
|
4
|
+
import { BoundingInfo } from "../../Culling/boundingInfo.js";
|
|
4
5
|
import { type GaussianSplattingMesh } from "./gaussianSplattingMesh.js";
|
|
5
6
|
import { type Ray } from "../../Culling/ray.core.js";
|
|
6
7
|
import { PickingInfo } from "../../Collisions/pickingInfo.js";
|
|
@@ -9,34 +10,65 @@ import { PickingInfo } from "../../Collisions/pickingInfo.js";
|
|
|
9
10
|
*/
|
|
10
11
|
export declare class GaussianSplattingPartProxyMesh extends Mesh {
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* Local-space bounds for this part, stored directly on the proxy so it does not
|
|
14
|
+
* need to retain a reference to the original source mesh.
|
|
13
15
|
*/
|
|
14
|
-
|
|
16
|
+
private _minimum;
|
|
17
|
+
private _maximum;
|
|
15
18
|
/**
|
|
16
19
|
* The index of the part in the compound mesh (internal storage)
|
|
17
20
|
*/
|
|
18
21
|
private _partIndex;
|
|
22
|
+
/**
|
|
23
|
+
* Number of splats owned by this part.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
_vertexCount: number;
|
|
27
|
+
/**
|
|
28
|
+
* Offset of this part in the compound splat ordering.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
_splatsDataOffset: number;
|
|
32
|
+
/**
|
|
33
|
+
* Texel offset of this part inside the compound SH textures.
|
|
34
|
+
* This matches the splat offset because SH data is stored one texel per splat.
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
_shDataOffset: number;
|
|
19
38
|
/**
|
|
20
39
|
* Gets the index of the part in the compound mesh
|
|
21
40
|
*/
|
|
22
41
|
get partIndex(): number;
|
|
23
42
|
/**
|
|
24
|
-
* The
|
|
43
|
+
* The compound mesh that owns this part proxy
|
|
25
44
|
*/
|
|
26
45
|
readonly compoundSplatMesh: GaussianSplattingMesh;
|
|
46
|
+
/**
|
|
47
|
+
* Backward-compatible alias for the owning compound mesh.
|
|
48
|
+
* @deprecated Use `compoundSplatMesh` instead.
|
|
49
|
+
*/
|
|
50
|
+
get proxiedMesh(): GaussianSplattingMesh;
|
|
27
51
|
/**
|
|
28
52
|
* Creates a new Gaussian Splatting part proxy mesh
|
|
29
53
|
* @param name The name of the proxy mesh
|
|
30
54
|
* @param scene The scene the proxy mesh belongs to
|
|
31
|
-
* @param compoundSplatMesh The
|
|
32
|
-
* @param proxiedMesh The Gaussian Splatting mesh that this proxy represents a part of
|
|
55
|
+
* @param compoundSplatMesh The compound mesh that owns this part proxy
|
|
33
56
|
* @param partIndex The index of the part in the compound mesh
|
|
57
|
+
* @param boundingInfo Local-space bounds of the part inside the compound mesh
|
|
58
|
+
* @param vertexCount Number of splats owned by the part
|
|
59
|
+
* @param splatsDataOffset Offset of the part in the compound splat ordering
|
|
60
|
+
* @param shDataOffset Offset of the part in the compound SH textures
|
|
61
|
+
*/
|
|
62
|
+
constructor(name: string, scene: Nullable<Scene>, compoundSplatMesh: GaussianSplattingMesh, partIndex: number, boundingInfo: BoundingInfo, vertexCount: number, splatsDataOffset: number, shDataOffset?: number);
|
|
63
|
+
/**
|
|
64
|
+
* Updates the bounding info of this proxy mesh from its stored part metadata.
|
|
34
65
|
*/
|
|
35
|
-
|
|
66
|
+
updateBoundingInfoFromPartData(): void;
|
|
36
67
|
/**
|
|
37
|
-
*
|
|
68
|
+
* Backward-compatible alias retained while callers move away from source-mesh based semantics.
|
|
38
69
|
*/
|
|
39
70
|
updateBoundingInfoFromProxiedMesh(): void;
|
|
71
|
+
private _applyBoundingInfo;
|
|
40
72
|
/**
|
|
41
73
|
* Returns the class name
|
|
42
74
|
* @returns "GaussianSplattingPartProxyMesh"
|
|
@@ -49,6 +81,15 @@ export declare class GaussianSplattingPartProxyMesh extends Mesh {
|
|
|
49
81
|
* @internal
|
|
50
82
|
*/
|
|
51
83
|
updatePartIndex(newPartIndex: number): void;
|
|
84
|
+
/**
|
|
85
|
+
* Updates the per-part metadata for this proxy mesh.
|
|
86
|
+
* This is used internally when compound parts are rebuilt and re-indexed.
|
|
87
|
+
* @param vertexCount the number of splats owned by the part
|
|
88
|
+
* @param splatsDataOffset the new splat offset in the compound
|
|
89
|
+
* @param shDataOffset the new SH texel offset in the compound
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
updatePartMetadata(vertexCount: number, splatsDataOffset: number, shDataOffset?: number): void;
|
|
52
93
|
/**
|
|
53
94
|
* Gets whether the part is visible
|
|
54
95
|
*/
|
|
@@ -71,4 +112,17 @@ export declare class GaussianSplattingPartProxyMesh extends Mesh {
|
|
|
71
112
|
* @returns the picking info with this mesh set as pickedMesh if hit
|
|
72
113
|
*/
|
|
73
114
|
intersects(ray: Ray): PickingInfo;
|
|
115
|
+
/**
|
|
116
|
+
* Serialize current GaussianSplattingPartProxyMesh
|
|
117
|
+
* @param serializationObject defines the object which will receive the serialization data
|
|
118
|
+
* @returns the serialized object
|
|
119
|
+
*/
|
|
120
|
+
serialize(serializationObject?: any): any;
|
|
121
|
+
/**
|
|
122
|
+
* Parses a serialized GaussianSplattingPartProxyMesh
|
|
123
|
+
* @param parsedMesh the serialized mesh
|
|
124
|
+
* @param scene the scene to create the GaussianSplattingPartProxyMesh in
|
|
125
|
+
* @returns the created GaussianSplattingPartProxyMesh
|
|
126
|
+
*/
|
|
127
|
+
static Parse(parsedMesh: any, scene: Scene): GaussianSplattingPartProxyMesh;
|
|
74
128
|
}
|
|
@@ -12,34 +12,54 @@ export class GaussianSplattingPartProxyMesh extends Mesh {
|
|
|
12
12
|
get partIndex() {
|
|
13
13
|
return this._partIndex;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Backward-compatible alias for the owning compound mesh.
|
|
17
|
+
* @deprecated Use `compoundSplatMesh` instead.
|
|
18
|
+
*/
|
|
19
|
+
get proxiedMesh() {
|
|
20
|
+
return this.compoundSplatMesh;
|
|
21
|
+
}
|
|
15
22
|
/**
|
|
16
23
|
* Creates a new Gaussian Splatting part proxy mesh
|
|
17
24
|
* @param name The name of the proxy mesh
|
|
18
25
|
* @param scene The scene the proxy mesh belongs to
|
|
19
|
-
* @param compoundSplatMesh The
|
|
20
|
-
* @param proxiedMesh The Gaussian Splatting mesh that this proxy represents a part of
|
|
26
|
+
* @param compoundSplatMesh The compound mesh that owns this part proxy
|
|
21
27
|
* @param partIndex The index of the part in the compound mesh
|
|
28
|
+
* @param boundingInfo Local-space bounds of the part inside the compound mesh
|
|
29
|
+
* @param vertexCount Number of splats owned by the part
|
|
30
|
+
* @param splatsDataOffset Offset of the part in the compound splat ordering
|
|
31
|
+
* @param shDataOffset Offset of the part in the compound SH textures
|
|
22
32
|
*/
|
|
23
|
-
constructor(name, scene, compoundSplatMesh,
|
|
33
|
+
constructor(name, scene, compoundSplatMesh, partIndex, boundingInfo, vertexCount, splatsDataOffset, shDataOffset = splatsDataOffset) {
|
|
24
34
|
super(name, scene);
|
|
25
|
-
this.proxiedMesh = proxiedMesh;
|
|
26
35
|
this._partIndex = partIndex;
|
|
36
|
+
this._vertexCount = vertexCount;
|
|
37
|
+
this._splatsDataOffset = splatsDataOffset;
|
|
38
|
+
this._shDataOffset = shDataOffset;
|
|
39
|
+
this._minimum = boundingInfo.minimum.clone();
|
|
40
|
+
this._maximum = boundingInfo.maximum.clone();
|
|
27
41
|
this.compoundSplatMesh = compoundSplatMesh;
|
|
28
|
-
|
|
29
|
-
this.updateBoundingInfoFromProxiedMesh();
|
|
42
|
+
this._applyBoundingInfo();
|
|
30
43
|
this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());
|
|
31
|
-
// Update the
|
|
44
|
+
// Update the compound mesh's part matrix when this proxy's world matrix changes.
|
|
32
45
|
this.onAfterWorldMatrixUpdateObservable.add(() => {
|
|
33
46
|
this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());
|
|
34
|
-
this.updateBoundingInfoFromProxiedMesh();
|
|
35
47
|
});
|
|
36
48
|
}
|
|
37
49
|
/**
|
|
38
|
-
* Updates the bounding info of this proxy mesh from
|
|
50
|
+
* Updates the bounding info of this proxy mesh from its stored part metadata.
|
|
51
|
+
*/
|
|
52
|
+
updateBoundingInfoFromPartData() {
|
|
53
|
+
this._applyBoundingInfo();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Backward-compatible alias retained while callers move away from source-mesh based semantics.
|
|
39
57
|
*/
|
|
40
58
|
updateBoundingInfoFromProxiedMesh() {
|
|
41
|
-
|
|
42
|
-
|
|
59
|
+
this.updateBoundingInfoFromPartData();
|
|
60
|
+
}
|
|
61
|
+
_applyBoundingInfo() {
|
|
62
|
+
this.setBoundingInfo(new BoundingInfo(this._minimum.clone(), this._maximum.clone()));
|
|
43
63
|
}
|
|
44
64
|
/**
|
|
45
65
|
* Returns the class name
|
|
@@ -57,6 +77,19 @@ export class GaussianSplattingPartProxyMesh extends Mesh {
|
|
|
57
77
|
updatePartIndex(newPartIndex) {
|
|
58
78
|
this._partIndex = newPartIndex;
|
|
59
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Updates the per-part metadata for this proxy mesh.
|
|
82
|
+
* This is used internally when compound parts are rebuilt and re-indexed.
|
|
83
|
+
* @param vertexCount the number of splats owned by the part
|
|
84
|
+
* @param splatsDataOffset the new splat offset in the compound
|
|
85
|
+
* @param shDataOffset the new SH texel offset in the compound
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
updatePartMetadata(vertexCount, splatsDataOffset, shDataOffset = splatsDataOffset) {
|
|
89
|
+
this._vertexCount = vertexCount;
|
|
90
|
+
this._splatsDataOffset = splatsDataOffset;
|
|
91
|
+
this._shDataOffset = shDataOffset;
|
|
92
|
+
}
|
|
60
93
|
/**
|
|
61
94
|
* Gets whether the part is visible
|
|
62
95
|
*/
|
|
@@ -103,5 +136,55 @@ export class GaussianSplattingPartProxyMesh extends Mesh {
|
|
|
103
136
|
pickingInfo.subMeshId = 0;
|
|
104
137
|
return pickingInfo;
|
|
105
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Serialize current GaussianSplattingPartProxyMesh
|
|
141
|
+
* @param serializationObject defines the object which will receive the serialization data
|
|
142
|
+
* @returns the serialized object
|
|
143
|
+
*/
|
|
144
|
+
serialize(serializationObject = {}) {
|
|
145
|
+
serializationObject = super.serialize(serializationObject);
|
|
146
|
+
// GaussianSplattingPartProxyMesh needs no SubMesh, Geometry, or Material
|
|
147
|
+
serializationObject.subMeshes = [];
|
|
148
|
+
serializationObject.geometryUniqueId = undefined;
|
|
149
|
+
serializationObject.geometryId = undefined;
|
|
150
|
+
serializationObject.materialUniqueId = undefined;
|
|
151
|
+
serializationObject.materialId = undefined;
|
|
152
|
+
serializationObject.instances = [];
|
|
153
|
+
serializationObject.actions = undefined;
|
|
154
|
+
serializationObject.type = this.getClassName();
|
|
155
|
+
serializationObject.compoundSplatMeshId = this.compoundSplatMesh.id;
|
|
156
|
+
// Part metadata is needed to reconnect the proxy to the correct compound segment.
|
|
157
|
+
serializationObject.partIndex = this._partIndex;
|
|
158
|
+
serializationObject.vertexCount = this._vertexCount;
|
|
159
|
+
serializationObject.splatsDataOffset = this._splatsDataOffset;
|
|
160
|
+
serializationObject.shDataOffset = this._shDataOffset;
|
|
161
|
+
const boundingInfo = this.getBoundingInfo();
|
|
162
|
+
serializationObject.boundingInfo = {
|
|
163
|
+
minimum: boundingInfo.minimum.asArray(),
|
|
164
|
+
maximum: boundingInfo.maximum.asArray(),
|
|
165
|
+
};
|
|
166
|
+
return serializationObject;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Parses a serialized GaussianSplattingPartProxyMesh
|
|
170
|
+
* @param parsedMesh the serialized mesh
|
|
171
|
+
* @param scene the scene to create the GaussianSplattingPartProxyMesh in
|
|
172
|
+
* @returns the created GaussianSplattingPartProxyMesh
|
|
173
|
+
*/
|
|
174
|
+
static Parse(parsedMesh, scene) {
|
|
175
|
+
const partIndex = parsedMesh.partIndex;
|
|
176
|
+
const compoundSplatMesh = parsedMesh.compoundSplatMesh ?? scene.getLastMeshById(parsedMesh.compoundSplatMeshId);
|
|
177
|
+
if (!compoundSplatMesh) {
|
|
178
|
+
throw new Error(`GaussianSplattingPartProxyMesh: compound mesh not found with ID ${parsedMesh.compoundSplatMeshId}`);
|
|
179
|
+
}
|
|
180
|
+
const minimum = Vector3.FromArray(parsedMesh.boundingInfo.minimum);
|
|
181
|
+
const maximum = Vector3.FromArray(parsedMesh.boundingInfo.maximum);
|
|
182
|
+
const boundingInfo = new BoundingInfo(minimum, maximum);
|
|
183
|
+
const vertexCount = parsedMesh.vertexCount ?? 0;
|
|
184
|
+
const splatsDataOffset = parsedMesh.splatsDataOffset ?? 0;
|
|
185
|
+
const shDataOffset = parsedMesh.shDataOffset ?? splatsDataOffset;
|
|
186
|
+
return new GaussianSplattingPartProxyMesh(parsedMesh.name, scene, compoundSplatMesh, partIndex, boundingInfo, vertexCount, splatsDataOffset, shDataOffset);
|
|
187
|
+
}
|
|
106
188
|
}
|
|
189
|
+
Mesh._GaussianSplattingPartProxyMeshParser = GaussianSplattingPartProxyMesh.Parse;
|
|
107
190
|
//# sourceMappingURL=gaussianSplattingPartProxyMesh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplattingPartProxyMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,IAAI;IAWpD;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IA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import { Mesh } from \"../mesh\";\r\nimport { BoundingInfo } from \"../../Culling/boundingInfo\";\r\nimport { type GaussianSplattingMesh } from \"./gaussianSplattingMesh\";\r\nimport { type Ray } from \"../../Culling/ray.core\";\r\nimport { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\n\r\n/**\r\n * Class used as a proxy mesh for a part of a compound Gaussian Splatting mesh\r\n */\r\nexport class GaussianSplattingPartProxyMesh extends Mesh {\r\n /**\r\n * The Gaussian Splatting mesh that this proxy represents a part of\r\n */\r\n public readonly proxiedMesh: GaussianSplattingMesh;\r\n\r\n /**\r\n * The index of the part in the compound mesh (internal storage)\r\n */\r\n private _partIndex: number;\r\n\r\n /**\r\n * Gets the index of the part in the compound mesh\r\n */\r\n public get partIndex(): number {\r\n return this._partIndex;\r\n }\r\n\r\n /**\r\n * The original Gaussian Splatting mesh that was merged into the compound\r\n */\r\n public readonly compoundSplatMesh: GaussianSplattingMesh;\r\n\r\n /**\r\n * Creates a new Gaussian Splatting part proxy mesh\r\n * @param name The name of the proxy mesh\r\n * @param scene The scene the proxy mesh belongs to\r\n * @param compoundSplatMesh The original Gaussian Splatting mesh that was merged into the compound\r\n * @param proxiedMesh The Gaussian Splatting mesh that this proxy represents a part of\r\n * @param partIndex The index of the part in the compound mesh\r\n */\r\n constructor(name: string, scene: Nullable<Scene>, compoundSplatMesh: GaussianSplattingMesh, proxiedMesh: GaussianSplattingMesh, partIndex: number) {\r\n super(name, scene);\r\n this.proxiedMesh = proxiedMesh;\r\n this._partIndex = partIndex;\r\n this.compoundSplatMesh = compoundSplatMesh;\r\n\r\n // Set bounding info based on the source mesh's bounds\r\n this.updateBoundingInfoFromProxiedMesh();\r\n this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());\r\n\r\n // Update the proxied mesh's part matrix when this proxy's world matrix changes\r\n this.onAfterWorldMatrixUpdateObservable.add(() => {\r\n this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());\r\n this.updateBoundingInfoFromProxiedMesh();\r\n });\r\n }\r\n\r\n /**\r\n * Updates the bounding info of this proxy mesh from the proxied mesh\r\n */\r\n public updateBoundingInfoFromProxiedMesh(): void {\r\n const boundingInfo = this.proxiedMesh.getBoundingInfo();\r\n this.setBoundingInfo(new BoundingInfo(boundingInfo.minimum.clone(), boundingInfo.maximum.clone()));\r\n }\r\n\r\n /**\r\n * Returns the class name\r\n * @returns \"GaussianSplattingPartProxyMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingPartProxyMesh\";\r\n }\r\n\r\n /**\r\n * Updates the part index for this proxy mesh.\r\n * This should only be called internally when parts are removed from the compound mesh.\r\n * @param newPartIndex the new part index\r\n * @internal\r\n */\r\n public updatePartIndex(newPartIndex: number): void {\r\n this._partIndex = newPartIndex;\r\n }\r\n\r\n /**\r\n * Gets whether the part is visible\r\n */\r\n public override get isVisible(): boolean {\r\n return this.compoundSplatMesh.getPartVisibility(this.partIndex) > 0;\r\n }\r\n\r\n /**\r\n * Sets whether the part is visible\r\n */\r\n public override set isVisible(value: boolean) {\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, value ? 1.0 : 0.0);\r\n }\r\n\r\n /**\r\n * Gets the visibility of the part (0.0 to 1.0)\r\n */\r\n public override get visibility(): number {\r\n return this.compoundSplatMesh.getPartVisibility(this.partIndex);\r\n }\r\n\r\n /**\r\n * Sets the visibility of the part (0.0 to 1.0)\r\n */\r\n public override set visibility(value: number) {\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, value);\r\n }\r\n\r\n /**\r\n * Checks if a ray intersects with this proxy mesh using only bounding info\r\n * @param ray defines the ray to test\r\n * @returns the picking info with this mesh set as pickedMesh if hit\r\n */\r\n public override intersects(ray: Ray): PickingInfo {\r\n const pickingInfo = new PickingInfo();\r\n const boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return pickingInfo;\r\n }\r\n\r\n // Always check against bounding info for proxy meshes\r\n if (!ray.intersectsSphere(boundingInfo.boundingSphere) || !ray.intersectsBox(boundingInfo.boundingBox)) {\r\n return pickingInfo;\r\n }\r\n\r\n // If we hit the bounding volume, report this mesh as picked\r\n pickingInfo.hit = true;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.distance = Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\r\n pickingInfo.subMeshId = 0;\r\n\r\n return pickingInfo;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"gaussianSplattingPartProxyMesh.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,IAAI;IAgCpD;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAOD;;;OAGG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAClC,CAAC;IAED;;;;;;;;;;OAUG;IACH,YACI,IAAY,EACZ,KAAsB,EACtB,iBAAwC,EACxC,SAAiB,EACjB,YAA0B,EAC1B,WAAmB,EACnB,gBAAwB,EACxB,eAAuB,gBAAgB;QAEvC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;QAC1C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IA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EAAE,KAAY;QACtD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACvC,MAAM,iBAAiB,GAClB,UAAU,CAAC,iBAAuD,IAAK,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,mBAAmB,CAAkC,CAAC;QACnK,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,mEAAmE,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;QACzH,CAAC;QACD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACnE,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACnE,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,IAAI,CAAC,CAAC;QAChD,MAAM,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,IAAI,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,IAAI,gBAAgB,CAAC;QACjE,OAAO,IAAI,8BAA8B,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;IAC/J,CAAC;CACJ;AAED,IAAI,CAAC,qCAAqC,GAAG,8BAA8B,CAAC,KAAK,CAAC","sourcesContent":["import { type Nullable } from \"core/types\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { Mesh } from \"../mesh\";\r\nimport { BoundingInfo } from \"../../Culling/boundingInfo\";\r\nimport { type GaussianSplattingMesh } from \"./gaussianSplattingMesh\";\r\nimport { type Ray } from \"../../Culling/ray.core\";\r\nimport { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\n\r\n/**\r\n * Class used as a proxy mesh for a part of a compound Gaussian Splatting mesh\r\n */\r\nexport class GaussianSplattingPartProxyMesh extends Mesh {\r\n /**\r\n * Local-space bounds for this part, stored directly on the proxy so it does not\r\n * need to retain a reference to the original source mesh.\r\n */\r\n private _minimum: Vector3;\r\n private _maximum: Vector3;\r\n\r\n /**\r\n * The index of the part in the compound mesh (internal storage)\r\n */\r\n private _partIndex: number;\r\n\r\n /**\r\n * Number of splats owned by this part.\r\n * @internal\r\n */\r\n public _vertexCount: number;\r\n\r\n /**\r\n * Offset of this part in the compound splat ordering.\r\n * @internal\r\n */\r\n public _splatsDataOffset: number;\r\n\r\n /**\r\n * Texel offset of this part inside the compound SH textures.\r\n * This matches the splat offset because SH data is stored one texel per splat.\r\n * @internal\r\n */\r\n public _shDataOffset: number;\r\n\r\n /**\r\n * Gets the index of the part in the compound mesh\r\n */\r\n public get partIndex(): number {\r\n return this._partIndex;\r\n }\r\n\r\n /**\r\n * The compound mesh that owns this part proxy\r\n */\r\n public readonly compoundSplatMesh: GaussianSplattingMesh;\r\n\r\n /**\r\n * Backward-compatible alias for the owning compound mesh.\r\n * @deprecated Use `compoundSplatMesh` instead.\r\n */\r\n public get proxiedMesh(): GaussianSplattingMesh {\r\n return this.compoundSplatMesh;\r\n }\r\n\r\n /**\r\n * Creates a new Gaussian Splatting part proxy mesh\r\n * @param name The name of the proxy mesh\r\n * @param scene The scene the proxy mesh belongs to\r\n * @param compoundSplatMesh The compound mesh that owns this part proxy\r\n * @param partIndex The index of the part in the compound mesh\r\n * @param boundingInfo Local-space bounds of the part inside the compound mesh\r\n * @param vertexCount Number of splats owned by the part\r\n * @param splatsDataOffset Offset of the part in the compound splat ordering\r\n * @param shDataOffset Offset of the part in the compound SH textures\r\n */\r\n constructor(\r\n name: string,\r\n scene: Nullable<Scene>,\r\n compoundSplatMesh: GaussianSplattingMesh,\r\n partIndex: number,\r\n boundingInfo: BoundingInfo,\r\n vertexCount: number,\r\n splatsDataOffset: number,\r\n shDataOffset: number = splatsDataOffset\r\n ) {\r\n super(name, scene);\r\n this._partIndex = partIndex;\r\n this._vertexCount = vertexCount;\r\n this._splatsDataOffset = splatsDataOffset;\r\n this._shDataOffset = shDataOffset;\r\n this._minimum = boundingInfo.minimum.clone();\r\n this._maximum = boundingInfo.maximum.clone();\r\n this.compoundSplatMesh = compoundSplatMesh;\r\n\r\n this._applyBoundingInfo();\r\n this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());\r\n\r\n // Update the compound mesh's part matrix when this proxy's world matrix changes.\r\n this.onAfterWorldMatrixUpdateObservable.add(() => {\r\n this.compoundSplatMesh.setWorldMatrixForPart(this.partIndex, this.getWorldMatrix());\r\n });\r\n }\r\n\r\n /**\r\n * Updates the bounding info of this proxy mesh from its stored part metadata.\r\n */\r\n public updateBoundingInfoFromPartData(): void {\r\n this._applyBoundingInfo();\r\n }\r\n\r\n /**\r\n * Backward-compatible alias retained while callers move away from source-mesh based semantics.\r\n */\r\n public updateBoundingInfoFromProxiedMesh(): void {\r\n this.updateBoundingInfoFromPartData();\r\n }\r\n\r\n private _applyBoundingInfo(): void {\r\n this.setBoundingInfo(new BoundingInfo(this._minimum.clone(), this._maximum.clone()));\r\n }\r\n\r\n /**\r\n * Returns the class name\r\n * @returns \"GaussianSplattingPartProxyMesh\"\r\n */\r\n public override getClassName(): string {\r\n return \"GaussianSplattingPartProxyMesh\";\r\n }\r\n\r\n /**\r\n * Updates the part index for this proxy mesh.\r\n * This should only be called internally when parts are removed from the compound mesh.\r\n * @param newPartIndex the new part index\r\n * @internal\r\n */\r\n public updatePartIndex(newPartIndex: number): void {\r\n this._partIndex = newPartIndex;\r\n }\r\n\r\n /**\r\n * Updates the per-part metadata for this proxy mesh.\r\n * This is used internally when compound parts are rebuilt and re-indexed.\r\n * @param vertexCount the number of splats owned by the part\r\n * @param splatsDataOffset the new splat offset in the compound\r\n * @param shDataOffset the new SH texel offset in the compound\r\n * @internal\r\n */\r\n public updatePartMetadata(vertexCount: number, splatsDataOffset: number, shDataOffset: number = splatsDataOffset): void {\r\n this._vertexCount = vertexCount;\r\n this._splatsDataOffset = splatsDataOffset;\r\n this._shDataOffset = shDataOffset;\r\n }\r\n\r\n /**\r\n * Gets whether the part is visible\r\n */\r\n public override get isVisible(): boolean {\r\n return this.compoundSplatMesh.getPartVisibility(this.partIndex) > 0;\r\n }\r\n\r\n /**\r\n * Sets whether the part is visible\r\n */\r\n public override set isVisible(value: boolean) {\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, value ? 1.0 : 0.0);\r\n }\r\n\r\n /**\r\n * Gets the visibility of the part (0.0 to 1.0)\r\n */\r\n public override get visibility(): number {\r\n return this.compoundSplatMesh.getPartVisibility(this.partIndex);\r\n }\r\n\r\n /**\r\n * Sets the visibility of the part (0.0 to 1.0)\r\n */\r\n public override set visibility(value: number) {\r\n this.compoundSplatMesh.setPartVisibility(this.partIndex, value);\r\n }\r\n\r\n /**\r\n * Checks if a ray intersects with this proxy mesh using only bounding info\r\n * @param ray defines the ray to test\r\n * @returns the picking info with this mesh set as pickedMesh if hit\r\n */\r\n public override intersects(ray: Ray): PickingInfo {\r\n const pickingInfo = new PickingInfo();\r\n const boundingInfo = this.getBoundingInfo();\r\n\r\n if (!boundingInfo) {\r\n return pickingInfo;\r\n }\r\n\r\n // Always check against bounding info for proxy meshes\r\n if (!ray.intersectsSphere(boundingInfo.boundingSphere) || !ray.intersectsBox(boundingInfo.boundingBox)) {\r\n return pickingInfo;\r\n }\r\n\r\n // If we hit the bounding volume, report this mesh as picked\r\n pickingInfo.hit = true;\r\n pickingInfo.pickedMesh = this;\r\n pickingInfo.distance = Vector3.Distance(ray.origin, boundingInfo.boundingSphere.center);\r\n pickingInfo.subMeshId = 0;\r\n\r\n return pickingInfo;\r\n }\r\n\r\n /**\r\n * Serialize current GaussianSplattingPartProxyMesh\r\n * @param serializationObject defines the object which will receive the serialization data\r\n * @returns the serialized object\r\n */\r\n public override serialize(serializationObject: any = {}): any {\r\n serializationObject = super.serialize(serializationObject);\r\n // GaussianSplattingPartProxyMesh needs no SubMesh, Geometry, or Material\r\n serializationObject.subMeshes = [];\r\n serializationObject.geometryUniqueId = undefined;\r\n serializationObject.geometryId = undefined;\r\n serializationObject.materialUniqueId = undefined;\r\n serializationObject.materialId = undefined;\r\n serializationObject.instances = [];\r\n serializationObject.actions = undefined;\r\n serializationObject.type = this.getClassName();\r\n serializationObject.compoundSplatMeshId = this.compoundSplatMesh.id;\r\n // Part metadata is needed to reconnect the proxy to the correct compound segment.\r\n serializationObject.partIndex = this._partIndex;\r\n serializationObject.vertexCount = this._vertexCount;\r\n serializationObject.splatsDataOffset = this._splatsDataOffset;\r\n serializationObject.shDataOffset = this._shDataOffset;\r\n const boundingInfo = this.getBoundingInfo();\r\n serializationObject.boundingInfo = {\r\n minimum: boundingInfo.minimum.asArray(),\r\n maximum: boundingInfo.maximum.asArray(),\r\n };\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Parses a serialized GaussianSplattingPartProxyMesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the GaussianSplattingPartProxyMesh in\r\n * @returns the created GaussianSplattingPartProxyMesh\r\n */\r\n public static override Parse(parsedMesh: any, scene: Scene): GaussianSplattingPartProxyMesh {\r\n const partIndex = parsedMesh.partIndex;\r\n const compoundSplatMesh =\r\n (parsedMesh.compoundSplatMesh as GaussianSplattingMesh | undefined) ?? (scene.getLastMeshById(parsedMesh.compoundSplatMeshId) as GaussianSplattingMesh | null);\r\n if (!compoundSplatMesh) {\r\n throw new Error(`GaussianSplattingPartProxyMesh: compound mesh not found with ID ${parsedMesh.compoundSplatMeshId}`);\r\n }\r\n const minimum = Vector3.FromArray(parsedMesh.boundingInfo.minimum);\r\n const maximum = Vector3.FromArray(parsedMesh.boundingInfo.maximum);\r\n const boundingInfo = new BoundingInfo(minimum, maximum);\r\n const vertexCount = parsedMesh.vertexCount ?? 0;\r\n const splatsDataOffset = parsedMesh.splatsDataOffset ?? 0;\r\n const shDataOffset = parsedMesh.shDataOffset ?? splatsDataOffset;\r\n return new GaussianSplattingPartProxyMesh(parsedMesh.name, scene, compoundSplatMesh, partIndex, boundingInfo, vertexCount, splatsDataOffset, shDataOffset);\r\n }\r\n}\r\n\r\nMesh._GaussianSplattingPartProxyMeshParser = GaussianSplattingPartProxyMesh.Parse;\r\n"]}
|
package/Meshes/mesh.d.ts
CHANGED
|
@@ -1131,6 +1131,21 @@ export declare class Mesh extends AbstractMesh implements IGetSetVerticesData {
|
|
|
1131
1131
|
* @internal
|
|
1132
1132
|
*/
|
|
1133
1133
|
static _TrailMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
|
|
1134
|
+
/**
|
|
1135
|
+
* Holder function for GaussianSplattingMesh Parser, should be GaussianSplattingMesh.Parse after imported
|
|
1136
|
+
* @internal
|
|
1137
|
+
*/
|
|
1138
|
+
static _GaussianSplattingMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
|
|
1139
|
+
/**
|
|
1140
|
+
* Holder function for GaussianSplattingPartProxyMesh Parser, should be GaussianSplattingPartProxyMesh.Parse after imported
|
|
1141
|
+
* @internal
|
|
1142
|
+
*/
|
|
1143
|
+
static _GaussianSplattingPartProxyMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
|
|
1144
|
+
/**
|
|
1145
|
+
* Holder function for GaussianSplattingCompoundMesh Parser, should be GaussianSplattingCompoundMesh.Parse after imported
|
|
1146
|
+
* @internal
|
|
1147
|
+
*/
|
|
1148
|
+
static _GaussianSplattingCompoundMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
|
|
1134
1149
|
/**
|
|
1135
1150
|
* Returns a new Mesh object parsed from the source provided.
|
|
1136
1151
|
* @param parsedMesh is the source
|
package/Meshes/mesh.js
CHANGED
|
@@ -3581,6 +3581,8 @@ export class Mesh extends AbstractMesh {
|
|
|
3581
3581
|
*/
|
|
3582
3582
|
static Parse(parsedMesh, scene, rootUrl) {
|
|
3583
3583
|
let mesh;
|
|
3584
|
+
// Should not import Geometry for GaussianSplattingMesh and GaussianSplattingPartProxyMesh
|
|
3585
|
+
let skipImportGeometry = false;
|
|
3584
3586
|
if (parsedMesh.type && parsedMesh.type === "LinesMesh") {
|
|
3585
3587
|
mesh = Mesh._LinesMeshParser(parsedMesh, scene);
|
|
3586
3588
|
}
|
|
@@ -3596,6 +3598,19 @@ export class Mesh extends AbstractMesh {
|
|
|
3596
3598
|
else if (parsedMesh.type && parsedMesh.type === "TrailMesh") {
|
|
3597
3599
|
mesh = Mesh._TrailMeshParser(parsedMesh, scene);
|
|
3598
3600
|
}
|
|
3601
|
+
else if (parsedMesh.type && parsedMesh.type === "GaussianSplattingMesh") {
|
|
3602
|
+
if (parsedMesh._isCompound) {
|
|
3603
|
+
mesh = Mesh._GaussianSplattingCompoundMeshParser(parsedMesh, scene);
|
|
3604
|
+
}
|
|
3605
|
+
else {
|
|
3606
|
+
mesh = Mesh._GaussianSplattingMeshParser(parsedMesh, scene);
|
|
3607
|
+
}
|
|
3608
|
+
skipImportGeometry = true;
|
|
3609
|
+
}
|
|
3610
|
+
else if (parsedMesh.type && parsedMesh.type === "GaussianSplattingPartProxyMesh") {
|
|
3611
|
+
mesh = Mesh._GaussianSplattingPartProxyMeshParser(parsedMesh, scene);
|
|
3612
|
+
skipImportGeometry = true;
|
|
3613
|
+
}
|
|
3599
3614
|
else {
|
|
3600
3615
|
mesh = new Mesh(parsedMesh.name, scene);
|
|
3601
3616
|
}
|
|
@@ -3731,7 +3746,7 @@ export class Mesh extends AbstractMesh {
|
|
|
3731
3746
|
mesh._checkDelayState();
|
|
3732
3747
|
}
|
|
3733
3748
|
}
|
|
3734
|
-
else {
|
|
3749
|
+
else if (!skipImportGeometry) {
|
|
3735
3750
|
Geometry._ImportGeometry(parsedMesh, mesh);
|
|
3736
3751
|
}
|
|
3737
3752
|
// Material
|
|
@@ -4862,5 +4877,29 @@ Mesh._GreasedLineRibbonMeshParser = (parsedMesh, scene) => {
|
|
|
4862
4877
|
Mesh._TrailMeshParser = (parsedMesh, scene) => {
|
|
4863
4878
|
throw _WarnImport("TrailMesh");
|
|
4864
4879
|
};
|
|
4880
|
+
/**
|
|
4881
|
+
* Holder function for GaussianSplattingMesh Parser, should be GaussianSplattingMesh.Parse after imported
|
|
4882
|
+
* @internal
|
|
4883
|
+
*/
|
|
4884
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4885
|
+
Mesh._GaussianSplattingMeshParser = (parsedMesh, scene) => {
|
|
4886
|
+
throw _WarnImport("GaussianSplattingMesh");
|
|
4887
|
+
};
|
|
4888
|
+
/**
|
|
4889
|
+
* Holder function for GaussianSplattingPartProxyMesh Parser, should be GaussianSplattingPartProxyMesh.Parse after imported
|
|
4890
|
+
* @internal
|
|
4891
|
+
*/
|
|
4892
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4893
|
+
Mesh._GaussianSplattingPartProxyMeshParser = (parsedMesh, scene) => {
|
|
4894
|
+
throw _WarnImport("GaussianSplattingPartProxyMesh");
|
|
4895
|
+
};
|
|
4896
|
+
/**
|
|
4897
|
+
* Holder function for GaussianSplattingCompoundMesh Parser, should be GaussianSplattingCompoundMesh.Parse after imported
|
|
4898
|
+
* @internal
|
|
4899
|
+
*/
|
|
4900
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4901
|
+
Mesh._GaussianSplattingCompoundMeshParser = (parsedMesh, scene) => {
|
|
4902
|
+
throw _WarnImport("GaussianSplattingCompoundMesh");
|
|
4903
|
+
};
|
|
4865
4904
|
RegisterClass("BABYLON.Mesh", Mesh);
|
|
4866
4905
|
//# sourceMappingURL=mesh.js.map
|