@babylonjs/core 9.12.0 → 9.12.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.
Files changed (90) hide show
  1. package/Behaviors/Cameras/interpolatingBehavior.d.ts +17 -2
  2. package/Behaviors/Cameras/interpolatingBehavior.js +53 -23
  3. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  4. package/Cameras/Inputs/flyCameraKeyboardInput.js +9 -1
  5. package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
  6. package/Cameras/Inputs/flyCameraMouseInput.d.ts +2 -0
  7. package/Cameras/Inputs/flyCameraMouseInput.js +14 -2
  8. package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
  9. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +25 -5
  10. package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
  11. package/Cameras/Inputs/freeCameraMouseInput.d.ts +14 -0
  12. package/Cameras/Inputs/freeCameraMouseInput.js +26 -4
  13. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  14. package/Cameras/Inputs/freeCameraTouchInput.js +16 -5
  15. package/Cameras/Inputs/freeCameraTouchInput.js.map +1 -1
  16. package/Cameras/Inputs/geospatialCameraKeyboardInput.js +8 -1
  17. package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
  18. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  19. package/Cameras/flyCamera.pure.d.ts +8 -0
  20. package/Cameras/flyCamera.pure.js.map +1 -1
  21. package/Cameras/freeCamera.pure.d.ts +8 -0
  22. package/Cameras/freeCamera.pure.js.map +1 -1
  23. package/Cameras/geospatialCamera.pure.d.ts +30 -7
  24. package/Cameras/geospatialCamera.pure.js +39 -14
  25. package/Cameras/geospatialCamera.pure.js.map +1 -1
  26. package/Cameras/geospatialCameraMovement.js +2 -2
  27. package/Cameras/geospatialCameraMovement.js.map +1 -1
  28. package/Cameras/index.d.ts +1 -0
  29. package/Cameras/index.js +1 -0
  30. package/Cameras/index.js.map +1 -1
  31. package/Cameras/pure.d.ts +1 -0
  32. package/Cameras/pure.js +1 -0
  33. package/Cameras/pure.js.map +1 -1
  34. package/Cameras/targetCamera.pure.d.ts +25 -0
  35. package/Cameras/targetCamera.pure.js +83 -25
  36. package/Cameras/targetCamera.pure.js.map +1 -1
  37. package/Cameras/targetCameraMovement.d.ts +56 -0
  38. package/Cameras/targetCameraMovement.js +63 -0
  39. package/Cameras/targetCameraMovement.js.map +1 -0
  40. package/Engines/AbstractEngine/abstractEngine.scissor.d.ts +18 -0
  41. package/Engines/AbstractEngine/abstractEngine.scissor.js +2 -0
  42. package/Engines/AbstractEngine/abstractEngine.scissor.js.map +1 -0
  43. package/Engines/abstractEngine.pure.js +2 -2
  44. package/Engines/abstractEngine.pure.js.map +1 -1
  45. package/Engines/engine.d.ts +1 -0
  46. package/Engines/engine.js +1 -0
  47. package/Engines/engine.js.map +1 -1
  48. package/Engines/engine.pure.d.ts +0 -12
  49. package/Engines/engine.pure.js +0 -20
  50. package/Engines/engine.pure.js.map +1 -1
  51. package/Engines/nullEngine.pure.d.ts +66 -0
  52. package/Engines/nullEngine.pure.js +93 -0
  53. package/Engines/nullEngine.pure.js.map +1 -1
  54. package/Engines/pure.d.ts +1 -0
  55. package/Engines/pure.js +1 -0
  56. package/Engines/pure.js.map +1 -1
  57. package/Engines/thinEngine.scissor.d.ts +6 -0
  58. package/Engines/thinEngine.scissor.js +9 -0
  59. package/Engines/thinEngine.scissor.js.map +1 -0
  60. package/Engines/thinEngine.scissor.pure.d.ts +6 -0
  61. package/Engines/thinEngine.scissor.pure.js +24 -0
  62. package/Engines/thinEngine.scissor.pure.js.map +1 -0
  63. package/Engines/thinNativeEngine.d.ts +0 -1
  64. package/Engines/thinNativeEngine.js +0 -1
  65. package/Engines/thinNativeEngine.js.map +1 -1
  66. package/Engines/thinNativeEngine.pure.js +7 -0
  67. package/Engines/thinNativeEngine.pure.js.map +1 -1
  68. package/Engines/webgpuEngine.pure.js.map +1 -1
  69. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +10 -3
  70. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -1
  71. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +18 -8
  72. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  73. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +50 -1
  74. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +199 -104
  75. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  76. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +37 -0
  77. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +160 -0
  78. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -0
  79. package/Meshes/geometry.js +30 -15
  80. package/Meshes/geometry.js.map +1 -1
  81. package/Meshes/mesh.pure.js +26 -14
  82. package/Meshes/mesh.pure.js.map +1 -1
  83. package/Misc/tools.pure.js +1 -1
  84. package/Misc/tools.pure.js.map +1 -1
  85. package/Shaders/greasedLine.vertex.js +19 -3
  86. package/Shaders/greasedLine.vertex.js.map +1 -1
  87. package/package.json +3 -2
  88. package/scene.pure.d.ts +12 -0
  89. package/scene.pure.js +36 -0
  90. package/scene.pure.js.map +1 -1
@@ -10,7 +10,9 @@ export function GetCustomCode(shaderType, cameraFacing) {
10
10
  const obj = {
11
11
  CUSTOM_VERTEX_DEFINITIONS: `
12
12
  attribute float grl_widths;
13
- attribute vec3 grl_offsets;
13
+ #ifdef GREASED_LINE_USE_OFFSETS
14
+ attribute vec3 grl_offsets;
15
+ #endif
14
16
  attribute float grl_colorPointers;
15
17
  varying float grlCounters;
16
18
  varying float grlColorPointer;
@@ -30,11 +32,16 @@ export function GetCustomCode(shaderType, cameraFacing) {
30
32
  #endif
31
33
  `,
32
34
  CUSTOM_VERTEX_UPDATE_POSITION: `
33
- #ifdef GREASED_LINE_CAMERA_FACING
35
+ #ifdef GREASED_LINE_USE_OFFSETS
34
36
  vec3 grlPositionOffset = grl_offsets;
37
+ #else
38
+ vec3 grlPositionOffset = vec3(0.);
39
+ #endif
40
+
41
+ #ifdef GREASED_LINE_CAMERA_FACING
35
42
  positionUpdated += grlPositionOffset;
36
43
  #else
37
- positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);
44
+ positionUpdated = (positionUpdated + grlPositionOffset) + (grl_slopes * grl_widths);
38
45
  #endif
39
46
  `,
40
47
  CUSTOM_VERTEX_MAIN_END: `
@@ -1 +1 @@
1
- {"version":3,"file":"greasedLinePluginMaterialShadersGLSL.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,YAAqB;IACnE,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAQ;YACb,yBAAyB,EAAE;;;;;;;;;;;;;;;;;;;;iBAoBtB;YACL,6BAA6B,EAAE;;;;;;;iBAO1B;YACL,sBAAsB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CnB;SACR,CAAC;QACF,IAAI,YAAY,EAAE,CAAC;YACf,GAAG,CAAC,2CAA2C,CAAC,GAAG,IAAI,CAAC,CAAC,mCAAmC;QAChG,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO;YACH,2BAA2B,EAAE;;;;;;;;;;iBAUxB;YACL,gCAAgC,EAAE;;;;;;;;;;;;;;;;;;;;8CAoBA,+CAAuC;;qDAEhC,+CAAuC;;qDAEvC,oDAA4C;;;;;;;;;;;kDAW/C,+CAAuC;;yDAEhC,+CAAuC;;yDAEvC,oDAA4C;;;;;iBAKpF;SACR,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { type Nullable } from \"../../types\";\nimport { GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\n\n/**\n * Returns GLSL custom shader code\n * @param shaderType vertex or fragment\n * @param cameraFacing is in camera facing mode?\n * @returns GLSL custom shader code\n */\n/** @internal */\nexport function GetCustomCode(shaderType: string, cameraFacing: boolean): Nullable<{ [pointName: string]: string }> {\n if (shaderType === \"vertex\") {\n const obj: any = {\n CUSTOM_VERTEX_DEFINITIONS: `\n attribute float grl_widths;\n attribute vec3 grl_offsets;\n attribute float grl_colorPointers;\n varying float grlCounters;\n varying float grlColorPointer;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n attribute vec4 grl_previousAndSide;\n attribute vec4 grl_nextAndCounters;\n\n vec2 grlFix( vec4 i, float aspect ) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n }\n #else\n attribute vec3 grl_slopes;\n attribute float grl_counters;\n #endif\n `,\n CUSTOM_VERTEX_UPDATE_POSITION: `\n #ifdef GREASED_LINE_CAMERA_FACING\n vec3 grlPositionOffset = grl_offsets;\n positionUpdated += grlPositionOffset;\n #else\n positionUpdated = (positionUpdated + grl_offsets) + (grl_slopes * grl_widths);\n #endif\n `,\n CUSTOM_VERTEX_MAIN_END: `\n grlColorPointer = grl_colorPointers;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n\n float grlAspect = grl_aspect_resolution_lineWidth.x;\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\n\n vec3 grlPrevious = grl_previousAndSide.xyz;\n float grlSide = grl_previousAndSide.w;\n\n vec3 grlNext = grl_nextAndCounters.xyz;\n grlCounters = grl_nextAndCounters.w;\n float grlWidth = grlBaseWidth * grl_widths;\n \n vec3 worldDir = normalize(grlNext - grlPrevious);\n vec3 nearPosition = positionUpdated + (worldDir * 0.01);\n mat4 grlMatrix = viewProjection * finalWorld;\n vec4 grlFinalPosition = grlMatrix * vec4(positionUpdated , 1.0);\n vec4 screenNearPos = grlMatrix * vec4(nearPosition, 1.0);\n vec2 grlLinePosition = grlFix(grlFinalPosition, grlAspect);\n vec2 grlLineNearPosition = grlFix(screenNearPos, grlAspect);\n vec2 grlDir = normalize(grlLineNearPosition - grlLinePosition);\n\n vec4 grlNormal = vec4(-grlDir.y, grlDir.x, 0., 1.);\n\n #ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\n grlNormal.xy *= -.5 * grlWidth;\n #else\n grlNormal.xy *= .5 * grlWidth;\n #endif\n\n grlNormal *= grl_projection;\n\n #ifdef GREASED_LINE_SIZE_ATTENUATION\n grlNormal.xy *= grlFinalPosition.w;\n grlNormal.xy /= (vec4(grl_aspect_resolution_lineWidth.yz, 0., 1.) * grl_projection).xy;\n #endif\n\n grlFinalPosition.xy += grlNormal.xy * grlSide;\n gl_Position = grlFinalPosition;\n\n vPositionW = vec3(grlFinalPosition);\n #else\n grlCounters = grl_counters;\n #endif\n `,\n };\n if (cameraFacing) {\n obj[\"!gl_Position\\\\=viewProjection\\\\*worldPos;\"] = \"//\"; // not needed for camera facing GRL\n }\n return obj;\n }\n\n if (shaderType === \"fragment\") {\n return {\n CUSTOM_FRAGMENT_DEFINITIONS: `\n #ifdef PBR\n #define grlFinalColor finalColor\n #else\n #define grlFinalColor color\n #endif\n\n varying float grlCounters;\n varying float grlColorPointer;\n uniform sampler2D grl_colors;\n `,\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\n\n float grlUseDash = grl_dashOptions.x;\n float grlDashArray = grl_dashOptions.y;\n float grlDashOffset = grl_dashOptions.z;\n float grlDashRatio = grl_dashOptions.w;\n\n grlFinalColor.a *= step(grlCounters, grlVisibility);\n if(grlFinalColor.a == 0.) discard;\n\n if(grlUseDash == 1.){\n grlFinalColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\n if (grlFinalColor.a == 0.) discard;\n }\n\n #ifdef GREASED_LINE_HAS_COLOR\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\n grlFinalColor.rgb = grl_singleColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\n grlFinalColor.rgb += grl_singleColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\n grlFinalColor.rgb *= grl_singleColor;\n }\n #else\n if (grlUseColors == 1.) {\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\n #else\n vec2 lookup = vec2(fract(grlColorPointer / grl_textureSize.x), 1.0 - floor(grlColorPointer / grl_textureSize.x) / max(grl_textureSize.y - 1.0, 1.0));\n vec4 grlColor = texture2D(grl_colors, lookup, 0.0);\n #endif\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\n grlFinalColor = grlColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\n grlFinalColor += grlColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\n grlFinalColor *= grlColor;\n }\n }\n #endif\n `,\n };\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"greasedLinePluginMaterialShadersGLSL.js","sourceRoot":"","sources":["../../../../../dev/core/src/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,YAAqB;IACnE,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAQ;YACb,yBAAyB,EAAE;;;;;;;;;;;;;;;;;;;;;;iBAsBtB;YACL,6BAA6B,EAAE;;;;;;;;;;;;iBAY1B;YACL,sBAAsB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CnB;SACR,CAAC;QACF,IAAI,YAAY,EAAE,CAAC;YACf,GAAG,CAAC,2CAA2C,CAAC,GAAG,IAAI,CAAC,CAAC,mCAAmC;QAChG,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO;YACH,2BAA2B,EAAE;;;;;;;;;;iBAUxB;YACL,gCAAgC,EAAE;;;;;;;;;;;;;;;;;;;;8CAoBA,+CAAuC;;qDAEhC,+CAAuC;;qDAEvC,oDAA4C;;;;;;;;;;;kDAW/C,+CAAuC;;yDAEhC,+CAAuC;;yDAEvC,oDAA4C;;;;;iBAKpF;SACR,CAAC;IACN,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { type Nullable } from \"../../types\";\nimport { GreasedLineMeshColorMode } from \"./greasedLineMaterialInterfaces\";\n\n/**\n * Returns GLSL custom shader code\n * @param shaderType vertex or fragment\n * @param cameraFacing is in camera facing mode?\n * @returns GLSL custom shader code\n */\n/** @internal */\nexport function GetCustomCode(shaderType: string, cameraFacing: boolean): Nullable<{ [pointName: string]: string }> {\n if (shaderType === \"vertex\") {\n const obj: any = {\n CUSTOM_VERTEX_DEFINITIONS: `\n attribute float grl_widths;\n #ifdef GREASED_LINE_USE_OFFSETS\n attribute vec3 grl_offsets;\n #endif\n attribute float grl_colorPointers;\n varying float grlCounters;\n varying float grlColorPointer;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n attribute vec4 grl_previousAndSide;\n attribute vec4 grl_nextAndCounters;\n\n vec2 grlFix( vec4 i, float aspect ) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n }\n #else\n attribute vec3 grl_slopes;\n attribute float grl_counters;\n #endif\n `,\n CUSTOM_VERTEX_UPDATE_POSITION: `\n #ifdef GREASED_LINE_USE_OFFSETS\n vec3 grlPositionOffset = grl_offsets;\n #else\n vec3 grlPositionOffset = vec3(0.);\n #endif\n\n #ifdef GREASED_LINE_CAMERA_FACING\n positionUpdated += grlPositionOffset;\n #else\n positionUpdated = (positionUpdated + grlPositionOffset) + (grl_slopes * grl_widths);\n #endif\n `,\n CUSTOM_VERTEX_MAIN_END: `\n grlColorPointer = grl_colorPointers;\n\n #ifdef GREASED_LINE_CAMERA_FACING\n\n float grlAspect = grl_aspect_resolution_lineWidth.x;\n float grlBaseWidth = grl_aspect_resolution_lineWidth.w;\n\n vec3 grlPrevious = grl_previousAndSide.xyz;\n float grlSide = grl_previousAndSide.w;\n\n vec3 grlNext = grl_nextAndCounters.xyz;\n grlCounters = grl_nextAndCounters.w;\n float grlWidth = grlBaseWidth * grl_widths;\n \n vec3 worldDir = normalize(grlNext - grlPrevious);\n vec3 nearPosition = positionUpdated + (worldDir * 0.01);\n mat4 grlMatrix = viewProjection * finalWorld;\n vec4 grlFinalPosition = grlMatrix * vec4(positionUpdated , 1.0);\n vec4 screenNearPos = grlMatrix * vec4(nearPosition, 1.0);\n vec2 grlLinePosition = grlFix(grlFinalPosition, grlAspect);\n vec2 grlLineNearPosition = grlFix(screenNearPos, grlAspect);\n vec2 grlDir = normalize(grlLineNearPosition - grlLinePosition);\n\n vec4 grlNormal = vec4(-grlDir.y, grlDir.x, 0., 1.);\n\n #ifdef GREASED_LINE_RIGHT_HANDED_COORDINATE_SYSTEM\n grlNormal.xy *= -.5 * grlWidth;\n #else\n grlNormal.xy *= .5 * grlWidth;\n #endif\n\n grlNormal *= grl_projection;\n\n #ifdef GREASED_LINE_SIZE_ATTENUATION\n grlNormal.xy *= grlFinalPosition.w;\n grlNormal.xy /= (vec4(grl_aspect_resolution_lineWidth.yz, 0., 1.) * grl_projection).xy;\n #endif\n\n grlFinalPosition.xy += grlNormal.xy * grlSide;\n gl_Position = grlFinalPosition;\n\n vPositionW = vec3(grlFinalPosition);\n #else\n grlCounters = grl_counters;\n #endif\n `,\n };\n if (cameraFacing) {\n obj[\"!gl_Position\\\\=viewProjection\\\\*worldPos;\"] = \"//\"; // not needed for camera facing GRL\n }\n return obj;\n }\n\n if (shaderType === \"fragment\") {\n return {\n CUSTOM_FRAGMENT_DEFINITIONS: `\n #ifdef PBR\n #define grlFinalColor finalColor\n #else\n #define grlFinalColor color\n #endif\n\n varying float grlCounters;\n varying float grlColorPointer;\n uniform sampler2D grl_colors;\n `,\n CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR: `\n float grlColorMode = grl_colorMode_visibility_colorsWidth_useColors.x;\n float grlVisibility = grl_colorMode_visibility_colorsWidth_useColors.y;\n float grlColorsWidth = grl_colorMode_visibility_colorsWidth_useColors.z;\n float grlUseColors = grl_colorMode_visibility_colorsWidth_useColors.w;\n\n float grlUseDash = grl_dashOptions.x;\n float grlDashArray = grl_dashOptions.y;\n float grlDashOffset = grl_dashOptions.z;\n float grlDashRatio = grl_dashOptions.w;\n\n grlFinalColor.a *= step(grlCounters, grlVisibility);\n if(grlFinalColor.a == 0.) discard;\n\n if(grlUseDash == 1.){\n grlFinalColor.a *= ceil(mod(grlCounters + grlDashOffset, grlDashArray) - (grlDashArray * grlDashRatio));\n if (grlFinalColor.a == 0.) discard;\n }\n\n #ifdef GREASED_LINE_HAS_COLOR\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\n grlFinalColor.rgb = grl_singleColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\n grlFinalColor.rgb += grl_singleColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\n grlFinalColor.rgb *= grl_singleColor;\n }\n #else\n if (grlUseColors == 1.) {\n #ifdef GREASED_LINE_COLOR_DISTRIBUTION_TYPE_LINE\n vec4 grlColor = texture2D(grl_colors, vec2(grlCounters, 0.), 0.);\n #else\n vec2 lookup = vec2(fract(grlColorPointer / grl_textureSize.x), 1.0 - floor(grlColorPointer / grl_textureSize.x) / max(grl_textureSize.y - 1.0, 1.0));\n vec4 grlColor = texture2D(grl_colors, lookup, 0.0);\n #endif\n if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_SET}.) {\n grlFinalColor = grlColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_ADD}.) {\n grlFinalColor += grlColor;\n } else if (grlColorMode == ${GreasedLineMeshColorMode.COLOR_MODE_MULTIPLY}.) {\n grlFinalColor *= grlColor;\n }\n }\n #endif\n `,\n };\n }\n\n return null;\n}\n"]}
@@ -2,6 +2,7 @@
2
2
  import { Matrix, Quaternion, Vector3 } from "../../Maths/math.vector.pure.js";
3
3
  import { GetGaussianSplattingMaxPartCount } from "../../Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js";
4
4
  import { GaussianSplattingMeshBase, AllocateShBuffers } from "./gaussianSplattingMeshBase.pure.js";
5
+ import { GaussianSplattingSortWorkerCommand } from "./gaussianSplattingSortWorker.js";
5
6
  import { RawTexture } from "../../Materials/Textures/rawTexture.js";
6
7
 
7
8
  import { DecodeBase64ToBinary, EncodeArrayBufferToBase64 } from "../../Misc/stringTools.js";
@@ -249,8 +250,8 @@ export class GaussianSplattingMesh extends GaussianSplattingMeshBase {
249
250
  * @param worker the newly created sort worker
250
251
  */
251
252
  _onWorkerCreated(worker) {
252
- worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });
253
- worker.postMessage({ partIndices: this._partIndices ? new Uint8Array(this._partIndices) : null });
253
+ worker.postMessage({ command: GaussianSplattingSortWorkerCommand.PART_MATRICES, partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });
254
+ worker.postMessage({ command: GaussianSplattingSortWorkerCommand.PART_INDICES, partIndices: this._partIndices ? new Uint8Array(this._partIndices) : null });
254
255
  }
255
256
  /**
256
257
  * Stores the raw part index array, padded to texture length, so the worker and GPU texture
@@ -304,7 +305,7 @@ export class GaussianSplattingMesh extends GaussianSplattingMeshBase {
304
305
  _notifyWorkerNewData() {
305
306
  super._notifyWorkerNewData();
306
307
  if (this._worker) {
307
- this._worker.postMessage({ partIndices: this._partIndices ?? null });
308
+ this._worker.postMessage({ command: GaussianSplattingSortWorkerCommand.PART_INDICES, partIndices: this._partIndices ?? null });
308
309
  }
309
310
  }
310
311
  /**
@@ -371,7 +372,10 @@ export class GaussianSplattingMesh extends GaussianSplattingMeshBase {
371
372
  // once the full rebuild completes (at the end of removePart).
372
373
  if (!this._rebuilding) {
373
374
  if (this._worker) {
374
- this._worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });
375
+ this._worker.postMessage({
376
+ command: GaussianSplattingSortWorkerCommand.PART_MATRICES,
377
+ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)),
378
+ });
375
379
  }
376
380
  this._postToWorker(true);
377
381
  }
@@ -444,7 +448,7 @@ export class GaussianSplattingMesh extends GaussianSplattingMeshBase {
444
448
  const partIndicesView = new Uint8Array(partIndices.buffer, texelStart, texelCount);
445
449
  this._updateTextureFromData(this._partIndicesTexture, partIndicesView, textureSize.x, lineStart, lineCount);
446
450
  if (this._worker) {
447
- this._worker.postMessage({ partIndices: partIndices });
451
+ this._worker.postMessage({ command: GaussianSplattingSortWorkerCommand.PART_INDICES, partIndices: partIndices });
448
452
  }
449
453
  }
450
454
  }
@@ -466,7 +470,7 @@ export class GaussianSplattingMesh extends GaussianSplattingMeshBase {
466
470
  this._partIndicesTexture.wrapU = 0;
467
471
  this._partIndicesTexture.wrapV = 0;
468
472
  if (this._worker) {
469
- this._worker.postMessage({ partIndices: partIndices ?? null });
473
+ this._worker.postMessage({ command: GaussianSplattingSortWorkerCommand.PART_INDICES, partIndices: partIndices ?? null });
470
474
  }
471
475
  }
472
476
  _appendPartSourceToArrays(source, dstOffset, covA, covB, colorArray, sh, minimum, maximum) {
@@ -896,7 +900,10 @@ export class GaussianSplattingMesh extends GaussianSplattingMeshBase {
896
900
  if (needsWorkerGate) {
897
901
  this._rebuilding = false;
898
902
  if (this._worker) {
899
- this._worker.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });
903
+ this._worker.postMessage({
904
+ command: GaussianSplattingSortWorkerCommand.PART_MATRICES,
905
+ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)),
906
+ });
900
907
  }
901
908
  this._canPostToWorker = true;
902
909
  this._postToWorker(true);
@@ -1057,7 +1064,10 @@ export class GaussianSplattingMesh extends GaussianSplattingMeshBase {
1057
1064
  this._rebuilding = false;
1058
1065
  // Break TypeScript's flow narrowing — _addPartsInternal may have reinstantiated _worker.
1059
1066
  const workerAfterRebuild = this._worker;
1060
- workerAfterRebuild?.postMessage({ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)) });
1067
+ workerAfterRebuild?.postMessage({
1068
+ command: GaussianSplattingSortWorkerCommand.PART_MATRICES,
1069
+ partMatrices: this._partMatrices.map((matrix) => new Float32Array(matrix.m)),
1070
+ });
1061
1071
  this._canPostToWorker = true;
1062
1072
  this._postToWorker(true);
1063
1073
  }