@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.
- package/dist/dist.dev.js +15 -28
- package/dist/dist.min.js +51 -48
- package/dist/index.cjs +15 -22
- package/dist/index.cjs.map +3 -3
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +0 -1
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-material.js +6 -11
- package/dist/modules/lighting/gouraud-material/gouraud-material.js.map +1 -1
- package/dist/modules/lighting/phong-material/phong-material.d.ts +0 -1
- package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-material.js +6 -11
- package/dist/modules/lighting/phong-material/phong-material.js.map +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js +4 -1
- package/dist/modules/lighting/phong-material/phong-shaders-wgsl.js.map +1 -1
- package/package.json +3 -3
- package/src/modules/lighting/gouraud-material/gouraud-material.ts +7 -15
- package/src/modules/lighting/phong-material/phong-material.ts +7 -15
- package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +1 -1
- package/src/modules/lighting/phong-material/phong-shaders-wgsl.ts +4 -1
package/dist/index.cjs
CHANGED
|
@@ -4366,7 +4366,7 @@ vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_d
|
|
|
4366
4366
|
specular = pow(specular_angle, material.shininess);
|
|
4367
4367
|
}
|
|
4368
4368
|
lambertian = max(lambertian, 0.0);
|
|
4369
|
-
return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;
|
|
4369
|
+
return (lambertian * material.diffuse * surfaceColor + specular * floatColors_normalize(material.specularColor)) * color;
|
|
4370
4370
|
}
|
|
4371
4371
|
|
|
4372
4372
|
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
|
|
@@ -4431,7 +4431,10 @@ fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, v
|
|
|
4431
4431
|
specular = pow(specular_angle, phongMaterial.shininess);
|
|
4432
4432
|
}
|
|
4433
4433
|
lambertian = max(lambertian, 0.0);
|
|
4434
|
-
return (
|
|
4434
|
+
return (
|
|
4435
|
+
lambertian * phongMaterial.diffuse * surfaceColor +
|
|
4436
|
+
specular * floatColors_normalize(phongMaterial.specularColor)
|
|
4437
|
+
) * color;
|
|
4435
4438
|
}
|
|
4436
4439
|
|
|
4437
4440
|
fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> {
|
|
@@ -4536,6 +4539,7 @@ fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace
|
|
|
4536
4539
|
);
|
|
4537
4540
|
|
|
4538
4541
|
// dist/modules/lighting/gouraud-material/gouraud-material.js
|
|
4542
|
+
var DEFAULT_SPECULAR_COLOR = [38.25, 38.25, 38.25];
|
|
4539
4543
|
var gouraudMaterial = {
|
|
4540
4544
|
props: {},
|
|
4541
4545
|
name: "gouraudMaterial",
|
|
@@ -4547,38 +4551,33 @@ var gouraudMaterial = {
|
|
|
4547
4551
|
defines: {
|
|
4548
4552
|
LIGHTING_VERTEX: true
|
|
4549
4553
|
},
|
|
4550
|
-
dependencies: [lighting],
|
|
4554
|
+
dependencies: [lighting, floatColors],
|
|
4551
4555
|
uniformTypes: {
|
|
4552
4556
|
unlit: "i32",
|
|
4553
4557
|
ambient: "f32",
|
|
4554
4558
|
diffuse: "f32",
|
|
4555
4559
|
shininess: "f32",
|
|
4556
|
-
specularColor: "vec3<f32>"
|
|
4557
|
-
useByteColors: "i32"
|
|
4560
|
+
specularColor: "vec3<f32>"
|
|
4558
4561
|
},
|
|
4559
4562
|
defaultUniforms: {
|
|
4560
4563
|
unlit: false,
|
|
4561
4564
|
ambient: 0.35,
|
|
4562
4565
|
diffuse: 0.6,
|
|
4563
4566
|
shininess: 32,
|
|
4564
|
-
specularColor:
|
|
4565
|
-
useByteColors: true
|
|
4567
|
+
specularColor: DEFAULT_SPECULAR_COLOR
|
|
4566
4568
|
},
|
|
4567
4569
|
getUniforms(props) {
|
|
4568
|
-
|
|
4569
|
-
if (uniforms.specularColor) {
|
|
4570
|
-
uniforms.specularColor = normalizeByteColor3(uniforms.specularColor, resolveUseByteColors(uniforms.useByteColors, true));
|
|
4571
|
-
}
|
|
4572
|
-
return { ...gouraudMaterial.defaultUniforms, ...uniforms };
|
|
4570
|
+
return { ...gouraudMaterial.defaultUniforms, ...props };
|
|
4573
4571
|
}
|
|
4574
4572
|
};
|
|
4575
4573
|
|
|
4576
4574
|
// dist/modules/lighting/phong-material/phong-material.js
|
|
4575
|
+
var DEFAULT_SPECULAR_COLOR2 = [38.25, 38.25, 38.25];
|
|
4577
4576
|
var phongMaterial = {
|
|
4578
4577
|
name: "phongMaterial",
|
|
4579
4578
|
firstBindingSlot: 0,
|
|
4580
4579
|
bindingLayout: [{ name: "phongMaterial", group: 3 }],
|
|
4581
|
-
dependencies: [lighting],
|
|
4580
|
+
dependencies: [lighting, floatColors],
|
|
4582
4581
|
// Note these are switched between phong and gouraud
|
|
4583
4582
|
source: PHONG_WGSL,
|
|
4584
4583
|
vs: PHONG_VS,
|
|
@@ -4591,23 +4590,17 @@ var phongMaterial = {
|
|
|
4591
4590
|
ambient: "f32",
|
|
4592
4591
|
diffuse: "f32",
|
|
4593
4592
|
shininess: "f32",
|
|
4594
|
-
specularColor: "vec3<f32>"
|
|
4595
|
-
useByteColors: "i32"
|
|
4593
|
+
specularColor: "vec3<f32>"
|
|
4596
4594
|
},
|
|
4597
4595
|
defaultUniforms: {
|
|
4598
4596
|
unlit: false,
|
|
4599
4597
|
ambient: 0.35,
|
|
4600
4598
|
diffuse: 0.6,
|
|
4601
4599
|
shininess: 32,
|
|
4602
|
-
specularColor:
|
|
4603
|
-
useByteColors: true
|
|
4600
|
+
specularColor: DEFAULT_SPECULAR_COLOR2
|
|
4604
4601
|
},
|
|
4605
4602
|
getUniforms(props) {
|
|
4606
|
-
|
|
4607
|
-
if (uniforms.specularColor) {
|
|
4608
|
-
uniforms.specularColor = normalizeByteColor3(uniforms.specularColor, resolveUseByteColors(uniforms.useByteColors, true));
|
|
4609
|
-
}
|
|
4610
|
-
return { ...phongMaterial.defaultUniforms, ...uniforms };
|
|
4603
|
+
return { ...phongMaterial.defaultUniforms, ...props };
|
|
4611
4604
|
}
|
|
4612
4605
|
};
|
|
4613
4606
|
|