@luma.gl/shadertools 9.2.0-alpha.2 → 9.2.0-alpha.5

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 CHANGED
@@ -8698,7 +8698,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
8698
8698
  lightType: "i32",
8699
8699
  directionalLightCount: "i32",
8700
8700
  pointLightCount: "i32",
8701
- ambientLightColor: "vec3<f32>",
8701
+ ambientColor: "vec3<f32>",
8702
8702
  // TODO define as arrays once we have appropriate uniformTypes
8703
8703
  lightColor0: "vec3<f32>",
8704
8704
  lightPosition0: "vec3<f32>",
@@ -8719,7 +8719,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
8719
8719
  lightType: 0 /* POINT */,
8720
8720
  directionalLightCount: 0,
8721
8721
  pointLightCount: 0,
8722
- ambientLightColor: [0.1, 0.1, 0.1],
8722
+ ambientColor: [0.1, 0.1, 0.1],
8723
8723
  lightColor0: [1, 1, 1],
8724
8724
  lightPosition0: [1, 1, 2],
8725
8725
  // TODO - could combine direction and attenuation
@@ -8768,7 +8768,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
8768
8768
  directionalLights = []
8769
8769
  }) {
8770
8770
  const lightSourceUniforms = {};
8771
- lightSourceUniforms.ambientLightColor = convertColor(ambientLight);
8771
+ lightSourceUniforms.ambientColor = convertColor(ambientLight);
8772
8772
  let currentLight = 0;
8773
8773
  for (const pointLight of pointLights) {
8774
8774
  lightSourceUniforms.lightType = 0 /* POINT */;
@@ -8913,7 +8913,7 @@ vec4 dirlight_filterColor(vec4 color) {
8913
8913
  );
8914
8914
  var PHONG_FS = (
8915
8915
  /* glsl */
8916
- `#define MAX_LIGHTS 1
8916
+ `#define MAX_LIGHTS 3
8917
8917
 
8918
8918
  uniform phongMaterialUniforms {
8919
8919
  uniform float ambient;
package/dist/dist.min.js CHANGED
@@ -1346,7 +1346,7 @@ fn getPointLightAttenuation(pointLight: PointLight, distance: f32) -> f32 {
1346
1346
  + pointLight.attenuation.y * distance
1347
1347
  + pointLight.attenuation.z * distance * distance;
1348
1348
  }
1349
- `;var bs=5,xs=255,Ke;(function(a){a[a.POINT=0]="POINT",a[a.DIRECTIONAL=1]="DIRECTIONAL"})(Ke||(Ke={}));var te={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientLightColor:"vec3<f32>",lightColor0:"vec3<f32>",lightPosition0:"vec3<f32>",lightDirection0:"vec3<f32>",lightAttenuation0:"vec3<f32>",lightColor1:"vec3<f32>",lightPosition1:"vec3<f32>",lightDirection1:"vec3<f32>",lightAttenuation1:"vec3<f32>",lightColor2:"vec3<f32>",lightPosition2:"vec3<f32>",lightDirection2:"vec3<f32>",lightAttenuation2:"vec3<f32>"},defaultUniforms:{enabled:1,lightType:Ke.POINT,directionalLightCount:0,pointLightCount:0,ambientLightColor:[.1,.1,.1],lightColor0:[1,1,1],lightPosition0:[1,1,2],lightDirection0:[1,1,1],lightAttenuation0:[1,0,0],lightColor1:[1,1,1],lightPosition1:[1,1,2],lightDirection1:[1,1,1],lightAttenuation1:[1,0,0],lightColor2:[1,1,1],lightPosition2:[1,1,2],lightDirection2:[1,1,1],lightAttenuation2:[1,0,0]},source:pr,vs:pn,fs:pn,getUniforms:ys};function ys(a,e={}){if(a=a&&{...a},!a)return{...te.defaultUniforms};a.lights&&(a={...a,...ks(a.lights),lights:void 0});let{ambientLight:t,pointLights:n,directionalLights:r}=a||{};if(!(t||n&&n.length>0||r&&r.length>0))return{...te.defaultUniforms,enabled:0};let i={...te.defaultUniforms,...e,...ws({ambientLight:t,pointLights:n,directionalLights:r})};return a.enabled!==void 0&&(i.enabled=a.enabled?1:0),i}function ws({ambientLight:a,pointLights:e=[],directionalLights:t=[]}){let n={};n.ambientLightColor=dn(a);let r=0;for(let s of e){n.lightType=Ke.POINT;let i=r;n[`lightColor${i}`]=dn(s),n[`lightPosition${i}`]=s.position,n[`lightAttenuation${i}`]=s.attenuation||[1,0,0],r++}for(let s of t){n.lightType=Ke.DIRECTIONAL;let i=r;n[`lightColor${i}`]=dn(s),n[`lightDirection${i}`]=s.direction,r++}return r>bs&&dr.log.warn("MAX_LIGHTS exceeded")(),n.directionalLightCount=t.length,n.pointLightCount=e.length,n}function ks(a){let e={pointLights:[],directionalLights:[]};for(let t of a||[])switch(t.type){case"ambient":e.ambientLight=t;break;case"directional":e.directionalLights?.push(t);break;case"point":e.pointLights?.push(t);break;default:}return e}function dn(a={}){let{color:e=[0,0,0],intensity:t=1}=a;return e.map(n=>n*t/xs)}var Is=`
1349
+ `;var bs=5,xs=255,Ke;(function(a){a[a.POINT=0]="POINT",a[a.DIRECTIONAL=1]="DIRECTIONAL"})(Ke||(Ke={}));var te={props:{},uniforms:{},name:"lighting",defines:{},uniformTypes:{enabled:"i32",lightType:"i32",directionalLightCount:"i32",pointLightCount:"i32",ambientColor:"vec3<f32>",lightColor0:"vec3<f32>",lightPosition0:"vec3<f32>",lightDirection0:"vec3<f32>",lightAttenuation0:"vec3<f32>",lightColor1:"vec3<f32>",lightPosition1:"vec3<f32>",lightDirection1:"vec3<f32>",lightAttenuation1:"vec3<f32>",lightColor2:"vec3<f32>",lightPosition2:"vec3<f32>",lightDirection2:"vec3<f32>",lightAttenuation2:"vec3<f32>"},defaultUniforms:{enabled:1,lightType:Ke.POINT,directionalLightCount:0,pointLightCount:0,ambientColor:[.1,.1,.1],lightColor0:[1,1,1],lightPosition0:[1,1,2],lightDirection0:[1,1,1],lightAttenuation0:[1,0,0],lightColor1:[1,1,1],lightPosition1:[1,1,2],lightDirection1:[1,1,1],lightAttenuation1:[1,0,0],lightColor2:[1,1,1],lightPosition2:[1,1,2],lightDirection2:[1,1,1],lightAttenuation2:[1,0,0]},source:pr,vs:pn,fs:pn,getUniforms:ys};function ys(a,e={}){if(a=a&&{...a},!a)return{...te.defaultUniforms};a.lights&&(a={...a,...ks(a.lights),lights:void 0});let{ambientLight:t,pointLights:n,directionalLights:r}=a||{};if(!(t||n&&n.length>0||r&&r.length>0))return{...te.defaultUniforms,enabled:0};let i={...te.defaultUniforms,...e,...ws({ambientLight:t,pointLights:n,directionalLights:r})};return a.enabled!==void 0&&(i.enabled=a.enabled?1:0),i}function ws({ambientLight:a,pointLights:e=[],directionalLights:t=[]}){let n={};n.ambientColor=dn(a);let r=0;for(let s of e){n.lightType=Ke.POINT;let i=r;n[`lightColor${i}`]=dn(s),n[`lightPosition${i}`]=s.position,n[`lightAttenuation${i}`]=s.attenuation||[1,0,0],r++}for(let s of t){n.lightType=Ke.DIRECTIONAL;let i=r;n[`lightColor${i}`]=dn(s),n[`lightDirection${i}`]=s.direction,r++}return r>bs&&dr.log.warn("MAX_LIGHTS exceeded")(),n.directionalLightCount=t.length,n.pointLightCount=e.length,n}function ks(a){let e={pointLights:[],directionalLights:[]};for(let t of a||[])switch(t.type){case"ambient":e.ambientLight=t;break;case"directional":e.directionalLights?.push(t);break;case"point":e.pointLights?.push(t);break;default:}return e}function dn(a={}){let{color:e=[0,0,0],intensity:t=1}=a;return e.map(n=>n*t/xs)}var Is=`
1350
1350
  struct dirlightUniforms {
1351
1351
  lightDirection: vec3<f32>,
1352
1352
  };
@@ -1394,7 +1394,7 @@ vec4 dirlight_filterColor(vec4 color) {
1394
1394
  uniform float shininess;
1395
1395
  uniform vec3 specularColor;
1396
1396
  } material;
1397
- `,Ft=`#define MAX_LIGHTS 1
1397
+ `,Ft=`#define MAX_LIGHTS 3
1398
1398
 
1399
1399
  uniform phongMaterialUniforms {
1400
1400
  uniform float ambient;
package/dist/index.cjs CHANGED
@@ -2730,7 +2730,7 @@ var lighting = {
2730
2730
  lightType: "i32",
2731
2731
  directionalLightCount: "i32",
2732
2732
  pointLightCount: "i32",
2733
- ambientLightColor: "vec3<f32>",
2733
+ ambientColor: "vec3<f32>",
2734
2734
  // TODO define as arrays once we have appropriate uniformTypes
2735
2735
  lightColor0: "vec3<f32>",
2736
2736
  lightPosition0: "vec3<f32>",
@@ -2751,7 +2751,7 @@ var lighting = {
2751
2751
  lightType: LIGHT_TYPE.POINT,
2752
2752
  directionalLightCount: 0,
2753
2753
  pointLightCount: 0,
2754
- ambientLightColor: [0.1, 0.1, 0.1],
2754
+ ambientColor: [0.1, 0.1, 0.1],
2755
2755
  lightColor0: [1, 1, 1],
2756
2756
  lightPosition0: [1, 1, 2],
2757
2757
  // TODO - could combine direction and attenuation
@@ -2796,7 +2796,7 @@ function getUniforms2(props, prevUniforms = {}) {
2796
2796
  }
2797
2797
  function getLightSourceUniforms({ ambientLight, pointLights = [], directionalLights = [] }) {
2798
2798
  const lightSourceUniforms = {};
2799
- lightSourceUniforms.ambientLightColor = convertColor(ambientLight);
2799
+ lightSourceUniforms.ambientColor = convertColor(ambientLight);
2800
2800
  let currentLight = 0;
2801
2801
  for (const pointLight of pointLights) {
2802
2802
  lightSourceUniforms.lightType = LIGHT_TYPE.POINT;
@@ -2942,7 +2942,7 @@ var PHONG_VS = (
2942
2942
  );
2943
2943
  var PHONG_FS = (
2944
2944
  /* glsl */
2945
- `#define MAX_LIGHTS 1
2945
+ `#define MAX_LIGHTS 3
2946
2946
 
2947
2947
  uniform phongMaterialUniforms {
2948
2948
  uniform float ambient;