@luma.gl/shadertools 9.1.5 → 9.1.6
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 +5908 -3435
- package/dist/dist.min.js +72 -71
- package/dist/index.cjs +38 -37
- package/dist/index.cjs.map +3 -3
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-material.js +2 -0
- package/dist/modules/lighting/gouraud-material/gouraud-material.js.map +1 -1
- package/dist/modules/lighting/lights/lighting-uniforms-wgsl.d.ts +1 -1
- package/dist/modules/lighting/lights/lighting-uniforms-wgsl.d.ts.map +1 -1
- package/dist/modules/lighting/lights/lighting-uniforms-wgsl.js +1 -1
- package/dist/modules/lighting/lights/lighting.d.ts +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts +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 -4
- package/package.json +3 -3
- package/src/modules/lighting/gouraud-material/gouraud-material.ts +2 -0
- package/src/modules/lighting/lights/lighting-uniforms-wgsl.ts +1 -1
- package/src/modules/lighting/phong-material/phong-shaders-wgsl.ts +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2679,7 +2679,7 @@ struct DirectionalLight {
|
|
|
2679
2679
|
|
|
2680
2680
|
struct lightingUniforms {
|
|
2681
2681
|
enabled: i32,
|
|
2682
|
-
|
|
2682
|
+
pointLightCount: i32,
|
|
2683
2683
|
directionalLightCount: i32,
|
|
2684
2684
|
|
|
2685
2685
|
ambientColor: vec3<f32>,
|
|
@@ -2995,38 +2995,6 @@ vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 positio
|
|
|
2995
2995
|
`
|
|
2996
2996
|
);
|
|
2997
2997
|
|
|
2998
|
-
// dist/modules/lighting/gouraud-material/gouraud-material.js
|
|
2999
|
-
var gouraudMaterial = {
|
|
3000
|
-
props: {},
|
|
3001
|
-
name: "gouraudMaterial",
|
|
3002
|
-
// Note these are switched between phong and gouraud
|
|
3003
|
-
vs: PHONG_FS.replace("phongMaterial", "gouraudMaterial"),
|
|
3004
|
-
fs: PHONG_VS.replace("phongMaterial", "gouraudMaterial"),
|
|
3005
|
-
defines: {
|
|
3006
|
-
LIGHTING_VERTEX: 1
|
|
3007
|
-
},
|
|
3008
|
-
dependencies: [lighting],
|
|
3009
|
-
uniformTypes: {
|
|
3010
|
-
ambient: "f32",
|
|
3011
|
-
diffuse: "f32",
|
|
3012
|
-
shininess: "f32",
|
|
3013
|
-
specularColor: "vec3<f32>"
|
|
3014
|
-
},
|
|
3015
|
-
defaultUniforms: {
|
|
3016
|
-
ambient: 0.35,
|
|
3017
|
-
diffuse: 0.6,
|
|
3018
|
-
shininess: 32,
|
|
3019
|
-
specularColor: [0.15, 0.15, 0.15]
|
|
3020
|
-
},
|
|
3021
|
-
getUniforms(props) {
|
|
3022
|
-
const uniforms = { ...props };
|
|
3023
|
-
if (uniforms.specularColor) {
|
|
3024
|
-
uniforms.specularColor = uniforms.specularColor.map((x) => x / 255);
|
|
3025
|
-
}
|
|
3026
|
-
return { ...gouraudMaterial.defaultUniforms, ...uniforms };
|
|
3027
|
-
}
|
|
3028
|
-
};
|
|
3029
|
-
|
|
3030
2998
|
// dist/modules/lighting/phong-material/phong-shaders-wgsl.js
|
|
3031
2999
|
var PHONG_WGSL = (
|
|
3032
3000
|
/* wgsl */
|
|
@@ -3037,7 +3005,7 @@ var PHONG_WGSL = (
|
|
|
3037
3005
|
specularColor: vec3<f32>,
|
|
3038
3006
|
};
|
|
3039
3007
|
|
|
3040
|
-
@binding(2) @group(0) var<uniform>
|
|
3008
|
+
@binding(2) @group(0) var<uniform> phongMaterial : phongMaterialUniforms;
|
|
3041
3009
|
|
|
3042
3010
|
fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, view_direction: vec3<f32>, normal_worldspace: vec3<f32>, color: vec3<f32>) -> vec3<f32> {
|
|
3043
3011
|
let halfway_direction: vec3<f32> = normalize(light_direction + view_direction);
|
|
@@ -3045,10 +3013,10 @@ fn lighting_getLightColor(surfaceColor: vec3<f32>, light_direction: vec3<f32>, v
|
|
|
3045
3013
|
var specular: f32 = 0.0;
|
|
3046
3014
|
if (lambertian > 0.0) {
|
|
3047
3015
|
let specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
|
|
3048
|
-
specular = pow(specular_angle,
|
|
3016
|
+
specular = pow(specular_angle, phongMaterial.shininess);
|
|
3049
3017
|
}
|
|
3050
3018
|
lambertian = max(lambertian, 0.0);
|
|
3051
|
-
return (lambertian *
|
|
3019
|
+
return (lambertian * phongMaterial.diffuse * surfaceColor + specular * phongMaterial.specularColor) * color;
|
|
3052
3020
|
}
|
|
3053
3021
|
|
|
3054
3022
|
fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, position_worldspace: vec3<f32>, normal_worldspace: vec3<f32>) -> vec3<f32> {
|
|
@@ -3059,7 +3027,7 @@ fn lighting_getLightColor2(surfaceColor: vec3<f32>, cameraPosition: vec3<f32>, p
|
|
|
3059
3027
|
}
|
|
3060
3028
|
|
|
3061
3029
|
let view_direction: vec3<f32> = normalize(cameraPosition - position_worldspace);
|
|
3062
|
-
lightColor =
|
|
3030
|
+
lightColor = phongMaterial.ambient * surfaceColor * lighting.ambientColor;
|
|
3063
3031
|
|
|
3064
3032
|
if (lighting.lightType == 0) {
|
|
3065
3033
|
let pointLight: PointLight = lighting_getPointLight(0);
|
|
@@ -3118,6 +3086,39 @@ fn lighting_getSpecularLightColor(cameraPosition: vec3<f32>, position_worldspace
|
|
|
3118
3086
|
`
|
|
3119
3087
|
);
|
|
3120
3088
|
|
|
3089
|
+
// dist/modules/lighting/gouraud-material/gouraud-material.js
|
|
3090
|
+
var gouraudMaterial = {
|
|
3091
|
+
props: {},
|
|
3092
|
+
name: "gouraudMaterial",
|
|
3093
|
+
// Note these are switched between phong and gouraud
|
|
3094
|
+
vs: PHONG_FS.replace("phongMaterial", "gouraudMaterial"),
|
|
3095
|
+
fs: PHONG_VS.replace("phongMaterial", "gouraudMaterial"),
|
|
3096
|
+
source: PHONG_WGSL.replaceAll("phongMaterial", "gouraudMaterial"),
|
|
3097
|
+
defines: {
|
|
3098
|
+
LIGHTING_VERTEX: 1
|
|
3099
|
+
},
|
|
3100
|
+
dependencies: [lighting],
|
|
3101
|
+
uniformTypes: {
|
|
3102
|
+
ambient: "f32",
|
|
3103
|
+
diffuse: "f32",
|
|
3104
|
+
shininess: "f32",
|
|
3105
|
+
specularColor: "vec3<f32>"
|
|
3106
|
+
},
|
|
3107
|
+
defaultUniforms: {
|
|
3108
|
+
ambient: 0.35,
|
|
3109
|
+
diffuse: 0.6,
|
|
3110
|
+
shininess: 32,
|
|
3111
|
+
specularColor: [0.15, 0.15, 0.15]
|
|
3112
|
+
},
|
|
3113
|
+
getUniforms(props) {
|
|
3114
|
+
const uniforms = { ...props };
|
|
3115
|
+
if (uniforms.specularColor) {
|
|
3116
|
+
uniforms.specularColor = uniforms.specularColor.map((x) => x / 255);
|
|
3117
|
+
}
|
|
3118
|
+
return { ...gouraudMaterial.defaultUniforms, ...uniforms };
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
|
|
3121
3122
|
// dist/modules/lighting/phong-material/phong-material.js
|
|
3122
3123
|
var phongMaterial = {
|
|
3123
3124
|
name: "phongMaterial",
|