@babylonjs/core 7.37.0 → 7.37.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/Cameras/arcRotateCamera.d.ts +3 -1
- package/Cameras/arcRotateCamera.js +14 -3
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +12 -2
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +5 -0
- package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +21 -5
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +52 -176
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.d.ts +11 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +158 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.d.ts +11 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +177 -0
- package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +6 -0
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/index.d.ts +1 -0
- package/Materials/Node/Blocks/index.js +1 -0
- package/Materials/Node/Blocks/index.js.map +1 -1
- package/Materials/Node/Blocks/matrixSplitterBlock.d.ts +56 -0
- package/Materials/Node/Blocks/matrixSplitterBlock.js +130 -0
- package/Materials/Node/Blocks/matrixSplitterBlock.js.map +1 -0
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +12 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/effectRenderer.js +1 -1
- package/Materials/effectRenderer.js.map +1 -1
- package/Maths/math.scalar.d.ts +0 -1
- package/Maths/math.scalar.js +1 -2
- package/Maths/math.scalar.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.js +2 -2
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +15 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +68 -20
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/abstractMesh.hotSpot.d.ts +8 -1
- package/Meshes/abstractMesh.hotSpot.js +17 -0
- package/Meshes/abstractMesh.hotSpot.js.map +1 -1
- package/Meshes/linesMesh.js +1 -1
- package/Meshes/linesMesh.js.map +1 -1
- package/Misc/virtualJoystick.js +2 -0
- package/Misc/virtualJoystick.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +3 -23
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +30 -67
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +8 -4
- package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
- package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.d.ts → iblCdfGenerator.d.ts} +15 -12
- package/Rendering/{IBLShadows/iblShadowsImportanceSamplingRenderer.js → iblCdfGenerator.js} +37 -27
- package/Rendering/iblCdfGenerator.js.map +1 -0
- package/Rendering/iblCdfGeneratorSceneComponent.d.ts +59 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js +83 -0
- package/Rendering/iblCdfGeneratorSceneComponent.js.map +1 -0
- package/Rendering/index.d.ts +12 -10
- package/Rendering/index.js +12 -10
- package/Rendering/index.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +72 -2
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +1 -1
- package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +29 -4
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js +9 -1
- package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js +9 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +16 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/{iblShadowsCdfy.fragment.d.ts → iblCdfx.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
- package/Shaders/iblCdfx.fragment.js.map +1 -0
- package/Shaders/{iblShadowsCdfx.fragment.d.ts → iblCdfy.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
- package/Shaders/iblCdfy.fragment.js.map +1 -0
- package/Shaders/{iblShadowsIcdfx.fragment.d.ts → iblIcdfx.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
- package/Shaders/iblIcdfx.fragment.js.map +1 -0
- package/Shaders/{iblShadowsIcdfy.fragment.d.ts → iblIcdfy.fragment.d.ts} +1 -1
- package/Shaders/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
- package/Shaders/iblIcdfy.fragment.js.map +1 -0
- package/Shaders/importanceSamplingDebug.fragment.d.ts +5 -0
- package/Shaders/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
- package/Shaders/importanceSamplingDebug.fragment.js.map +1 -0
- package/Shaders/pbr.fragment.js +8 -0
- package/Shaders/pbr.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +77 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +28 -4
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/oitFragment.js +1 -1
- package/ShadersWGSL/ShadersInclude/oitFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +14 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +14 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +18 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/iblCdfx.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsCdfx.fragment.js → iblCdfx.fragment.js} +3 -3
- package/ShadersWGSL/iblCdfx.fragment.js.map +1 -0
- package/ShadersWGSL/iblCdfy.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsCdfy.fragment.js → iblCdfy.fragment.js} +3 -3
- package/ShadersWGSL/iblCdfy.fragment.js.map +1 -0
- package/ShadersWGSL/iblIcdfx.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsIcdfx.fragment.js → iblIcdfx.fragment.js} +3 -3
- package/ShadersWGSL/iblIcdfx.fragment.js.map +1 -0
- package/ShadersWGSL/iblIcdfy.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsIcdfy.fragment.js → iblIcdfy.fragment.js} +3 -3
- package/ShadersWGSL/iblIcdfy.fragment.js.map +1 -0
- package/ShadersWGSL/importanceSamplingDebug.fragment.d.ts +5 -0
- package/ShadersWGSL/{iblShadowsImportanceSamplingDebug.fragment.js → importanceSamplingDebug.fragment.js} +3 -3
- package/ShadersWGSL/importanceSamplingDebug.fragment.js.map +1 -0
- package/ShadersWGSL/pbr.fragment.js +12 -0
- package/ShadersWGSL/pbr.fragment.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +4 -0
- package/scene.js +6 -0
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +1 -1
- package/sceneComponent.js +1 -1
- package/sceneComponent.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsImportanceSamplingRenderer.js.map +0 -1
- package/Shaders/iblShadowsCdfx.fragment.js.map +0 -1
- package/Shaders/iblShadowsCdfy.fragment.js.map +0 -1
- package/Shaders/iblShadowsIcdfx.fragment.js.map +0 -1
- package/Shaders/iblShadowsIcdfy.fragment.js.map +0 -1
- package/Shaders/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
- package/Shaders/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsCdfx.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsCdfx.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsCdfy.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsCdfy.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsIcdfx.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsIcdfx.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsIcdfy.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsIcdfy.fragment.js.map +0 -1
- package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.d.ts +0 -5
- package/ShadersWGSL/iblShadowsImportanceSamplingDebug.fragment.js.map +0 -1
|
@@ -109,6 +109,12 @@ var PLYValue;
|
|
|
109
109
|
* Class used to render a gaussian splatting mesh
|
|
110
110
|
*/
|
|
111
111
|
export class GaussianSplattingMesh extends Mesh {
|
|
112
|
+
/**
|
|
113
|
+
* SH degree. 0 = no sh (default). 1 = 3 parameters. 2 = 8 parameters. 3 = 15 parameters.
|
|
114
|
+
*/
|
|
115
|
+
get shDegree() {
|
|
116
|
+
return this._shDegree;
|
|
117
|
+
}
|
|
112
118
|
/**
|
|
113
119
|
* Gets the covariancesA texture
|
|
114
120
|
*/
|
|
@@ -133,6 +139,12 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
133
139
|
get colorsTexture() {
|
|
134
140
|
return this._colorsTexture;
|
|
135
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Gets the SH textures
|
|
144
|
+
*/
|
|
145
|
+
get shTextures() {
|
|
146
|
+
return this._shTextures;
|
|
147
|
+
}
|
|
136
148
|
/**
|
|
137
149
|
* set rendering material
|
|
138
150
|
*/
|
|
@@ -169,12 +181,14 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
169
181
|
this._colorsTexture = null;
|
|
170
182
|
this._splatPositions = null;
|
|
171
183
|
this._splatIndex = null;
|
|
184
|
+
this._shTextures = null;
|
|
172
185
|
//@ts-expect-error
|
|
173
186
|
this._covariancesA = null;
|
|
174
187
|
//@ts-expect-error
|
|
175
188
|
this._covariancesB = null;
|
|
176
189
|
//@ts-expect-error
|
|
177
190
|
this._colors = null;
|
|
191
|
+
this._sh = null;
|
|
178
192
|
this._keepInRam = false;
|
|
179
193
|
this._delayedTextureUpdate = null;
|
|
180
194
|
this._oldDirection = new Vector3();
|
|
@@ -182,6 +196,7 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
182
196
|
this._material = null;
|
|
183
197
|
this._tmpCovariances = [0, 0, 0, 0, 0, 0];
|
|
184
198
|
this._sortIsDirty = false;
|
|
199
|
+
this._shDegree = 0;
|
|
185
200
|
const vertexData = new VertexData();
|
|
186
201
|
// Use an intanced quad or triangle. Triangle might be a bit faster because of less shader invocation but I didn't see any difference.
|
|
187
202
|
// Keeping both and use triangle for now.
|
|
@@ -694,10 +709,16 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
694
709
|
this._covariancesBTexture?.dispose();
|
|
695
710
|
this._centersTexture?.dispose();
|
|
696
711
|
this._colorsTexture?.dispose();
|
|
712
|
+
if (this._shTextures) {
|
|
713
|
+
this._shTextures.forEach((shTexture) => {
|
|
714
|
+
shTexture.dispose();
|
|
715
|
+
});
|
|
716
|
+
}
|
|
697
717
|
this._covariancesATexture = null;
|
|
698
718
|
this._covariancesBTexture = null;
|
|
699
719
|
this._centersTexture = null;
|
|
700
720
|
this._colorsTexture = null;
|
|
721
|
+
this._shTextures = null;
|
|
701
722
|
this._worker?.terminate();
|
|
702
723
|
this._worker = null;
|
|
703
724
|
super.dispose(doNotRecurse, true);
|
|
@@ -707,6 +728,12 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
707
728
|
this._covariancesBTexture = source.covariancesBTexture?.clone();
|
|
708
729
|
this._centersTexture = source.centersTexture?.clone();
|
|
709
730
|
this._colorsTexture = source.colorsTexture?.clone();
|
|
731
|
+
if (source._shTextures) {
|
|
732
|
+
this._shTextures = [];
|
|
733
|
+
this._shTextures.forEach((shTexture) => {
|
|
734
|
+
this._shTextures?.push(shTexture.clone());
|
|
735
|
+
});
|
|
736
|
+
}
|
|
710
737
|
}
|
|
711
738
|
/**
|
|
712
739
|
* Returns a new Mesh object generated from the current mesh properties.
|
|
@@ -772,7 +799,7 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
772
799
|
colorArray[destinationIndex * 4 + 2] = uBuffer[32 * sourceIndex + 24 + 2];
|
|
773
800
|
colorArray[destinationIndex * 4 + 3] = uBuffer[32 * sourceIndex + 24 + 3];
|
|
774
801
|
}
|
|
775
|
-
_updateTextures(covA, covB, colorArray) {
|
|
802
|
+
_updateTextures(covA, covB, colorArray, sh) {
|
|
776
803
|
const textureSize = this._getTextureSize(this._vertexCount);
|
|
777
804
|
// Update the textures
|
|
778
805
|
const createTextureFromData = (data, width, height, format) => {
|
|
@@ -781,6 +808,9 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
781
808
|
const createTextureFromDataU8 = (data, width, height, format) => {
|
|
782
809
|
return new RawTexture(data, width, height, format, this._scene, false, false, 2, 0);
|
|
783
810
|
};
|
|
811
|
+
const createTextureFromDataU32 = (data, width, height, format) => {
|
|
812
|
+
return new RawTexture(data, width, height, format, this._scene, false, false, 1, 7);
|
|
813
|
+
};
|
|
784
814
|
const createTextureFromDataF16 = (data, width, height, format) => {
|
|
785
815
|
return new RawTexture(data, width, height, format, this._scene, false, false, 2, 2);
|
|
786
816
|
};
|
|
@@ -788,9 +818,12 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
788
818
|
this._covariancesA = covA;
|
|
789
819
|
this._covariancesB = covB;
|
|
790
820
|
this._colors = colorArray;
|
|
821
|
+
if (sh) {
|
|
822
|
+
this._sh = sh;
|
|
823
|
+
}
|
|
791
824
|
}
|
|
792
825
|
if (this._covariancesATexture) {
|
|
793
|
-
this._delayedTextureUpdate = { covA: covA, covB: covB, colors: colorArray, centers: this._splatPositions };
|
|
826
|
+
this._delayedTextureUpdate = { covA: covA, covB: covB, colors: colorArray, centers: this._splatPositions, sh: sh };
|
|
794
827
|
const positions = Float32Array.from(this._splatPositions);
|
|
795
828
|
const vertexCount = this._vertexCount;
|
|
796
829
|
this._worker.postMessage({ positions, vertexCount }, [positions.buffer]);
|
|
@@ -801,10 +834,20 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
801
834
|
this._covariancesBTexture = createTextureFromDataF16(covB, textureSize.x, textureSize.y, this._useRGBACovariants ? 5 : 7);
|
|
802
835
|
this._centersTexture = createTextureFromData(this._splatPositions, textureSize.x, textureSize.y, 5);
|
|
803
836
|
this._colorsTexture = createTextureFromDataU8(colorArray, textureSize.x, textureSize.y, 5);
|
|
837
|
+
if (sh) {
|
|
838
|
+
this._shTextures = [];
|
|
839
|
+
sh.forEach((shData) => {
|
|
840
|
+
const buffer = new Uint32Array(shData.buffer);
|
|
841
|
+
const shTexture = createTextureFromDataU32(buffer, textureSize.x, textureSize.y, 11);
|
|
842
|
+
shTexture.wrapU = 0;
|
|
843
|
+
shTexture.wrapV = 0;
|
|
844
|
+
this._shTextures.push(shTexture);
|
|
845
|
+
});
|
|
846
|
+
}
|
|
804
847
|
this._instanciateWorker();
|
|
805
848
|
}
|
|
806
849
|
}
|
|
807
|
-
*_updateData(data, isAsync) {
|
|
850
|
+
*_updateData(data, isAsync, sh) {
|
|
808
851
|
// if a covariance texture is present, then it's not a creation but an update
|
|
809
852
|
if (!this._covariancesATexture) {
|
|
810
853
|
this._readyToDisplay = false;
|
|
@@ -817,6 +860,8 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
817
860
|
this._updateSplatIndexBuffer(vertexCount);
|
|
818
861
|
}
|
|
819
862
|
this._vertexCount = vertexCount;
|
|
863
|
+
// degree == 1 for 1 texture (3 terms), 2 for 2 textures(8 terms) and 3 for 3 textures (15 terms)
|
|
864
|
+
this._shDegree = sh ? sh.length : 0;
|
|
820
865
|
const textureSize = this._getTextureSize(vertexCount);
|
|
821
866
|
const textureLength = textureSize.x * textureSize.y;
|
|
822
867
|
const lineCountUpdate = GaussianSplattingMesh.ProgressiveUpdateAmount ?? textureSize.y;
|
|
@@ -829,7 +874,7 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
829
874
|
const maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
|
|
830
875
|
if (GaussianSplattingMesh.ProgressiveUpdateAmount) {
|
|
831
876
|
// create textures with not filled-yet array, then update directly portions of it
|
|
832
|
-
this._updateTextures(covA, covB, colorArray);
|
|
877
|
+
this._updateTextures(covA, covB, colorArray, sh);
|
|
833
878
|
this.setEnabled(true);
|
|
834
879
|
const partCount = Math.ceil(textureSize.y / lineCountUpdate);
|
|
835
880
|
for (let partIndex = 0; partIndex < partCount; partIndex++) {
|
|
@@ -859,7 +904,7 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
859
904
|
}
|
|
860
905
|
}
|
|
861
906
|
// textures
|
|
862
|
-
this._updateTextures(covA, covB, colorArray);
|
|
907
|
+
this._updateTextures(covA, covB, colorArray, sh);
|
|
863
908
|
// Update the binfo
|
|
864
909
|
this.getBoundingInfo().reConstruct(minimum, maximum, this.getWorldMatrix());
|
|
865
910
|
this.setEnabled(true);
|
|
@@ -869,18 +914,20 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
869
914
|
/**
|
|
870
915
|
* Update asynchronously the buffer
|
|
871
916
|
* @param data array buffer containing center, color, orientation and scale of splats
|
|
917
|
+
* @param sh optional array of uint8 array for SH data
|
|
872
918
|
* @returns a promise
|
|
873
919
|
*/
|
|
874
|
-
async updateDataAsync(data) {
|
|
875
|
-
return runCoroutineAsync(this._updateData(data, true), createYieldingScheduler());
|
|
920
|
+
async updateDataAsync(data, sh) {
|
|
921
|
+
return runCoroutineAsync(this._updateData(data, true, sh), createYieldingScheduler());
|
|
876
922
|
}
|
|
877
923
|
/**
|
|
878
924
|
* @experimental
|
|
879
925
|
* Update data from GS (position, orientation, color, scaling)
|
|
880
926
|
* @param data array that contain all the datas
|
|
927
|
+
* @param sh optional array of uint8 array for SH data
|
|
881
928
|
*/
|
|
882
|
-
updateData(data) {
|
|
883
|
-
runCoroutineSync(this._updateData(data, false));
|
|
929
|
+
updateData(data, sh) {
|
|
930
|
+
runCoroutineSync(this._updateData(data, false, sh));
|
|
884
931
|
}
|
|
885
932
|
// in case size is different
|
|
886
933
|
_updateSplatIndexBuffer(vertexCount) {
|
|
@@ -890,16 +937,10 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
890
937
|
}
|
|
891
938
|
this.forcedInstanceCount = vertexCount;
|
|
892
939
|
}
|
|
893
|
-
_updateSubTextures(centers, covA, covB, colors, lineStart, lineCount) {
|
|
940
|
+
_updateSubTextures(centers, covA, covB, colors, lineStart, lineCount, sh) {
|
|
894
941
|
const updateTextureFromData = (texture, data, width, lineStart, lineCount) => {
|
|
895
942
|
this.getEngine().updateTextureData(texture.getInternalTexture(), data, 0, lineStart, width, lineCount, 0, 0, false);
|
|
896
943
|
};
|
|
897
|
-
const updateTextureFromDataU8 = (texture, data, width, lineStart, lineCount) => {
|
|
898
|
-
this.getEngine().updateTextureData(texture.getInternalTexture(), data, 0, lineStart, width, lineCount, 0, 0, false);
|
|
899
|
-
};
|
|
900
|
-
const updateTextureFromDataF16 = (texture, data, width, lineStart, lineCount) => {
|
|
901
|
-
this.getEngine().updateTextureData(texture.getInternalTexture(), data, 0, lineStart, width, lineCount, 0, 0, false);
|
|
902
|
-
};
|
|
903
944
|
const textureSize = this._getTextureSize(this._vertexCount);
|
|
904
945
|
const covBSItemSize = this._useRGBACovariants ? 4 : 2;
|
|
905
946
|
const texelStart = lineStart * textureSize.x;
|
|
@@ -908,10 +949,17 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
908
949
|
const covBView = new Uint16Array(covB.buffer, texelStart * covBSItemSize * Uint16Array.BYTES_PER_ELEMENT, texelCount * covBSItemSize);
|
|
909
950
|
const colorsView = new Uint8Array(colors.buffer, texelStart * 4, texelCount * 4);
|
|
910
951
|
const centersView = new Float32Array(centers.buffer, texelStart * 4 * Float32Array.BYTES_PER_ELEMENT, texelCount * 4);
|
|
911
|
-
|
|
912
|
-
|
|
952
|
+
updateTextureFromData(this._covariancesATexture, covAView, textureSize.x, lineStart, lineCount);
|
|
953
|
+
updateTextureFromData(this._covariancesBTexture, covBView, textureSize.x, lineStart, lineCount);
|
|
913
954
|
updateTextureFromData(this._centersTexture, centersView, textureSize.x, lineStart, lineCount);
|
|
914
|
-
|
|
955
|
+
updateTextureFromData(this._colorsTexture, colorsView, textureSize.x, lineStart, lineCount);
|
|
956
|
+
if (sh) {
|
|
957
|
+
for (let i = 0; i < sh.length; i++) {
|
|
958
|
+
const componentCount = 4;
|
|
959
|
+
const shView = new Uint8Array(this._sh[i].buffer, texelStart * componentCount, texelCount * componentCount);
|
|
960
|
+
updateTextureFromData(this._shTextures[i], shView, textureSize.x, lineStart, lineCount);
|
|
961
|
+
}
|
|
962
|
+
}
|
|
915
963
|
}
|
|
916
964
|
_instanciateWorker() {
|
|
917
965
|
if (!this._vertexCount) {
|
|
@@ -937,7 +985,7 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
937
985
|
}
|
|
938
986
|
if (this._delayedTextureUpdate) {
|
|
939
987
|
const textureSize = this._getTextureSize(vertexCount);
|
|
940
|
-
this._updateSubTextures(this._delayedTextureUpdate.centers, this._delayedTextureUpdate.covA, this._delayedTextureUpdate.covB, this._delayedTextureUpdate.colors, 0, textureSize.y);
|
|
988
|
+
this._updateSubTextures(this._delayedTextureUpdate.centers, this._delayedTextureUpdate.covA, this._delayedTextureUpdate.covB, this._delayedTextureUpdate.colors, 0, textureSize.y, this._delayedTextureUpdate.sh);
|
|
941
989
|
this._delayedTextureUpdate = null;
|
|
942
990
|
}
|
|
943
991
|
this.thinInstanceBufferUpdated("splatIndex");
|