@luma.gl/shadertools 9.0.0-alpha.20 → 9.0.0-alpha.21
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 +60 -60
- package/dist/index.cjs +59 -59
- package/dist/lib/shader-assembler/assemble-shaders.js +2 -2
- package/dist/lib/shader-assembler/assemble-shaders.js.map +1 -1
- package/dist/lib/shader-assembler/inject-shader.d.ts +1 -1
- package/dist/lib/shader-assembler/inject-shader.d.ts.map +1 -1
- package/dist/lib/shader-assembler/inject-shader.js +1 -1
- package/dist/lib/shader-assembler/inject-shader.js.map +1 -1
- package/dist/lib/transpiler/transpile-shader.d.ts +1 -1
- package/dist/lib/transpiler/transpile-shader.d.ts.map +1 -1
- package/dist/lib/transpiler/transpile-shader.js +1 -1
- package/dist/lib/transpiler/transpile-shader.js.map +1 -1
- package/dist/modules/image-blur-filters/tiltshift.js.map +1 -1
- package/dist/modules/lights/lights.glsl.d.ts +1 -2
- package/dist/modules/lights/lights.glsl.d.ts.map +1 -1
- package/dist/modules/lights/lights.glsl.js +1 -1
- package/dist/modules/lights/lights.glsl.js.map +1 -1
- package/dist/modules/lights/lights.js +1 -1
- package/dist/modules/lights/lights.js.map +1 -1
- package/dist/modules/pbr/pbr-fragment.glsl.d.ts +1 -2
- package/dist/modules/pbr/pbr-fragment.glsl.d.ts.map +1 -1
- package/dist/modules/pbr/pbr-fragment.glsl.js +1 -1
- package/dist/modules/pbr/pbr-fragment.glsl.js.map +1 -1
- package/dist/modules/pbr/pbr-vertex.glsl.d.ts +1 -2
- package/dist/modules/pbr/pbr-vertex.glsl.d.ts.map +1 -1
- package/dist/modules/pbr/pbr-vertex.glsl.js +1 -1
- package/dist/modules/pbr/pbr-vertex.glsl.js.map +1 -1
- package/dist/modules/pbr/pbr.js +2 -2
- package/dist/modules/pbr/pbr.js.map +1 -1
- package/dist/modules/phong-lighting/phong-lighting.glsl.d.ts +1 -2
- package/dist/modules/phong-lighting/phong-lighting.glsl.d.ts.map +1 -1
- package/dist/modules/phong-lighting/phong-lighting.glsl.js +1 -1
- package/dist/modules/phong-lighting/phong-lighting.glsl.js.map +1 -1
- package/dist/modules/phong-lighting/phong-lighting.js +1 -1
- package/dist/modules/phong-lighting/phong-lighting.js.map +1 -1
- package/dist.min.js +35 -35
- package/package.json +3 -3
- package/src/.DS_Store +0 -0
- package/src/lib/.DS_Store +0 -0
- package/src/lib/shader-assembler/assemble-shaders.ts +2 -2
- package/src/lib/shader-assembler/inject-shader.ts +1 -1
- package/src/lib/transpiler/transpile-shader.ts +1 -1
- package/src/modules/.DS_Store +0 -0
- package/src/modules/image-blur-filters/tiltshift.ts +1 -1
- package/src/modules/lights/lights.glsl.ts +1 -1
- package/src/modules/lights/lights.ts +1 -1
- package/src/modules/pbr/pbr-fragment.glsl.ts +1 -1
- package/src/modules/pbr/pbr-vertex.glsl.ts +1 -1
- package/src/modules/pbr/pbr.ts +2 -2
- package/src/modules/phong-lighting/phong-lighting.glsl.ts +1 -1
- package/src/modules/phong-lighting/phong-lighting.ts +1 -1
package/dist.min.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['luma'] = factory();
|
|
6
6
|
else root['luma'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var
|
|
8
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(n,e){return
|
|
7
|
+
"use strict";var __exports__=(()=>{var dn=Object.defineProperty;var br=Object.getOwnPropertyDescriptor;var Pr=Object.getOwnPropertyNames;var Lr=Object.prototype.hasOwnProperty;var Er=(n,e)=>{for(var t in e)dn(n,t,{get:e[t],enumerable:!0})},Sr=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Pr(e))!Lr.call(n,o)&&o!==t&&dn(n,o,{get:()=>e[o],enumerable:!(r=br(e,o))||r.enumerable});return n};var Ir=n=>Sr(dn({},"__esModule",{value:!0}),n);var Li={};Er(Li,{_transform:()=>gr,_warp:()=>W,assembleShaders:()=>Fe,brightnessContrast:()=>Bt,bulgePinch:()=>ur,colorHalftone:()=>nr,combineInjects:()=>he,convertToVec4:()=>Fn,denoise:()=>Gt,dirlight:()=>Pt,dotScreen:()=>tr,edgeWork:()=>or,fp32:()=>Be,fp64:()=>Qe,fp64arithmetic:()=>On,fxaa:()=>mr,getPassthroughFS:()=>we,getQualifierDetails:()=>Ce,getShaderInfo:()=>ye,glsl:()=>f,gouraudLighting:()=>Ft,hexagonalPixelate:()=>ar,hueSaturation:()=>Vt,ink:()=>sr,lights:()=>V,magnify:()=>cr,noise:()=>jt,normalizeShaderModule:()=>Ne,pbr:()=>Ct,phongLighting:()=>Nt,picking:()=>St,project:()=>cn,random:()=>k,sepia:()=>Ht,swirl:()=>dr,tiltShift:()=>wt,triangleBlur:()=>Dt,typeToChannelCount:()=>De,typeToChannelSuffix:()=>Ue,vibrance:()=>Kt,vignette:()=>Zt,zoomBlur:()=>kt});function mn(n){if(Array.isArray(n))return n}function vn(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,o,i,a,l=[],s=!0,c=!1;try{if(i=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;s=!1}else for(;!(s=(r=i.call(t)).done)&&(l.push(r.value),l.length!==e);s=!0);}catch(p){c=!0,o=p}finally{try{if(!s&&t.return!=null&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}function Z(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function gn(n,e){if(n){if(typeof n=="string")return Z(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Z(n,e)}}function hn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(n,e){return mn(n)||vn(n,e)||gn(n,e)||hn()}function U(n){return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U(n)}function xn(n,e){if(U(n)!=="object"||n===null)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(U(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function H(n){var e=xn(n,"string");return U(e)==="symbol"?e:String(e)}function M(n,e,t){return e=H(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function u(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}var f=function(e){return"".concat(e)};function w(n,e){if(!n)throw new Error(e||"shadertools: assertion failed.")}function An(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Vn(n,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,H(r.key),r)}}function bn(n,e,t){return e&&Vn(n.prototype,e),t&&Vn(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function Qn(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),t.push.apply(t,r)}return t}function X(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qn(Object(t),!0).forEach(function(r){M(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Qn(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}var Pn={number:{type:"number",validate:function(e,t){return Number.isFinite(e)&&U(t)==="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate:function(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function Wn(n){for(var e={},t=0,r=Object.entries(n);t<r.length;t++){var o=D(r[t],2),i=o[0],a=o[1];e[i]=Tr(a)}return e}function Hn(n,e,t){for(var r={},o=0,i=Object.entries(e);o<i.length;o++){var a=D(i[o],2),l=a[0],s=a[1];n&&l in n&&!s.private?(s.validate&&w(s.validate(n[l],s),"".concat(t,": invalid ").concat(l)),r[l]=n[l]):r[l]=s.value}return r}function Tr(n){var e=jn(n);if(e!=="object")return X(X({value:n},Pn[e]),{},{type:e});if(U(n)==="object")return n?n.type!==void 0?X(X(X({},n),Pn[n.type]),{},{type:n.type}):n.value===void 0?{type:"object",value:n}:(e=jn(n.value),X(X(X({},n),Pn[e]),{},{type:e})):{type:"object",value:null};throw new Error("props")}function jn(n){return Array.isArray(n)||ArrayBuffer.isView(n)?"array":U(n)}var q=function(){function n(e){An(this,n),M(this,"name",void 0),M(this,"vs",void 0),M(this,"fs",void 0),M(this,"getModuleUniforms",void 0),M(this,"dependencies",void 0),M(this,"deprecations",void 0),M(this,"defines",void 0),M(this,"injections",void 0),M(this,"uniforms",{});var t=e.name,r=e.vs,o=e.fs,i=e.dependencies,a=i===void 0?[]:i,l=e.uniforms,s=l===void 0?{}:l,c=e.getUniforms,p=e.deprecations,_=p===void 0?[]:p,d=e.defines,m=d===void 0?{}:d,v=e.inject,g=v===void 0?{}:v;w(typeof t=="string"),this.name=t,this.vs=r,this.fs=o,this.getModuleUniforms=c,this.dependencies=a,this.deprecations=this._parseDeprecationDefinitions(_),this.defines=m,this.injections=Fr(g),s&&(this.uniforms=Wn(s))}return bn(n,[{key:"getModuleSource",value:function(t){var r;switch(t){case"vs":r=this.vs||"";break;case"fs":r=this.fs||"";break;default:w(!1)}return"#define MODULE_".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),`
|
|
9
9
|
`).concat(r,"// END MODULE_").concat(this.name,`
|
|
10
10
|
|
|
11
|
-
`)}},{key:"getUniforms",value:function(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):
|
|
12
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,l;return{s:function(){t=t.call(n)},n:function(){var c=t.next();return i=c.done,c},e:function(c){a=!0,l=c},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(a)throw l}}}}function Nr(n,e){if(n){if(typeof n=="string")return
|
|
11
|
+
`)}},{key:"getUniforms",value:function(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):Hn(t,this.uniforms,this.name)}},{key:"getDefines",value:function(){return this.defines}},{key:"checkDeprecations",value:function(t,r){this.deprecations.forEach(function(o){var i;(i=o.regex)!==null&&i!==void 0&&i.test(t)&&(o.deprecated?r.deprecated(o.old,o.new)():r.removed(o.old,o.new)())})}},{key:"_parseDeprecationDefinitions",value:function(t){return t.forEach(function(r){switch(r.type){case"function":r.regex=new RegExp("\\b".concat(r.old,"\\("));break;default:r.regex=new RegExp("".concat(r.type," ").concat(r.old,";"))}}),t}},{key:"_defaultGetUniforms",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},o=this.uniforms;for(var i in o){var a=o[i];i in t&&!a.private?(a.validate&&w(a.validate(t[i],a),"".concat(this.name,": invalid ").concat(i)),r[i]=t[i]):r[i]=a.value}return r}}]),n}();function Fr(n){var e={vs:{},fs:{}};for(var t in n){var r=n[t],o=t.slice(0,2);if(o!=="vs"&&o!=="fs")throw new Error(o);typeof r=="string"&&(r={order:0,injection:r}),e[o][t]=r}return e}function qn(n,e){var t=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=Nr(n))||e&&n&&typeof n.length=="number"){t&&(n=t);var r=0,o=function(){};return{s:o,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
12
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,l;return{s:function(){t=t.call(n)},n:function(){var c=t.next();return i=c.done,c},e:function(c){a=!0,l=c},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(a)throw l}}}}function Nr(n,e){if(n){if(typeof n=="string")return Kn(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Kn(n,e)}}function Kn(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function $n(n){return yr(Zn(n))}function Zn(n){return n.map(function(e){if(e instanceof q)return e;w(typeof e!="string","Shader module use by name is deprecated. Import shader module '".concat(e,"' and use it directly.")),w(e.name,"shader module has no name");var t=new q(e);return t.dependencies=Zn(e.dependencies||[]),t})}function yr(n){var e={},t={};return Jn({modules:n,level:0,moduleMap:e,moduleDepth:t}),Object.keys(t).sort(function(r,o){return t[o]-t[r]}).map(function(r){return e[r]})}function Jn(n){var e=n.modules,t=n.level,r=n.moduleMap,o=n.moduleDepth;if(t>=5)throw new Error("Possible loop in shader dependency graph");var i=qn(e),a;try{for(i.s();!(a=i.n()).done;){var l=a.value;r[l.name]=l,(o[l.name]===void 0||o[l.name]<t)&&(o[l.name]=t)}}catch(_){i.e(_)}finally{i.f()}var s=qn(e),c;try{for(s.s();!(c=s.n()).done;){var p=c.value;p.dependencies&&Jn({modules:p.dependencies,level:t+1,moduleMap:r,moduleDepth:o})}}catch(_){s.e(_)}finally{s.f()}}var ne,ee,te,re,oe,ie,ae,le,se,ce;function fe(n){switch(n?.gpu.toLowerCase()){case"apple":return f(ne||(ne=u([`#define APPLE_GPU
|
|
13
13
|
// Apple optimizes away the calculation necessary for emulated fp64
|
|
14
14
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
15
15
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
@@ -22,14 +22,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
22
22
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
23
23
|
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
|
|
24
24
|
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
25
|
-
`])));case"nvidia":return f(
|
|
25
|
+
`])));case"nvidia":return f(ee||(ee=u([`#define NVIDIA_GPU
|
|
26
26
|
// Nvidia optimizes away the calculation necessary for emulated fp64
|
|
27
27
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
28
28
|
`],[`\\
|
|
29
29
|
#define NVIDIA_GPU
|
|
30
30
|
// Nvidia optimizes away the calculation necessary for emulated fp64
|
|
31
31
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
32
|
-
`])));case"intel":return f(
|
|
32
|
+
`])));case"intel":return f(te||(te=u([`#define INTEL_GPU
|
|
33
33
|
// Intel optimizes away the calculation necessary for emulated fp64
|
|
34
34
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
35
35
|
// Intel's built-in 'tan' function doesn't have acceptable precision
|
|
@@ -44,17 +44,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
44
44
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
45
45
|
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
|
|
46
46
|
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
47
|
-
`])));case"amd":return f(
|
|
47
|
+
`])));case"amd":return f(re||(re=u([`#define AMD_GPU
|
|
48
48
|
`],[`\\
|
|
49
49
|
#define AMD_GPU
|
|
50
|
-
`])));default:return f(
|
|
50
|
+
`])));default:return f(oe||(oe=u([`#define DEFAULT_GPU
|
|
51
51
|
// Prevent driver from optimizing away the calculation necessary for emulated fp64
|
|
52
52
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
53
53
|
`],[`\\
|
|
54
54
|
#define DEFAULT_GPU
|
|
55
55
|
// Prevent driver from optimizing away the calculation necessary for emulated fp64
|
|
56
56
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
57
|
-
`])))}}function
|
|
57
|
+
`])))}}function _e(n){var e=f(ie||(ie=u([`#if (__VERSION__ > 120)
|
|
58
58
|
|
|
59
59
|
# define FEATURE_GLSL_DERIVATIVES
|
|
60
60
|
# define FEATURE_GLSL_DRAW_BUFFERS
|
|
@@ -83,7 +83,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
83
83
|
# define TEXTURE_LOD
|
|
84
84
|
|
|
85
85
|
#endif // __VERSION
|
|
86
|
-
`])));return n.features.has("glsl-frag-depth")&&(e+=f(
|
|
86
|
+
`])));return n.features.has("glsl-frag-depth")&&(e+=f(ae||(ae=u([`
|
|
87
87
|
// FRAG_DEPTH => gl_FragDepth is available
|
|
88
88
|
#ifdef GL_EXT_frag_depth
|
|
89
89
|
#extension GL_EXT_frag_depth : enable
|
|
@@ -100,7 +100,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
100
100
|
# define FRAG_DEPTH
|
|
101
101
|
# define gl_FragDepth gl_FragDepthEXT
|
|
102
102
|
#endif
|
|
103
|
-
`])))),n!=null&&n.features.has("glsl-derivatives")&&(e+=f(
|
|
103
|
+
`])))),n!=null&&n.features.has("glsl-derivatives")&&(e+=f(le||(le=u([`
|
|
104
104
|
// DERIVATIVES => dxdF, dxdY and fwidth are available
|
|
105
105
|
#if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES)
|
|
106
106
|
#extension GL_OES_standard_derivatives : enable
|
|
@@ -115,7 +115,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
115
115
|
# define FEATURE_GLSL_DERIVATIVES
|
|
116
116
|
# define DERIVATIVES
|
|
117
117
|
#endif
|
|
118
|
-
`])))),n!=null&&n.features.has("glsl-frag-data")&&(e+=f(
|
|
118
|
+
`])))),n!=null&&n.features.has("glsl-frag-data")&&(e+=f(se||(se=u([`
|
|
119
119
|
// DRAW_BUFFERS => gl_FragData[] is available
|
|
120
120
|
#ifdef GL_EXT_draw_buffers
|
|
121
121
|
#extension GL_EXT_draw_buffers : require
|
|
@@ -130,7 +130,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
130
130
|
#define FEATURE_GLSL_DRAW_BUFFERS
|
|
131
131
|
#define DRAW_BUFFERS
|
|
132
132
|
#endif
|
|
133
|
-
`])))),n!=null&&n.features.has("glsl-texture-lod")&&(e+=f(
|
|
133
|
+
`])))),n!=null&&n.features.has("glsl-texture-lod")&&(e+=f(ce||(ce=u([`// TEXTURE_LOD => texture2DLod etc are available
|
|
134
134
|
#ifdef GL_EXT_shader_texture_lod
|
|
135
135
|
#extension GL_EXT_shader_texture_lod : enable
|
|
136
136
|
|
|
@@ -147,14 +147,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
147
147
|
# define TEXTURE_LOD
|
|
148
148
|
|
|
149
149
|
#endif
|
|
150
|
-
`])))),e}var pe,de
|
|
150
|
+
`])))),e}var ue,pe,de=f(ue||(ue=u([`#ifdef MODULE_LOGDEPTH
|
|
151
151
|
logdepth_adjustPosition(gl_Position);
|
|
152
152
|
#endif
|
|
153
153
|
`],[`\\
|
|
154
154
|
#ifdef MODULE_LOGDEPTH
|
|
155
155
|
logdepth_adjustPosition(gl_Position);
|
|
156
156
|
#endif
|
|
157
|
-
`]))),
|
|
157
|
+
`]))),me=f(pe||(pe=u([`#ifdef MODULE_MATERIAL
|
|
158
158
|
gl_FragColor = material_filterColor(gl_FragColor);
|
|
159
159
|
#endif
|
|
160
160
|
|
|
@@ -195,14 +195,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
195
195
|
#ifdef MODULE_LOGDEPTH
|
|
196
196
|
logdepth_setFragDepth();
|
|
197
197
|
#endif
|
|
198
|
-
`])));var Or={vs:
|
|
198
|
+
`])));var Or={vs:de,fs:me},ve=/void\s+main\s*\([^)]*\)\s*\{\n?/,ge=/}\n?[^{}]*$/,Ln=[],K="__LUMA_INJECT_DECLARATIONS__";function En(n,e,t){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,o=e==="vs",i=function(){var s=t[a];s.sort(function(d,m){return d.order-m.order}),Ln.length=s.length;for(var c=0,p=s.length;c<p;++c)Ln[c]=s[c].injection;var _="".concat(Ln.join(`
|
|
199
199
|
`),`
|
|
200
|
-
`);switch(a){case"vs:#decl":o&&(n=n.replace(K,_));break;case"vs:#main-start":o&&(n=n.replace(
|
|
200
|
+
`);switch(a){case"vs:#decl":o&&(n=n.replace(K,_));break;case"vs:#main-start":o&&(n=n.replace(ve,function(d){return d+_}));break;case"vs:#main-end":o&&(n=n.replace(ge,function(d){return _+d}));break;case"fs:#decl":o||(n=n.replace(K,_));break;case"fs:#main-start":o||(n=n.replace(ve,function(d){return d+_}));break;case"fs:#main-end":o||(n=n.replace(ge,function(d){return _+d}));break;default:n=n.replace(a,function(d){return d+_})}};for(var a in t)i();return n=n.replace(K,""),r&&(n=n.replace(/\}\s*$/,function(l){return l+Or[e]})),n}function he(n){var e={};return w(Array.isArray(n)&&n.length>1),n.forEach(function(t){for(var r in t)e[r]=e[r]?"".concat(e[r],`
|
|
201
201
|
`).concat(t[r]):t[r]}),e}function Rr(n,e){var t=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=Mr(n))||e&&n&&typeof n.length=="number"){t&&(n=t);var r=0,o=function(){};return{s:o,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
202
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,l;return{s:function(){t=t.call(n)},n:function(){var c=t.next();return i=c.done,c},e:function(c){a=!0,l=c},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(a)throw l}}}}function Mr(n,e){if(n){if(typeof n=="string")return
|
|
203
|
-
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Cr=[].concat(be,[[Q("attribute"),"in $1"],[Q("varying"),"out $1"]]),wr=[].concat(be,[[Q("varying"),"in $1"]]),Pe=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],Ur=[].concat(Pe,[[Q("in"),"attribute $1"],[Q("out"),"varying $1"]]),Dr=[].concat(Pe,[[Q("in"),"varying $1"]]),Sn="gl_FragColor",In=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/,kr=/void\s+main\s*\([^)]*\)\s*\{\n?/;function
|
|
204
|
-
`).concat(o)}).replace(new RegExp("\\b".concat(Sn,"\\b"),"g"),r)}return n}function Br(n){n=
|
|
205
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,l;return{s:function(){t=t.call(n)},n:function(){var c=t.next();return i=c.done,c},e:function(c){a=!0,l=c},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(a)throw l}}}}function Xr(n,e){if(n){if(typeof n=="string")return Ee(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ee(n,e)}}function Ee(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Se(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),t.push.apply(t,r)}return t}function
|
|
202
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,l;return{s:function(){t=t.call(n)},n:function(){var c=t.next();return i=c.done,c},e:function(c){a=!0,l=c},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(a)throw l}}}}function Mr(n,e){if(n){if(typeof n=="string")return xe(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xe(n,e)}}function xe(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Ae(n,e,t){switch(e){case 300:return t?J(n,Cr):zr(n);case 100:return t?J(n,Ur):Br(n);default:throw new Error("unknown GLSL version ".concat(e))}}var be=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
|
|
203
|
+
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Cr=[].concat(be,[[Q("attribute"),"in $1"],[Q("varying"),"out $1"]]),wr=[].concat(be,[[Q("varying"),"in $1"]]),Pe=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],Ur=[].concat(Pe,[[Q("in"),"attribute $1"],[Q("out"),"varying $1"]]),Dr=[].concat(Pe,[[Q("in"),"varying $1"]]),Sn="gl_FragColor",In=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/,kr=/void\s+main\s*\([^)]*\)\s*\{\n?/;function J(n,e){var t=Rr(e),r;try{for(t.s();!(r=t.n()).done;){var o=D(r.value,2),i=o[0],a=o[1];n=n.replace(i,a)}}catch(l){t.e(l)}finally{t.f()}return n}function zr(n){n=J(n,wr);var e=In.exec(n);if(e){var t=e[1];n=n.replace(new RegExp("\\b".concat(Sn,"\\b"),"g"),t)}else{var r="fragmentColor";n=n.replace(kr,function(o){return"out vec4 ".concat(r,`;
|
|
204
|
+
`).concat(o)}).replace(new RegExp("\\b".concat(Sn,"\\b"),"g"),r)}return n}function Br(n){n=J(n,Dr);var e=In.exec(n);if(e){var t=e[1];n=n.replace(In,"").replace(new RegExp("\\b".concat(t,"\\b"),"g"),Sn)}return n}function Q(n){return new RegExp("\\b".concat(n,"[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)"),"g")}var Le;function Tn(n,e){var t=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=Xr(n))||e&&n&&typeof n.length=="number"){t&&(n=t);var r=0,o=function(){};return{s:o,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
205
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,l;return{s:function(){t=t.call(n)},n:function(){var c=t.next();return i=c.done,c},e:function(c){a=!0,l=c},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(a)throw l}}}}function Xr(n,e){if(n){if(typeof n=="string")return Ee(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ee(n,e)}}function Ee(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function Se(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),t.push.apply(t,r)}return t}function nn(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Se(Object(t),!0).forEach(function(r){M(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Se(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}var Gr=`
|
|
206
206
|
|
|
207
207
|
`.concat(K,`
|
|
208
208
|
|
|
@@ -211,17 +211,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
211
211
|
`],[`\\
|
|
212
212
|
precision highp float;
|
|
213
213
|
|
|
214
|
-
`])));function Fe(n,e){var t=e.vs,r=e.fs,o
|
|
214
|
+
`])));function Fe(n,e){var t=e.vs,r=e.fs,o=$n(e.modules||[]);return{vs:Ie(n,nn(nn({},e),{},{source:t,type:"vs",modules:o})),fs:Ie(n,nn(nn({},e),{},{source:r,type:"fs",modules:o})),getUniforms:Vr(o)}}function Ie(n,e){var t=e.id,r=e.source,o=e.type,i=e.modules,a=e.defines,l=a===void 0?{}:a,s=e.hookFunctions,c=s===void 0?[]:s,p=e.inject,_=p===void 0?{}:p,d=e.transpileToGLSL100,m=d===void 0?!1:d,v=e.prologue,g=v===void 0?!0:v,P=e.log;w(typeof r=="string","shader source must be a string");var L=o==="vs",S=r.split(`
|
|
215
215
|
`),h=100,x="",A=r;S[0].indexOf("#version ")===0?(h=300,x=S[0],A=S.slice(1).join(`
|
|
216
|
-
`)):x="#version ".concat(h);var b={};i.forEach(function(
|
|
216
|
+
`)):x="#version ".concat(h);var b={};i.forEach(function(pn){Object.assign(b,pn.getDefines())}),Object.assign(b,l);var I=g?"".concat(x,`
|
|
217
217
|
`).concat(jr({id:t,source:r,type:o}),`
|
|
218
218
|
`).concat(Qr(o),`
|
|
219
|
+
`).concat(fe(n),`
|
|
219
220
|
`).concat(_e(n),`
|
|
220
|
-
`).concat(ue(n),`
|
|
221
221
|
`).concat(Wr(b),`
|
|
222
222
|
`).concat(L?"":Yr,`
|
|
223
223
|
`):"".concat(x,`
|
|
224
|
-
`),R=qr(c),F={},N={},y={};for(var T in _){var O=typeof _[T]=="string"?{injection:_[T],order:0}:_[T],E=/^(v|f)s:(#)?([\w-]+)$/.exec(T);if(E){var G=E[2],hr=E[3];G?hr==="decl"?N[T]=[O]:y[T]=[O]:F[T]=[O]}else y[T]=[O]}var $=
|
|
224
|
+
`),R=qr(c),F={},N={},y={};for(var T in _){var O=typeof _[T]=="string"?{injection:_[T],order:0}:_[T],E=/^(v|f)s:(#)?([\w-]+)$/.exec(T);if(E){var G=E[2],hr=E[3];G?hr==="decl"?N[T]=[O]:y[T]=[O]:F[T]=[O]}else y[T]=[O]}var $=Tn(i),Gn;try{for($.s();!(Gn=$.n()).done;){var fn=Gn.value;P&&fn.checkDeprecations(A,P);var xr=fn.getModuleSource(o,h);I+=xr;var _n=fn.injections[o];for(var z in _n){var Yn=/^(v|f)s:#([\w-]+)$/.exec(z);if(Yn){var Ar=Yn[2],un=Ar==="decl"?N:y;un[z]=un[z]||[],un[z].push(_n[z])}else F[z]=F[z]||[],F[z].push(_n[z])}}}catch(pn){$.e(pn)}finally{$.f()}return I+=Gr,I=En(I,o,N),I+=Hr(R[o],F),I+=A,I=En(I,o,y),I=Ae(I,m?100:h,L),I}function Vr(n){return function(t){var r={},o=Tn(n),i;try{for(o.s();!(i=o.n()).done;){var a=i.value,l=a.getUniforms(t,r);Object.assign(r,l)}}catch(s){o.e(s)}finally{o.f()}return r}}function Qr(n){return`
|
|
225
225
|
#define SHADER_TYPE_`.concat(Te[n].toUpperCase(),`
|
|
226
226
|
`)}function jr(n){var e=n.id,t=n.source,r=n.type,o=e&&t.indexOf("SHADER_NAME")===-1;return o?`
|
|
227
227
|
#define SHADER_NAME `.concat(e,"_").concat(Te[r],`
|
|
@@ -231,7 +231,7 @@ precision highp float;
|
|
|
231
231
|
`),e++;var o=n[r];(o||Number.isFinite(o))&&(t+="#define ".concat(r.toUpperCase()," ").concat(n[r],`
|
|
232
232
|
`))}return e===0&&(t+=`
|
|
233
233
|
`),t}function Hr(n,e){var t="";for(var r in n){var o=n[r];if(t+="void ".concat(o.signature,` {
|
|
234
|
-
`),o.header&&(t+=" ".concat(o.header)),e[r]){var i=e[r];i.sort(function(c,p){return c.order-p.order});var a=
|
|
234
|
+
`),o.header&&(t+=" ".concat(o.header)),e[r]){var i=e[r];i.sort(function(c,p){return c.order-p.order});var a=Tn(i),l;try{for(a.s();!(l=a.n()).done;){var s=l.value;t+=" ".concat(s.injection,`
|
|
235
235
|
`)}}catch(c){a.e(c)}finally{a.f()}}o.footer&&(t+=" ".concat(o.footer)),t+=`}
|
|
236
236
|
`}return t}function qr(n){var e={vs:{},fs:{}};return n.forEach(function(t){var r,o;typeof t!="string"?(r=t,o=r.hook):(r={},o=t),o=o.trim();var i=o.split(":"),a=D(i,2),l=a[0],s=a[1],c=o.replace(/\(.+/,"");if(l!=="vs"&&l!=="fs")throw new Error(l);e[l][c]=Object.assign(r,{signature:s})}),e}function Ne(n){if(!n.normalized&&(n.normalized=!0,n.uniforms&&!n.getUniforms)){var e=new q(n);n.getUniforms=e.getUniforms.bind(e)}return n}function ye(n,e){return{name:Kr(n,e),language:"glsl",version:$r(n)}}function Kr(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",t=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,r=t.exec(n);return r?r[1]:e}function $r(n){var e=100,t=n.match(/[^\s]+/g);if(t&&t.length>=2&&t[0]==="#version"){var r=parseInt(t[1],10);Number.isFinite(r)&&(e=r)}return e}var Oe,Re,Zr=f(Oe||(Oe=u(["void main() {gl_FragColor = vec4(0);}"]))),Me=f(Re||(Re=u([`out vec4 transform_output;
|
|
237
237
|
void main() {
|
|
@@ -242,7 +242,7 @@ void main() {
|
|
|
242
242
|
transform_output = vec4(0);
|
|
243
243
|
}`]))),Jr=`#version 300 es
|
|
244
244
|
`.concat(Me);function Ce(n,e){e=Array.isArray(e)?e:[e];var t=n.replace(/^\s+/,"").split(/\s+/),r=D(t,3),o=r[0],i=r[1],a=r[2];if(!e.includes(o)||!i||!a)return null;var l=a.split(";")[0];return{qualifier:o,type:i,name:l}}function we(n){var e=n||{},t=e.version,r=t===void 0?100:t,o=e.input,i=e.inputType,a=e.output;if(!o)return r===300?Jr:r>300?"#version ".concat(r,`
|
|
245
|
-
`).concat(Me):Zr;if(!i)throw new Error("inputType");var l=
|
|
245
|
+
`).concat(Me):Zr;if(!i)throw new Error("inputType");var l=Fn(o,i);return r>=300?"#version ".concat(r," ").concat(r===300?"es":"",`
|
|
246
246
|
in `).concat(i," ").concat(o,`;
|
|
247
247
|
out vec4 `).concat(a,`;
|
|
248
248
|
void main() {
|
|
@@ -250,7 +250,7 @@ void main() {
|
|
|
250
250
|
}`):"varying ".concat(i," ").concat(o,`;
|
|
251
251
|
void main() {
|
|
252
252
|
gl_FragColor = `).concat(l,`;
|
|
253
|
-
}`)}function Ue(n){switch(n){case"float":return"x";case"vec2":return"xy";case"vec3":return"xyz";case"vec4":return"xyzw";default:throw new Error(n)}}function De(n){switch(n){case"float":return 1;case"vec2":return 2;case"vec3":return 3;case"vec4":return 4;default:throw new Error(n)}}function
|
|
253
|
+
}`)}function Ue(n){switch(n){case"float":return"x";case"vec2":return"xy";case"vec3":return"xyz";case"vec4":return"xyzw";default:throw new Error(n)}}function De(n){switch(n){case"float":return 1;case"vec2":return 2;case"vec3":return 3;case"vec4":return 4;default:throw new Error(n)}}function Fn(n,e){switch(e){case"float":return"vec4(".concat(n,", 0.0, 0.0, 1.0)");case"vec2":return"vec4(".concat(n,", 0.0, 1.0)");case"vec3":return"vec4(".concat(n,", 1.0)");case"vec4":return n;default:throw new Error(e)}}var ke,no=f(ke||(ke=u([`float random(vec3 scale, float seed) {
|
|
254
254
|
/* use the fragment position for a different seed per-pixel */
|
|
255
255
|
return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
|
|
256
256
|
}
|
|
@@ -560,7 +560,7 @@ float tan_fp32(float a) {
|
|
|
560
560
|
return tan(a);
|
|
561
561
|
#endif
|
|
562
562
|
}
|
|
563
|
-
`]))),Be={name:"fp32",vs:eo};function
|
|
563
|
+
`]))),Be={name:"fp32",vs:eo};function en(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=Math.fround(n),o=n-r;return e[t]=r,e[t+1]=o,e}function Nn(n){return n-Math.fround(n)}function yn(n){for(var e=new Float32Array(32),t=0;t<4;++t)for(var r=0;r<4;++r){var o=t*4+r;en(n[r*4+t],e,o*2)}return e}var Xe,Ge=f(Xe||(Xe=u([`uniform float ONE;
|
|
564
564
|
|
|
565
565
|
/*
|
|
566
566
|
About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
@@ -2230,7 +2230,7 @@ void mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) {
|
|
|
2230
2230
|
vec4_dot_fp64(a, tmp, out_val[i]);
|
|
2231
2231
|
}
|
|
2232
2232
|
}
|
|
2233
|
-
`])));var to={ONE:1};function ro(){return to}var Rn={name:"fp64-arithmetic",vs:Ge,getUniforms:ro,fp64ify:tn,fp64LowPart:yn,fp64ifyMatrix4:On},Qe={name:"fp64",vs:Ve,dependencies:[Rn],fp64ify:tn,fp64LowPart:yn,fp64ifyMatrix4:On};var el=1/Math.PI*180,tl=1/180*Math.PI,oo={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...oo}};var C=globalThis.mathgl.config;function je(n,{precision:e=C.precision}={}){return n=io(n),"".concat(parseFloat(n.toPrecision(e)))}function rn(n){return Array.isArray(n)||ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Mn(n,e,t){let r=C.EPSILON;t&&(C.EPSILON=t);try{if(n===e)return!0;if(rn(n)&&rn(e)){if(n.length!==e.length)return!1;for(let o=0;o<n.length;++o)if(!Mn(n[o],e[o]))return!1;return!0}return n&&n.equals?n.equals(e):e&&e.equals?e.equals(n):typeof n=="number"&&typeof e=="number"?Math.abs(n-e)<=C.EPSILON*Math.max(1,Math.abs(n),Math.abs(e)):!1}finally{C.EPSILON=r}}function io(n){return Math.round(n/C.EPSILON)*C.EPSILON}function ao(n){function e(){var t=Reflect.construct(n,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return e.prototype=Object.create(n.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n,e}var on=class extends ao(Array){clone(){return new this.constructor().copy(this)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:rn(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(C)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+je(this[r],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Mn(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){if(r===void 0)return this.lerp(this,e,t);for(let o=0;o<this.ELEMENTS;++o){let i=e[o],a=typeof t=="number"?t:t[o];this[o]=i+r*(a-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(let t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]+=t[r];return this.check()}subtract(...e){for(let t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]-=t[r];return this.check()}scale(e){if(typeof e=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(C.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}get elements(){return this}};function lo(n,e){if(n.length!==e)return!1;for(let t=0;t<n.length;++t)if(!Number.isFinite(n[t]))return!1;return!0}function We(n){if(!Number.isFinite(n))throw new Error("Invalid number ".concat(JSON.stringify(n)));return n}function an(n,e,t=""){if(C.debug&&!lo(n,e))throw new Error("math.gl: ".concat(t," some fields set to invalid numbers'"));return n}var B=typeof Float32Array<"u"?Float32Array:Array;var sl=Math.PI/180;function so(){let n=new B(2);return B!=Float32Array&&(n[0]=0,n[1]=0),n}function Ke(n,e,t){let r=e[0],o=e[1];return n[0]=t[0]*r+t[4]*o+t[12],n[1]=t[1]*r+t[5]*o+t[13],n}var cl=function(){let n=so();return function(e,t,r,o,i,a){let l,s;for(t||(t=2),r||(r=0),o?s=Math.min(o*t+r,e.length):s=e.length,l=r;l<s;l+=t)n[0]=e[l],n[1]=e[l+1],i(n,n,a),e[l]=n[0],e[l+1]=n[1];return e}}();function $e(n,e,t){let r=e[0],o=e[1],i=t[3]*r+t[7]*o||1;return n[0]=(t[0]*r+t[4]*o)/i,n[1]=(t[1]*r+t[5]*o)/i,n}function Ze(n,e,t){let r=e[0],o=e[1],i=e[2],a=t[3]*r+t[7]*o+t[11]*i||1;return n[0]=(t[0]*r+t[4]*o+t[8]*i)/a,n[1]=(t[1]*r+t[5]*o+t[9]*i)/a,n[2]=(t[2]*r+t[6]*o+t[10]*i)/a,n}function co(){let n=new B(3);return B!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Je(n,e,t){let r=e[0],o=e[1],i=e[2],a=t[3]*r+t[7]*o+t[11]*i+t[15];return a=a||1,n[0]=(t[0]*r+t[4]*o+t[8]*i+t[12])/a,n[1]=(t[1]*r+t[5]*o+t[9]*i+t[13])/a,n[2]=(t[2]*r+t[6]*o+t[10]*i+t[14])/a,n}var ul=function(){let n=co();return function(e,t,r,o,i,a){let l,s;for(t||(t=3),r||(r=0),o?s=Math.min(o*t+r,e.length):s=e.length,l=r;l<s;l+=t)n[0]=e[l],n[1]=e[l+1],n[2]=e[l+2],i(n,n,a),e[l]=n[0],e[l+1]=n[1],e[l+2]=n[2];return e}}();var ln=class extends on{toString(){let e="[";if(C.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=" ".concat(this[r*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=We(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){let r=e*this.RANK;for(let o=0;o<this.RANK;++o)t[o]=this[r+o];return t}setColumn(e,t){let r=e*this.RANK;for(let o=0;o<this.RANK;++o)this[r+o]=t[o];return this}};function fo(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function nt(n,e){if(n===e){let t=e[1],r=e[2],o=e[3],i=e[6],a=e[7],l=e[11];n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=t,n[6]=e[9],n[7]=e[13],n[8]=r,n[9]=i,n[11]=e[14],n[12]=o,n[13]=a,n[14]=l}else n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15];return n}function et(n,e){let t=e[0],r=e[1],o=e[2],i=e[3],a=e[4],l=e[5],s=e[6],c=e[7],p=e[8],_=e[9],d=e[10],m=e[11],v=e[12],g=e[13],P=e[14],L=e[15],S=t*l-r*a,h=t*s-o*a,x=t*c-i*a,A=r*s-o*l,b=r*c-i*l,I=o*c-i*s,R=p*g-_*v,F=p*P-d*v,N=p*L-m*v,y=_*P-d*g,T=_*L-m*g,O=d*L-m*P,E=S*O-h*T+x*y+A*N-b*F+I*R;return E?(E=1/E,n[0]=(l*O-s*T+c*y)*E,n[1]=(o*T-r*O-i*y)*E,n[2]=(g*I-P*b+L*A)*E,n[3]=(d*b-_*I-m*A)*E,n[4]=(s*N-a*O-c*F)*E,n[5]=(t*O-o*N+i*F)*E,n[6]=(P*x-v*I-L*h)*E,n[7]=(p*I-d*x+m*h)*E,n[8]=(a*T-l*N+c*R)*E,n[9]=(r*N-t*T-i*R)*E,n[10]=(v*b-g*x+L*S)*E,n[11]=(_*x-p*b-m*S)*E,n[12]=(l*F-a*y-s*R)*E,n[13]=(t*y-r*F+o*R)*E,n[14]=(g*h-v*A-P*S)*E,n[15]=(p*A-_*h+d*S)*E,n):null}function tt(n){let e=n[0],t=n[1],r=n[2],o=n[3],i=n[4],a=n[5],l=n[6],s=n[7],c=n[8],p=n[9],_=n[10],d=n[11],m=n[12],v=n[13],g=n[14],P=n[15],L=e*a-t*i,S=e*l-r*i,h=t*l-r*a,x=c*v-p*m,A=c*g-_*m,b=p*g-_*v,I=e*b-t*A+r*x,R=i*b-a*A+l*x,F=c*h-p*S+_*L,N=m*h-v*S+g*L;return s*I-o*R+P*F-d*N}function wn(n,e,t){let r=e[0],o=e[1],i=e[2],a=e[3],l=e[4],s=e[5],c=e[6],p=e[7],_=e[8],d=e[9],m=e[10],v=e[11],g=e[12],P=e[13],L=e[14],S=e[15],h=t[0],x=t[1],A=t[2],b=t[3];return n[0]=h*r+x*l+A*_+b*g,n[1]=h*o+x*s+A*d+b*P,n[2]=h*i+x*c+A*m+b*L,n[3]=h*a+x*p+A*v+b*S,h=t[4],x=t[5],A=t[6],b=t[7],n[4]=h*r+x*l+A*_+b*g,n[5]=h*o+x*s+A*d+b*P,n[6]=h*i+x*c+A*m+b*L,n[7]=h*a+x*p+A*v+b*S,h=t[8],x=t[9],A=t[10],b=t[11],n[8]=h*r+x*l+A*_+b*g,n[9]=h*o+x*s+A*d+b*P,n[10]=h*i+x*c+A*m+b*L,n[11]=h*a+x*p+A*v+b*S,h=t[12],x=t[13],A=t[14],b=t[15],n[12]=h*r+x*l+A*_+b*g,n[13]=h*o+x*s+A*d+b*P,n[14]=h*i+x*c+A*m+b*L,n[15]=h*a+x*p+A*v+b*S,n}function rt(n,e,t){let r=t[0],o=t[1],i=t[2],a,l,s,c,p,_,d,m,v,g,P,L;return e===n?(n[12]=e[0]*r+e[4]*o+e[8]*i+e[12],n[13]=e[1]*r+e[5]*o+e[9]*i+e[13],n[14]=e[2]*r+e[6]*o+e[10]*i+e[14],n[15]=e[3]*r+e[7]*o+e[11]*i+e[15]):(a=e[0],l=e[1],s=e[2],c=e[3],p=e[4],_=e[5],d=e[6],m=e[7],v=e[8],g=e[9],P=e[10],L=e[11],n[0]=a,n[1]=l,n[2]=s,n[3]=c,n[4]=p,n[5]=_,n[6]=d,n[7]=m,n[8]=v,n[9]=g,n[10]=P,n[11]=L,n[12]=a*r+p*o+v*i+e[12],n[13]=l*r+_*o+g*i+e[13],n[14]=s*r+d*o+P*i+e[14],n[15]=c*r+m*o+L*i+e[15]),n}function ot(n,e,t){let r=t[0],o=t[1],i=t[2];return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*o,n[5]=e[5]*o,n[6]=e[6]*o,n[7]=e[7]*o,n[8]=e[8]*i,n[9]=e[9]*i,n[10]=e[10]*i,n[11]=e[11]*i,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function it(n,e,t,r){let o=r[0],i=r[1],a=r[2],l=Math.sqrt(o*o+i*i+a*a),s,c,p,_,d,m,v,g,P,L,S,h,x,A,b,I,R,F,N,y,T,O,E,G;return l<1e-6?null:(l=1/l,o*=l,i*=l,a*=l,c=Math.sin(t),s=Math.cos(t),p=1-s,_=e[0],d=e[1],m=e[2],v=e[3],g=e[4],P=e[5],L=e[6],S=e[7],h=e[8],x=e[9],A=e[10],b=e[11],I=o*o*p+s,R=i*o*p+a*c,F=a*o*p-i*c,N=o*i*p-a*c,y=i*i*p+s,T=a*i*p+o*c,O=o*a*p+i*c,E=i*a*p-o*c,G=a*a*p+s,n[0]=_*I+g*R+h*F,n[1]=d*I+P*R+x*F,n[2]=m*I+L*R+A*F,n[3]=v*I+S*R+b*F,n[4]=_*N+g*y+h*T,n[5]=d*N+P*y+x*T,n[6]=m*N+L*y+A*T,n[7]=v*N+S*y+b*T,n[8]=_*O+g*E+h*G,n[9]=d*O+P*E+x*G,n[10]=m*O+L*E+A*G,n[11]=v*O+S*E+b*G,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n)}function at(n,e,t){let r=Math.sin(t),o=Math.cos(t),i=e[4],a=e[5],l=e[6],s=e[7],c=e[8],p=e[9],_=e[10],d=e[11];return e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[4]=i*o+c*r,n[5]=a*o+p*r,n[6]=l*o+_*r,n[7]=s*o+d*r,n[8]=c*o-i*r,n[9]=p*o-a*r,n[10]=_*o-l*r,n[11]=d*o-s*r,n}function lt(n,e,t){let r=Math.sin(t),o=Math.cos(t),i=e[0],a=e[1],l=e[2],s=e[3],c=e[8],p=e[9],_=e[10],d=e[11];return e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=i*o-c*r,n[1]=a*o-p*r,n[2]=l*o-_*r,n[3]=s*o-d*r,n[8]=i*r+c*o,n[9]=a*r+p*o,n[10]=l*r+_*o,n[11]=s*r+d*o,n}function st(n,e,t){let r=Math.sin(t),o=Math.cos(t),i=e[0],a=e[1],l=e[2],s=e[3],c=e[4],p=e[5],_=e[6],d=e[7];return e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=i*o+c*r,n[1]=a*o+p*r,n[2]=l*o+_*r,n[3]=s*o+d*r,n[4]=c*o-i*r,n[5]=p*o-a*r,n[6]=_*o-l*r,n[7]=d*o-s*r,n}function ct(n,e){let t=e[0],r=e[1],o=e[2],i=e[3],a=t+t,l=r+r,s=o+o,c=t*a,p=r*a,_=r*l,d=o*a,m=o*l,v=o*s,g=i*a,P=i*l,L=i*s;return n[0]=1-_-v,n[1]=p+L,n[2]=d-P,n[3]=0,n[4]=p-L,n[5]=1-c-v,n[6]=m+g,n[7]=0,n[8]=d+P,n[9]=m-g,n[10]=1-c-_,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function ft(n,e,t,r,o,i,a){let l=1/(t-e),s=1/(o-r),c=1/(i-a);return n[0]=i*2*l,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i*2*s,n[6]=0,n[7]=0,n[8]=(t+e)*l,n[9]=(o+r)*s,n[10]=(a+i)*c,n[11]=-1,n[12]=0,n[13]=0,n[14]=a*i*2*c,n[15]=0,n}function _o(n,e,t,r,o){let i=1/Math.tan(e/2);if(n[0]=i/t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,o!=null&&o!==1/0){let a=1/(r-o);n[10]=(o+r)*a,n[14]=2*o*r*a}else n[10]=-1,n[14]=-2*r;return n}var _t=_o;function uo(n,e,t,r,o,i,a){let l=1/(e-t),s=1/(r-o),c=1/(i-a);return n[0]=-2*l,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*s,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*c,n[11]=0,n[12]=(e+t)*l,n[13]=(o+r)*s,n[14]=(a+i)*c,n[15]=1,n}var ut=uo;function pt(n,e,t,r){let o,i,a,l,s,c,p,_,d,m,v=e[0],g=e[1],P=e[2],L=r[0],S=r[1],h=r[2],x=t[0],A=t[1],b=t[2];return Math.abs(v-x)<1e-6&&Math.abs(g-A)<1e-6&&Math.abs(P-b)<1e-6?fo(n):(_=v-x,d=g-A,m=P-b,o=1/Math.sqrt(_*_+d*d+m*m),_*=o,d*=o,m*=o,i=S*m-h*d,a=h*_-L*m,l=L*d-S*_,o=Math.sqrt(i*i+a*a+l*l),o?(o=1/o,i*=o,a*=o,l*=o):(i=0,a=0,l=0),s=d*l-m*a,c=m*i-_*l,p=_*a-d*i,o=Math.sqrt(s*s+c*c+p*p),o?(o=1/o,s*=o,c*=o,p*=o):(s=0,c=0,p=0),n[0]=i,n[1]=s,n[2]=_,n[3]=0,n[4]=a,n[5]=c,n[6]=d,n[7]=0,n[8]=l,n[9]=p,n[10]=m,n[11]=0,n[12]=-(i*v+a*g+l*P),n[13]=-(s*v+c*g+p*P),n[14]=-(_*v+d*g+m*P),n[15]=1,n)}function po(){let n=new B(4);return B!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function dt(n,e,t){let r=e[0],o=e[1],i=e[2],a=e[3];return n[0]=t[0]*r+t[4]*o+t[8]*i+t[12]*a,n[1]=t[1]*r+t[5]*o+t[9]*i+t[13]*a,n[2]=t[2]*r+t[6]*o+t[10]*i+t[14]*a,n[3]=t[3]*r+t[7]*o+t[11]*i+t[15]*a,n}var xl=function(){let n=po();return function(e,t,r,o,i,a){let l,s;for(t||(t=4),r||(r=0),o?s=Math.min(o*t+r,e.length):s=e.length,l=r;l<s;l+=t)n[0]=e[l],n[1]=e[l+1],n[2]=e[l+2],n[3]=e[l+3],i(n,n,a),e[l]=n[0],e[l+1]=n[1],e[l+2]=n[2],e[l+3]=n[3];return e}}();var kn;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL0ROW3=3]="COL0ROW3",n[n.COL1ROW0=4]="COL1ROW0",n[n.COL1ROW1=5]="COL1ROW1",n[n.COL1ROW2=6]="COL1ROW2",n[n.COL1ROW3=7]="COL1ROW3",n[n.COL2ROW0=8]="COL2ROW0",n[n.COL2ROW1=9]="COL2ROW1",n[n.COL2ROW2=10]="COL2ROW2",n[n.COL2ROW3=11]="COL2ROW3",n[n.COL3ROW0=12]="COL3ROW0",n[n.COL3ROW1=13]="COL3ROW1",n[n.COL3ROW2=14]="COL3ROW2",n[n.COL3ROW3=15]="COL3ROW3"})(kn||(kn={}));var mo=45*Math.PI/180,vo=1,Un=.1,Dn=500,go=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Y=class extends ln{static get IDENTITY(){return xo()}static get ZERO(){return ho()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return kn}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,r,o,i,a,l,s,c,p,_,d,m,v,g,P){return this[0]=e,this[1]=t,this[2]=r,this[3]=o,this[4]=i,this[5]=a,this[6]=l,this[7]=s,this[8]=c,this[9]=p,this[10]=_,this[11]=d,this[12]=m,this[13]=v,this[14]=g,this[15]=P,this.check()}setRowMajor(e,t,r,o,i,a,l,s,c,p,_,d,m,v,g,P){return this[0]=e,this[1]=i,this[2]=c,this[3]=m,this[4]=t,this[5]=a,this[6]=p,this[7]=v,this[8]=r,this[9]=l,this[10]=_,this[11]=g,this[12]=o,this[13]=s,this[14]=d,this[15]=P,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(go)}fromObject(e){return this.check()}fromQuaternion(e){return ct(this,e),this.check()}frustum(e){let{left:t,right:r,bottom:o,top:i,near:a=Un,far:l=Dn}=e;return l===1/0?Ao(this,t,r,o,i,a):ft(this,t,r,o,i,a,l),this.check()}lookAt(e){let{eye:t,center:r=[0,0,0],up:o=[0,1,0]}=e;return pt(this,t,r,o),this.check()}ortho(e){let{left:t,right:r,bottom:o,top:i,near:a=Un,far:l=Dn}=e;return ut(this,t,r,o,i,a,l),this.check()}orthographic(e){let{fovy:t=mo,aspect:r=vo,focalDistance:o=1,near:i=Un,far:a=Dn}=e;mt(t);let l=t/2,s=o*Math.tan(l),c=s*r;return this.ortho({left:-c,right:c,bottom:-s,top:s,near:i,far:a})}perspective(e){let{fovy:t=45*Math.PI/180,aspect:r=1,near:o=.1,far:i=500}=e;return mt(t),_t(this,t,r,o,i),this.check()}determinant(){return tt(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let r=this.getScale(t),o=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*o,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*o,e[5]=this[5]*i,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*o,e[9]=this[9]*i,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let r=this.getScale(t),o=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*o,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=this[4]*o,e[4]=this[5]*i,e[5]=this[6]*a,e[6]=this[8]*o,e[7]=this[9]*i,e[8]=this[10]*a,e}transpose(){return nt(this,this),this.check()}invert(){return et(this,this),this.check()}multiplyLeft(e){return wn(this,e,this),this.check()}multiplyRight(e){return wn(this,this,e),this.check()}rotateX(e){return at(this,this,e),this.check()}rotateY(e){return lt(this,this,e),this.check()}rotateZ(e){return st(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return it(this,this,e,t),this.check()}scale(e){return ot(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return rt(this,this,e),this.check()}transform(e,t){return e.length===4?(t=dt(t||[-0,-0,-0,-0],e,this),an(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){let{length:r}=e,o;switch(r){case 2:o=Ke(t||[-0,-0],e,this);break;case 3:o=Je(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return an(o,e.length),o}transformAsVector(e,t){let r;switch(e.length){case 2:r=$e(t||[-0,-0],e,this);break;case 3:r=Ze(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return an(r,e.length),r}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}},sn,cn;function ho(){return sn||(sn=new Y([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(sn)),sn}function xo(){return cn||(cn=new Y,Object.freeze(cn)),cn}function mt(n){if(n>Math.PI*2)throw Error("expected radians")}function Ao(n,e,t,r,o,i){let a=2*i/(t-e),l=2*i/(o-r),s=(t+e)/(t-e),c=(o+r)/(o-r),p=-1,_=-1,d=-2*i;return n[0]=a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=l,n[6]=0,n[7]=0,n[8]=s,n[9]=c,n[10]=p,n[11]=_,n[12]=0,n[13]=0,n[14]=d,n[15]=0,n}var vt,zn=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],bo={modelMatrix:zn,viewMatrix:zn,projectionMatrix:zn,cameraPositionWorld:[0,0,0]};function Po(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bo,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={};return n.modelMatrix!==void 0&&(t.modelMatrix=n.modelMatrix),n.viewMatrix!==void 0&&(t.viewMatrix=n.viewMatrix),n.projectionMatrix!==void 0&&(t.projectionMatrix=n.projectionMatrix),n.cameraPositionWorld!==void 0&&(t.cameraPositionWorld=n.cameraPositionWorld),(n.projectionMatrix!==void 0||n.viewMatrix!==void 0)&&(t.viewProjectionMatrix=new Y(n.projectionMatrix).multiplyRight(n.viewMatrix)),t}var gt=f(vt||(vt=u([`varying vec4 project_vPositionWorld;
|
|
2233
|
+
`])));var to={ONE:1};function ro(){return to}var On={name:"fp64-arithmetic",vs:Ge,getUniforms:ro,fp64ify:en,fp64LowPart:Nn,fp64ifyMatrix4:yn},Qe={name:"fp64",vs:Ve,dependencies:[On],fp64ify:en,fp64LowPart:Nn,fp64ifyMatrix4:yn};var el=1/Math.PI*180,tl=1/180*Math.PI,oo={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...oo}};var C=globalThis.mathgl.config;function je(n,{precision:e=C.precision}={}){return n=io(n),"".concat(parseFloat(n.toPrecision(e)))}function tn(n){return Array.isArray(n)||ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Rn(n,e,t){let r=C.EPSILON;t&&(C.EPSILON=t);try{if(n===e)return!0;if(tn(n)&&tn(e)){if(n.length!==e.length)return!1;for(let o=0;o<n.length;++o)if(!Rn(n[o],e[o]))return!1;return!0}return n&&n.equals?n.equals(e):e&&e.equals?e.equals(n):typeof n=="number"&&typeof e=="number"?Math.abs(n-e)<=C.EPSILON*Math.max(1,Math.abs(n),Math.abs(e)):!1}finally{C.EPSILON=r}}function io(n){return Math.round(n/C.EPSILON)*C.EPSILON}function ao(n){function e(){var t=Reflect.construct(n,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return e.prototype=Object.create(n.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n,e}var rn=class extends ao(Array){clone(){return new this.constructor().copy(this)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:tn(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(C)}formatString(e){let t="";for(let r=0;r<this.ELEMENTS;++r)t+=(r>0?", ":"")+je(this[r],e);return"".concat(e.printTypes?this.constructor.name:"","[").concat(t,"]")}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!Rn(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){if(r===void 0)return this.lerp(this,e,t);for(let o=0;o<this.ELEMENTS;++o){let i=e[o],a=typeof t=="number"?t:t[o];this[o]=i+r*(a-i)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(let t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]+=t[r];return this.check()}subtract(...e){for(let t of e)for(let r=0;r<this.ELEMENTS;++r)this[r]-=t[r];return this.check()}scale(e){if(typeof e=="number")for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(C.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}get elements(){return this}};function lo(n,e){if(n.length!==e)return!1;for(let t=0;t<n.length;++t)if(!Number.isFinite(n[t]))return!1;return!0}function We(n){if(!Number.isFinite(n))throw new Error("Invalid number ".concat(JSON.stringify(n)));return n}function on(n,e,t=""){if(C.debug&&!lo(n,e))throw new Error("math.gl: ".concat(t," some fields set to invalid numbers'"));return n}var B=typeof Float32Array<"u"?Float32Array:Array;var sl=Math.PI/180;function so(){let n=new B(2);return B!=Float32Array&&(n[0]=0,n[1]=0),n}function Ke(n,e,t){let r=e[0],o=e[1];return n[0]=t[0]*r+t[4]*o+t[12],n[1]=t[1]*r+t[5]*o+t[13],n}var cl=function(){let n=so();return function(e,t,r,o,i,a){let l,s;for(t||(t=2),r||(r=0),o?s=Math.min(o*t+r,e.length):s=e.length,l=r;l<s;l+=t)n[0]=e[l],n[1]=e[l+1],i(n,n,a),e[l]=n[0],e[l+1]=n[1];return e}}();function $e(n,e,t){let r=e[0],o=e[1],i=t[3]*r+t[7]*o||1;return n[0]=(t[0]*r+t[4]*o)/i,n[1]=(t[1]*r+t[5]*o)/i,n}function Ze(n,e,t){let r=e[0],o=e[1],i=e[2],a=t[3]*r+t[7]*o+t[11]*i||1;return n[0]=(t[0]*r+t[4]*o+t[8]*i)/a,n[1]=(t[1]*r+t[5]*o+t[9]*i)/a,n[2]=(t[2]*r+t[6]*o+t[10]*i)/a,n}function co(){let n=new B(3);return B!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Je(n,e,t){let r=e[0],o=e[1],i=e[2],a=t[3]*r+t[7]*o+t[11]*i+t[15];return a=a||1,n[0]=(t[0]*r+t[4]*o+t[8]*i+t[12])/a,n[1]=(t[1]*r+t[5]*o+t[9]*i+t[13])/a,n[2]=(t[2]*r+t[6]*o+t[10]*i+t[14])/a,n}var ul=function(){let n=co();return function(e,t,r,o,i,a){let l,s;for(t||(t=3),r||(r=0),o?s=Math.min(o*t+r,e.length):s=e.length,l=r;l<s;l+=t)n[0]=e[l],n[1]=e[l+1],n[2]=e[l+2],i(n,n,a),e[l]=n[0],e[l+1]=n[1],e[l+2]=n[2];return e}}();var an=class extends rn{toString(){let e="[";if(C.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=" ".concat(this[r*this.RANK+t])}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=" ".concat(this[t])}return e+="]",e}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=We(r),this}getColumn(e,t=new Array(this.RANK).fill(-0)){let r=e*this.RANK;for(let o=0;o<this.RANK;++o)t[o]=this[r+o];return t}setColumn(e,t){let r=e*this.RANK;for(let o=0;o<this.RANK;++o)this[r+o]=t[o];return this}};function fo(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function nt(n,e){if(n===e){let t=e[1],r=e[2],o=e[3],i=e[6],a=e[7],l=e[11];n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=t,n[6]=e[9],n[7]=e[13],n[8]=r,n[9]=i,n[11]=e[14],n[12]=o,n[13]=a,n[14]=l}else n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15];return n}function et(n,e){let t=e[0],r=e[1],o=e[2],i=e[3],a=e[4],l=e[5],s=e[6],c=e[7],p=e[8],_=e[9],d=e[10],m=e[11],v=e[12],g=e[13],P=e[14],L=e[15],S=t*l-r*a,h=t*s-o*a,x=t*c-i*a,A=r*s-o*l,b=r*c-i*l,I=o*c-i*s,R=p*g-_*v,F=p*P-d*v,N=p*L-m*v,y=_*P-d*g,T=_*L-m*g,O=d*L-m*P,E=S*O-h*T+x*y+A*N-b*F+I*R;return E?(E=1/E,n[0]=(l*O-s*T+c*y)*E,n[1]=(o*T-r*O-i*y)*E,n[2]=(g*I-P*b+L*A)*E,n[3]=(d*b-_*I-m*A)*E,n[4]=(s*N-a*O-c*F)*E,n[5]=(t*O-o*N+i*F)*E,n[6]=(P*x-v*I-L*h)*E,n[7]=(p*I-d*x+m*h)*E,n[8]=(a*T-l*N+c*R)*E,n[9]=(r*N-t*T-i*R)*E,n[10]=(v*b-g*x+L*S)*E,n[11]=(_*x-p*b-m*S)*E,n[12]=(l*F-a*y-s*R)*E,n[13]=(t*y-r*F+o*R)*E,n[14]=(g*h-v*A-P*S)*E,n[15]=(p*A-_*h+d*S)*E,n):null}function tt(n){let e=n[0],t=n[1],r=n[2],o=n[3],i=n[4],a=n[5],l=n[6],s=n[7],c=n[8],p=n[9],_=n[10],d=n[11],m=n[12],v=n[13],g=n[14],P=n[15],L=e*a-t*i,S=e*l-r*i,h=t*l-r*a,x=c*v-p*m,A=c*g-_*m,b=p*g-_*v,I=e*b-t*A+r*x,R=i*b-a*A+l*x,F=c*h-p*S+_*L,N=m*h-v*S+g*L;return s*I-o*R+P*F-d*N}function Cn(n,e,t){let r=e[0],o=e[1],i=e[2],a=e[3],l=e[4],s=e[5],c=e[6],p=e[7],_=e[8],d=e[9],m=e[10],v=e[11],g=e[12],P=e[13],L=e[14],S=e[15],h=t[0],x=t[1],A=t[2],b=t[3];return n[0]=h*r+x*l+A*_+b*g,n[1]=h*o+x*s+A*d+b*P,n[2]=h*i+x*c+A*m+b*L,n[3]=h*a+x*p+A*v+b*S,h=t[4],x=t[5],A=t[6],b=t[7],n[4]=h*r+x*l+A*_+b*g,n[5]=h*o+x*s+A*d+b*P,n[6]=h*i+x*c+A*m+b*L,n[7]=h*a+x*p+A*v+b*S,h=t[8],x=t[9],A=t[10],b=t[11],n[8]=h*r+x*l+A*_+b*g,n[9]=h*o+x*s+A*d+b*P,n[10]=h*i+x*c+A*m+b*L,n[11]=h*a+x*p+A*v+b*S,h=t[12],x=t[13],A=t[14],b=t[15],n[12]=h*r+x*l+A*_+b*g,n[13]=h*o+x*s+A*d+b*P,n[14]=h*i+x*c+A*m+b*L,n[15]=h*a+x*p+A*v+b*S,n}function rt(n,e,t){let r=t[0],o=t[1],i=t[2],a,l,s,c,p,_,d,m,v,g,P,L;return e===n?(n[12]=e[0]*r+e[4]*o+e[8]*i+e[12],n[13]=e[1]*r+e[5]*o+e[9]*i+e[13],n[14]=e[2]*r+e[6]*o+e[10]*i+e[14],n[15]=e[3]*r+e[7]*o+e[11]*i+e[15]):(a=e[0],l=e[1],s=e[2],c=e[3],p=e[4],_=e[5],d=e[6],m=e[7],v=e[8],g=e[9],P=e[10],L=e[11],n[0]=a,n[1]=l,n[2]=s,n[3]=c,n[4]=p,n[5]=_,n[6]=d,n[7]=m,n[8]=v,n[9]=g,n[10]=P,n[11]=L,n[12]=a*r+p*o+v*i+e[12],n[13]=l*r+_*o+g*i+e[13],n[14]=s*r+d*o+P*i+e[14],n[15]=c*r+m*o+L*i+e[15]),n}function ot(n,e,t){let r=t[0],o=t[1],i=t[2];return n[0]=e[0]*r,n[1]=e[1]*r,n[2]=e[2]*r,n[3]=e[3]*r,n[4]=e[4]*o,n[5]=e[5]*o,n[6]=e[6]*o,n[7]=e[7]*o,n[8]=e[8]*i,n[9]=e[9]*i,n[10]=e[10]*i,n[11]=e[11]*i,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function it(n,e,t,r){let o=r[0],i=r[1],a=r[2],l=Math.sqrt(o*o+i*i+a*a),s,c,p,_,d,m,v,g,P,L,S,h,x,A,b,I,R,F,N,y,T,O,E,G;return l<1e-6?null:(l=1/l,o*=l,i*=l,a*=l,c=Math.sin(t),s=Math.cos(t),p=1-s,_=e[0],d=e[1],m=e[2],v=e[3],g=e[4],P=e[5],L=e[6],S=e[7],h=e[8],x=e[9],A=e[10],b=e[11],I=o*o*p+s,R=i*o*p+a*c,F=a*o*p-i*c,N=o*i*p-a*c,y=i*i*p+s,T=a*i*p+o*c,O=o*a*p+i*c,E=i*a*p-o*c,G=a*a*p+s,n[0]=_*I+g*R+h*F,n[1]=d*I+P*R+x*F,n[2]=m*I+L*R+A*F,n[3]=v*I+S*R+b*F,n[4]=_*N+g*y+h*T,n[5]=d*N+P*y+x*T,n[6]=m*N+L*y+A*T,n[7]=v*N+S*y+b*T,n[8]=_*O+g*E+h*G,n[9]=d*O+P*E+x*G,n[10]=m*O+L*E+A*G,n[11]=v*O+S*E+b*G,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n)}function at(n,e,t){let r=Math.sin(t),o=Math.cos(t),i=e[4],a=e[5],l=e[6],s=e[7],c=e[8],p=e[9],_=e[10],d=e[11];return e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[4]=i*o+c*r,n[5]=a*o+p*r,n[6]=l*o+_*r,n[7]=s*o+d*r,n[8]=c*o-i*r,n[9]=p*o-a*r,n[10]=_*o-l*r,n[11]=d*o-s*r,n}function lt(n,e,t){let r=Math.sin(t),o=Math.cos(t),i=e[0],a=e[1],l=e[2],s=e[3],c=e[8],p=e[9],_=e[10],d=e[11];return e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=i*o-c*r,n[1]=a*o-p*r,n[2]=l*o-_*r,n[3]=s*o-d*r,n[8]=i*r+c*o,n[9]=a*r+p*o,n[10]=l*r+_*o,n[11]=s*r+d*o,n}function st(n,e,t){let r=Math.sin(t),o=Math.cos(t),i=e[0],a=e[1],l=e[2],s=e[3],c=e[4],p=e[5],_=e[6],d=e[7];return e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n[0]=i*o+c*r,n[1]=a*o+p*r,n[2]=l*o+_*r,n[3]=s*o+d*r,n[4]=c*o-i*r,n[5]=p*o-a*r,n[6]=_*o-l*r,n[7]=d*o-s*r,n}function ct(n,e){let t=e[0],r=e[1],o=e[2],i=e[3],a=t+t,l=r+r,s=o+o,c=t*a,p=r*a,_=r*l,d=o*a,m=o*l,v=o*s,g=i*a,P=i*l,L=i*s;return n[0]=1-_-v,n[1]=p+L,n[2]=d-P,n[3]=0,n[4]=p-L,n[5]=1-c-v,n[6]=m+g,n[7]=0,n[8]=d+P,n[9]=m-g,n[10]=1-c-_,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function ft(n,e,t,r,o,i,a){let l=1/(t-e),s=1/(o-r),c=1/(i-a);return n[0]=i*2*l,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i*2*s,n[6]=0,n[7]=0,n[8]=(t+e)*l,n[9]=(o+r)*s,n[10]=(a+i)*c,n[11]=-1,n[12]=0,n[13]=0,n[14]=a*i*2*c,n[15]=0,n}function _o(n,e,t,r,o){let i=1/Math.tan(e/2);if(n[0]=i/t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,o!=null&&o!==1/0){let a=1/(r-o);n[10]=(o+r)*a,n[14]=2*o*r*a}else n[10]=-1,n[14]=-2*r;return n}var _t=_o;function uo(n,e,t,r,o,i,a){let l=1/(e-t),s=1/(r-o),c=1/(i-a);return n[0]=-2*l,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*s,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*c,n[11]=0,n[12]=(e+t)*l,n[13]=(o+r)*s,n[14]=(a+i)*c,n[15]=1,n}var ut=uo;function pt(n,e,t,r){let o,i,a,l,s,c,p,_,d,m,v=e[0],g=e[1],P=e[2],L=r[0],S=r[1],h=r[2],x=t[0],A=t[1],b=t[2];return Math.abs(v-x)<1e-6&&Math.abs(g-A)<1e-6&&Math.abs(P-b)<1e-6?fo(n):(_=v-x,d=g-A,m=P-b,o=1/Math.sqrt(_*_+d*d+m*m),_*=o,d*=o,m*=o,i=S*m-h*d,a=h*_-L*m,l=L*d-S*_,o=Math.sqrt(i*i+a*a+l*l),o?(o=1/o,i*=o,a*=o,l*=o):(i=0,a=0,l=0),s=d*l-m*a,c=m*i-_*l,p=_*a-d*i,o=Math.sqrt(s*s+c*c+p*p),o?(o=1/o,s*=o,c*=o,p*=o):(s=0,c=0,p=0),n[0]=i,n[1]=s,n[2]=_,n[3]=0,n[4]=a,n[5]=c,n[6]=d,n[7]=0,n[8]=l,n[9]=p,n[10]=m,n[11]=0,n[12]=-(i*v+a*g+l*P),n[13]=-(s*v+c*g+p*P),n[14]=-(_*v+d*g+m*P),n[15]=1,n)}function po(){let n=new B(4);return B!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function dt(n,e,t){let r=e[0],o=e[1],i=e[2],a=e[3];return n[0]=t[0]*r+t[4]*o+t[8]*i+t[12]*a,n[1]=t[1]*r+t[5]*o+t[9]*i+t[13]*a,n[2]=t[2]*r+t[6]*o+t[10]*i+t[14]*a,n[3]=t[3]*r+t[7]*o+t[11]*i+t[15]*a,n}var xl=function(){let n=po();return function(e,t,r,o,i,a){let l,s;for(t||(t=4),r||(r=0),o?s=Math.min(o*t+r,e.length):s=e.length,l=r;l<s;l+=t)n[0]=e[l],n[1]=e[l+1],n[2]=e[l+2],n[3]=e[l+3],i(n,n,a),e[l]=n[0],e[l+1]=n[1],e[l+2]=n[2],e[l+3]=n[3];return e}}();var Dn;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL0ROW3=3]="COL0ROW3",n[n.COL1ROW0=4]="COL1ROW0",n[n.COL1ROW1=5]="COL1ROW1",n[n.COL1ROW2=6]="COL1ROW2",n[n.COL1ROW3=7]="COL1ROW3",n[n.COL2ROW0=8]="COL2ROW0",n[n.COL2ROW1=9]="COL2ROW1",n[n.COL2ROW2=10]="COL2ROW2",n[n.COL2ROW3=11]="COL2ROW3",n[n.COL3ROW0=12]="COL3ROW0",n[n.COL3ROW1=13]="COL3ROW1",n[n.COL3ROW2=14]="COL3ROW2",n[n.COL3ROW3=15]="COL3ROW3"})(Dn||(Dn={}));var mo=45*Math.PI/180,vo=1,wn=.1,Un=500,go=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Y=class extends an{static get IDENTITY(){return xo()}static get ZERO(){return ho()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Dn}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,r,o,i,a,l,s,c,p,_,d,m,v,g,P){return this[0]=e,this[1]=t,this[2]=r,this[3]=o,this[4]=i,this[5]=a,this[6]=l,this[7]=s,this[8]=c,this[9]=p,this[10]=_,this[11]=d,this[12]=m,this[13]=v,this[14]=g,this[15]=P,this.check()}setRowMajor(e,t,r,o,i,a,l,s,c,p,_,d,m,v,g,P){return this[0]=e,this[1]=i,this[2]=c,this[3]=m,this[4]=t,this[5]=a,this[6]=p,this[7]=v,this[8]=r,this[9]=l,this[10]=_,this[11]=g,this[12]=o,this[13]=s,this[14]=d,this[15]=P,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(go)}fromObject(e){return this.check()}fromQuaternion(e){return ct(this,e),this.check()}frustum(e){let{left:t,right:r,bottom:o,top:i,near:a=wn,far:l=Un}=e;return l===1/0?Ao(this,t,r,o,i,a):ft(this,t,r,o,i,a,l),this.check()}lookAt(e){let{eye:t,center:r=[0,0,0],up:o=[0,1,0]}=e;return pt(this,t,r,o),this.check()}ortho(e){let{left:t,right:r,bottom:o,top:i,near:a=wn,far:l=Un}=e;return ut(this,t,r,o,i,a,l),this.check()}orthographic(e){let{fovy:t=mo,aspect:r=vo,focalDistance:o=1,near:i=wn,far:a=Un}=e;mt(t);let l=t/2,s=o*Math.tan(l),c=s*r;return this.ortho({left:-c,right:c,bottom:-s,top:s,near:i,far:a})}perspective(e){let{fovy:t=45*Math.PI/180,aspect:r=1,near:o=.1,far:i=500}=e;return mt(t),_t(this,t,r,o,i),this.check()}determinant(){return tt(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let r=this.getScale(t),o=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*o,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=0,e[4]=this[4]*o,e[5]=this[5]*i,e[6]=this[6]*a,e[7]=0,e[8]=this[8]*o,e[9]=this[9]*i,e[10]=this[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let r=this.getScale(t),o=1/r[0],i=1/r[1],a=1/r[2];return e[0]=this[0]*o,e[1]=this[1]*i,e[2]=this[2]*a,e[3]=this[4]*o,e[4]=this[5]*i,e[5]=this[6]*a,e[6]=this[8]*o,e[7]=this[9]*i,e[8]=this[10]*a,e}transpose(){return nt(this,this),this.check()}invert(){return et(this,this),this.check()}multiplyLeft(e){return Cn(this,e,this),this.check()}multiplyRight(e){return Cn(this,this,e),this.check()}rotateX(e){return at(this,this,e),this.check()}rotateY(e){return lt(this,this,e),this.check()}rotateZ(e){return st(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return it(this,this,e,t),this.check()}scale(e){return ot(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return rt(this,this,e),this.check()}transform(e,t){return e.length===4?(t=dt(t||[-0,-0,-0,-0],e,this),on(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){let{length:r}=e,o;switch(r){case 2:o=Ke(t||[-0,-0],e,this);break;case 3:o=Je(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return on(o,e.length),o}transformAsVector(e,t){let r;switch(e.length){case 2:r=$e(t||[-0,-0],e,this);break;case 3:r=Ze(t||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return on(r,e.length),r}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}},ln,sn;function ho(){return ln||(ln=new Y([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(ln)),ln}function xo(){return sn||(sn=new Y,Object.freeze(sn)),sn}function mt(n){if(n>Math.PI*2)throw Error("expected radians")}function Ao(n,e,t,r,o,i){let a=2*i/(t-e),l=2*i/(o-r),s=(t+e)/(t-e),c=(o+r)/(o-r),p=-1,_=-1,d=-2*i;return n[0]=a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=l,n[6]=0,n[7]=0,n[8]=s,n[9]=c,n[10]=p,n[11]=_,n[12]=0,n[13]=0,n[14]=d,n[15]=0,n}var vt,kn=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],bo={modelMatrix:kn,viewMatrix:kn,projectionMatrix:kn,cameraPositionWorld:[0,0,0]};function Po(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bo,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t={};return n.modelMatrix!==void 0&&(t.modelMatrix=n.modelMatrix),n.viewMatrix!==void 0&&(t.viewMatrix=n.viewMatrix),n.projectionMatrix!==void 0&&(t.projectionMatrix=n.projectionMatrix),n.cameraPositionWorld!==void 0&&(t.cameraPositionWorld=n.cameraPositionWorld),(n.projectionMatrix!==void 0||n.viewMatrix!==void 0)&&(t.viewProjectionMatrix=new Y(n.projectionMatrix).multiplyRight(n.viewMatrix)),t}var gt=f(vt||(vt=u([`varying vec4 project_vPositionWorld;
|
|
2234
2234
|
varying vec3 project_vNormalWorld;
|
|
2235
2235
|
|
|
2236
2236
|
vec4 project_getPosition_World() {
|
|
@@ -2305,7 +2305,7 @@ vec4 project_to_clipspace(vec3 position) {
|
|
|
2305
2305
|
return viewProjectionMatrix * vec4(position, 1.);
|
|
2306
2306
|
}
|
|
2307
2307
|
`),Eo=`
|
|
2308
|
-
`.concat(gt),
|
|
2308
|
+
`.concat(gt),cn={name:"project",getUniforms:Po,vs:Lo,fs:Eo};var ht,zn=f(ht||(ht=u([`#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
2309
2309
|
|
|
2310
2310
|
struct AmbientLight {
|
|
2311
2311
|
vec3 color;
|
|
@@ -2375,7 +2375,7 @@ float getPointLightAttenuation(PointLight pointLight, float distance) {
|
|
|
2375
2375
|
|
|
2376
2376
|
#endif
|
|
2377
2377
|
`])));function So(n,e){var t=typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=Io(n))||e&&n&&typeof n.length=="number"){t&&(n=t);var r=0,o=function(){};return{s:o,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2378
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,l;return{s:function(){t=t.call(n)},n:function(){var c=t.next();return i=c.done,c},e:function(c){a=!0,l=c},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(a)throw l}}}}function Io(n,e){if(n){if(typeof n=="string")return xt(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xt(n,e)}}function xt(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}var To={lightSources:{}};function
|
|
2378
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,l;return{s:function(){t=t.call(n)},n:function(){var c=t.next();return i=c.done,c},e:function(c){a=!0,l=c},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(a)throw l}}}}function Io(n,e){if(n){if(typeof n=="string")return xt(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return xt(n,e)}}function xt(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}var To={lightSources:{}};function Bn(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=n.color,t=e===void 0?[0,0,0]:e,r=n.intensity,o=r===void 0?1:r;return t.map(function(i){return i*o/255})}function Fo(n){var e=n.ambientLight,t=n.pointLights,r=t===void 0?[]:t,o=n.directionalLights,i=o===void 0?[]:o,a={};return e?a["lighting_uAmbientLight.color"]=Bn(e):a["lighting_uAmbientLight.color"]=[0,0,0],r.forEach(function(l,s){a["lighting_uPointLight[".concat(s,"].color")]=Bn(l),a["lighting_uPointLight[".concat(s,"].position")]=l.position,a["lighting_uPointLight[".concat(s,"].attenuation")]=l.attenuation||[1,0,0]}),a.lighting_uPointLightCount=r.length,i.forEach(function(l,s){a["lighting_uDirectionalLight[".concat(s,"].color")]=Bn(l),a["lighting_uDirectionalLight[".concat(s,"].direction")]=l.direction}),a.lighting_uDirectionalLightCount=i.length,a}function At(){var n,e,t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:To;if("lightSources"in t){var r=t.lightSources||{},o=r.ambientLight,i=r.pointLights,a=r.directionalLights,l=o||i&&i.length>0||a&&a.length>0;return l?Object.assign({},Fo({ambientLight:o,pointLights:i,directionalLights:a}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in t){var s={pointLights:[],directionalLights:[]},c=So(t.lights||[]),p;try{for(c.s();!(p=c.n()).done;){var _=p.value;switch(_.type){case"ambient":s.ambientLight=_;break;case"directional":(n=s.directionalLights)===null||n===void 0||n.push(_);break;case"point":(e=s.pointLights)===null||e===void 0||e.push(_);break;default:}}}catch(d){c.e(d)}finally{c.f()}return At({lightSources:s})}return{}}var V={name:"lights",vs:zn,fs:zn,getUniforms:At,defines:{MAX_LIGHTS:3}};var bt,No={lightDirection:new Float32Array([1,1,2])};function yo(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:No,e={};return n.lightDirection&&(e.dirlight_uLightDirection=n.lightDirection),e}var Oo=f(bt||(bt=u([`uniform vec3 dirlight_uLightDirection;
|
|
2379
2379
|
|
|
2380
2380
|
/*
|
|
2381
2381
|
* Returns color attenuated by angle from light source
|
|
@@ -2396,7 +2396,7 @@ vec4 dirlight_filterColor(vec4 color) {
|
|
|
2396
2396
|
float d = abs(dot(normalize(normal), normalize(dirlight_uLightDirection)));
|
|
2397
2397
|
return vec4(color.rgb * d, color.a);
|
|
2398
2398
|
}
|
|
2399
|
-
`]))),Pt={name:"dirlight",fs:Oo,getUniforms:yo,dependencies:[
|
|
2399
|
+
`]))),Pt={name:"dirlight",fs:Oo,getUniforms:yo,dependencies:[cn]};var Lt,Et,Ro=new Uint8Array([0,255,255,255]),Mo={pickingSelectedColor:null,pickingHighlightColor:Ro,pickingActive:!1,pickingAttribute:!1};function Co(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Mo,e={};if(n.pickingSelectedColor!==void 0)if(!n.pickingSelectedColor)e.picking_uSelectedColorValid=0;else{var t=n.pickingSelectedColor.slice(0,3);e.picking_uSelectedColorValid=1,e.picking_uSelectedColor=t}if(n.pickingHighlightColor){var r=Array.from(n.pickingHighlightColor,function(o){return o/255});Number.isFinite(r[3])||(r[3]=1),e.picking_uHighlightColor=r}return n.pickingActive!==void 0&&(e.picking_uActive=Boolean(n.pickingActive),e.picking_uAttribute=Boolean(n.pickingAttribute)),e}var wo=f(Lt||(Lt=u([`uniform bool picking_uActive;
|
|
2400
2400
|
uniform bool picking_uAttribute;
|
|
2401
2401
|
uniform vec3 picking_uSelectedColor;
|
|
2402
2402
|
uniform bool picking_uSelectedColorValid;
|
|
@@ -2594,7 +2594,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
2594
2594
|
return picking_filterPickingColor(highightColor);
|
|
2595
2595
|
}
|
|
2596
2596
|
|
|
2597
|
-
`]))),St={name:"picking",vs:wo,fs:Uo,getUniforms:Co};var It,
|
|
2597
|
+
`]))),St={name:"picking",vs:wo,fs:Uo,getUniforms:Co};var It,Xn=f(It||(It=u([`
|
|
2598
2598
|
uniform float lighting_uAmbient;
|
|
2599
2599
|
uniform float lighting_uDiffuse;
|
|
2600
2600
|
uniform float lighting_uShininess;
|
|
@@ -2741,7 +2741,7 @@ vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspac
|
|
|
2741
2741
|
}
|
|
2742
2742
|
return lightColor;
|
|
2743
2743
|
}
|
|
2744
|
-
`])));var Do={};function ko(n){var e=n.ambient,t=e===void 0?.35:e,r=n.diffuse,o=r===void 0?.6:r,i=n.shininess,a=i===void 0?32:i,l=n.specularColor,s=l===void 0?[30,30,30]:l;return{lighting_uAmbient:t,lighting_uDiffuse:o,lighting_uShininess:a,lighting_uSpecularColor:s.map(function(c){return c/255})}}function Tt(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Do;if(!("material"in n))return{};var e=n.material;return e?ko(e):{lighting_uEnabled:!1}}var Ft={name:"gouraud-lighting",dependencies:[V],vs:
|
|
2744
|
+
`])));var Do={};function ko(n){var e=n.ambient,t=e===void 0?.35:e,r=n.diffuse,o=r===void 0?.6:r,i=n.shininess,a=i===void 0?32:i,l=n.specularColor,s=l===void 0?[30,30,30]:l;return{lighting_uAmbient:t,lighting_uDiffuse:o,lighting_uShininess:a,lighting_uSpecularColor:s.map(function(c){return c/255})}}function Tt(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Do;if(!("material"in n))return{};var e=n.material;return e?ko(e):{lighting_uEnabled:!1}}var Ft={name:"gouraud-lighting",dependencies:[V],vs:Xn,defines:{LIGHTING_VERTEX:1},getUniforms:Tt},Nt={name:"phong-lighting",dependencies:[V],fs:Xn,defines:{LIGHTING_FRAGMENT:1},getUniforms:Tt};var yt,Ot=f(yt||(yt=u([`uniform mat4 u_MVPMatrix;
|
|
2745
2745
|
uniform mat4 u_ModelMatrix;
|
|
2746
2746
|
uniform mat4 u_NormalMatrix;
|
|
2747
2747
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/shadertools",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.21",
|
|
4
4
|
"description": "Shader module system for luma.gl",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
|
-
"@luma.gl/api": "9.0.0-alpha.
|
|
49
|
+
"@luma.gl/api": "9.0.0-alpha.21",
|
|
50
50
|
"@math.gl/core": "4.0.0-alpha.4"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "7ee95470a6a2f62753201beb0c36b00e37c70455"
|
|
53
53
|
}
|
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {glsl} from '../glsl-utils/highlight';
|
|
3
3
|
import {resolveModules} from './resolve-modules';
|
|
4
4
|
import {getPlatformShaderDefines, getVersionDefines, PlatformInfo} from './platform-defines';
|
|
5
|
-
import injectShader,
|
|
6
|
-
import transpileShader from '../transpiler/transpile-shader';
|
|
5
|
+
import {injectShader, DECLARATION_INJECT_MARKER} from './inject-shader';
|
|
6
|
+
import {transpileShader} from '../transpiler/transpile-shader';
|
|
7
7
|
import {assert} from '../utils/assert';
|
|
8
8
|
import {ShaderModuleInstance} from '../shader-module/shader-module-instance';
|
|
9
9
|
import type { Injection } from '../shader-module/shader-module-instance';
|
|
@@ -24,7 +24,7 @@ export const DECLARATION_INJECT_MARKER = '__LUMA_INJECT_DECLARATIONS__';
|
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
26
|
// eslint-disable-next-line complexity
|
|
27
|
-
export
|
|
27
|
+
export function injectShader(
|
|
28
28
|
source: string,
|
|
29
29
|
type: 'vs' | 'fs',
|
|
30
30
|
inject: Record<string, Injection[]>,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @note We always run transpiler even if same version e.g. 3.00 => 3.00
|
|
7
7
|
* RFC: https://github.com/visgl/luma.gl/blob/7.0-release/dev-docs/RFCs/v6.0/portable-glsl-300-rfc.md
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export function transpileShader(source: string, targetGLSLVersion: number, isVertex: boolean): string {
|
|
10
10
|
switch (targetGLSLVersion) {
|
|
11
11
|
case 300:
|
|
12
12
|
return isVertex
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {glsl} from '../../lib/glsl-utils/highlight';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export const lightingShader = glsl`\
|
|
4
4
|
#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
5
5
|
|
|
6
6
|
struct AmbientLight {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// TODO - better do the checks outside of shader
|
|
8
8
|
import {glsl} from '../../lib/glsl-utils/highlight';
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export const fs = glsl`\
|
|
11
11
|
#if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)
|
|
12
12
|
# error PBR fragment shader: Texture LOD is not available
|
|
13
13
|
#endif
|
package/src/modules/pbr/pbr.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {lights} from '../lights/lights';
|
|
2
2
|
|
|
3
|
-
import vs from './pbr-vertex.glsl';
|
|
4
|
-
import fs from './pbr-fragment.glsl';
|
|
3
|
+
import {vs} from './pbr-vertex.glsl';
|
|
4
|
+
import {fs} from './pbr-fragment.glsl';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* An implementation of PBR (Physically-Based Rendering).
|