@luma.gl/shadertools 9.0.11 → 9.0.14

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/LICENSE ADDED
@@ -0,0 +1,34 @@
1
+ luma.gl is provided under the MIT license
2
+
3
+ Copyright (c) 2020 vis.gl contributors
4
+
5
+ This software includes parts initially developed by Uber and open sourced under MIT license.
6
+ Copyright (c) 2015 Uber Technologies, Inc.
7
+
8
+ This software includes parts of PhiloGL (https://github.com/philogb/philogl)
9
+ under MIT license. PhiloGL parts Copyright © 2013 Sencha Labs.
10
+
11
+ This software includes adaptations of some postprocessing code from
12
+ THREE.js (https://github.com/mrdoob/three.js/) under MIT license.
13
+ THREE.js parts Copyright © 2010-2018 three.js authors.
14
+
15
+ Additional attribution given in specific source files.
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in
25
+ all copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33
+ THE SOFTWARE.
34
+
package/dist/dist.dev.js CHANGED
@@ -356,6 +356,7 @@ ${inject[key]}` : inject[key];
356
356
  vs: vs6,
357
357
  fs: fs28,
358
358
  dependencies = [],
359
+ uniformTypes = {},
359
360
  uniformPropTypes = {},
360
361
  getUniforms: getUniforms9,
361
362
  deprecations = [],
@@ -371,6 +372,7 @@ ${inject[key]}` : inject[key];
371
372
  this.deprecations = this._parseDeprecationDefinitions(deprecations);
372
373
  this.defines = defines;
373
374
  this.injections = normalizeInjections(inject);
375
+ this.uniformTypes = uniformTypes;
374
376
  if (uniformPropTypes) {
375
377
  this.uniforms = makePropValidators(uniformPropTypes);
376
378
  }
package/dist/dist.min.js CHANGED
@@ -26,7 +26,7 @@ logdepth_setFragDepth();
26
26
  `;var io={vertex:ur,fragment:_r},hr=/void\s+main\s*\([^)]*\)\s*\{\n?/,pr=/}\n?[^{}]*$/,Ze=[],_e="__LUMA_INJECT_DECLARATIONS__";function dr(t){let e={vertex:{},fragment:{}};for(let r in t){let n=t[r],o=so(r);typeof n=="string"&&(n={order:0,injection:n}),e[o][r]=n}return e}function so(t){let e=t.slice(0,2);switch(e){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(e)}}function he(t,e,r,n=!1){let o=e==="vertex";for(let i in r){let a=r[i];a.sort((u,h)=>u.order-h.order),Ze.length=a.length;for(let u=0,h=a.length;u<h;++u)Ze[u]=a[u].injection;let f=`${Ze.join(`
27
27
  `)}
28
28
  `;switch(i){case"vs:#decl":o&&(t=t.replace(_e,f));break;case"vs:#main-start":o&&(t=t.replace(hr,u=>u+f));break;case"vs:#main-end":o&&(t=t.replace(pr,u=>f+u));break;case"fs:#decl":o||(t=t.replace(_e,f));break;case"fs:#main-start":o||(t=t.replace(hr,u=>u+f));break;case"fs:#main-end":o||(t=t.replace(pr,u=>f+u));break;default:t=t.replace(i,u=>u+f)}}return t=t.replace(_e,""),n&&(t=t.replace(/\}\s*$/,i=>i+io[e])),t}function mr(t){let e={};return z(Array.isArray(t)&&t.length>1),t.forEach(r=>{for(let n in r)e[n]=e[n]?`${e[n]}
29
- ${r[n]}`:r[n]}),e}var ao=1,C=class{name;vs;fs;getModuleUniforms;dependencies;deprecations;defines;injections;uniforms={};uniformTypes={};static instantiateModules(e){return e.map(r=>{if(r instanceof C)return r;z(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${ao++}`);let n=new C(r);return n.dependencies=C.instantiateModules(r.dependencies||[]),n})}constructor(e){let{name:r,vs:n,fs:o,dependencies:i=[],uniformPropTypes:a={},getUniforms:f,deprecations:u=[],defines:h={},inject:p={}}=e;z(typeof r=="string"),this.name=r,this.vs=n,this.fs=o,this.getModuleUniforms=f,this.dependencies=C.instantiateModules(i),this.deprecations=this._parseDeprecationDefinitions(u),this.defines=h,this.injections=dr(p),a&&(this.uniforms=lr(a))}getModuleSource(e){let r;switch(e){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:z(!1)}let n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
29
+ ${r[n]}`:r[n]}),e}var ao=1,C=class{name;vs;fs;getModuleUniforms;dependencies;deprecations;defines;injections;uniforms={};uniformTypes={};static instantiateModules(e){return e.map(r=>{if(r instanceof C)return r;z(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${ao++}`);let n=new C(r);return n.dependencies=C.instantiateModules(r.dependencies||[]),n})}constructor(e){let{name:r,vs:n,fs:o,dependencies:i=[],uniformTypes:a={},uniformPropTypes:f={},getUniforms:u,deprecations:h=[],defines:p={},inject:d={}}=e;z(typeof r=="string"),this.name=r,this.vs=n,this.fs=o,this.getModuleUniforms=u,this.dependencies=C.instantiateModules(i),this.deprecations=this._parseDeprecationDefinitions(h),this.defines=p,this.injections=dr(d),this.uniformTypes=a,f&&(this.uniforms=lr(f))}getModuleSource(e){let r;switch(e){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:z(!1)}let n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
30
30
 
31
31
  #define MODULE_${n}
32
32
  ${r}
package/dist/index.cjs CHANGED
@@ -307,7 +307,7 @@ var ShaderModuleInstance = class {
307
307
  });
308
308
  }
309
309
  constructor(props) {
310
- const { name, vs: vs6, fs: fs28, dependencies = [], uniformPropTypes = {}, getUniforms: getUniforms9, deprecations = [], defines = {}, inject = {} } = props;
310
+ const { name, vs: vs6, fs: fs28, dependencies = [], uniformTypes = {}, uniformPropTypes = {}, getUniforms: getUniforms9, deprecations = [], defines = {}, inject = {} } = props;
311
311
  assert(typeof name === "string");
312
312
  this.name = name;
313
313
  this.vs = vs6;
@@ -317,6 +317,7 @@ var ShaderModuleInstance = class {
317
317
  this.deprecations = this._parseDeprecationDefinitions(deprecations);
318
318
  this.defines = defines;
319
319
  this.injections = normalizeInjections(inject);
320
+ this.uniformTypes = uniformTypes;
320
321
  if (uniformPropTypes) {
321
322
  this.uniforms = makePropValidators(uniformPropTypes);
322
323
  }