@luma.gl/shadertools 9.3.0 → 9.3.2

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 (24) hide show
  1. package/dist/dist.dev.js +15 -28
  2. package/dist/dist.min.js +51 -48
  3. package/dist/index.cjs +15 -22
  4. package/dist/index.cjs.map +3 -3
  5. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +0 -1
  6. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
  7. package/dist/modules/lighting/gouraud-material/gouraud-material.js +6 -11
  8. package/dist/modules/lighting/gouraud-material/gouraud-material.js.map +1 -1
  9. package/dist/modules/lighting/phong-material/phong-material.d.ts +0 -1
  10. package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -1
  11. package/dist/modules/lighting/phong-material/phong-material.js +6 -11
  12. package/dist/modules/lighting/phong-material/phong-material.js.map +1 -1
  13. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +1 -1
  14. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -1
  15. package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +1 -1
  16. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts +1 -1
  17. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts.map +1 -1
  18. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js +4 -1
  19. package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js.map +1 -1
  20. package/package.json +3 -3
  21. package/src/modules/lighting/gouraud-material/gouraud-material.ts +7 -15
  22. package/src/modules/lighting/phong-material/phong-material.ts +7 -15
  23. package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +1 -1
  24. package/src/modules/lighting/phong-material/phong-shaders-wgsl.ts +4 -1
package/dist/dist.dev.js CHANGED
@@ -6253,7 +6253,7 @@ vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_d
6253
6253
  specular = pow(specular_angle, material.shininess);
6254
6254
  }
6255
6255
  lambertian = max(lambertian, 0.0);
6256
- return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;
6256
+ return (lambertian * material.diffuse * surfaceColor + specular * floatColors_normalize(material.specularColor)) * color;
6257
6257
  }
6258
6258
 
6259
6259
  vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
@@ -6318,7 +6318,10 @@ fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, v
6318
6318
  specular = pow(specular_angle, phongMaterial.shininess);
6319
6319
  }
6320
6320
  lambertian = max(lambertian, 0.0);
6321
- return (lambertian * phongMaterial.diffuse * surfaceColor + specular * phongMaterial.specularColor) * color;
6321
+ return (
6322
+ lambertian * phongMaterial.diffuse * surfaceColor +
6323
+ specular * floatColors_normalize(phongMaterial.specularColor)
6324
+ ) * color;
6322
6325
  }
6323
6326
 
6324
6327
  fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> {
@@ -6423,6 +6426,7 @@ fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace
6423
6426
  );
6424
6427
 
6425
6428
  // src/modules/lighting/gouraud-material/gouraud-material.ts
6429
+ var DEFAULT_SPECULAR_COLOR = [38.25, 38.25, 38.25];
6426
6430
  var gouraudMaterial = {
6427
6431
  props: {},
6428
6432
  name: "gouraudMaterial",
@@ -6434,41 +6438,33 @@ fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace
6434
6438
  defines: {
6435
6439
  LIGHTING_VERTEX: true
6436
6440
  },
6437
- dependencies: [lighting],
6441
+ dependencies: [lighting, floatColors],
6438
6442
  uniformTypes: {
6439
6443
  unlit: "i32",
6440
6444
  ambient: "f32",
6441
6445
  diffuse: "f32",
6442
6446
  shininess: "f32",
6443
- specularColor: "vec3<f32>",
6444
- useByteColors: "i32"
6447
+ specularColor: "vec3<f32>"
6445
6448
  },
6446
6449
  defaultUniforms: {
6447
6450
  unlit: false,
6448
6451
  ambient: 0.35,
6449
6452
  diffuse: 0.6,
6450
6453
  shininess: 32,
6451
- specularColor: [0.15, 0.15, 0.15],
6452
- useByteColors: true
6454
+ specularColor: DEFAULT_SPECULAR_COLOR
6453
6455
  },
6454
6456
  getUniforms(props) {
6455
- const uniforms = { ...props };
6456
- if (uniforms.specularColor) {
6457
- uniforms.specularColor = normalizeByteColor3(
6458
- uniforms.specularColor,
6459
- resolveUseByteColors(uniforms.useByteColors, true)
6460
- );
6461
- }
6462
- return { ...gouraudMaterial.defaultUniforms, ...uniforms };
6457
+ return { ...gouraudMaterial.defaultUniforms, ...props };
6463
6458
  }
6464
6459
  };
6465
6460
 
6466
6461
  // src/modules/lighting/phong-material/phong-material.ts
6462
+ var DEFAULT_SPECULAR_COLOR2 = [38.25, 38.25, 38.25];
6467
6463
  var phongMaterial = {
6468
6464
  name: "phongMaterial",
6469
6465
  firstBindingSlot: 0,
6470
6466
  bindingLayout: [{ name: "phongMaterial", group: 3 }],
6471
- dependencies: [lighting],
6467
+ dependencies: [lighting, floatColors],
6472
6468
  // Note these are switched between phong and gouraud
6473
6469
  source: PHONG_WGSL,
6474
6470
  vs: PHONG_VS,
@@ -6481,26 +6477,17 @@ fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace
6481
6477
  ambient: "f32",
6482
6478
  diffuse: "f32",
6483
6479
  shininess: "f32",
6484
- specularColor: "vec3<f32>",
6485
- useByteColors: "i32"
6480
+ specularColor: "vec3<f32>"
6486
6481
  },
6487
6482
  defaultUniforms: {
6488
6483
  unlit: false,
6489
6484
  ambient: 0.35,
6490
6485
  diffuse: 0.6,
6491
6486
  shininess: 32,
6492
- specularColor: [0.15, 0.15, 0.15],
6493
- useByteColors: true
6487
+ specularColor: DEFAULT_SPECULAR_COLOR2
6494
6488
  },
6495
6489
  getUniforms(props) {
6496
- const uniforms = { ...props };
6497
- if (uniforms.specularColor) {
6498
- uniforms.specularColor = normalizeByteColor3(
6499
- uniforms.specularColor,
6500
- resolveUseByteColors(uniforms.useByteColors, true)
6501
- );
6502
- }
6503
- return { ...phongMaterial.defaultUniforms, ...uniforms };
6490
+ return { ...phongMaterial.defaultUniforms, ...props };
6504
6491
  }
6505
6492
  };
6506
6493