@onerjs/core 8.38.5 → 8.38.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/Culling/ray.core.js +2 -2
- package/Culling/ray.core.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.d.ts +76 -0
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.js +209 -0
- package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +20 -6
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +108 -77
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/glowLayerTask.js +1 -1
- package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.d.ts +28 -0
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +36 -0
- package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -0
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +5 -6
- package/Layers/thinSelectionOutlineLayer.js +35 -36
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +2 -15
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Maths/math.vector.functions.d.ts +3 -3
- package/Maths/math.vector.functions.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +18 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +122 -28
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.d.ts +74 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js +107 -0
- package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.js.map +1 -0
- package/Misc/environmentTextureTools.js +1 -1
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.js +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Misc/index.d.ts +1 -0
- package/Misc/index.js +1 -0
- package/Misc/index.js.map +1 -1
- package/Misc/textureTools.d.ts +2 -1
- package/Misc/textureTools.js +5 -3
- package/Misc/textureTools.js.map +1 -1
- package/Particles/Node/Blocks/particleGradientBlock.d.ts +1 -0
- package/Particles/Node/Blocks/particleGradientBlock.js +21 -0
- package/Particles/Node/Blocks/particleGradientBlock.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +5 -0
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +8 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +10 -4
- package/Particles/Node/Blocks/systemBlock.js +17 -8
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +8 -9
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js +12 -2
- package/Shaders/ShadersInclude/bakedVertexAnimationDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/bonesDeclaration.js +12 -2
- package/Shaders/ShadersInclude/bonesDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +12 -2
- package/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/bakedVertexAnimationDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.js +1 -1
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobalDeclaration.js +4 -3
- package/ShadersWGSL/ShadersInclude/morphTargetsVertexGlobalDeclaration.js.map +1 -1
- package/ShadersWGSL/boundingInfo.compute.js +2 -2
- package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
- package/ShadersWGSL/selectionOutline.fragment.js +1 -1
- package/ShadersWGSL/selectionOutline.fragment.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +3 -3
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/package.json +1 -1
|
@@ -65,9 +65,9 @@ export declare function Vector3ScaleToRef<T extends IVector3Like>(a: DeepImmutab
|
|
|
65
65
|
*/
|
|
66
66
|
export declare function Vector3ScaleInPlace<T extends IVector3Like>(vector: T, scale: number): T;
|
|
67
67
|
export declare function Vector3SubtractToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>, result: T): T;
|
|
68
|
-
export declare function Vector3CopyToRef<T extends IVector3Like>(source: IVector3Like
|
|
69
|
-
export declare function Vector3LerpToRef<T extends IVector3Like>(start:
|
|
70
|
-
export declare function Vector3NormalizeToRef<T extends IVector3Like>(vector: DeepImmutable<
|
|
68
|
+
export declare function Vector3CopyToRef<T extends IVector3Like>(source: DeepImmutable<IVector3Like>, result: T): T;
|
|
69
|
+
export declare function Vector3LerpToRef<T extends IVector3Like>(start: DeepImmutable<IVector3Like>, end: DeepImmutable<IVector3Like>, amount: number, result: T): T;
|
|
70
|
+
export declare function Vector3NormalizeToRef<T extends IVector3Like>(vector: DeepImmutable<IVector3Like>, result: T): T;
|
|
71
71
|
/**
|
|
72
72
|
* Computes the signed distance between the specified point and plane.
|
|
73
73
|
* @param origin defines a point on the plane
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.vector.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.vector.functions.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmC,EAAE,YAAoB;IACpF,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACzF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,CAA8B,EAAE,CAA8B;IACrF,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAmC;IACpE,OAAO,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAmC;IAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,CAA8B,EAAE,CAA8B;IACjG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB,MAAM,CAAC,GAAG,CAAC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,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmC,EAAE,YAAoB;IACpF,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACnK,CAAC","sourcesContent":["import type { DeepImmutable } from \"../types\";\r\nimport type { IVector2Like, IVector3Like, IVector4Like } from \"./math.like\";\r\n\r\n/**\r\n * Creates a string representation of the IVector2Like\r\n * @param vector defines the IVector2Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector2Like coordinates.\r\n */\r\nexport function Vector2ToFixed(vector: DeepImmutable<IVector2Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector3Like objects.\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector3Dot(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number {\r\n return a.x * b.x + a.y * b.y + a.z * b.z;\r\n}\r\n\r\n/**\r\n * Computes the squared length of the IVector3Like\r\n * @param vector the vector to measure\r\n * @returns the squared length of the vector\r\n */\r\nexport function Vector3LengthSquared(vector: DeepImmutable<IVector3Like>): number {\r\n return vector.x * vector.x + vector.y * vector.y + vector.z * vector.z;\r\n}\r\n\r\n/**\r\n * Computes the length of the IVector3Like\r\n * @param vector the vector to measure\r\n * @returns the length of the vector\r\n */\r\nexport function Vector3Length(vector: DeepImmutable<IVector3Like>): number {\r\n return Math.sqrt(Vector3LengthSquared(vector));\r\n}\r\n\r\n/**\r\n * Computes the squared distance between the IVector3Like objects\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the squared distance\r\n */\r\nexport function Vector3DistanceSquared(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number {\r\n const x = b.x - a.x;\r\n const y = b.y - a.y;\r\n const z = b.z - a.z;\r\n return x * x + y * y + z * z;\r\n}\r\n\r\n/**\r\n * Computes the distance between the IVector3Like objects\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the distance\r\n */\r\nexport function Vector3Distance(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number {\r\n return Math.sqrt(Vector3DistanceSquared(a, b));\r\n}\r\n\r\n/**\r\n * Sets the given floats into the result.\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param result defines the result vector\r\n * @returns the result vector\r\n */\r\nexport function Vector3FromFloatsToRef<T extends IVector3Like>(x: number, y: number, z: number, result: T): T {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n return result;\r\n}\r\n\r\n/**\r\n * Stores the scaled values of a vector into the result.\r\n * @param a defines the source vector\r\n * @param scale defines the scale factor\r\n * @param result defines the result vector\r\n * @returns the scaled vector\r\n */\r\nexport function Vector3ScaleToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, scale: number, result: T): T {\r\n result.x = a.x * scale;\r\n result.y = a.y * scale;\r\n result.z = a.z * scale;\r\n return result;\r\n}\r\n\r\n/**\r\n * Scales the current vector values in place by a factor.\r\n * @param vector defines the vector to scale\r\n * @param scale defines the scale factor\r\n * @returns the scaled vector\r\n */\r\nexport function Vector3ScaleInPlace<T extends IVector3Like>(vector: T, scale: number): T {\r\n vector.x *= scale;\r\n vector.y *= scale;\r\n vector.z *= scale;\r\n return vector;\r\n}\r\n\r\nexport function Vector3SubtractToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>, result: T): T {\r\n result.x = a.x - b.x;\r\n result.y = a.y - b.y;\r\n result.z = a.z - b.z;\r\n return result;\r\n}\r\n\r\nexport function Vector3CopyToRef<T extends IVector3Like>(source: IVector3Like, result: T): T {\r\n result.x = source.x;\r\n result.y = source.y;\r\n result.z = source.z;\r\n return result;\r\n}\r\n\r\nexport function Vector3LerpToRef<T extends IVector3Like>(start: T, end: T, amount: number, result: T): T {\r\n result.x = start.x + (end.x - start.x) * amount;\r\n result.y = start.y + (end.y - start.y) * amount;\r\n result.z = start.z + (end.z - start.z) * amount;\r\n return result;\r\n}\r\n\r\nexport function Vector3NormalizeToRef<T extends IVector3Like>(vector: DeepImmutable<T>, result: T): T {\r\n const len = Vector3Length(vector);\r\n if (len === 0) {\r\n result.x = 0;\r\n result.y = 0;\r\n result.z = 0;\r\n } else {\r\n result.x = vector.x / len;\r\n result.y = vector.y / len;\r\n result.z = vector.z / len;\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Computes the signed distance between the specified point and plane.\r\n * @param origin defines a point on the plane\r\n * @param normal defines the plane normal (assumes normalized)\r\n * @param point defines the point to compute the signed distance to\r\n * @returns the signed distance\r\n */\r\nexport function Vector3SignedDistanceToPlaneFromPositionAndNormal(\r\n origin: DeepImmutable<IVector3Like>,\r\n normal: DeepImmutable<IVector3Like>,\r\n point: DeepImmutable<IVector3Like>\r\n): number {\r\n return (point.x - origin.x) * normal.x + (point.y - origin.y) * normal.y + (point.z - origin.z) * normal.z;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the IVector3Like\r\n * @param vector defines the IVector3Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector3Like coordinates.\r\n */\r\nexport function Vector3ToFixed(vector: DeepImmutable<IVector3Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector4Like objects\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector4Dot(a: DeepImmutable<IVector4Like>, b: DeepImmutable<IVector4Like>): number {\r\n return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the IVector4Like\r\n * @param vector defines the IVector4Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector4Like coordinates.\r\n */\r\nexport function Vector4ToFixed(vector: DeepImmutable<IVector4Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"math.vector.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Maths/math.vector.functions.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmC,EAAE,YAAoB;IACpF,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACzF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,CAA8B,EAAE,CAA8B;IACrF,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAmC;IACpE,OAAO,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAm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;AACH,MAAM,UAAU,UAAU,CAAC,CAA8B,EAAE,CAA8B;IACrF,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmC,EAAE,YAAoB;IACpF,OAAO,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC;AACnK,CAAC","sourcesContent":["import type { DeepImmutable } from \"../types\";\r\nimport type { IVector2Like, IVector3Like, IVector4Like } from \"./math.like\";\r\n\r\n/**\r\n * Creates a string representation of the IVector2Like\r\n * @param vector defines the IVector2Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector2Like coordinates.\r\n */\r\nexport function Vector2ToFixed(vector: DeepImmutable<IVector2Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector3Like objects.\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector3Dot(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number {\r\n return a.x * b.x + a.y * b.y + a.z * b.z;\r\n}\r\n\r\n/**\r\n * Computes the squared length of the IVector3Like\r\n * @param vector the vector to measure\r\n * @returns the squared length of the vector\r\n */\r\nexport function Vector3LengthSquared(vector: DeepImmutable<IVector3Like>): number {\r\n return vector.x * vector.x + vector.y * vector.y + vector.z * vector.z;\r\n}\r\n\r\n/**\r\n * Computes the length of the IVector3Like\r\n * @param vector the vector to measure\r\n * @returns the length of the vector\r\n */\r\nexport function Vector3Length(vector: DeepImmutable<IVector3Like>): number {\r\n return Math.sqrt(Vector3LengthSquared(vector));\r\n}\r\n\r\n/**\r\n * Computes the squared distance between the IVector3Like objects\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the squared distance\r\n */\r\nexport function Vector3DistanceSquared(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number {\r\n const x = b.x - a.x;\r\n const y = b.y - a.y;\r\n const z = b.z - a.z;\r\n return x * x + y * y + z * z;\r\n}\r\n\r\n/**\r\n * Computes the distance between the IVector3Like objects\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the distance\r\n */\r\nexport function Vector3Distance(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>): number {\r\n return Math.sqrt(Vector3DistanceSquared(a, b));\r\n}\r\n\r\n/**\r\n * Sets the given floats into the result.\r\n * @param x defines the x coordinate\r\n * @param y defines the y coordinate\r\n * @param z defines the z coordinate\r\n * @param result defines the result vector\r\n * @returns the result vector\r\n */\r\nexport function Vector3FromFloatsToRef<T extends IVector3Like>(x: number, y: number, z: number, result: T): T {\r\n result.x = x;\r\n result.y = y;\r\n result.z = z;\r\n return result;\r\n}\r\n\r\n/**\r\n * Stores the scaled values of a vector into the result.\r\n * @param a defines the source vector\r\n * @param scale defines the scale factor\r\n * @param result defines the result vector\r\n * @returns the scaled vector\r\n */\r\nexport function Vector3ScaleToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, scale: number, result: T): T {\r\n result.x = a.x * scale;\r\n result.y = a.y * scale;\r\n result.z = a.z * scale;\r\n return result;\r\n}\r\n\r\n/**\r\n * Scales the current vector values in place by a factor.\r\n * @param vector defines the vector to scale\r\n * @param scale defines the scale factor\r\n * @returns the scaled vector\r\n */\r\nexport function Vector3ScaleInPlace<T extends IVector3Like>(vector: T, scale: number): T {\r\n vector.x *= scale;\r\n vector.y *= scale;\r\n vector.z *= scale;\r\n return vector;\r\n}\r\n\r\nexport function Vector3SubtractToRef<T extends IVector3Like>(a: DeepImmutable<IVector3Like>, b: DeepImmutable<IVector3Like>, result: T): T {\r\n result.x = a.x - b.x;\r\n result.y = a.y - b.y;\r\n result.z = a.z - b.z;\r\n return result;\r\n}\r\n\r\nexport function Vector3CopyToRef<T extends IVector3Like>(source: DeepImmutable<IVector3Like>, result: T): T {\r\n result.x = source.x;\r\n result.y = source.y;\r\n result.z = source.z;\r\n return result;\r\n}\r\n\r\nexport function Vector3LerpToRef<T extends IVector3Like>(start: DeepImmutable<IVector3Like>, end: DeepImmutable<IVector3Like>, amount: number, result: T): T {\r\n result.x = start.x + (end.x - start.x) * amount;\r\n result.y = start.y + (end.y - start.y) * amount;\r\n result.z = start.z + (end.z - start.z) * amount;\r\n return result;\r\n}\r\n\r\nexport function Vector3NormalizeToRef<T extends IVector3Like>(vector: DeepImmutable<IVector3Like>, result: T): T {\r\n const len = Vector3Length(vector);\r\n if (len === 0) {\r\n result.x = 0;\r\n result.y = 0;\r\n result.z = 0;\r\n } else {\r\n result.x = vector.x / len;\r\n result.y = vector.y / len;\r\n result.z = vector.z / len;\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Computes the signed distance between the specified point and plane.\r\n * @param origin defines a point on the plane\r\n * @param normal defines the plane normal (assumes normalized)\r\n * @param point defines the point to compute the signed distance to\r\n * @returns the signed distance\r\n */\r\nexport function Vector3SignedDistanceToPlaneFromPositionAndNormal(\r\n origin: DeepImmutable<IVector3Like>,\r\n normal: DeepImmutable<IVector3Like>,\r\n point: DeepImmutable<IVector3Like>\r\n): number {\r\n return (point.x - origin.x) * normal.x + (point.y - origin.y) * normal.y + (point.z - origin.z) * normal.z;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the IVector3Like\r\n * @param vector defines the IVector3Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector3Like coordinates.\r\n */\r\nexport function Vector3ToFixed(vector: DeepImmutable<IVector3Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)}}`;\r\n}\r\n\r\n/**\r\n * Computes the dot product of two IVector4Like objects\r\n * @param a defines the first vector\r\n * @param b defines the second vector\r\n * @returns the dot product\r\n */\r\nexport function Vector4Dot(a: DeepImmutable<IVector4Like>, b: DeepImmutable<IVector4Like>): number {\r\n return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\r\n}\r\n\r\n/**\r\n * Creates a string representation of the IVector4Like\r\n * @param vector defines the IVector4Like to stringify\r\n * @param decimalCount defines the number of decimals to use\r\n * @returns a string with the IVector4Like coordinates.\r\n */\r\nexport function Vector4ToFixed(vector: DeepImmutable<IVector4Like>, decimalCount: number): string {\r\n return `{X: ${vector.x.toFixed(decimalCount)} Y: ${vector.y.toFixed(decimalCount)} Z: ${vector.z.toFixed(decimalCount)} W: ${vector.w.toFixed(decimalCount)}}`;\r\n}\r\n"]}
|
|
@@ -203,6 +203,7 @@ export declare class GaussianSplattingMesh extends Mesh {
|
|
|
203
203
|
private _partIndices;
|
|
204
204
|
private _partMatrices;
|
|
205
205
|
private _partVisibility;
|
|
206
|
+
private _partProxies;
|
|
206
207
|
private _textureSize;
|
|
207
208
|
private readonly _keepInRam;
|
|
208
209
|
private _delayedTextureUpdate;
|
|
@@ -478,6 +479,18 @@ export declare class GaussianSplattingMesh extends Mesh {
|
|
|
478
479
|
* @returns the world matrix for the part, or the current world matrix of the mesh if the mesh is not a compound
|
|
479
480
|
*/
|
|
480
481
|
getWorldMatrixForPart(partIndex: number): Matrix;
|
|
482
|
+
/**
|
|
483
|
+
* Gets the visibility for a specific part of the compound (if this mesh is a compound).
|
|
484
|
+
* @param partIndex index of the part, that must be between 0 and partCount - 1
|
|
485
|
+
* @returns the visibility value (0.0 to 1.0) for the part
|
|
486
|
+
*/
|
|
487
|
+
getPartVisibility(partIndex: number): number;
|
|
488
|
+
/**
|
|
489
|
+
* Sets the visibility for a specific part of the compound (if this mesh is a compound).
|
|
490
|
+
* @param partIndex index of the part, that must be between 0 and partCount - 1
|
|
491
|
+
* @param value the visibility value (0.0 to 1.0) to set
|
|
492
|
+
*/
|
|
493
|
+
setPartVisibility(partIndex: number, value: number): void;
|
|
481
494
|
/**
|
|
482
495
|
* Ensure that the part world matrix array is at least the given length.
|
|
483
496
|
* NB: This length is used as reference for the number of parts in the compound.
|
|
@@ -500,5 +513,10 @@ export declare class GaussianSplattingMesh extends Mesh {
|
|
|
500
513
|
* @returns a placeholder mesh that can be used to manipulate the part transform
|
|
501
514
|
*/
|
|
502
515
|
addPart(other: GaussianSplattingMesh, disposeOther?: boolean): Mesh;
|
|
516
|
+
/**
|
|
517
|
+
* Remove a part from this compound mesh.
|
|
518
|
+
* @param index - The index of the part to remove
|
|
519
|
+
*/
|
|
520
|
+
removePart(index: number): void;
|
|
503
521
|
}
|
|
504
522
|
export {};
|
|
@@ -13,6 +13,7 @@ import { Scalar } from "../../Maths/math.scalar.js";
|
|
|
13
13
|
import { runCoroutineSync, runCoroutineAsync, createYieldingScheduler } from "../../Misc/coroutine.js";
|
|
14
14
|
import { EngineStore } from "../../Engines/engineStore.js";
|
|
15
15
|
import { ImportMeshAsync } from "../../Loading/sceneLoader.js";
|
|
16
|
+
import { GaussianSplattingPartProxyMesh } from "./gaussianSplattingPartProxyMesh.js";
|
|
16
17
|
const IsNative = typeof _native !== "undefined";
|
|
17
18
|
const Native = IsNative ? _native : null;
|
|
18
19
|
// @internal
|
|
@@ -346,6 +347,7 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
346
347
|
this._partIndices = null;
|
|
347
348
|
this._partMatrices = [];
|
|
348
349
|
this._partVisibility = [];
|
|
350
|
+
this._partProxies = new Map();
|
|
349
351
|
this._textureSize = new Vector2(0, 0);
|
|
350
352
|
this._keepInRam = false;
|
|
351
353
|
this._delayedTextureUpdate = null;
|
|
@@ -1250,6 +1252,11 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
1250
1252
|
this._cameraViewInfos.forEach((cameraViewInfo) => {
|
|
1251
1253
|
cameraViewInfo.mesh.dispose();
|
|
1252
1254
|
});
|
|
1255
|
+
// dispose all proxy meshes
|
|
1256
|
+
this._partProxies.forEach((proxy) => {
|
|
1257
|
+
proxy.dispose();
|
|
1258
|
+
});
|
|
1259
|
+
this._partProxies.clear();
|
|
1253
1260
|
super.dispose(doNotRecurse, true);
|
|
1254
1261
|
}
|
|
1255
1262
|
_copyTextures(source) {
|
|
@@ -1707,6 +1714,22 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
1707
1714
|
getWorldMatrixForPart(partIndex) {
|
|
1708
1715
|
return this._partMatrices[partIndex] ?? this.getWorldMatrix();
|
|
1709
1716
|
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Gets the visibility for a specific part of the compound (if this mesh is a compound).
|
|
1719
|
+
* @param partIndex index of the part, that must be between 0 and partCount - 1
|
|
1720
|
+
* @returns the visibility value (0.0 to 1.0) for the part
|
|
1721
|
+
*/
|
|
1722
|
+
getPartVisibility(partIndex) {
|
|
1723
|
+
return this._partVisibility[partIndex] ?? 1.0;
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Sets the visibility for a specific part of the compound (if this mesh is a compound).
|
|
1727
|
+
* @param partIndex index of the part, that must be between 0 and partCount - 1
|
|
1728
|
+
* @param value the visibility value (0.0 to 1.0) to set
|
|
1729
|
+
*/
|
|
1730
|
+
setPartVisibility(partIndex, value) {
|
|
1731
|
+
this._partVisibility[partIndex] = Math.max(0.0, Math.min(1.0, value));
|
|
1732
|
+
}
|
|
1710
1733
|
/**
|
|
1711
1734
|
* Ensure that the part world matrix array is at least the given length.
|
|
1712
1735
|
* NB: This length is used as reference for the number of parts in the compound.
|
|
@@ -1821,38 +1844,109 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
1821
1844
|
// Merge part matrices (TODO)
|
|
1822
1845
|
const partWorldMatrix = other.getWorldMatrix();
|
|
1823
1846
|
this.setWorldMatrixForPart(newPartIndex, partWorldMatrix);
|
|
1824
|
-
// Create a
|
|
1825
|
-
|
|
1847
|
+
// Create a proxy mesh to manipulate the part transform
|
|
1848
|
+
const proxyMesh = new GaussianSplattingPartProxyMesh(other.name, this.getScene(), this, other, newPartIndex);
|
|
1826
1849
|
if (disposeOther) {
|
|
1827
1850
|
other.dispose();
|
|
1828
1851
|
}
|
|
1829
|
-
|
|
1830
|
-
placeholderMesh.onAfterWorldMatrixUpdateObservable.add(() => {
|
|
1831
|
-
this.setWorldMatrixForPart(newPartIndex, placeholderMesh.getWorldMatrix());
|
|
1832
|
-
});
|
|
1833
|
-
Object.defineProperty(placeholderMesh, "isVisible", {
|
|
1834
|
-
get: () => {
|
|
1835
|
-
return (this._partVisibility[newPartIndex] ?? 1.0) > 0;
|
|
1836
|
-
},
|
|
1837
|
-
set: (value) => {
|
|
1838
|
-
this._partVisibility[newPartIndex] = value ? 1.0 : 0.0;
|
|
1839
|
-
},
|
|
1840
|
-
});
|
|
1841
|
-
Object.defineProperty(placeholderMesh, "visibility", {
|
|
1842
|
-
get: () => {
|
|
1843
|
-
return this._partVisibility[newPartIndex] ?? 1.0;
|
|
1844
|
-
},
|
|
1845
|
-
set: (value) => {
|
|
1846
|
-
this._partVisibility[newPartIndex] = Math.max(0.0, Math.min(1.0, value));
|
|
1847
|
-
},
|
|
1848
|
-
});
|
|
1849
|
-
// Directly set the world matrix using freezeWorldMatrix
|
|
1852
|
+
// Set the initial world matrix
|
|
1850
1853
|
const quaternion = new Quaternion();
|
|
1851
|
-
partWorldMatrix.decompose(
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1854
|
+
partWorldMatrix.decompose(proxyMesh.scaling, quaternion, proxyMesh.position);
|
|
1855
|
+
proxyMesh.rotationQuaternion = quaternion;
|
|
1856
|
+
proxyMesh.computeWorldMatrix(true);
|
|
1857
|
+
// Store the proxy in the map
|
|
1858
|
+
this._partProxies.set(newPartIndex, proxyMesh);
|
|
1859
|
+
return proxyMesh;
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Remove a part from this compound mesh.
|
|
1863
|
+
* @param index - The index of the part to remove
|
|
1864
|
+
*/
|
|
1865
|
+
removePart(index) {
|
|
1866
|
+
if (index < 0 || index >= this.partCount) {
|
|
1867
|
+
throw new Error(`Part index ${index} is out of range [0, ${this.partCount})`);
|
|
1868
|
+
}
|
|
1869
|
+
// Get the current data
|
|
1870
|
+
const splatsData = this.splatsData;
|
|
1871
|
+
const shData = this.shData;
|
|
1872
|
+
const partIndices = this.partIndices;
|
|
1873
|
+
if (!splatsData || !partIndices) {
|
|
1874
|
+
throw new Error("Cannot remove part from a non-compound mesh or mesh without keepInRam");
|
|
1875
|
+
}
|
|
1876
|
+
const splatCount = this._vertexCount;
|
|
1877
|
+
const rowLength = GaussianSplattingMesh._RowOutputLength;
|
|
1878
|
+
// Count splats that will remain (not in the removed part)
|
|
1879
|
+
let newSplatCount = 0;
|
|
1880
|
+
for (let i = 0; i < splatCount; i++) {
|
|
1881
|
+
if (partIndices[i] !== index) {
|
|
1882
|
+
newSplatCount++;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
// Build new splats data excluding the removed part
|
|
1886
|
+
const newSplatsData = new Uint8Array(newSplatCount * rowLength);
|
|
1887
|
+
const newPartIndices = new Uint8Array(newSplatCount);
|
|
1888
|
+
let newShData = undefined;
|
|
1889
|
+
if (shData) {
|
|
1890
|
+
const bytesPerTexel = 16;
|
|
1891
|
+
newShData = [];
|
|
1892
|
+
for (let i = 0; i < shData.length; i++) {
|
|
1893
|
+
newShData.push(new Uint8Array(newSplatCount * bytesPerTexel));
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
let writeIndex = 0;
|
|
1897
|
+
for (let readIndex = 0; readIndex < splatCount; readIndex++) {
|
|
1898
|
+
const currentPartIndex = partIndices[readIndex];
|
|
1899
|
+
if (currentPartIndex === index) {
|
|
1900
|
+
// Skip splats from the removed part
|
|
1901
|
+
continue;
|
|
1902
|
+
}
|
|
1903
|
+
// Copy splat data
|
|
1904
|
+
const srcOffset = readIndex * rowLength;
|
|
1905
|
+
const dstOffset = writeIndex * rowLength;
|
|
1906
|
+
newSplatsData.set(new Uint8Array(splatsData, srcOffset, rowLength), dstOffset);
|
|
1907
|
+
// Renumber part indices: indices > removed index get decremented
|
|
1908
|
+
newPartIndices[writeIndex] = currentPartIndex > index ? currentPartIndex - 1 : currentPartIndex;
|
|
1909
|
+
// Copy SH data if present
|
|
1910
|
+
if (shData && newShData) {
|
|
1911
|
+
const bytesPerTexel = 16;
|
|
1912
|
+
for (let shIndex = 0; shIndex < shData.length; shIndex++) {
|
|
1913
|
+
const srcShOffset = readIndex * bytesPerTexel;
|
|
1914
|
+
const dstShOffset = writeIndex * bytesPerTexel;
|
|
1915
|
+
newShData[shIndex].set(new Uint8Array(shData[shIndex].buffer, srcShOffset, bytesPerTexel), dstShOffset);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
writeIndex++;
|
|
1919
|
+
}
|
|
1920
|
+
// Update the mesh with the new data
|
|
1921
|
+
this.updateData(newSplatsData.buffer, newShData, { flipY: false }, newPartIndices);
|
|
1922
|
+
// Remove the part matrix and visibility
|
|
1923
|
+
this._partMatrices.splice(index, 1);
|
|
1924
|
+
this._partVisibility.splice(index, 1);
|
|
1925
|
+
// Update worker with new part matrices
|
|
1926
|
+
if (this._worker) {
|
|
1927
|
+
this._worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });
|
|
1928
|
+
}
|
|
1929
|
+
// Dispose and remove the proxy for the removed part
|
|
1930
|
+
const proxyToRemove = this._partProxies.get(index);
|
|
1931
|
+
if (proxyToRemove) {
|
|
1932
|
+
proxyToRemove.dispose();
|
|
1933
|
+
this._partProxies.delete(index);
|
|
1934
|
+
}
|
|
1935
|
+
// Update the proxy map: renumber proxies with index > removed index
|
|
1936
|
+
const proxiesToUpdate = [];
|
|
1937
|
+
this._partProxies.forEach((proxy, proxyIndex) => {
|
|
1938
|
+
if (proxyIndex > index) {
|
|
1939
|
+
proxiesToUpdate.push([proxyIndex, proxy]);
|
|
1940
|
+
}
|
|
1941
|
+
});
|
|
1942
|
+
// Remove and re-add with updated indices
|
|
1943
|
+
for (const [oldIndex, proxy] of proxiesToUpdate) {
|
|
1944
|
+
this._partProxies.delete(oldIndex);
|
|
1945
|
+
// Update the proxy's internal partIndex
|
|
1946
|
+
proxy.updatePartIndex(oldIndex - 1);
|
|
1947
|
+
this._partProxies.set(oldIndex - 1, proxy);
|
|
1948
|
+
}
|
|
1949
|
+
this._postToWorker(true);
|
|
1856
1950
|
}
|
|
1857
1951
|
}
|
|
1858
1952
|
GaussianSplattingMesh._RowOutputLength = 3 * 4 + 3 * 4 + 4 + 4; // Vector3 position, Vector3 scale, 1 u8 quaternion, 1 color with alpha
|