@jdultra/threedtiles 13.3.1 → 13.3.3

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.
@@ -7163,7 +7163,10 @@ class kd extends Ni {
7163
7163
  this.sortListeners[m](g.data.id) && this.sortListeners.splice(m, 1);
7164
7164
  }, this.cameraPosition = new Ae(0, 0, 0), this.viewProjModel, this.rotateOnAxis(new Ae(1, 0, 0), 0.5 * Math.PI), this.frustumCulled = !1, this.copyMaterial2D = new oi({ glslVersion: si, uniforms: { sourceTexture: {} }, vertexShader: Qr(), fragmentShader: `
7165
7165
  precision highp float;
7166
- layout(location = 0) out uvec4 fragColor;
7166
+ precision highp int;
7167
+ precision highp usampler3D;
7168
+
7169
+ layout(location = 0) out highp uvec4 fragColor;
7167
7170
  uniform highp usampler2D sourceTexture;
7168
7171
 
7169
7172
  in vec2 vUv;
@@ -7172,7 +7175,10 @@ void main() {
7172
7175
  fragColor = texture( sourceTexture, vUv );
7173
7176
  }`, transparent: !1, side: Ta, depthTest: !1, depthWrite: !1 }), this.copyMaterial3D = new oi({ glslVersion: si, uniforms: { sourceTexture: {}, w: { value: 0 } }, vertexShader: Qr(), fragmentShader: `
7174
7177
  precision highp float;
7175
- layout(location = 0) out uvec4 fragColor;
7178
+ precision highp int;
7179
+ precision highp usampler3D;
7180
+
7181
+ layout(location = 0) out highp uvec4 fragColor;
7176
7182
  uniform highp usampler3D sourceTexture;
7177
7183
  uniform float w;
7178
7184
 
@@ -7288,6 +7294,7 @@ function jd() {
7288
7294
  return `
7289
7295
  precision highp float;
7290
7296
  precision highp int;
7297
+ precision highp usampler3D;
7291
7298
 
7292
7299
  #include <common>
7293
7300
  #include <packing>
@@ -7295,7 +7302,7 @@ precision highp int;
7295
7302
  uniform float textureSize;
7296
7303
  uniform float numSlices;
7297
7304
  uniform float sizeMultiplier;
7298
- in uint order;
7305
+ in highp uint order;
7299
7306
  out vec4 color;
7300
7307
  out vec2 vUv;
7301
7308
  out vec3 splatPositionWorld;
@@ -7333,22 +7340,24 @@ void getVertexData(out vec3 position, out mat3 covariance) {
7333
7340
  int( (y + 0.5) ), // y pixel
7334
7341
  int( sliceIndex + 0.5 ) ); // z slice */
7335
7342
 
7336
- float index = float(order)+0.1; // add small offset to avoid floating point errors with modulo
7337
- float pixelsPerSlice = textureSize * textureSize;
7338
- float sliceIndex = floor(index / pixelsPerSlice);
7339
- float slicePixelIndex = mod(index,pixelsPerSlice);
7343
+
7344
+ highp uint uOrder = order; // Use a local uint copy
7340
7345
 
7341
- float x = mod(slicePixelIndex,textureSize);
7342
- float y = floor(slicePixelIndex / textureSize);
7346
+ // It's good practice to ensure textureSize is treated as uint for these calcs
7347
+ uint uTextureSize = uint(textureSize); // textureSize uniform is float
7348
+ uint uPixelsPerSlice = uTextureSize * uTextureSize;
7343
7349
 
7344
- //vec3 uvw = vec3((x + 0.5) / textureSize, (y + 0.5) / textureSize, (sliceIndex + 0.5) / numSlices);
7345
- ivec3 coord = ivec3(
7346
- int( (x + 0.5) ), // x pixel
7347
- int( (y + 0.5) ), // y pixel
7348
- int( sliceIndex + 0.5 ) ); // z slice
7350
+ uint sliceIndexVal = uOrder / uPixelsPerSlice;
7351
+ uint slicePixelIndex = uOrder % uPixelsPerSlice; // umod(uOrder, uPixelsPerSlice) also works
7352
+
7353
+ uint xVal = slicePixelIndex % uTextureSize; // umod(slicePixelIndex, uTextureSize)
7354
+ uint yVal = slicePixelIndex / uTextureSize;
7355
+
7356
+ // texelFetch takes ivec3 for coordinates, no +0.5 needed as these are direct integer indices
7357
+ ivec3 coord = ivec3(xVal, yVal, sliceIndexVal);
7349
7358
 
7350
7359
  // Position
7351
- uvec4 positionColor = texelFetch(positionColorTexture, coord,0);
7360
+ highp uvec4 positionColor = texelFetch(positionColorTexture, coord,0);
7352
7361
  position = vec3(uintBitsToFloat(positionColor.r),uintBitsToFloat(positionColor.g),uintBitsToFloat(positionColor.b));
7353
7362
 
7354
7363
  color = vec4( (positionColor.a & 255u),
@@ -7357,7 +7366,7 @@ void getVertexData(out vec3 position, out mat3 covariance) {
7357
7366
  (positionColor.a >> 24) ) / 255.0;
7358
7367
 
7359
7368
 
7360
- uvec4 cov = texelFetch(covarianceTexture, coord, 0);
7369
+ highp uvec4 cov = texelFetch(covarianceTexture, coord, 0);
7361
7370
  vec2 c0 = unpackHalf2x16(cov.r);
7362
7371
  vec2 c1 = unpackHalf2x16(cov.g);
7363
7372
  vec2 c2 = unpackHalf2x16(cov.b);
@@ -7498,6 +7507,7 @@ function Md() {
7498
7507
  return `
7499
7508
  precision highp float;
7500
7509
  precision highp int;
7510
+ precision highp usampler3D;
7501
7511
 
7502
7512
  in float stds;
7503
7513
  in vec4 color;
@@ -7516,10 +7526,6 @@ uniform float beta_k; // pow((4.0 * gamma(2.0/k)) /k, k/2)
7516
7526
  void main() {
7517
7527
  float l = dot(vUv, vUv);
7518
7528
  if (l > 0.25) discard; // early out unchanged
7519
- /* if (l > 0.245){
7520
- fragColor = vec4(pow(color.xyz, vec3(1.0/2.2)), 0.8);
7521
- return;
7522
- } */
7523
7529
  vec2 p = vUv * stds;
7524
7530
  float r2 = dot(p, p); // r²
7525
7531
  float rk = pow(r2, 0.5 * k); // r^{k}
@@ -7534,6 +7540,10 @@ void main() {
7534
7540
  function Qr() {
7535
7541
  return `
7536
7542
 
7543
+ precision highp float;
7544
+ precision highp int;
7545
+ precision highp usampler3D;
7546
+
7537
7547
  out vec2 vUv;
7538
7548
 
7539
7549
  void main() {