@file-viewer/renderer-3d 3.1.2 → 3.2.1
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/GEO3D.md +505 -0
- package/GEO3D_THIRD_PARTY_NOTICES.md +63 -0
- package/IFC.md +14 -1
- package/README.en.md +3 -35
- package/README.md +3 -35
- package/bin/copy-geo3d-assets.mjs +143 -0
- package/bin/copy-ifc-assets.mjs +53 -17
- package/dist/geo3d-workers/geotiff-worker.js +9 -0
- package/dist/geo3d-workers/las-worker.js +3858 -0
- package/dist/geo3d-workers/licenses/_giro3d_giro3d-LICENSE +10 -0
- package/dist/geo3d-workers/licenses/copc-license +21 -0
- package/dist/geo3d-workers/licenses/cross-fetch-LICENSE +21 -0
- package/dist/geo3d-workers/licenses/laz-perf-COPYING.txt +202 -0
- package/dist/geo3d-workers/licenses/mgrs-license.md +19 -0
- package/dist/geo3d-workers/licenses/ol-LICENSE.md +25 -0
- package/dist/geo3d-workers/licenses/proj4-LICENSE.md +29 -0
- package/dist/geo3d-workers/licenses/three-LICENSE +21 -0
- package/dist/geo3d-workers/licenses/wkt-parser-LICENSE.md +29 -0
- package/dist/geo3d-workers/manifest.json +203 -0
- package/dist/geo3d-workers/raster-licenses/_giro3d_giro3d-LICENSE +10 -0
- package/dist/geo3d-workers/raster-licenses/_petamoriken_float16-LICENSE +21 -0
- package/dist/geo3d-workers/raster-licenses/geotiff-LICENSE +22 -0
- package/dist/geo3d-workers/raster-licenses/lerc-LICENSE +101 -0
- package/dist/geo3d-workers/raster-licenses/lerc-NOTICE +23 -0
- package/dist/geo3d-workers/raster-licenses/pako-LICENSE +21 -0
- package/dist/geo3d-workers/raster-licenses/quick-lru-license +9 -0
- package/dist/geo3d-workers/raster-licenses/web-worker-LICENSE +201 -0
- package/dist/geo3d-workers/raster-licenses/xml-utils-LICENSE +121 -0
- package/dist/geo3d-workers/raster-licenses/zstddec-LICENSE +54 -0
- package/dist/geo3d-workers/texture-worker.js +1 -0
- package/dist/geo3d.d.ts +10 -0
- package/dist/geo3d.js +38 -0
- package/dist/geo3dArchive.d.ts +25 -0
- package/dist/geo3dArchive.js +393 -0
- package/dist/geo3dCityJson.d.ts +65 -0
- package/dist/geo3dCityJson.js +354 -0
- package/dist/geo3dCrs.d.ts +8 -0
- package/dist/geo3dCrs.js +18 -0
- package/dist/geo3dHooks.d.ts +4 -0
- package/dist/geo3dHooks.js +91 -0
- package/dist/geo3dInspect.d.ts +32 -0
- package/dist/geo3dInspect.js +410 -0
- package/dist/geo3dLasWorkers.d.ts +6 -0
- package/dist/geo3dLasWorkers.js +59 -0
- package/dist/geo3dOwnedWorkerPool.d.ts +31 -0
- package/dist/geo3dOwnedWorkerPool.js +209 -0
- package/dist/geo3dPointFactories.js +3835 -0
- package/dist/geo3dPointMaterial.d.ts +2 -0
- package/dist/geo3dPointMaterial.js +54 -0
- package/dist/geo3dRange.d.ts +11 -0
- package/dist/geo3dRange.js +151 -0
- package/dist/geo3dRasterFactories.js +32 -0
- package/dist/geo3dRasterWorkers.d.ts +14 -0
- package/dist/geo3dRasterWorkers.js +48 -0
- package/dist/geo3dRuntime.d.ts +144 -0
- package/dist/geo3dRuntime.js +378 -0
- package/dist/geo3dUrl.d.ts +1 -0
- package/dist/geo3dUrl.js +5 -0
- package/dist/ifc-import.worker.js +0 -2
- package/dist/ifc.d.ts +0 -9
- package/dist/ifc.js +0 -1
- package/dist/ifcRuntime.js +4 -9
- package/dist/ifcSettings.d.ts +0 -3
- package/dist/ifcSettings.js +0 -3
- package/dist/model.js +0 -4
- package/dist/occtModel.js +0 -2
- package/licenses/laz-perf-COPYING.txt +202 -0
- package/licenses/laz-perf-PROVENANCE.md +22 -0
- package/licenses/lerc-LICENSE +101 -0
- package/licenses/lerc-NOTICE +23 -0
- package/licenses/lerc-PROVENANCE.md +37 -0
- package/licenses/thatopen-components-MIT.txt +18 -0
- package/package.json +115 -29
|
@@ -0,0 +1,3835 @@
|
|
|
1
|
+
var mc=Object.create;var Us=Object.defineProperty;var gc=Object.getOwnPropertyDescriptor;var _c=Object.getOwnPropertyNames;var yc=Object.getPrototypeOf,vc=Object.prototype.hasOwnProperty;var Ns=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var K=(s,e)=>()=>{try{return e||s((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var xc=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _c(e))!vc.call(s,i)&&i!==t&&Us(s,i,{get:()=>e[i],enumerable:!(n=gc(e,i))||n.enumerable});return s};var Fn=(s,e,t)=>(t=s!=null?mc(yc(s)):{},xc(e||!s||!s.__esModule?Us(t,"default",{value:s,enumerable:!0}):t,s));var Os=K(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0})});var Bs=K(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.Hierarchy=void 0;On.Hierarchy={parse:Sc};function Sc(s){return Object.entries(s).reduce((e,[t,n])=>(n===-1?e.pages[t]={}:n&&(e.nodes[t]={pointCount:n}),e),{nodes:{},pages:{}})}});var Vs=K(ht=>{"use strict";var bc=ht&&ht.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),zs=ht&&ht.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&bc(e,s,t)};Object.defineProperty(ht,"__esModule",{value:!0});zs(Os(),ht);zs(Bs(),ht)});var Bn=K(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.hierarchyItemLength=Ot.infoLength=void 0;Ot.infoLength=160;Ot.hierarchyItemLength=32});var zn=K(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.evlrHeaderLength=ft.vlrHeaderLength=ft.minHeaderLength=void 0;ft.minHeaderLength=375;ft.vlrHeaderLength=54;ft.evlrHeaderLength=60});var ks=K(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.getBigUint64=Bt.parseBigInt=void 0;function Mc(s){if(s>BigInt(Number.MAX_SAFE_INTEGER)||s<BigInt(-Number.MAX_SAFE_INTEGER))throw new Error(`Cannot convert bigint to number: ${s}`);return Number(s)}Bt.parseBigInt=Mc;function wc(s,e,t){if(s.getBigUint64)return s.getBigUint64(e,t);let[n,i]=t?[4,0]:[0,4],r=BigInt(s.getUint32(e+n,t)),l=BigInt(s.getUint32(e+i,t));return(r<<BigInt(32))+l}Bt.getBigUint64=wc});var ji=K(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.toCString=dt.toDataView=dt.Binary=void 0;dt.Binary={toDataView:Ji,toCString:Gs};function Ji(s){return new DataView(s.buffer,s.byteOffset,s.length)}dt.toDataView=Ji;function Gs(s){let e=Ji(s),t="";for(let n=0;n<e.byteLength;++n){let i=e.getInt8(n);if(i===0)return t;t+=String.fromCharCode(i)}return t}dt.toCString=Gs});var Ys=K(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.Bounds=void 0;Vn.Bounds={min:Tc,max:Ec,mid:Ki,width:Hs,depth:Ws,height:Xs,cube:Ac,step:qs,stepTo:Cc,intersection:Rc};function Tc(s){return[s[0],s[1],s[2]]}function Ec(s){return[s[3],s[4],s[5]]}function Ki([s,e,t,n,i,r]){return[s+(n-s)/2,e+(i-e)/2,t+(r-t)/2]}function Hs(s){return s[3]-s[0]}function Ws(s){return s[4]-s[1]}function Xs(s){return s[5]-s[2]}function Ac(s){let e=Ki(s),t=Math.max(Hs(s),Ws(s),Xs(s))/2;return[e[0]-t,e[1]-t,e[2]-t,e[0]+t,e[1]+t,e[2]+t]}function qs(s,[e,t,n]){let[i,r,l,c,u,h]=s,[d,p,v]=Ki(s);return[e?d:i,t?p:r,n?v:l,e?c:d,t?u:p,n?h:v]}function Cc(s,[e,t,n,i]){for(let r=e-1;r>=0;--r)s=qs(s,[t>>r&1,n>>r&1,i>>r&1]);return s}function Rc(s,e){return[Math.max(s[0],e[0]),Math.max(s[1],e[1]),Math.max(s[2],e[2]),Math.min(s[3],e[3]),Math.min(s[4],e[4]),Math.min(s[5],e[5])]}});var $s=K(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.Dimension=void 0;var Pc={int8:{type:"signed",size:1},int16:{type:"signed",size:2},int32:{type:"signed",size:4},int64:{type:"signed",size:8},uint8:{type:"unsigned",size:1},uint16:{type:"unsigned",size:2},uint32:{type:"unsigned",size:4},uint64:{type:"unsigned",size:8},float32:{type:"float",size:4},float64:{type:"float",size:8},float:{type:"float",size:4},double:{type:"float",size:8},bool:{type:"unsigned",size:1},boolean:{type:"unsigned",size:1}};kn.Dimension={Type:Pc,ctype:Ic};function Ic({type:s,size:e}){switch(s){case"signed":switch(e){case 1:return"int8";case 2:return"int16";case 4:return"int32";case 8:return"int64"}case"unsigned":switch(e){case 1:return"uint8";case 2:return"uint16";case 4:return"uint32";case 8:return"uint64"}case"float":switch(e){case 4:return"float";case 8:return"double"}}throw new Error(`Invalid dimension type/size: ${s}/${e}`)}});var Js=K((pt,Zs)=>{var Gn=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,Hn=(function(){function s(){this.fetch=!1,this.DOMException=Gn.DOMException}return s.prototype=Gn,new s})();(function(s){var e=(function(t){var n=typeof s<"u"&&s||typeof self<"u"&&self||typeof global<"u"&&global||{},i={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function r(y){return y&&DataView.prototype.isPrototypeOf(y)}if(i.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(y){return y&&l.indexOf(Object.prototype.toString.call(y))>-1};function u(y){if(typeof y!="string"&&(y=String(y)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(y)||y==="")throw new TypeError('Invalid character in header field name: "'+y+'"');return y.toLowerCase()}function h(y){return typeof y!="string"&&(y=String(y)),y}function d(y){var M={next:function(){var B=y.shift();return{done:B===void 0,value:B}}};return i.iterable&&(M[Symbol.iterator]=function(){return M}),M}function p(y){this.map={},y instanceof p?y.forEach(function(M,B){this.append(B,M)},this):Array.isArray(y)?y.forEach(function(M){if(M.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+M.length);this.append(M[0],M[1])},this):y&&Object.getOwnPropertyNames(y).forEach(function(M){this.append(M,y[M])},this)}p.prototype.append=function(y,M){y=u(y),M=h(M);var B=this.map[y];this.map[y]=B?B+", "+M:M},p.prototype.delete=function(y){delete this.map[u(y)]},p.prototype.get=function(y){return y=u(y),this.has(y)?this.map[y]:null},p.prototype.has=function(y){return this.map.hasOwnProperty(u(y))},p.prototype.set=function(y,M){this.map[u(y)]=h(M)},p.prototype.forEach=function(y,M){for(var B in this.map)this.map.hasOwnProperty(B)&&y.call(M,this.map[B],B,this)},p.prototype.keys=function(){var y=[];return this.forEach(function(M,B){y.push(B)}),d(y)},p.prototype.values=function(){var y=[];return this.forEach(function(M){y.push(M)}),d(y)},p.prototype.entries=function(){var y=[];return this.forEach(function(M,B){y.push([B,M])}),d(y)},i.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function v(y){if(!y._noBody){if(y.bodyUsed)return Promise.reject(new TypeError("Already read"));y.bodyUsed=!0}}function _(y){return new Promise(function(M,B){y.onload=function(){M(y.result)},y.onerror=function(){B(y.error)}})}function g(y){var M=new FileReader,B=_(M);return M.readAsArrayBuffer(y),B}function x(y){var M=new FileReader,B=_(M),X=/charset=([A-Za-z0-9_-]+)/.exec(y.type),k=X?X[1]:"utf-8";return M.readAsText(y,k),B}function A(y){for(var M=new Uint8Array(y),B=new Array(M.length),X=0;X<M.length;X++)B[X]=String.fromCharCode(M[X]);return B.join("")}function E(y){if(y.slice)return y.slice(0);var M=new Uint8Array(y.byteLength);return M.set(new Uint8Array(y)),M.buffer}function I(){return this.bodyUsed=!1,this._initBody=function(y){this.bodyUsed=this.bodyUsed,this._bodyInit=y,y?typeof y=="string"?this._bodyText=y:i.blob&&Blob.prototype.isPrototypeOf(y)?this._bodyBlob=y:i.formData&&FormData.prototype.isPrototypeOf(y)?this._bodyFormData=y:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(y)?this._bodyText=y.toString():i.arrayBuffer&&i.blob&&r(y)?(this._bodyArrayBuffer=E(y.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(y)||c(y))?this._bodyArrayBuffer=E(y):this._bodyText=y=Object.prototype.toString.call(y):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof y=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(y)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var y=v(this);if(y)return y;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var y=v(this);return y||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(i.blob)return this.blob().then(g);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var y=v(this);if(y)return y;if(this._bodyBlob)return x(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(A(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(G)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function O(y){var M=y.toUpperCase();return N.indexOf(M)>-1?M:y}function C(y,M){if(!(this instanceof C))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');M=M||{};var B=M.body;if(y instanceof C){if(y.bodyUsed)throw new TypeError("Already read");this.url=y.url,this.credentials=y.credentials,M.headers||(this.headers=new p(y.headers)),this.method=y.method,this.mode=y.mode,this.signal=y.signal,!B&&y._bodyInit!=null&&(B=y._bodyInit,y.bodyUsed=!0)}else this.url=String(y);if(this.credentials=M.credentials||this.credentials||"same-origin",(M.headers||!this.headers)&&(this.headers=new p(M.headers)),this.method=O(M.method||this.method||"GET"),this.mode=M.mode||this.mode||null,this.signal=M.signal||this.signal||(function(){if("AbortController"in n){var q=new AbortController;return q.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&B)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(B),(this.method==="GET"||this.method==="HEAD")&&(M.cache==="no-store"||M.cache==="no-cache")){var X=/([?&])_=[^&]*/;if(X.test(this.url))this.url=this.url.replace(X,"$1_="+new Date().getTime());else{var k=/\?/;this.url+=(k.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function G(y){var M=new FormData;return y.trim().split("&").forEach(function(B){if(B){var X=B.split("="),k=X.shift().replace(/\+/g," "),q=X.join("=").replace(/\+/g," ");M.append(decodeURIComponent(k),decodeURIComponent(q))}}),M}function z(y){var M=new p,B=y.replace(/\r?\n[\t ]+/g," ");return B.split("\r").map(function(X){return X.indexOf(`
|
|
2
|
+
`)===0?X.substr(1,X.length):X}).forEach(function(X){var k=X.split(":"),q=k.shift().trim();if(q){var L=k.join(":").trim();try{M.append(q,L)}catch(de){console.warn("Response "+de.message)}}}),M}I.call(C.prototype);function $(y,M){if(!(this instanceof $))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(M||(M={}),this.type="default",this.status=M.status===void 0?200:M.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=M.statusText===void 0?"":""+M.statusText,this.headers=new p(M.headers),this.url=M.url||"",this._initBody(y)}I.call($.prototype),$.prototype.clone=function(){return new $(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},$.error=function(){var y=new $(null,{status:200,statusText:""});return y.ok=!1,y.status=0,y.type="error",y};var Q=[301,302,303,307,308];$.redirect=function(y,M){if(Q.indexOf(M)===-1)throw new RangeError("Invalid status code");return new $(null,{status:M,headers:{location:y}})},t.DOMException=n.DOMException;try{new t.DOMException}catch{t.DOMException=function(M,B){this.message=M,this.name=B;var X=Error(M);this.stack=X.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function re(y,M){return new Promise(function(B,X){var k=new C(y,M);if(k.signal&&k.signal.aborted)return X(new t.DOMException("Aborted","AbortError"));var q=new XMLHttpRequest;function L(){q.abort()}q.onload=function(){var ee={statusText:q.statusText,headers:z(q.getAllResponseHeaders()||"")};k.url.indexOf("file://")===0&&(q.status<200||q.status>599)?ee.status=200:ee.status=q.status,ee.url="responseURL"in q?q.responseURL:ee.headers.get("X-Request-URL");var pe="response"in q?q.response:q.responseText;setTimeout(function(){B(new $(pe,ee))},0)},q.onerror=function(){setTimeout(function(){X(new TypeError("Network request failed"))},0)},q.ontimeout=function(){setTimeout(function(){X(new TypeError("Network request timed out"))},0)},q.onabort=function(){setTimeout(function(){X(new t.DOMException("Aborted","AbortError"))},0)};function de(ee){try{return ee===""&&n.location.href?n.location.href:ee}catch{return ee}}if(q.open(k.method,de(k.url),!0),k.credentials==="include"?q.withCredentials=!0:k.credentials==="omit"&&(q.withCredentials=!1),"responseType"in q&&(i.blob?q.responseType="blob":i.arrayBuffer&&(q.responseType="arraybuffer")),M&&typeof M.headers=="object"&&!(M.headers instanceof p||n.Headers&&M.headers instanceof n.Headers)){var _e=[];Object.getOwnPropertyNames(M.headers).forEach(function(ee){_e.push(u(ee)),q.setRequestHeader(ee,h(M.headers[ee]))}),k.headers.forEach(function(ee,pe){_e.indexOf(pe)===-1&&q.setRequestHeader(pe,ee)})}else k.headers.forEach(function(ee,pe){q.setRequestHeader(pe,ee)});k.signal&&(k.signal.addEventListener("abort",L),q.onreadystatechange=function(){q.readyState===4&&k.signal.removeEventListener("abort",L)}),q.send(typeof k._bodyInit>"u"?null:k._bodyInit)})}return re.polyfill=!0,n.fetch||(n.fetch=re,n.Headers=p,n.Request=C,n.Response=$),t.Headers=p,t.Request=C,t.Response=$,t.fetch=re,Object.defineProperty(t,"__esModule",{value:!0}),t})({})})(Hn);Hn.fetch.ponyfill=!0;delete Hn.fetch.polyfill;var zt=Gn.fetch?Gn:Hn;pt=zt.fetch;pt.default=zt.fetch;pt.fetch=zt.fetch;pt.Headers=zt.Headers;pt.Request=zt.Request;pt.Response=zt.Response;Zs.exports=pt});var js=K(()=>{});var ea=K(Be=>{"use strict";var Lc=Be&&Be.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Dc=Be&&Be.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Uc=Be&&Be.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Lc(e,s,t);return Dc(e,s),e},Nc=Be&&Be.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Be,"__esModule",{value:!0});Be.Getter=void 0;var Fc=Nc(Js());Be.Getter={create:Oc,http:Ks,file:Qs};function Oc(s){return typeof s=="function"?s:s.startsWith("http://")||s.startsWith("https://")?Ks(s):Qs(s)}function Ks(s){return async function(t,n){if(t<0||n<0||t>n)throw new Error("Invalid range");let r=await(await(0,Fc.default)(s,{headers:{Range:`bytes=${t}-${n-1}`}})).arrayBuffer();return new Uint8Array(r)}}function Qs(s){return async function(t,n){let i=await Promise.resolve().then(()=>Uc(js()));async function r(l=0,c=1/0){if(l<0||c<0||l>c)throw new Error("Invalid range");await i.promises.access(s);let u=i.createReadStream(s,{start:l,end:c-1,autoClose:!0});return Bc(u)}return r(t,n)}}async function Bc(s){return await new Promise((e,t)=>{let n=[];s.on("data",i=>n.push(i)),s.on("error",t),s.on("end",()=>e(Buffer.concat(n)))})}});var na=K(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.Key=void 0;Vt.Key={create:zc,parse:ta,toString:Vc,step:kc,up:Gc,compare:Hc,depth:Wc};function zc(s,e=0,t=0,n=0){return typeof s!="number"?ta(s):[s,e,t,n]}function ta(s){if(typeof s!="string")return s;let[e,t,n,i,...r]=s.split("-").map(c=>parseInt(c,10)),l=[e,t,n,i];if(r.length!==0||l.some(c=>typeof c!="number"||Number.isNaN(c)))throw new Error(`Invalid key: ${s}`);return l}function Vc(s){return typeof s=="string"?s:s.join("-")}function kc(s,[e,t,n]){let[i,r,l,c]=Vt.Key.create(s);return[i+1,r*2+e,l*2+t,c*2+n]}function Gc(s,e=1){let[t,n,i,r]=Vt.Key.create(s);return[t-e,n>>e,i>>e,r>>e]}function Hc(s,e){for(let t=0;t<s.length;++t){if(s[t]<e[t])return-1;if(s[t]>e[t])return 1}return 0}function Wc(s){return s[0]}});var ia=K(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.Scale=void 0;Wn.Scale={apply:(s,e=1,t=0)=>(s-t)/e,unapply:(s,e=1,t=0)=>s*e+t}});var ra=K(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.Step=void 0;Xn.Step={fromIndex:Xc,list:qc};function Xc(s){if(s<0||s>=8)throw new Error(`Invalid step index: ${s}`);let e=s>>0&1?1:0,t=s>>1&1?1:0,n=s>>2&1?1:0;return[e,t,n]}function qc(){return[[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]]}});var ze=K(he=>{"use strict";var Yc=he&&he.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),$c=he&&he.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Yc(e,s,t)};Object.defineProperty(he,"__esModule",{value:!0});he.Step=he.Scale=he.Key=he.Getter=he.Dimension=he.Bounds=he.Binary=void 0;$c(ks(),he);var Zc=ji();Object.defineProperty(he,"Binary",{enumerable:!0,get:function(){return Zc.Binary}});var Jc=Ys();Object.defineProperty(he,"Bounds",{enumerable:!0,get:function(){return Jc.Bounds}});var jc=$s();Object.defineProperty(he,"Dimension",{enumerable:!0,get:function(){return jc.Dimension}});var Kc=ea();Object.defineProperty(he,"Getter",{enumerable:!0,get:function(){return Kc.Getter}});var Qc=na();Object.defineProperty(he,"Key",{enumerable:!0,get:function(){return Qc.Key}});var eu=ia();Object.defineProperty(he,"Scale",{enumerable:!0,get:function(){return eu.Scale}});var tu=ra();Object.defineProperty(he,"Step",{enumerable:!0,get:function(){return tu.Step}})});var Qi=K(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.ExtraBytes=void 0;var Se=ze();Yn.ExtraBytes={getDimension:nu,parse:iu,parseOne:sa};var qn=192;function nu({type:s,length:e}){switch(s){case"signed":case"unsigned":switch(e){case 1:case 2:case 4:case 8:return{type:s,size:e}}case"float":switch(e){case 4:case 8:return{type:s,size:e}}}}function iu(s){if(s.byteLength%qn!==0)throw new Error(`Invalid extra bytes VLR length: ${s.byteLength}`);let e=[];for(let t=0;t<s.byteLength;t+=qn)e.push(sa(s.slice(t,t+qn)));return e}function sa(s){if(s.byteLength!==qn)throw new Error(`Invalid extra bytes entry length: ${s.byteLength}`);let e=Se.Binary.toDataView(s),t=Se.Binary.toCString(s.slice(4,36)),n=Se.Binary.toCString(s.slice(60,192)),i=e.getUint8(2),r=e.getUint8(3);if(i>=11)throw new Error(`Invalid extra bytes "type" value: ${i}`);if(i===0)return{name:t,description:n,length:r};let l=su(r),c=ru(i);if(!c)throw new Error(`Failed to extract dimension type: ${i}`);let{type:u,size:h}=c;function d(v){switch(u){case"signed":return(0,Se.parseBigInt)(e.getBigInt64(v,!0));case"unsigned":return(0,Se.parseBigInt)((0,Se.getBigUint64)(e,v,!0));case"float":return e.getFloat64(v,!0)}}let p={name:t,description:n,type:u,length:h};return l.hasNodata&&(p.nodata=d(40)),l.hasMin&&(p.min=d(64)),l.hasMax&&(p.max=d(88)),l.hasScale&&(p.scale=e.getFloat64(112)),l.hasOffset&&(p.offset=e.getFloat64(136)),p}function ru(s){switch(s){case 1:return Se.Dimension.Type.uint8;case 2:return Se.Dimension.Type.int8;case 3:return Se.Dimension.Type.uint16;case 4:return Se.Dimension.Type.int16;case 5:return Se.Dimension.Type.uint32;case 6:return Se.Dimension.Type.int32;case 7:return Se.Dimension.Type.uint64;case 8:return Se.Dimension.Type.int64;case 9:return Se.Dimension.Type.float32;case 10:return Se.Dimension.Type.float64}}function su(s){return{hasNodata:!!(s&1),hasMin:!!(s>>1&1),hasMax:!!(s>>2&1),hasScale:!!(s>>3&1),hasOffset:!!(s>>4&1)}}});var er=K($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.Dimensions=void 0;var au=ze(),ou=Qi();$n.Dimensions={create:cu};var{Type:ue}=au.Dimension,lu={X:ue.float64,Y:ue.float64,Z:ue.float64,Intensity:ue.uint16,ReturnNumber:ue.uint8,NumberOfReturns:ue.uint8,ScanDirectionFlag:ue.boolean,EdgeOfFlightLine:ue.boolean,Classification:ue.uint8,Synthetic:ue.boolean,KeyPoint:ue.boolean,Withheld:ue.boolean,Overlap:ue.boolean,ScanAngle:ue.float32,UserData:ue.uint8,PointSourceId:ue.uint16,GpsTime:ue.float64,Red:ue.uint16,Green:ue.uint16,Blue:ue.uint16,ScannerChannel:ue.uint8,Infrared:ue.uint16};function cu(s,e=[]){return Object.keys(s).reduce((t,n)=>{let i=lu[n];if(i)return{...t,[n]:i};let r=e.find(c=>c.name===n),l=r&&ou.ExtraBytes.getDimension(r);if(l)return{...t,[n]:l};throw new Error(`Failed to look up LAS type: ${n}`)},{})}});var tr=K(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.Extractor=void 0;var Je=ze();Jn.Extractor={create:du};function uu(s){switch(s){case 0:return 20;case 1:return 28;case 2:return 26;case 3:return 34;case 6:return 30;case 7:return 36;case 8:return 38;default:throw new Error(`Unsupported point data record format: ${s}`)}}function hu(s,e,{type:t,length:n}){let i=mt(s);switch(t){case"signed":switch(n){case 1:return(r,l)=>r.getInt8(i(l)+e);case 2:return(r,l)=>r.getInt16(i(l)+e,!0);case 4:return(r,l)=>r.getInt32(i(l)+e,!0);case 8:return(r,l)=>(0,Je.parseBigInt)(r.getBigInt64(i(l)+e,!0))}case"unsigned":switch(n){case 1:return(r,l)=>r.getUint8(i(l)+e);case 2:return(r,l)=>r.getUint16(i(l)+e,!0);case 4:return(r,l)=>r.getUint32(i(l)+e,!0);case 8:return(r,l)=>(0,Je.parseBigInt)((0,Je.getBigUint64)(r,i(l)+e,!0))}case"float":switch(n){case 4:return(r,l)=>r.getFloat32(i(l)+e,!0);case 8:return(r,l)=>r.getFloat64(i(l)+e,!0)}}}function fu(s,e){let n=uu(s.pointDataRecordFormat);return e.reduce((i,r)=>{let l=n;n+=r.length;let c=hu(s,l,r);if(!c)return i;let u=(h,d)=>Je.Scale.unapply(c(h,d),r.scale,r.offset);return{...i,[r.name]:u}},{})}function du(s,e=[]){let t=fu(s,e);return{...(()=>{let{pointDataRecordFormat:i}=s;switch(i){case 0:return Zn(s);case 1:return pu(s);case 2:return mu(s);case 3:return gu(s);case 6:return aa(s);case 7:return oa(s);case 8:return _u(s);default:throw new Error(`Unsupported point data record format: ${i}`)}})(),...t}}function Zn(s){let{scale:e,offset:t}=s,n=mt(s);function i(c,u){return c.getUint8(n(u)+14)}function r(c,u){return c.getUint8(n(u)+15)}function l(c,u){return r(c,u)&31}return{X:(c,u)=>Je.Scale.unapply(c.getInt32(n(u),!0),e[0],t[0]),Y:(c,u)=>Je.Scale.unapply(c.getInt32(n(u)+4,!0),e[1],t[1]),Z:(c,u)=>Je.Scale.unapply(c.getInt32(n(u)+8,!0),e[2],t[2]),Intensity:(c,u)=>c.getUint16(n(u)+12,!0),ReturnNumber:(c,u)=>i(c,u)&7,NumberOfReturns:(c,u)=>(i(c,u)&56)>>3,ScanDirectionFlag:(c,u)=>(i(c,u)&64)>>6,EdgeOfFlightLine:(c,u)=>(i(c,u)&128)>>7,Classification:(c,u)=>{let h=l(c,u);return h===12?0:h},Synthetic:(c,u)=>(r(c,u)&32)>>5,KeyPoint:(c,u)=>(r(c,u)&64)>>6,Withheld:(c,u)=>(r(c,u)&128)>>7,Overlap:(c,u)=>l(c,u)===12?1:0,ScanAngle:(c,u)=>c.getInt8(n(u)+16),UserData:(c,u)=>c.getUint8(n(u)+17),PointSourceId:(c,u)=>c.getUint16(n(u)+18,!0)}}function pu(s){let e=mt(s);return{...Zn(s),GpsTime:(t,n)=>t.getFloat64(e(n)+20,!0)}}function mu(s){let e=mt(s);return{...Zn(s),Red:(t,n)=>t.getUint16(e(n)+20,!0),Green:(t,n)=>t.getUint16(e(n)+22,!0),Blue:(t,n)=>t.getUint16(e(n)+24,!0)}}function gu(s){let e=mt(s);return{...Zn(s),GpsTime:(t,n)=>t.getFloat64(e(n)+20,!0),Red:(t,n)=>t.getUint16(e(n)+28,!0),Green:(t,n)=>t.getUint16(e(n)+30,!0),Blue:(t,n)=>t.getUint16(e(n)+32,!0)}}function aa(s){let{scale:e,offset:t}=s,n=mt(s);function i(r,l){return r.getUint8(n(l)+15)}return{X:(r,l)=>Je.Scale.unapply(r.getInt32(n(l),!0),e[0],t[0]),Y:(r,l)=>Je.Scale.unapply(r.getInt32(n(l)+4,!0),e[1],t[1]),Z:(r,l)=>Je.Scale.unapply(r.getInt32(n(l)+8,!0),e[2],t[2]),Intensity:(r,l)=>r.getUint16(n(l)+12,!0),ReturnNumber:(r,l)=>r.getUint16(n(l)+14,!0)&15,NumberOfReturns:(r,l)=>(r.getUint16(n(l)+14,!0)&240)>>4,Synthetic:(r,l)=>i(r,l)&1,KeyPoint:(r,l)=>(i(r,l)&2)>>1,Withheld:(r,l)=>(i(r,l)&4)>>2,Overlap:(r,l)=>(i(r,l)&8)>>3,ScannerChannel:(r,l)=>(i(r,l)&48)>>4,ScanDirectionFlag:(r,l)=>(i(r,l)&64)>>6,EdgeOfFlightLine:(r,l)=>(i(r,l)&128)>>7,Classification:(r,l)=>r.getUint8(n(l)+16),UserData:(r,l)=>r.getUint8(n(l)+17),ScanAngle:(r,l)=>r.getInt16(n(l)+18,!0)*.006,PointSourceId:(r,l)=>r.getUint16(n(l)+20,!0),GpsTime:(r,l)=>r.getFloat64(n(l)+22,!0)}}function oa(s){let e=mt(s);return{...aa(s),Red:(t,n)=>t.getUint16(e(n)+30,!0),Green:(t,n)=>t.getUint16(e(n)+32,!0),Blue:(t,n)=>t.getUint16(e(n)+34,!0)}}function _u(s){let e=mt(s);return{...oa(s),Infrared:(t,n)=>t.getUint16(e(n)+36,!0)}}function mt(s){let{pointDataRecordLength:e}=s;return function(n){return n*e}}});var ca=K(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.formatGuid=kt.parsePoint=void 0;var la=ze();function yu(s){let e=la.Binary.toDataView(s);if(e.byteLength!==24)throw new Error(`Invalid tuple buffer length: ${e.byteLength}`);return[e.getFloat64(0,!0),e.getFloat64(8,!0),e.getFloat64(16,!0)]}kt.parsePoint=yu;function vu(s){let e=la.Binary.toDataView(s);if(e.byteLength!==16)throw new Error(`Invalid GUID buffer length: ${e.byteLength}`);let t="";for(let n=0;n<e.byteLength;n+=4){let i=e.getUint32(n,!0);t+=i.toString(16).padStart(8,"0")}return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,32)].join("-")}kt.formatGuid=vu});var ir=K(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.Header=void 0;var Ie=ze(),ua=zn(),nr=ca();jn.Header={parse:xu};function xu(s){if(s.byteLength<ua.minHeaderLength)throw new Error(`Invalid header: must be at least ${ua.minHeaderLength} bytes`);let e=Ie.Binary.toDataView(s),t=Ie.Binary.toCString(s.slice(0,4));if(t!=="LASF")throw new Error(`Invalid file signature: ${t}`);let n=e.getUint8(24),i=e.getUint8(25);if(n!==1||i!==2&&i!==4)throw new Error(`Invalid version (only 1.2 and 1.4 supported): ${n}.${i}`);let r={fileSignature:t,fileSourceId:e.getUint16(4,!0),globalEncoding:e.getUint16(6,!0),projectId:(0,nr.formatGuid)(s.slice(8,24)),majorVersion:n,minorVersion:i,systemIdentifier:Ie.Binary.toCString(s.slice(26,58)),generatingSoftware:Ie.Binary.toCString(s.slice(58,90)),fileCreationDayOfYear:e.getUint16(90,!0),fileCreationYear:e.getUint16(92,!0),headerLength:e.getUint16(94,!0),pointDataOffset:e.getUint32(96,!0),vlrCount:e.getUint32(100,!0),pointDataRecordFormat:e.getUint8(104)&15,pointDataRecordLength:e.getUint16(105,!0),pointCount:e.getUint32(107,!0),pointCountByReturn:bu(s.slice(111,131)),scale:(0,nr.parsePoint)(s.slice(131,155)),offset:(0,nr.parsePoint)(s.slice(155,179)),min:[e.getFloat64(187,!0),e.getFloat64(203,!0),e.getFloat64(219,!0)],max:[e.getFloat64(179,!0),e.getFloat64(195,!0),e.getFloat64(211,!0)],waveformDataOffset:0,evlrOffset:0,evlrCount:0};return i==2?r:{...r,pointCount:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,247,!0)),pointCountByReturn:Su(s.slice(255,375)),waveformDataOffset:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,227,!0)),evlrOffset:(0,Ie.parseBigInt)((0,Ie.getBigUint64)(e,235,!0)),evlrCount:e.getUint32(243,!0)}}function Su(s){let e=Ie.Binary.toDataView(s),t=[];for(let n=0;n<120;n+=8)t.push((0,Ie.getBigUint64)(e,n,!0));return t.map(n=>(0,Ie.parseBigInt)(n))}function bu(s){let e=Ie.Binary.toDataView(s),t=[];for(let n=0;n<20;n+=4)t.push(e.getUint32(n,!0));return t}});var ha=K((Kn,sr)=>{var rr=(()=>{var s=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return(function(e){e=e||{};var t=typeof e<"u"?e:{},n,i;t.ready=new Promise(function(a,o){n=a,i=o}),["_main","___getTypeName","__embind_initialize_bindings","_fflush","onRuntimeInitialized"].forEach(a=>{Object.getOwnPropertyDescriptor(t.ready,a)||Object.defineProperty(t.ready,a,{get:()=>Re("You are getting "+a+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>Re("You are setting "+a+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})});var r=Object.assign({},t),l=[],c="./this.program",u=(a,o)=>{throw o},h=!0,d=!1,p=!1,v=!1;if(t.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var _="";function g(a){return t.locateFile?t.locateFile(a,_):_+a}var x,A,E,I;function N(a){if(a instanceof Po)return;let o=a;a&&typeof a=="object"&&a.stack&&(o=[a,a.stack]),C("exiting due to exception: "+o)}if(v){if(typeof process=="object"&&typeof Ns=="function"||typeof window=="object"||typeof importScripts=="function")throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");typeof read<"u"&&(x=function(o){return read(o)}),E=function(o){let f;return typeof readbuffer=="function"?new Uint8Array(readbuffer(o)):(f=read(o,"binary"),L(typeof f=="object"),f)},A=function(o,f,m){setTimeout(()=>f(E(o)),0)},typeof scriptArgs<"u"?l=scriptArgs:typeof arguments<"u"&&(l=arguments),typeof quit=="function"&&(u=(a,o)=>{N(o),quit(a)}),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)}else if(h||d){if(d?_=self.location.href:typeof document<"u"&&document.currentScript&&(_=document.currentScript.src),s&&(_=s),_.indexOf("blob:")!==0?_=_.substr(0,_.replace(/[?#].*/,"").lastIndexOf("/")+1):_="",!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");x=a=>{var o=new XMLHttpRequest;return o.open("GET",a,!1),o.send(null),o.responseText},d&&(E=a=>{var o=new XMLHttpRequest;return o.open("GET",a,!1),o.responseType="arraybuffer",o.send(null),new Uint8Array(o.response)}),A=(a,o,f)=>{var m=new XMLHttpRequest;m.open("GET",a,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){o(m.response);return}f()},m.onerror=f,m.send(null)},I=a=>document.title=a}else throw new Error("environment detection error");var O=t.print||console.log.bind(console),C=t.printErr||console.warn.bind(console);Object.assign(t,r),r=null,rc(),t.arguments&&(l=t.arguments),z("arguments","arguments_"),t.thisProgram&&(c=t.thisProgram),z("thisProgram","thisProgram"),t.quit&&(u=t.quit),z("quit","quit_"),L(typeof t.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),L(typeof t.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),L(typeof t.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),L(typeof t.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),L(typeof t.read>"u","Module.read option was removed (modify read_ in JS)"),L(typeof t.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),L(typeof t.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),L(typeof t.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),L(typeof t.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),z("read","read_"),z("readAsync","readAsync"),z("readBinary","readBinary"),z("setWindowTitle","setWindowTitle"),L(!d,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),L(!p,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),L(!v,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");var G=4;function z(a,o){Object.getOwnPropertyDescriptor(t,a)||Object.defineProperty(t,a,{configurable:!0,get:function(){Re("Module."+a+" has been replaced with plain "+o+" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}})}function $(a){Object.getOwnPropertyDescriptor(t,a)&&Re("`Module."+a+"` was supplied but `"+a+"` not included in INCOMING_MODULE_JS_API")}function Q(a){return a==="FS_createPath"||a==="FS_createDataFile"||a==="FS_createPreloadedFile"||a==="FS_unlink"||a==="addRunDependency"||a==="FS_createLazyFile"||a==="FS_createDevice"||a==="removeRunDependency"}function re(a){typeof globalThis<"u"&&!Object.getOwnPropertyDescriptor(globalThis,a)&&Object.defineProperty(globalThis,a,{configurable:!0,get:function(){var o="`"+a+"` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line";Q(a)&&(o+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),lt(o)}})}function y(a){Object.getOwnPropertyDescriptor(t,a)||Object.defineProperty(t,a,{configurable:!0,get:function(){var o="'"+a+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";Q(a)&&(o+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),Re(o)}})}var M;t.wasmBinary&&(M=t.wasmBinary),z("wasmBinary","wasmBinary");var B=t.noExitRuntime||!0;z("noExitRuntime","noExitRuntime"),typeof WebAssembly!="object"&&Re("no native wasm support detected");var X,k=!1,q;function L(a,o){a||Re("Assertion failed"+(o?": "+o:""))}var de=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function _e(a,o,f){for(var m=o+f,S=o;a[S]&&!(S>=m);)++S;if(S-o>16&&a.buffer&&de)return de.decode(a.subarray(o,S));for(var w="";o<S;){var T=a[o++];if(!(T&128)){w+=String.fromCharCode(T);continue}var b=a[o++]&63;if((T&224)==192){w+=String.fromCharCode((T&31)<<6|b);continue}var P=a[o++]&63;if((T&240)==224?T=(T&15)<<12|b<<6|P:((T&248)!=240&<("Invalid UTF-8 leading byte 0x"+T.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),T=(T&7)<<18|b<<12|P<<6|a[o++]&63),T<65536)w+=String.fromCharCode(T);else{var D=T-65536;w+=String.fromCharCode(55296|D>>10,56320|D&1023)}}return w}function ee(a,o){return a?_e(Ce,a,o):""}function pe(a,o,f,m){if(!(m>0))return 0;for(var S=f,w=f+m-1,T=0;T<a.length;++T){var b=a.charCodeAt(T);if(b>=55296&&b<=57343){var P=a.charCodeAt(++T);b=65536+((b&1023)<<10)|P&1023}if(b<=127){if(f>=w)break;o[f++]=b}else if(b<=2047){if(f+1>=w)break;o[f++]=192|b>>6,o[f++]=128|b&63}else if(b<=65535){if(f+2>=w)break;o[f++]=224|b>>12,o[f++]=128|b>>6&63,o[f++]=128|b&63}else{if(f+3>=w)break;b>1114111&<("Invalid Unicode code point 0x"+b.toString(16)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),o[f++]=240|b>>18,o[f++]=128|b>>12&63,o[f++]=128|b>>6&63,o[f++]=128|b&63}}return o[f]=0,f-S}function Tn(a,o,f){return L(typeof f=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),pe(a,Ce,o,f)}function ts(a){for(var o=0,f=0;f<a.length;++f){var m=a.charCodeAt(f);m<=127?o++:m<=2047?o+=2:m>=55296&&m<=57343?(o+=4,++f):o+=3}return o}var En,Ye,Ce,It,An,oe,ie,ns,is;function rs(a){En=a,t.HEAP8=Ye=new Int8Array(a),t.HEAP16=It=new Int16Array(a),t.HEAP32=oe=new Int32Array(a),t.HEAPU8=Ce=new Uint8Array(a),t.HEAPU16=An=new Uint16Array(a),t.HEAPU32=ie=new Uint32Array(a),t.HEAPF32=ns=new Float32Array(a),t.HEAPF64=is=new Float64Array(a)}var Pi=65536;t.TOTAL_STACK&&L(Pi===t.TOTAL_STACK,"the stack size can no longer be determined at runtime");var Ii=t.INITIAL_MEMORY||262144;z("INITIAL_MEMORY","INITIAL_MEMORY"),L(Ii>=Pi,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+Ii+"! (TOTAL_STACK="+Pi+")"),L(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!=null&&Int32Array.prototype.set!=null,"JS engine does not provide full typed array support"),L(!t.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),L(Ii==262144,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically");var ot;function _o(){var a=Zi();L((a&3)==0),ie[a>>2]=34821223,ie[a+4>>2]=2310721022,ie[0]=1668509029}function Li(){if(!k){var a=Zi(),o=ie[a>>2],f=ie[a+4>>2];(o!=34821223||f!=2310721022)&&Re("Stack overflow! Stack cookie has been overwritten at 0x"+a.toString(16)+", expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+f.toString(16)+" 0x"+o.toString(16)),ie[0]!==1668509029&&Re("Runtime error: The application has corrupted its heap memory area (address zero)!")}}(function(){var a=new Int16Array(1),o=new Int8Array(a.buffer);if(a[0]=25459,o[0]!==115||o[1]!==99)throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"})();var ss=[],as=[],os=[],Di=!1;function yo(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)So(t.preRun.shift());Ui(ss)}function vo(){L(!Di),Di=!0,Li(),Ui(as)}function xo(){if(Li(),t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)Mo(t.postRun.shift());Ui(os)}function So(a){ss.unshift(a)}function bo(a){as.unshift(a)}function Mo(a){os.unshift(a)}L(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),L(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),L(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),L(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var Tt=0,Et=null,rn=null,sn={};function wo(a){Tt++,t.monitorRunDependencies&&t.monitorRunDependencies(Tt),a?(L(!sn[a]),sn[a]=1,Et===null&&typeof setInterval<"u"&&(Et=setInterval(function(){if(k){clearInterval(Et),Et=null;return}var o=!1;for(var f in sn)o||(o=!0,C("still waiting on run dependencies:")),C("dependency: "+f);o&&C("(end of list)")},1e4))):C("warning: run dependency added without ID")}function To(a){if(Tt--,t.monitorRunDependencies&&t.monitorRunDependencies(Tt),a?(L(sn[a]),delete sn[a]):C("warning: run dependency removed without ID"),Tt==0&&(Et!==null&&(clearInterval(Et),Et=null),rn)){var o=rn;rn=null,o()}}function Re(a){t.onAbort&&t.onAbort(a),a="Aborted("+a+")",C(a),k=!0,q=1;var o=new WebAssembly.RuntimeError(a);throw i(o),o}var Fe={error:function(){Re("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM")},init:function(){Fe.error()},createDataFile:function(){Fe.error()},createPreloadedFile:function(){Fe.error()},createLazyFile:function(){Fe.error()},open:function(){Fe.error()},mkdev:function(){Fe.error()},registerDevice:function(){Fe.error()},analyzePath:function(){Fe.error()},loadFilesFromDB:function(){Fe.error()},ErrnoError:function(){Fe.error()}};t.FS_createDataFile=Fe.createDataFile,t.FS_createPreloadedFile=Fe.createPreloadedFile;var Eo="data:application/octet-stream;base64,";function ls(a){return a.startsWith(Eo)}function Ao(a){return a.startsWith("file://")}function ye(a,o){return function(){var f=a,m=o;return o||(m=t.asm),L(Di,"native function `"+f+"` called before runtime initialization"),m[a]||L(m[a],"exported native function `"+f+"` not found"),m[a].apply(null,arguments)}}var De;De="laz-perf.wasm",ls(De)||(De=g(De));function cs(a){try{if(a==De&&M)return new Uint8Array(M);if(E)return E(a);throw"both async and sync fetching of the wasm failed"}catch(o){Re(o)}}function Co(){return!M&&(h||d)&&typeof fetch=="function"?fetch(De,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+De+"'";return a.arrayBuffer()}).catch(function(){return cs(De)}):Promise.resolve().then(function(){return cs(De)})}function Ro(){var a={env:Ps,wasi_snapshot_preview1:Ps};function o(b,P){var D=b.exports;t.asm=D,X=t.asm.memory,L(X,"memory not found in wasm exports"),rs(X.buffer),ot=t.asm.__indirect_function_table,L(ot,"table not found in wasm exports"),bo(t.asm.__wasm_call_ctors),To("wasm-instantiate")}wo("wasm-instantiate");var f=t;function m(b){L(t===f,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),f=null,o(b.instance)}function S(b){return Co().then(function(P){return WebAssembly.instantiate(P,a)}).then(function(P){return P}).then(b,function(P){C("failed to asynchronously prepare wasm: "+P),Ao(De)&&C("warning: Loading from a file URI ("+De+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"),Re(P)})}function w(){return!M&&typeof WebAssembly.instantiateStreaming=="function"&&!ls(De)&&typeof fetch=="function"?fetch(De,{credentials:"same-origin"}).then(function(b){var P=WebAssembly.instantiateStreaming(b,a);return P.then(m,function(D){return C("wasm streaming compile failed: "+D),C("falling back to ArrayBuffer instantiation"),S(m)})}):S(m)}if(t.instantiateWasm)try{var T=t.instantiateWasm(a,o);return T}catch(b){return C("Module.instantiateWasm callback failed with error: "+b),!1}return w().catch(i),{}}var kp,Gp;function Po(a){this.name="ExitStatus",this.message="Program terminated with exit("+a+")",this.status=a}function Ui(a){for(;a.length>0;)a.shift()(t)}function Io(a){return lt("warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling"),a}function Hp(a){var o=/\b_Z[\w\d_]+/g;return a.replace(o,function(f){var m=Io(f);return f===m?f:m+" ["+f+"]"})}function Wp(){var a=new Error;if(!a.stack){try{throw new Error}catch(o){a=o}if(!a.stack)return"(no stack trace available)"}return a.stack.toString()}function lt(a){lt.shown||(lt.shown={}),lt.shown[a]||(lt.shown[a]=1,C(a))}function us(a,o){L(a.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),Ye.set(a,o)}function Lo(a){return $i(a+24)+24}function Do(a){this.excPtr=a,this.ptr=a-24,this.set_type=function(o){ie[this.ptr+4>>2]=o},this.get_type=function(){return ie[this.ptr+4>>2]},this.set_destructor=function(o){ie[this.ptr+8>>2]=o},this.get_destructor=function(){return ie[this.ptr+8>>2]},this.set_refcount=function(o){oe[this.ptr>>2]=o},this.set_caught=function(o){o=o?1:0,Ye[this.ptr+12>>0]=o},this.get_caught=function(){return Ye[this.ptr+12>>0]!=0},this.set_rethrown=function(o){o=o?1:0,Ye[this.ptr+13>>0]=o},this.get_rethrown=function(){return Ye[this.ptr+13>>0]!=0},this.init=function(o,f){this.set_adjusted_ptr(0),this.set_type(o),this.set_destructor(f),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var o=oe[this.ptr>>2];oe[this.ptr>>2]=o+1},this.release_ref=function(){var o=oe[this.ptr>>2];return oe[this.ptr>>2]=o-1,L(o>0),o===1},this.set_adjusted_ptr=function(o){ie[this.ptr+16>>2]=o},this.get_adjusted_ptr=function(){return ie[this.ptr+16>>2]},this.get_exception_ptr=function(){var o=hc(this.get_type());if(o)return ie[this.excPtr>>2];var f=this.get_adjusted_ptr();return f!==0?f:this.excPtr}}var Uo=0,No=0;function Fo(a,o,f){var m=new Do(a);throw m.init(o,f),Uo=a,No++,a+" - Exception catching is disabled, this exception cannot be caught. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch."}function Oo(a,o,f,m,S){}function Ni(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+a)}}function Bo(){for(var a=new Array(256),o=0;o<256;++o)a[o]=String.fromCharCode(o);hs=a}var hs=void 0;function Oe(a){for(var o="",f=a;Ce[f];)o+=hs[Ce[f++]];return o}var Lt={},Dt={},Cn={},zo=48,Vo=57;function fs(a){if(a===void 0)return"_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var o=a.charCodeAt(0);return o>=zo&&o<=Vo?"_"+a:a}function ds(a,o){return a=fs(a),function(){"use strict";return o.apply(this,arguments)}}function Fi(a,o){var f=ds(o,function(m){this.name=o,this.message=m;var S=new Error(m).stack;S!==void 0&&(this.stack=this.toString()+`
|
|
3
|
+
`+S.replace(/^Error(:[^\n]*)?\n/,""))});return f.prototype=Object.create(a.prototype),f.prototype.constructor=f,f.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},f}var Ut=void 0;function te(a){throw new Ut(a)}var ps=void 0;function Rn(a){throw new ps(a)}function an(a,o,f){a.forEach(function(b){Cn[b]=o});function m(b){var P=f(b);P.length!==a.length&&Rn("Mismatched type converter count");for(var D=0;D<a.length;++D)et(a[D],P[D])}var S=new Array(o.length),w=[],T=0;o.forEach((b,P)=>{Dt.hasOwnProperty(b)?S[P]=Dt[b]:(w.push(b),Lt.hasOwnProperty(b)||(Lt[b]=[]),Lt[b].push(()=>{S[P]=Dt[b],++T,T===w.length&&m(S)}))}),w.length===0&&m(S)}function et(a,o,f={}){if(!("argPackAdvance"in o))throw new TypeError("registerType registeredInstance requires argPackAdvance");var m=o.name;if(a||te('type "'+m+'" must have a positive integer typeid pointer'),Dt.hasOwnProperty(a)){if(f.ignoreDuplicateRegistrations)return;te("Cannot register type '"+m+"' twice")}if(Dt[a]=o,delete Cn[a],Lt.hasOwnProperty(a)){var S=Lt[a];delete Lt[a],S.forEach(w=>w())}}function ko(a,o,f,m,S){var w=Ni(f);o=Oe(o),et(a,{name:o,fromWireType:function(T){return!!T},toWireType:function(T,b){return b?m:S},argPackAdvance:8,readValueFromPointer:function(T){var b;if(f===1)b=Ye;else if(f===2)b=It;else if(f===4)b=oe;else throw new TypeError("Unknown boolean type size: "+o);return this.fromWireType(b[T>>w])},destructorFunction:null})}function Go(a){if(!(this instanceof ct)||!(a instanceof ct))return!1;for(var o=this.$$.ptrType.registeredClass,f=this.$$.ptr,m=a.$$.ptrType.registeredClass,S=a.$$.ptr;o.baseClass;)f=o.upcast(f),o=o.baseClass;for(;m.baseClass;)S=m.upcast(S),m=m.baseClass;return o===m&&f===S}function Ho(a){return{count:a.count,deleteScheduled:a.deleteScheduled,preservePointerOnDelete:a.preservePointerOnDelete,ptr:a.ptr,ptrType:a.ptrType,smartPtr:a.smartPtr,smartPtrType:a.smartPtrType}}function Oi(a){function o(f){return f.$$.ptrType.registeredClass.name}te(o(a)+" instance already deleted")}var Bi=!1;function ms(a){}function Wo(a){a.smartPtr?a.smartPtrType.rawDestructor(a.smartPtr):a.ptrType.registeredClass.rawDestructor(a.ptr)}function gs(a){a.count.value-=1;var o=a.count.value===0;o&&Wo(a)}function _s(a,o,f){if(o===f)return a;if(f.baseClass===void 0)return null;var m=_s(a,o,f.baseClass);return m===null?null:f.downcast(m)}var ys={};function Xo(){return Object.keys(cn).length}function qo(){var a=[];for(var o in cn)cn.hasOwnProperty(o)&&a.push(cn[o]);return a}var on=[];function zi(){for(;on.length;){var a=on.pop();a.$$.deleteScheduled=!1,a.delete()}}var ln=void 0;function Yo(a){ln=a,on.length&&ln&&ln(zi)}function $o(){t.getInheritedInstanceCount=Xo,t.getLiveInheritedInstances=qo,t.flushPendingDeletes=zi,t.setDelayFunction=Yo}var cn={};function Zo(a,o){for(o===void 0&&te("ptr should not be undefined");a.baseClass;)o=a.upcast(o),a=a.baseClass;return o}function Jo(a,o){return o=Zo(a,o),cn[o]}function Pn(a,o){(!o.ptrType||!o.ptr)&&Rn("makeClassHandle requires ptr and ptrType");var f=!!o.smartPtrType,m=!!o.smartPtr;return f!==m&&Rn("Both smartPtrType and smartPtr must be specified"),o.count={value:1},un(Object.create(a,{$$:{value:o}}))}function vs(a){var o=this.getPointee(a);if(!o)return this.destructor(a),null;var f=Jo(this.registeredClass,o);if(f!==void 0){if(f.$$.count.value===0)return f.$$.ptr=o,f.$$.smartPtr=a,f.clone();var m=f.clone();return this.destructor(a),m}function S(){return this.isSmartPointer?Pn(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:o,smartPtrType:this,smartPtr:a}):Pn(this.registeredClass.instancePrototype,{ptrType:this,ptr:a})}var w=this.registeredClass.getActualType(o),T=ys[w];if(!T)return S.call(this);var b;this.isConst?b=T.constPointerType:b=T.pointerType;var P=_s(o,this.registeredClass,b.registeredClass);return P===null?S.call(this):this.isSmartPointer?Pn(b.registeredClass.instancePrototype,{ptrType:b,ptr:P,smartPtrType:this,smartPtr:a}):Pn(b.registeredClass.instancePrototype,{ptrType:b,ptr:P})}function un(a){return typeof FinalizationRegistry>"u"?(un=o=>o,a):(Bi=new FinalizationRegistry(o=>{console.warn(o.leakWarning.stack.replace(/^Error: /,"")),gs(o.$$)}),un=o=>{var f=o.$$,m=!!f.smartPtr;if(m){var S={$$:f},w=f.ptrType.registeredClass;S.leakWarning=new Error("Embind found a leaked C++ instance "+w.name+" <0x"+f.ptr.toString(16)+`>.
|
|
4
|
+
We'll free it automatically in this case, but this functionality is not reliable across various environments.
|
|
5
|
+
Make sure to invoke .delete() manually once you're done with the instance instead.
|
|
6
|
+
Originally allocated`),"captureStackTrace"in Error&&Error.captureStackTrace(S.leakWarning,vs),Bi.register(o,S,o)}return o},ms=o=>Bi.unregister(o),un(a))}function jo(){if(this.$$.ptr||Oi(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var a=un(Object.create(Object.getPrototypeOf(this),{$$:{value:Ho(this.$$)}}));return a.$$.count.value+=1,a.$$.deleteScheduled=!1,a}function Ko(){this.$$.ptr||Oi(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&te("Object already scheduled for deletion"),ms(this),gs(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Qo(){return!this.$$.ptr}function el(){return this.$$.ptr||Oi(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&te("Object already scheduled for deletion"),on.push(this),on.length===1&&ln&&ln(zi),this.$$.deleteScheduled=!0,this}function tl(){ct.prototype.isAliasOf=Go,ct.prototype.clone=jo,ct.prototype.delete=Ko,ct.prototype.isDeleted=Qo,ct.prototype.deleteLater=el}function ct(){}function xs(a,o,f){if(a[o].overloadTable===void 0){var m=a[o];a[o]=function(){return a[o].overloadTable.hasOwnProperty(arguments.length)||te("Function '"+f+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+a[o].overloadTable+")!"),a[o].overloadTable[arguments.length].apply(this,arguments)},a[o].overloadTable=[],a[o].overloadTable[m.argCount]=m}}function nl(a,o,f){t.hasOwnProperty(a)?((f===void 0||t[a].overloadTable!==void 0&&t[a].overloadTable[f]!==void 0)&&te("Cannot register public name '"+a+"' twice"),xs(t,a,a),t.hasOwnProperty(f)&&te("Cannot register multiple overloads of a function with the same number of arguments ("+f+")!"),t[a].overloadTable[f]=o):(t[a]=o,f!==void 0&&(t[a].numArguments=f))}function il(a,o,f,m,S,w,T,b){this.name=a,this.constructor=o,this.instancePrototype=f,this.rawDestructor=m,this.baseClass=S,this.getActualType=w,this.upcast=T,this.downcast=b,this.pureVirtualFunctions=[]}function Vi(a,o,f){for(;o!==f;)o.upcast||te("Expected null or instance of "+f.name+", got an instance of "+o.name),a=o.upcast(a),o=o.baseClass;return a}function rl(a,o){if(o===null)return this.isReference&&te("null is not a valid "+this.name),0;o.$$||te('Cannot pass "'+Ft(o)+'" as a '+this.name),o.$$.ptr||te("Cannot pass deleted object as a pointer of type "+this.name);var f=o.$$.ptrType.registeredClass,m=Vi(o.$$.ptr,f,this.registeredClass);return m}function sl(a,o){var f;if(o===null)return this.isReference&&te("null is not a valid "+this.name),this.isSmartPointer?(f=this.rawConstructor(),a!==null&&a.push(this.rawDestructor,f),f):0;o.$$||te('Cannot pass "'+Ft(o)+'" as a '+this.name),o.$$.ptr||te("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&o.$$.ptrType.isConst&&te("Cannot convert argument of type "+(o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name)+" to parameter type "+this.name);var m=o.$$.ptrType.registeredClass;if(f=Vi(o.$$.ptr,m,this.registeredClass),this.isSmartPointer)switch(o.$$.smartPtr===void 0&&te("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:o.$$.smartPtrType===this?f=o.$$.smartPtr:te("Cannot convert argument of type "+(o.$$.smartPtrType?o.$$.smartPtrType.name:o.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:f=o.$$.smartPtr;break;case 2:if(o.$$.smartPtrType===this)f=o.$$.smartPtr;else{var S=o.clone();f=this.rawShare(f,Hi.toHandle(function(){S.delete()})),a!==null&&a.push(this.rawDestructor,f)}break;default:te("Unsupporting sharing policy")}return f}function al(a,o){if(o===null)return this.isReference&&te("null is not a valid "+this.name),0;o.$$||te('Cannot pass "'+Ft(o)+'" as a '+this.name),o.$$.ptr||te("Cannot pass deleted object as a pointer of type "+this.name),o.$$.ptrType.isConst&&te("Cannot convert argument of type "+o.$$.ptrType.name+" to parameter type "+this.name);var f=o.$$.ptrType.registeredClass,m=Vi(o.$$.ptr,f,this.registeredClass);return m}function In(a){return this.fromWireType(oe[a>>2])}function ol(a){return this.rawGetPointee&&(a=this.rawGetPointee(a)),a}function ll(a){this.rawDestructor&&this.rawDestructor(a)}function cl(a){a!==null&&a.delete()}function ul(){tt.prototype.getPointee=ol,tt.prototype.destructor=ll,tt.prototype.argPackAdvance=8,tt.prototype.readValueFromPointer=In,tt.prototype.deleteObject=cl,tt.prototype.fromWireType=vs}function tt(a,o,f,m,S,w,T,b,P,D,H){this.name=a,this.registeredClass=o,this.isReference=f,this.isConst=m,this.isSmartPointer=S,this.pointeeType=w,this.sharingPolicy=T,this.rawGetPointee=b,this.rawConstructor=P,this.rawShare=D,this.rawDestructor=H,!S&&o.baseClass===void 0?m?(this.toWireType=rl,this.destructorFunction=null):(this.toWireType=al,this.destructorFunction=null):this.toWireType=sl}function hl(a,o,f){t.hasOwnProperty(a)||Rn("Replacing nonexistant public symbol"),t[a].overloadTable!==void 0&&f!==void 0?t[a].overloadTable[f]=o:(t[a]=o,t[a].argCount=f)}function fl(a,o,f){L("dynCall_"+a in t,"bad function pointer type - no table for sig '"+a+"'"),f&&f.length?L(f.length===a.substring(1).replace(/j/g,"--").length):L(a.length==1);var m=t["dynCall_"+a];return f&&f.length?m.apply(null,[o].concat(f)):m.call(null,o)}var hn=[];function Ln(a){var o=hn[a];return o||(a>=hn.length&&(hn.length=a+1),hn[a]=o=ot.get(a)),L(ot.get(a)==o,"JavaScript-side Wasm function table mirror is out of date!"),o}function dl(a,o,f){if(a.includes("j"))return fl(a,o,f);L(Ln(o),"missing table entry in dynCall: "+o);var m=Ln(o).apply(null,f);return m}function pl(a,o){L(a.includes("j")||a.includes("p"),"getDynCaller should only be called with i64 sigs");var f=[];return function(){return f.length=0,Object.assign(f,arguments),dl(a,o,f)}}function Nt(a,o){a=Oe(a);function f(){return a.includes("j")?pl(a,o):Ln(o)}var m=f();return typeof m!="function"&&te("unknown function pointer with signature "+a+": "+o),m}var Ss=void 0;function ml(a){var o=sc(a),f=Oe(o);return ut(o),f}function ki(a,o){var f=[],m={};function S(w){if(!m[w]&&!Dt[w]){if(Cn[w]){Cn[w].forEach(S);return}f.push(w),m[w]=!0}}throw o.forEach(S),new Ss(a+": "+f.map(ml).join([", "]))}function gl(a,o,f,m,S,w,T,b,P,D,H,Y,W){H=Oe(H),w=Nt(S,w),b&&(b=Nt(T,b)),D&&(D=Nt(P,D)),W=Nt(Y,W);var ce=fs(H);nl(ce,function(){ki("Cannot construct "+H+" due to unbound types",[m])}),an([a,o,f],m?[m]:[],function(ne){ne=ne[0];var se,Pe;m?(se=ne.registeredClass,Pe=se.instancePrototype):Pe=ct.prototype;var Ze=ds(ce,function(){if(Object.getPrototypeOf(this)!==R)throw new Ut("Use 'new' to construct "+H);if(V.constructor_body===void 0)throw new Ut(H+" has no accessible constructor");var Nn=V.constructor_body[arguments.length];if(Nn===void 0)throw new Ut("Tried to invoke ctor of "+H+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(V.constructor_body).toString()+") parameters instead!");return Nn.apply(this,arguments)}),R=Object.create(Pe,{constructor:{value:Ze}});Ze.prototype=R;var V=new il(H,Ze,R,W,se,w,b,D),xe=new tt(H,V,!0,!1,!1),ve=new tt(H+"*",V,!1,!1,!1),At=new tt(H+" const*",V,!1,!0,!1);return ys[a]={pointerType:ve,constPointerType:At},hl(ce,Ze),[xe,ve,At]})}function bs(a,o){for(var f=[],m=0;m<a;m++)f.push(ie[o+m*4>>2]);return f}function _l(a){for(;a.length;){var o=a.pop(),f=a.pop();f(o)}}function Ms(a,o,f,m,S){var w=o.length;w<2&&te("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var T=o[1]!==null&&f!==null,b=!1,P=1;P<o.length;++P)if(o[P]!==null&&o[P].destructorFunction===void 0){b=!0;break}var D=o[0].name!=="void",H=w-2,Y=new Array(H),W=[],ce=[];return function(){arguments.length!==H&&te("function "+a+" called with "+arguments.length+" arguments, expected "+H+" args!"),ce.length=0;var ne;W.length=T?2:1,W[0]=S,T&&(ne=o[1].toWireType(ce,this),W[1]=ne);for(var se=0;se<H;++se)Y[se]=o[se+2].toWireType(ce,arguments[se]),W.push(Y[se]);var Pe=m.apply(null,W);function Ze(R){if(b)_l(ce);else for(var V=T?1:2;V<o.length;V++){var xe=V===1?ne:Y[V-2];o[V].destructorFunction!==null&&o[V].destructorFunction(xe)}if(D)return o[0].fromWireType(R)}return Ze(Pe)}}function yl(a,o,f,m,S,w){L(o>0);var T=bs(o,f);S=Nt(m,S),an([],[a],function(b){b=b[0];var P="constructor "+b.name;if(b.registeredClass.constructor_body===void 0&&(b.registeredClass.constructor_body=[]),b.registeredClass.constructor_body[o-1]!==void 0)throw new Ut("Cannot register multiple constructors with identical number of parameters ("+(o-1)+") for class '"+b.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return b.registeredClass.constructor_body[o-1]=()=>{ki("Cannot construct "+b.name+" due to unbound types",T)},an([],T,function(D){return D.splice(1,0,null),b.registeredClass.constructor_body[o-1]=Ms(P,D,null,S,w),[]}),[]})}function vl(a,o,f,m,S,w,T,b){var P=bs(f,m);o=Oe(o),w=Nt(S,w),an([],[a],function(D){D=D[0];var H=D.name+"."+o;o.startsWith("@@")&&(o=Symbol[o.substring(2)]),b&&D.registeredClass.pureVirtualFunctions.push(o);function Y(){ki("Cannot call "+H+" due to unbound types",P)}var W=D.registeredClass.instancePrototype,ce=W[o];return ce===void 0||ce.overloadTable===void 0&&ce.className!==D.name&&ce.argCount===f-2?(Y.argCount=f-2,Y.className=D.name,W[o]=Y):(xs(W,o,H),W[o].overloadTable[f-2]=Y),an([],P,function(ne){var se=Ms(H,ne,D,w,T);return W[o].overloadTable===void 0?(se.argCount=f-2,W[o]=se):W[o].overloadTable[f-2]=se,[]}),[]})}var Gi=[],$e=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function xl(a){a>4&&--$e[a].refcount===0&&($e[a]=void 0,Gi.push(a))}function Sl(){for(var a=0,o=5;o<$e.length;++o)$e[o]!==void 0&&++a;return a}function bl(){for(var a=5;a<$e.length;++a)if($e[a]!==void 0)return $e[a];return null}function Ml(){t.count_emval_handles=Sl,t.get_first_emval=bl}var Hi={toValue:a=>(a||te("Cannot use deleted val. handle = "+a),$e[a].value),toHandle:a=>{switch(a){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var o=Gi.length?Gi.pop():$e.length;return $e[o]={refcount:1,value:a},o}}}};function wl(a,o){o=Oe(o),et(a,{name:o,fromWireType:function(f){var m=Hi.toValue(f);return xl(f),m},toWireType:function(f,m){return Hi.toHandle(m)},argPackAdvance:8,readValueFromPointer:In,destructorFunction:null})}function Ft(a){if(a===null)return"null";var o=typeof a;return o==="object"||o==="array"||o==="function"?a.toString():""+a}function Tl(a,o){switch(o){case 2:return function(f){return this.fromWireType(ns[f>>2])};case 3:return function(f){return this.fromWireType(is[f>>3])};default:throw new TypeError("Unknown float type: "+a)}}function El(a,o,f){var m=Ni(f);o=Oe(o),et(a,{name:o,fromWireType:function(S){return S},toWireType:function(S,w){if(typeof w!="number"&&typeof w!="boolean")throw new TypeError('Cannot convert "'+Ft(w)+'" to '+this.name);return w},argPackAdvance:8,readValueFromPointer:Tl(o,m),destructorFunction:null})}function Al(a,o,f){switch(o){case 0:return f?function(S){return Ye[S]}:function(S){return Ce[S]};case 1:return f?function(S){return It[S>>1]}:function(S){return An[S>>1]};case 2:return f?function(S){return oe[S>>2]}:function(S){return ie[S>>2]};default:throw new TypeError("Unknown integer type: "+a)}}function Cl(a,o,f,m,S){o=Oe(o),S===-1&&(S=4294967295);var w=Ni(f),T=Y=>Y;if(m===0){var b=32-8*f;T=Y=>Y<<b>>>b}var P=o.includes("unsigned"),D=(Y,W)=>{if(typeof Y!="number"&&typeof Y!="boolean")throw new TypeError('Cannot convert "'+Ft(Y)+'" to '+W);if(Y<m||Y>S)throw new TypeError('Passing a number "'+Ft(Y)+'" from JS side to C/C++ side to an argument of type "'+o+'", which is outside the valid range ['+m+", "+S+"]!")},H;P?H=function(Y,W){return D(W,this.name),W>>>0}:H=function(Y,W){return D(W,this.name),W},et(a,{name:o,fromWireType:T,toWireType:H,argPackAdvance:8,readValueFromPointer:Al(o,w,m!==0),destructorFunction:null})}function Rl(a,o,f){var m=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],S=m[o];function w(T){T=T>>2;var b=ie,P=b[T],D=b[T+1];return new S(En,D,P)}f=Oe(f),et(a,{name:f,fromWireType:w,argPackAdvance:8,readValueFromPointer:w},{ignoreDuplicateRegistrations:!0})}function Pl(a,o){o=Oe(o);var f=o==="std::string";et(a,{name:o,fromWireType:function(m){var S=ie[m>>2],w=m+4,T;if(f)for(var b=w,P=0;P<=S;++P){var D=w+P;if(P==S||Ce[D]==0){var H=D-b,Y=ee(b,H);T===void 0?T=Y:(T+="\0",T+=Y),b=D+1}}else{for(var W=new Array(S),P=0;P<S;++P)W[P]=String.fromCharCode(Ce[w+P]);T=W.join("")}return ut(m),T},toWireType:function(m,S){S instanceof ArrayBuffer&&(S=new Uint8Array(S));var w,T=typeof S=="string";T||S instanceof Uint8Array||S instanceof Uint8ClampedArray||S instanceof Int8Array||te("Cannot pass non-string to std::string"),f&&T?w=ts(S):w=S.length;var b=$i(4+w+1),P=b+4;if(ie[b>>2]=w,f&&T)Tn(S,P,w+1);else if(T)for(var D=0;D<w;++D){var H=S.charCodeAt(D);H>255&&(ut(P),te("String has UTF-16 code units that do not fit in 8 bits")),Ce[P+D]=H}else for(var D=0;D<w;++D)Ce[P+D]=S[D];return m!==null&&m.push(ut,b),b},argPackAdvance:8,readValueFromPointer:In,destructorFunction:function(m){ut(m)}})}var ws=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Il(a,o){L(a%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var f=a,m=f>>1,S=m+o/2;!(m>=S)&&An[m];)++m;if(f=m<<1,f-a>32&&ws)return ws.decode(Ce.subarray(a,f));for(var w="",T=0;!(T>=o/2);++T){var b=It[a+T*2>>1];if(b==0)break;w+=String.fromCharCode(b)}return w}function Ll(a,o,f){if(L(o%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),L(typeof f=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),f===void 0&&(f=2147483647),f<2)return 0;f-=2;for(var m=o,S=f<a.length*2?f/2:a.length,w=0;w<S;++w){var T=a.charCodeAt(w);It[o>>1]=T,o+=2}return It[o>>1]=0,o-m}function Dl(a){return a.length*2}function Ul(a,o){L(a%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var f=0,m="";!(f>=o/4);){var S=oe[a+f*4>>2];if(S==0)break;if(++f,S>=65536){var w=S-65536;m+=String.fromCharCode(55296|w>>10,56320|w&1023)}else m+=String.fromCharCode(S)}return m}function Nl(a,o,f){if(L(o%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),L(typeof f=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),f===void 0&&(f=2147483647),f<4)return 0;for(var m=o,S=m+f-4,w=0;w<a.length;++w){var T=a.charCodeAt(w);if(T>=55296&&T<=57343){var b=a.charCodeAt(++w);T=65536+((T&1023)<<10)|b&1023}if(oe[o>>2]=T,o+=4,o+4>S)break}return oe[o>>2]=0,o-m}function Fl(a){for(var o=0,f=0;f<a.length;++f){var m=a.charCodeAt(f);m>=55296&&m<=57343&&++f,o+=4}return o}function Ol(a,o,f){f=Oe(f);var m,S,w,T,b;o===2?(m=Il,S=Ll,T=Dl,w=()=>An,b=1):o===4&&(m=Ul,S=Nl,T=Fl,w=()=>ie,b=2),et(a,{name:f,fromWireType:function(P){for(var D=ie[P>>2],H=w(),Y,W=P+4,ce=0;ce<=D;++ce){var ne=P+4+ce*o;if(ce==D||H[ne>>b]==0){var se=ne-W,Pe=m(W,se);Y===void 0?Y=Pe:(Y+="\0",Y+=Pe),W=ne+o}}return ut(P),Y},toWireType:function(P,D){typeof D!="string"&&te("Cannot pass non-string to C++ string type "+f);var H=T(D),Y=$i(4+H+o);return ie[Y>>2]=H>>b,S(D,Y+4,H+o),P!==null&&P.push(ut,Y),Y},argPackAdvance:8,readValueFromPointer:In,destructorFunction:function(P){ut(P)}})}function Bl(a,o){o=Oe(o),et(a,{isVoid:!0,name:o,argPackAdvance:0,fromWireType:function(){},toWireType:function(f,m){}})}function zl(){Re("native code called abort()")}function Vl(a,o,f){Ce.copyWithin(a,o,o+f)}function kl(){return 2147483648}function Gl(a){try{return X.grow(a-En.byteLength+65535>>>16),rs(X.buffer),1}catch(o){C("emscripten_realloc_buffer: Attempted to grow heap from "+En.byteLength+" bytes to "+a+" bytes, but got error: "+o)}}function Hl(a){var o=Ce.length;a=a>>>0,L(a>o);var f=kl();if(a>f)return C("Cannot enlarge memory, asked to go up to "+a+" bytes, but the limit is "+f+" bytes!"),!1;let m=(P,D)=>P+(D-P%D)%D;for(var S=1;S<=4;S*=2){var w=o*(1+.2/S);w=Math.min(w,a+100663296);var T=Math.min(f,m(Math.max(a,w),65536)),b=Gl(T);if(b)return!0}return C("Failed to grow the heap from "+o+" bytes to "+T+" bytes, not enough memory!"),!1}var Wi={};function Wl(){return c||"./this.program"}function fn(){if(!fn.strings){var a=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",o={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:a,_:Wl()};for(var f in Wi)Wi[f]===void 0?delete o[f]:o[f]=Wi[f];var m=[];for(var f in o)m.push(f+"="+o[f]);fn.strings=m}return fn.strings}function Xl(a,o,f){for(var m=0;m<a.length;++m)L(a.charCodeAt(m)===(a.charCodeAt(m)&255)),Ye[o++>>0]=a.charCodeAt(m);f||(Ye[o>>0]=0)}var Xi={varargs:void 0,get:function(){L(Xi.varargs!=null),Xi.varargs+=4;var a=oe[Xi.varargs-4>>2];return a},getStr:function(a){var o=ee(a);return o}};function ql(a,o){var f=0;return fn().forEach(function(m,S){var w=o+f;ie[a+S*4>>2]=w,Xl(m,w),f+=m.length+1}),0}function Yl(a,o){var f=fn();ie[a>>2]=f.length;var m=0;return f.forEach(function(S){m+=S.length+1}),ie[o>>2]=m,0}function $l(a){Re("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")}function Zl(a,o,f,m,S){return 70}var qi=[null,[],[]];function Yi(a,o){var f=qi[a];L(f),o===0||o===10?((a===1?O:C)(_e(f,0)),f.length=0):f.push(o)}function Xp(){ac(0),qi[1].length&&Yi(1,10),qi[2].length&&Yi(2,10)}function Jl(a,o,f,m){for(var S=0,w=0;w<f;w++){var T=ie[o>>2],b=ie[o+4>>2];o+=8;for(var P=0;P<b;P++)Yi(a,Ce[T+P]);S+=b}return ie[m>>2]=S,0}function Dn(a){return a%4===0&&(a%100!==0||a%400===0)}function jl(a,o){for(var f=0,m=0;m<=o;f+=a[m++]);return f}var Ts=[31,29,31,30,31,30,31,31,30,31,30,31],Es=[31,28,31,30,31,30,31,31,30,31,30,31];function Kl(a,o){for(var f=new Date(a.getTime());o>0;){var m=Dn(f.getFullYear()),S=f.getMonth(),w=(m?Ts:Es)[S];if(o>w-f.getDate())o-=w-f.getDate()+1,f.setDate(1),S<11?f.setMonth(S+1):(f.setMonth(0),f.setFullYear(f.getFullYear()+1));else return f.setDate(f.getDate()+o),f}return f}function Ql(a,o,f){var m=f>0?f:ts(a)+1,S=new Array(m),w=pe(a,S,0,S.length);return o&&(S.length=w),S}function ec(a,o,f,m){var S=oe[m+40>>2],w={tm_sec:oe[m>>2],tm_min:oe[m+4>>2],tm_hour:oe[m+8>>2],tm_mday:oe[m+12>>2],tm_mon:oe[m+16>>2],tm_year:oe[m+20>>2],tm_wday:oe[m+24>>2],tm_yday:oe[m+28>>2],tm_isdst:oe[m+32>>2],tm_gmtoff:oe[m+36>>2],tm_zone:S?ee(S):""},T=ee(f),b={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var P in b)T=T.replace(new RegExp(P,"g"),b[P]);var D=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],H=["January","February","March","April","May","June","July","August","September","October","November","December"];function Y(R,V,xe){for(var ve=typeof R=="number"?R.toString():R||"";ve.length<V;)ve=xe[0]+ve;return ve}function W(R,V){return Y(R,V,"0")}function ce(R,V){function xe(At){return At<0?-1:At>0?1:0}var ve;return(ve=xe(R.getFullYear()-V.getFullYear()))===0&&(ve=xe(R.getMonth()-V.getMonth()))===0&&(ve=xe(R.getDate()-V.getDate())),ve}function ne(R){switch(R.getDay()){case 0:return new Date(R.getFullYear()-1,11,29);case 1:return R;case 2:return new Date(R.getFullYear(),0,3);case 3:return new Date(R.getFullYear(),0,2);case 4:return new Date(R.getFullYear(),0,1);case 5:return new Date(R.getFullYear()-1,11,31);case 6:return new Date(R.getFullYear()-1,11,30)}}function se(R){var V=Kl(new Date(R.tm_year+1900,0,1),R.tm_yday),xe=new Date(V.getFullYear(),0,4),ve=new Date(V.getFullYear()+1,0,4),At=ne(xe),Nn=ne(ve);return ce(At,V)<=0?ce(Nn,V)<=0?V.getFullYear()+1:V.getFullYear():V.getFullYear()-1}var Pe={"%a":function(R){return D[R.tm_wday].substring(0,3)},"%A":function(R){return D[R.tm_wday]},"%b":function(R){return H[R.tm_mon].substring(0,3)},"%B":function(R){return H[R.tm_mon]},"%C":function(R){var V=R.tm_year+1900;return W(V/100|0,2)},"%d":function(R){return W(R.tm_mday,2)},"%e":function(R){return Y(R.tm_mday,2," ")},"%g":function(R){return se(R).toString().substring(2)},"%G":function(R){return se(R)},"%H":function(R){return W(R.tm_hour,2)},"%I":function(R){var V=R.tm_hour;return V==0?V=12:V>12&&(V-=12),W(V,2)},"%j":function(R){return W(R.tm_mday+jl(Dn(R.tm_year+1900)?Ts:Es,R.tm_mon-1),3)},"%m":function(R){return W(R.tm_mon+1,2)},"%M":function(R){return W(R.tm_min,2)},"%n":function(){return`
|
|
7
|
+
`},"%p":function(R){return R.tm_hour>=0&&R.tm_hour<12?"AM":"PM"},"%S":function(R){return W(R.tm_sec,2)},"%t":function(){return" "},"%u":function(R){return R.tm_wday||7},"%U":function(R){var V=R.tm_yday+7-R.tm_wday;return W(Math.floor(V/7),2)},"%V":function(R){var V=Math.floor((R.tm_yday+7-(R.tm_wday+6)%7)/7);if((R.tm_wday+371-R.tm_yday-2)%7<=2&&V++,V){if(V==53){var ve=(R.tm_wday+371-R.tm_yday)%7;ve!=4&&(ve!=3||!Dn(R.tm_year))&&(V=1)}}else{V=52;var xe=(R.tm_wday+7-R.tm_yday-1)%7;(xe==4||xe==5&&Dn(R.tm_year%400-1))&&V++}return W(V,2)},"%w":function(R){return R.tm_wday},"%W":function(R){var V=R.tm_yday+7-(R.tm_wday+6)%7;return W(Math.floor(V/7),2)},"%y":function(R){return(R.tm_year+1900).toString().substring(2)},"%Y":function(R){return R.tm_year+1900},"%z":function(R){var V=R.tm_gmtoff,xe=V>=0;return V=Math.abs(V)/60,V=V/60*100+V%60,(xe?"+":"-")+("0000"+V).slice(-4)},"%Z":function(R){return R.tm_zone},"%%":function(){return"%"}};T=T.replace(/%%/g,"\0\0");for(var P in Pe)T.includes(P)&&(T=T.replace(new RegExp(P,"g"),Pe[P](w)));T=T.replace(/\0\0/g,"%");var Ze=Ql(T,!1);return Ze.length>o?0:(us(Ze,a),Ze.length-1)}function tc(a,o,f,m){return ec(a,o,f,m)}function As(a,o){L(a<16384),a<128?o.push(a):o.push(a%128|128,a>>7)}function nc(a){for(var o={i:"i32",j:"i64",f:"f32",d:"f64",p:"i32"},f={parameters:[],results:a[0]=="v"?[]:[o[a[0]]]},m=1;m<a.length;++m)L(a[m]in o,"invalid signature char: "+a[m]),f.parameters.push(o[a[m]]);return f}function qp(a,o){if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(nc(o),a);var f=[1,96],m=o.slice(0,1),S=o.slice(1),w={i:127,p:127,j:126,f:125,d:124};As(S.length,f);for(var T=0;T<S.length;++T)L(S[T]in w,"invalid signature char: "+S[T]),f.push(w[S[T]]);m=="v"?f.push(0):f.push(1,w[m]);var b=[0,97,115,109,1,0,0,0,1];As(f.length,b),b.push.apply(b,f),b.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var P=new WebAssembly.Module(new Uint8Array(b)),D=new WebAssembly.Instance(P,{e:{f:a}}),H=D.exports.f;return H}function Yp(a,o){if(Cs)for(var f=a;f<a+o;f++){var m=Ln(f);m&&Cs.set(m,f)}}var Cs=void 0,Rs=[];function $p(){if(Rs.length)return Rs.pop();try{ot.grow(1)}catch(a){throw a instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":a}return ot.length-1}function Zp(a,o){ot.set(a,o),hn[a]=ot.get(a)}var Jp=1;function ic(a){var o=t["_"+a];return L(o,"Cannot call unknown function "+a+", make sure it is exported"),o}function jp(a,o,f,m,S){var w={string:ne=>{var se=0;if(ne!=null&&ne!==0){var Pe=(ne.length<<2)+1;se=Ls(Pe),Tn(ne,se,Pe)}return se},array:ne=>{var se=Ls(ne.length);return us(ne,se),se}};function T(ne){return o==="string"?ee(ne):o==="boolean"?!!ne:ne}var b=ic(a),P=[],D=0;if(L(o!=="array",'Return type should not be "array".'),m)for(var H=0;H<m.length;H++){var Y=w[f[H]];Y?(D===0&&(D=cc()),P[H]=Y(m[H])):P[H]=m[H]}var W=b.apply(null,P);function ce(ne){return D!==0&&uc(D),T(ne)}return W=ce(W),W}Bo(),Ut=t.BindingError=Fi(Error,"BindingError"),ps=t.InternalError=Fi(Error,"InternalError"),tl(),$o(),ul(),Ss=t.UnboundTypeError=Fi(Error,"UnboundTypeError"),Ml();var Kp=!0;function rc(){$("fetchSettings")}var Ps={__cxa_allocate_exception:Lo,__cxa_throw:Fo,_embind_register_bigint:Oo,_embind_register_bool:ko,_embind_register_class:gl,_embind_register_class_constructor:yl,_embind_register_class_function:vl,_embind_register_emval:wl,_embind_register_float:El,_embind_register_integer:Cl,_embind_register_memory_view:Rl,_embind_register_std_string:Pl,_embind_register_std_wstring:Ol,_embind_register_void:Bl,abort:zl,emscripten_memcpy_big:Vl,emscripten_resize_heap:Hl,environ_get:ql,environ_sizes_get:Yl,fd_close:$l,fd_seek:Zl,fd_write:Jl,strftime_l:tc},Qp=Ro(),em=t.___wasm_call_ctors=ye("__wasm_call_ctors"),$i=t._malloc=ye("malloc"),ut=t._free=ye("free"),sc=t.___getTypeName=ye("__getTypeName"),tm=t.__embind_initialize_bindings=ye("_embind_initialize_bindings"),nm=t.___errno_location=ye("__errno_location"),ac=t._fflush=ye("fflush"),Is=t._emscripten_stack_init=function(){return(Is=t._emscripten_stack_init=t.asm.emscripten_stack_init).apply(null,arguments)},oc=t._emscripten_stack_get_free=function(){return(oc=t._emscripten_stack_get_free=t.asm.emscripten_stack_get_free).apply(null,arguments)},lc=t._emscripten_stack_get_base=function(){return(lc=t._emscripten_stack_get_base=t.asm.emscripten_stack_get_base).apply(null,arguments)},Zi=t._emscripten_stack_get_end=function(){return(Zi=t._emscripten_stack_get_end=t.asm.emscripten_stack_get_end).apply(null,arguments)},cc=t.stackSave=ye("stackSave"),uc=t.stackRestore=ye("stackRestore"),Ls=t.stackAlloc=ye("stackAlloc"),hc=t.___cxa_is_pointer_type=ye("__cxa_is_pointer_type"),im=t.dynCall_viijii=ye("dynCall_viijii"),rm=t.dynCall_ji=ye("dynCall_ji"),sm=t.dynCall_jiji=ye("dynCall_jiji"),am=t.dynCall_iiiiij=ye("dynCall_iiiiij"),om=t.dynCall_iiiiijj=ye("dynCall_iiiiijj"),lm=t.dynCall_iiiiiijj=ye("dynCall_iiiiiijj"),fc=["run","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","FS_createFolder","FS_createPath","FS_createDataFile","FS_createPreloadedFile","FS_createLazyFile","FS_createLink","FS_createDevice","FS_unlink","getLEB","getFunctionTables","alignFunctionTables","registerFunctions","prettyPrint","getCompilerSetting","print","printErr","callMain","abort","keepRuntimeAlive","wasmMemory","stackAlloc","stackSave","stackRestore","getTempRet0","setTempRet0","writeStackCookie","checkStackCookie","ptrToString","zeroMemory","stringToNewUTF8","exitJS","getHeapMax","emscripten_realloc_buffer","ENV","ERRNO_CODES","ERRNO_MESSAGES","setErrNo","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","DNS","getHostByName","Protocols","Sockets","getRandomDevice","warnOnce","traverseStack","UNWIND_CACHE","convertPCtoSourceLocation","readAsmConstArgsArray","readAsmConstArgs","mainThreadEM_ASM","jstoi_q","jstoi_s","getExecutableName","listenOnce","autoResumeAudioContext","dynCallLegacy","getDynCaller","dynCall","handleException","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","safeSetTimeout","asmjsMangle","asyncLoad","alignMemory","mmapAlloc","writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertI32PairToI53Checked","convertU32PairToI53","getCFunc","ccall","cwrap","uleb128Encode","sigToWasmTypes","convertJsFunctionToWasm","freeTableIndexes","functionsInTableMap","getEmptyTableSlot","updateTableMap","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","setValue","getValue","PATH","PATH_FS","intArrayFromString","intArrayToString","AsciiToString","stringToAscii","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","allocateUTF8","allocateUTF8OnStack","writeStringToMemory","writeArrayToMemory","writeAsciiToMemory","SYSCALLS","getSocketFromFD","getSocketAddress","JSEvents","registerKeyEventCallback","specialHTMLTargets","maybeCStringToJsString","findEventTarget","findCanvasEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","currentFullscreenStrategy","restoreOldWindowedStyle","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","demangle","demangleAll","jsStackTrace","stackTrace","ExitStatus","getEnvStrings","checkWasiClock","flush_NO_FILESYSTEM","dlopenMissingError","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","uncaughtExceptionCount","exceptionLast","exceptionCaught","ExceptionInfo","exception_addRef","exception_decRef","Browser","setMainLoop","wget","FS","MEMFS","TTY","PIPEFS","SOCKFS","_setNetworkCallback","tempFixedLengthArray","miniTempWebGLFloatBuffers","heapObjectForWebGLType","heapAccessShiftForWebGLHeap","GL","emscriptenWebGLGet","computeUnpackAlignedImageSize","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","writeGLArray","AL","SDL_unicode","SDL_ttfContext","SDL_audio","SDL","SDL_gfx","GLUT","EGL","GLFW_Window","GLFW","GLEW","IDBStore","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","InternalError","BindingError","UnboundTypeError","PureVirtualError","init_embind","throwInternalError","throwBindingError","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","extendError","createNamedFunction","embindRepr","registeredInstances","getBasestPointer","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","registeredTypes","awaitingDependencies","typeDependencies","registeredPointers","registerType","whenDependentTypesAreResolved","embind_charCodes","embind_init_charCodes","readLatin1String","getTypeName","heap32VectorToArray","requireRegisteredType","getShiftFromSize","integerReadValueFromPointer","enumReadValueFromPointer","floatReadValueFromPointer","simpleReadValueFromPointer","runDestructors","new_","craftInvokerFunction","embind__requireFunction","tupleRegistrations","structRegistrations","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_getPointee","RegisteredPointer_destructor","RegisteredPointer_deleteObject","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","finalizationRegistry","detachFinalizer_deps","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","ClassHandle_isAliasOf","throwInstanceAlreadyDeleted","ClassHandle_clone","ClassHandle_delete","deletionQueue","ClassHandle_isDeleted","ClassHandle_deleteLater","flushPendingDeletes","delayFunction","setDelayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName","emval_handle_array","emval_free_list","emval_symbols","init_emval","count_emval_handles","get_first_emval","getStringOrSymbol","Emval","emval_newers","craftEmvalAllocator","emval_get_global","emval_lookupTypes","emval_allocateDestructors","emval_methodCallers","emval_addMethodCaller","emval_registeredMethods"];fc.forEach(y);var dc=["ptrToString","zeroMemory","stringToNewUTF8","exitJS","setErrNo","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","getHostByName","getRandomDevice","traverseStack","convertPCtoSourceLocation","readAsmConstArgs","mainThreadEM_ASM","jstoi_q","jstoi_s","listenOnce","autoResumeAudioContext","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","safeSetTimeout","asmjsMangle","asyncLoad","alignMemory","mmapAlloc","writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","reallyNegative","unSign","strLen","reSign","formatString","getSocketFromFD","getSocketAddress","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","findCanvasEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","checkWasiClock","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","exception_addRef","exception_decRef","setMainLoop","_setNetworkCallback","heapObjectForWebGLType","heapAccessShiftForWebGLHeap","emscriptenWebGLGet","computeUnpackAlignedImageSize","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","writeGLArray","SDL_unicode","SDL_ttfContext","SDL_audio","GLFW_Window","runAndAbortIfError","registerInheritedInstance","unregisterInheritedInstance","requireRegisteredType","enumReadValueFromPointer","validateThis","getStringOrSymbol","craftEmvalAllocator","emval_get_global","emval_lookupTypes","emval_allocateDestructors","emval_addMethodCaller"];dc.forEach(re);var Un;rn=function a(){Un||Ds(),Un||(rn=a)};function pc(){Is(),_o()}function Ds(a){if(a=a||l,Tt>0||(pc(),yo(),Tt>0))return;function o(){Un||(Un=!0,t.calledRun=!0,!k&&(vo(),n(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),L(!t._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),xo()))}t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),o()},1)):o(),Li()}if(t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return Ds(),e.ready})})();typeof Kn=="object"&&typeof sr=="object"?sr.exports=rr:typeof define=="function"&&define.amd?define([],function(){return rr}):typeof Kn=="object"&&(Kn.createLazPerf=rr)});var fa=K(je=>{"use strict";var Mu=je&&je.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(je,"__esModule",{value:!0});je.LazPerf=je.create=je.createLazPerf=void 0;var ar=Mu(ha());je.createLazPerf=ar.default;je.create=ar.default;je.LazPerf={create:ar.default}});var _a=K(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.decompressFile=gt.decompressChunk=gt.PointData=void 0;var da=fa(),wu=ir();gt.PointData={createLazPerf:da.createLazPerf,decompressChunk:ma,decompressFile:ga};var or;async function pa(s){return s||(or||(or=(0,da.createLazPerf)()),or)}async function ma(s,{pointCount:e,pointDataRecordFormat:t,pointDataRecordLength:n},i){let r=await pa(i),l=new Uint8Array(e*n),c=r._malloc(s.byteLength),u=r._malloc(n),h=new r.ChunkDecoder;try{r.HEAPU8.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),c),h.open(t,n,c);for(let d=0;d<e;++d)h.getPoint(u),l.set(new Uint8Array(r.HEAPU8.buffer,u,n),d*n)}finally{r._free(c),r._free(u),h.delete()}return l}gt.decompressChunk=ma;async function ga(s,e){let t=await pa(e),n=wu.Header.parse(s),{pointCount:i,pointDataRecordLength:r}=n,l=new Uint8Array(i*r),c=t._malloc(s.byteLength),u=t._malloc(r),h=new t.LASZip;try{t.HEAPU8.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),c),h.open(c,s.byteLength);for(let d=0;d<i;++d)h.getPoint(u),l.set(new Uint8Array(t.HEAPU8.buffer,u,r),d*r)}finally{h.delete()}return l}gt.decompressFile=ga});var ya=K(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.View=void 0;var Tu=ze(),Eu=er(),Au=tr();Qn.View={create:Cu};function Cu(s,e,t=[],n){let i=Au.Extractor.create(e,t);if(n){let d=new Set([...n]);i=Object.entries(i).reduce((p,[v,_])=>(d.has(v)&&(p[v]=_),p),{})}let r=Eu.Dimensions.create(i,t),l=Tu.Binary.toDataView(s),c=e.pointDataRecordLength;if(l.byteLength%c!==0)throw new Error(`Invalid buffer length (${l.byteLength}) for point length ${c}`);let u=l.byteLength/e.pointDataRecordLength;function h(d){let p=i[d];if(!p)throw new Error(`No extractor for dimension: ${d}`);return function(v){if(v>=u)throw new RangeError(`View index (${v}) out of range: ${u}`);return p(l,v)}}return{pointCount:u,dimensions:r,getter:h}}});var ba=K(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.Vlr=void 0;var Ke=ze(),Gt=zn();ei.Vlr={walk:Iu,parse:Sa,find:xa,at:Ru,fetch:Pu};function xa(s,e,t){return s.find(n=>n.userId===e&&n.recordId===t)}function Ru(s,e,t){let n=xa(s,e,t);if(!n)throw new Error(`VLR not found: ${e}/${t}`);return n}function Pu(s,{contentOffset:e,contentLength:t}){return t===0?new Uint8Array:Ke.Getter.create(s)(e,e+t)}async function Iu(s,e){let t=Ke.Getter.create(s),n=await va({get:t,startOffset:e.headerLength,count:e.vlrCount,isExtended:!1}),i=await va({get:t,startOffset:e.evlrOffset,count:e.evlrCount,isExtended:!0});return[...n,...i]}function Sa(s,e){return(e?Du:Lu)(s)}function Lu(s){let e=Ke.Binary.toDataView(s);if(e.byteLength!==Gt.vlrHeaderLength)throw new Error(`Invalid VLR header length (must be ${Gt.vlrHeaderLength}): ${e.byteLength}`);return{userId:Ke.Binary.toCString(s.slice(2,18)),recordId:e.getUint16(18,!0),contentLength:e.getUint16(20,!0),description:Ke.Binary.toCString(s.slice(22,54)),isExtended:!1}}function Du(s){let e=Ke.Binary.toDataView(s);if(e.byteLength!==Gt.evlrHeaderLength)throw new Error(`Invalid EVLR header length (must be ${Gt.evlrHeaderLength}): ${e.byteLength}`);return{userId:Ke.Binary.toCString(s.slice(2,18)),recordId:e.getUint16(18,!0),contentLength:(0,Ke.parseBigInt)((0,Ke.getBigUint64)(e,20,!0)),description:Ke.Binary.toCString(s.slice(28,60)),isExtended:!0}}async function va({get:s,startOffset:e,count:t,isExtended:n}){let i=[],r=e,l=n?Gt.evlrHeaderLength:Gt.vlrHeaderLength;for(let c=0;c<t;++c){let u=l?await s(r,r+l):new Uint8Array,{userId:h,recordId:d,contentLength:p,description:v}=Sa(u,n);i.push({userId:h,recordId:d,contentOffset:r+l,contentLength:p,description:v,isExtended:n}),r+=l+p}return i}});var ti=K(le=>{"use strict";var Uu=le&&le.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Nu=le&&le.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Fu=le&&le.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Uu(e,s,t);return Nu(e,s),e};Object.defineProperty(le,"__esModule",{value:!0});le.Vlr=le.View=le.PointData=le.Header=le.Extractor=le.ExtraBytes=le.Dimensions=le.Constants=void 0;le.Constants=Fu(zn());var Ou=er();Object.defineProperty(le,"Dimensions",{enumerable:!0,get:function(){return Ou.Dimensions}});var Bu=Qi();Object.defineProperty(le,"ExtraBytes",{enumerable:!0,get:function(){return Bu.ExtraBytes}});var zu=tr();Object.defineProperty(le,"Extractor",{enumerable:!0,get:function(){return zu.Extractor}});var Vu=ir();Object.defineProperty(le,"Header",{enumerable:!0,get:function(){return Vu.Header}});var ku=_a();Object.defineProperty(le,"PointData",{enumerable:!0,get:function(){return ku.PointData}});var Gu=ya();Object.defineProperty(le,"View",{enumerable:!0,get:function(){return Gu.View}});var Hu=ba();Object.defineProperty(le,"Vlr",{enumerable:!0,get:function(){return Hu.Vlr}})});var lr=K(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.Hierarchy=void 0;var dn=ze(),Ma=Bn();ni.Hierarchy={parse:wa,load:Wu};function wa(s){let e=dn.Binary.toDataView(s);if(e.byteLength%Ma.hierarchyItemLength!==0)throw new Error(`Invalid hierarchy page length: ${e.byteLength}`);let t={},n={};for(let i=0;i<e.byteLength;i+=Ma.hierarchyItemLength){let r=e.getInt32(i+0,!0),l=e.getInt32(i+4,!0),c=e.getInt32(i+8,!0),u=e.getInt32(i+12,!0),h=(0,dn.parseBigInt)((0,dn.getBigUint64)(e,i+16,!0)),d=e.getInt32(i+24,!0),p=e.getInt32(i+28,!0),v=dn.Key.toString([r,l,c,u]);if(p<-1)throw new Error(`Invalid hierarchy point count at key: ${v}`);p===-1?n[v]={pageOffset:h,pageLength:d}:t[v]={pointCount:p,pointDataOffset:h,pointDataLength:d}}return{nodes:t,pages:n}}async function Wu(s,e){let t=dn.Getter.create(s);return wa(await t(e.pageOffset,e.pageOffset+e.pageLength))}});var cr=K(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.Info=void 0;var pn=ze(),Ta=Bn();ii.Info={parse:Xu};function Xu(s){let e=pn.Binary.toDataView(s);if(e.byteLength!==Ta.infoLength)throw new Error(`Invalid COPC info VLR length (should be ${Ta.infoLength}): ${e.byteLength}`);let t=[e.getFloat64(0,!0),e.getFloat64(8,!0),e.getFloat64(16,!0)],n=e.getFloat64(24,!0);return{cube:[t[0]-n,t[1]-n,t[2]-n,t[0]+n,t[1]+n,t[2]+n],spacing:e.getFloat64(32,!0),rootHierarchyPage:{pageOffset:(0,pn.parseBigInt)((0,pn.getBigUint64)(e,40,!0)),pageLength:(0,pn.parseBigInt)((0,pn.getBigUint64)(e,48,!0))},gpsTimeRange:[e.getFloat64(56,!0),e.getFloat64(64,!0)]}}});var Ca=K(Qe=>{"use strict";var qu=Qe&&Qe.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),Yu=Qe&&Qe.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),$u=Qe&&Qe.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&qu(e,s,t);return Yu(e,s),e};Object.defineProperty(Qe,"__esModule",{value:!0});Qe.Copc=void 0;var Ve=$u(ti()),ri=ze(),Zu=lr(),Ju=cr();Qe.Copc={create:ju,loadHierarchyPage:Ku,loadCompressedPointDataBuffer:Ea,loadPointDataBuffer:Aa,loadPointDataView:Qu};async function ju(s){let e=ri.Getter.create(s),t=65536,n=e(0,t);async function i(_,g){return g>=t?e(_,g):(await n).slice(_,g)}let r=Ve.Header.parse(await i(0,Ve.Constants.minHeaderLength)),l=await Ve.Vlr.walk(i,r),c=Ve.Vlr.find(l,"copc",1);if(!c)throw new Error("COPC info VLR is required");let u=Ju.Info.parse(await Ve.Vlr.fetch(i,c)),h,d=Ve.Vlr.find(l,"LASF_Projection",2112);d&&d.contentLength&&(h=ri.Binary.toCString(await Ve.Vlr.fetch(i,d)),h===""&&(h=void 0));let p=[],v=Ve.Vlr.find(l,"LASF_Spec",4);return v&&(p=Ve.ExtraBytes.parse(await Ve.Vlr.fetch(i,v))),{header:r,vlrs:l,info:u,wkt:h,eb:p}}async function Ku(s,e){let t=ri.Getter.create(s);return Zu.Hierarchy.load(t,e)}async function Ea(s,{pointDataOffset:e,pointDataLength:t}){return ri.Getter.create(s)(e,e+t)}async function Aa(s,{pointDataRecordFormat:e,pointDataRecordLength:t},n,i){let r=await Ea(s,n),{pointCount:l}=n;return Ve.PointData.decompressChunk(r,{pointCount:l,pointDataRecordFormat:e,pointDataRecordLength:t},i)}async function Qu(s,e,t,{lazPerf:n,include:i}={}){let r=await Aa(s,e.header,t,n);return Ve.View.create(r,e.header,e.eb,i)}});var Ra=K(be=>{"use strict";var eh=be&&be.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),th=be&&be.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),nh=be&&be.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&eh(e,s,t);return th(e,s),e};Object.defineProperty(be,"__esModule",{value:!0});be.Info=be.Hierarchy=be.Copc=be.Constants=void 0;be.Constants=nh(Bn());var ih=Ca();Object.defineProperty(be,"Copc",{enumerable:!0,get:function(){return ih.Copc}});var rh=lr();Object.defineProperty(be,"Hierarchy",{enumerable:!0,get:function(){return rh.Hierarchy}});var sh=cr();Object.defineProperty(be,"Info",{enumerable:!0,get:function(){return sh.Info}})});var ur=K(Me=>{"use strict";var Pa=Me&&Me.__createBinding||(Object.create?(function(s,e,t,n){n===void 0&&(n=t);var i=Object.getOwnPropertyDescriptor(e,t);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,i)}):(function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]})),ah=Me&&Me.__setModuleDefault||(Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e}),Ia=Me&&Me.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&Pa(e,s,t);return ah(e,s),e},La=Me&&Me.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Pa(e,s,t)};Object.defineProperty(Me,"__esModule",{value:!0});Me.Las=Me.Ept=void 0;Me.Ept=Ia(Vs());La(Ra(),Me);Me.Las=Ia(ti());La(ze(),Me)});import zp from"@giro3d/giro3d/entities/PointCloud.js";var Ri=Fn(ur()),fo=Fn(ti()),po=Fn(ji());var qa=1;var Ya=3;var xr=0,Sr=1,br=2,Mr=3,wr=4,Tr=5,Er=6,Ar=7,$a=0,Za=1,Ja=2;var kr=1,Gr=2,Hr=3,Wr=4,Xr=5,qr=6,Yr=7;var $r=300,ja=301,Zr=302;var Ka=306,Cr=1e3,yn=1001,Rr=1002;var Qa=1006;var eo=1008;var to=1009;var no=1015;var io=1023;var xn=2300,pi=2301,fi=2302,Pr=2303,Ir=2400,Lr=2401,Dr=2402;var Jr="",Ge="srgb",Ur="srgb-linear",Nr="linear",di="srgb";var ro=35044;var vn=2e3,Fr=2001;function oh(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Or(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}var Da={},mi=null;function so(s){let e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function Ee(...s){s=so(s);let e="THREE."+s.shift();if(mi)mi("warn",e,...s);else{let t=s[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...s)}}function me(...s){s=so(s);let e="THREE."+s.shift();if(mi)mi("error",e,...s);else{let t=s[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...s)}}function jt(...s){let e=s.join(" ");e in Da||(Da[e]=!0,Ee(...s))}var lh={[xr]:Sr,[br]:Er,[wr]:Ar,[Mr]:Tr,[Sr]:xr,[Er]:br,[Ar]:wr,[Tr]:Mr},Qt=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let r=0,l=i.length;r<l;r++)i[r].call(this,e);e.target=null}}},we=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var Gm=Math.PI/180,ch=180/Math.PI;function jr(){let s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(we[s&255]+we[s>>8&255]+we[s>>16&255]+we[s>>24&255]+"-"+we[e&255]+we[e>>8&255]+"-"+we[e>>16&15|64]+we[e>>24&255]+"-"+we[t&63|128]+we[t>>8&255]+"-"+we[t>>16&255]+we[t>>24&255]+we[n&255]+we[n>>8&255]+we[n>>16&255]+we[n>>24&255]).toLowerCase()}function j(s,e,t){return Math.max(e,Math.min(t,s))}function uh(s,e){return(s%e+e)%e}function hr(s,e,t){return(1-t)*s+t*e}function mn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:case Uint8ClampedArray:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Le(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var He=class s{static{s.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=j(this.x,e.x,t.x),this.y=j(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=j(this.x,e,t),this.y=j(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(j(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(j(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,l=this.y-e.y;return this.x=r*n-l*i+e.x,this.y=r*i+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},at=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,l,c){let u=n[i+0],h=n[i+1],d=n[i+2],p=n[i+3],v=r[l+0],_=r[l+1],g=r[l+2],x=r[l+3];if(p!==x||u!==v||h!==_||d!==g){let A=u*v+h*_+d*g+p*x;A<0&&(v=-v,_=-_,g=-g,x=-x,A=-A);let E=1-c;if(A<.9995){let I=Math.acos(A),N=Math.sin(I);E=Math.sin(E*I)/N,c=Math.sin(c*I)/N,u=u*E+v*c,h=h*E+_*c,d=d*E+g*c,p=p*E+x*c}else{u=u*E+v*c,h=h*E+_*c,d=d*E+g*c,p=p*E+x*c;let I=1/Math.sqrt(u*u+h*h+d*d+p*p);u*=I,h*=I,d*=I,p*=I}}e[t]=u,e[t+1]=h,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,n,i,r,l){let c=n[i],u=n[i+1],h=n[i+2],d=n[i+3],p=r[l],v=r[l+1],_=r[l+2],g=r[l+3];return e[t]=c*g+d*p+u*_-h*v,e[t+1]=u*g+d*v+h*p-c*_,e[t+2]=h*g+d*_+c*v-u*p,e[t+3]=d*g-c*p-u*v-h*_,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,r=e._z,l=e._order,c=Math.cos,u=Math.sin,h=c(n/2),d=c(i/2),p=c(r/2),v=u(n/2),_=u(i/2),g=u(r/2);switch(l){case"XYZ":this._x=v*d*p+h*_*g,this._y=h*_*p-v*d*g,this._z=h*d*g+v*_*p,this._w=h*d*p-v*_*g;break;case"YXZ":this._x=v*d*p+h*_*g,this._y=h*_*p-v*d*g,this._z=h*d*g-v*_*p,this._w=h*d*p+v*_*g;break;case"ZXY":this._x=v*d*p-h*_*g,this._y=h*_*p+v*d*g,this._z=h*d*g+v*_*p,this._w=h*d*p-v*_*g;break;case"ZYX":this._x=v*d*p-h*_*g,this._y=h*_*p+v*d*g,this._z=h*d*g-v*_*p,this._w=h*d*p+v*_*g;break;case"YZX":this._x=v*d*p+h*_*g,this._y=h*_*p+v*d*g,this._z=h*d*g-v*_*p,this._w=h*d*p-v*_*g;break;case"XZY":this._x=v*d*p-h*_*g,this._y=h*_*p-v*d*g,this._z=h*d*g+v*_*p,this._w=h*d*p+v*_*g;break;default:Ee("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],r=t[8],l=t[1],c=t[5],u=t[9],h=t[2],d=t[6],p=t[10],v=n+c+p;if(v>0){let _=.5/Math.sqrt(v+1);this._w=.25/_,this._x=(d-u)*_,this._y=(r-h)*_,this._z=(l-i)*_}else if(n>c&&n>p){let _=2*Math.sqrt(1+n-c-p);this._w=(d-u)/_,this._x=.25*_,this._y=(i+l)/_,this._z=(r+h)/_}else if(c>p){let _=2*Math.sqrt(1+c-n-p);this._w=(r-h)/_,this._x=(i+l)/_,this._y=.25*_,this._z=(u+d)/_}else{let _=2*Math.sqrt(1+p-n-c);this._w=(l-i)/_,this._x=(r+h)/_,this._y=(u+d)/_,this._z=.25*_}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(j(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,r=e._z,l=e._w,c=t._x,u=t._y,h=t._z,d=t._w;return this._x=n*d+l*c+i*h-r*u,this._y=i*d+l*u+r*c-n*h,this._z=r*d+l*h+n*u-i*c,this._w=l*d-n*c-i*u-r*h,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,r=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,i=-i,r=-r,l=-l,c=-c);let u=1-t;if(c<.9995){let h=Math.acos(c),d=Math.sin(h);u=Math.sin(u*h)/d,t=Math.sin(t*h)/d,this._x=this._x*u+n*t,this._y=this._y*u+i*t,this._z=this._z*u+r*t,this._w=this._w*u+l*t,this._onChangeCallback()}else this._x=this._x*u+n*t,this._y=this._y*u+i*t,this._z=this._z*u+r*t,this._w=this._w*u+l*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},F=class s{static{s.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ua.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ua.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=e.elements,l=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*l,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*l,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*l,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,r=e.x,l=e.y,c=e.z,u=e.w,h=2*(l*i-c*n),d=2*(c*t-r*i),p=2*(r*n-l*t);return this.x=t+u*h+l*p-c*d,this.y=n+u*d+c*h-r*p,this.z=i+u*p+r*d-l*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=j(this.x,e.x,t.x),this.y=j(this.y,e.y,t.y),this.z=j(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=j(this.x,e,t),this.y=j(this.y,e,t),this.z=j(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(j(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,r=e.z,l=t.x,c=t.y,u=t.z;return this.x=i*u-r*c,this.y=r*l-n*u,this.z=n*c-i*l,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return fr.copy(this).projectOnVector(e),this.sub(fr)}reflect(e){return this.sub(fr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(j(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},fr=new F,Ua=new at,Z=class s{static{s.prototype.isMatrix3=!0}constructor(e,t,n,i,r,l,c,u,h){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,l,c,u,h)}set(e,t,n,i,r,l,c,u,h){let d=this.elements;return d[0]=e,d[1]=i,d[2]=c,d[3]=t,d[4]=r,d[5]=u,d[6]=n,d[7]=l,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,l=n[0],c=n[3],u=n[6],h=n[1],d=n[4],p=n[7],v=n[2],_=n[5],g=n[8],x=i[0],A=i[3],E=i[6],I=i[1],N=i[4],O=i[7],C=i[2],G=i[5],z=i[8];return r[0]=l*x+c*I+u*C,r[3]=l*A+c*N+u*G,r[6]=l*E+c*O+u*z,r[1]=h*x+d*I+p*C,r[4]=h*A+d*N+p*G,r[7]=h*E+d*O+p*z,r[2]=v*x+_*I+g*C,r[5]=v*A+_*N+g*G,r[8]=v*E+_*O+g*z,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],u=e[6],h=e[7],d=e[8];return t*l*d-t*c*h-n*r*d+n*c*u+i*r*h-i*l*u}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],u=e[6],h=e[7],d=e[8],p=d*l-c*h,v=c*u-d*r,_=h*r-l*u,g=t*p+n*v+i*_;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let x=1/g;return e[0]=p*x,e[1]=(i*h-d*n)*x,e[2]=(c*n-i*l)*x,e[3]=v*x,e[4]=(d*t-i*u)*x,e[5]=(i*r-c*t)*x,e[6]=_*x,e[7]=(n*u-h*t)*x,e[8]=(l*t-n*r)*x,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,l,c){let u=Math.cos(r),h=Math.sin(r);return this.set(n*u,n*h,-n*(u*l+h*c)+l+e,-i*h,i*u,-i*(-h*l+u*c)+c+t,0,0,1),this}scale(e,t){return jt("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(dr.makeScale(e,t)),this}rotate(e){return jt("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(dr.makeRotation(-e)),this}translate(e,t){return jt("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(dr.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},dr=new Z,Na=new Z().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Fa=new Z().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function hh(){let s={enabled:!0,workingColorSpace:Ur,spaces:{},convert:function(i,r,l){return this.enabled===!1||r===l||!r||!l||(this.spaces[r].transfer===di&&(i.r=rt(i.r),i.g=rt(i.g),i.b=rt(i.b)),this.spaces[r].primaries!==this.spaces[l].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===di&&(i.r=Kt(i.r),i.g=Kt(i.g),i.b=Kt(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Jr?Nr:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,l){return i.copy(this.spaces[r].toXYZ).multiply(this.spaces[l].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,r){return jt("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return jt("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[Ur]:{primaries:e,whitePoint:n,transfer:Nr,toXYZ:Na,fromXYZ:Fa,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Ge},outputColorSpaceConfig:{drawingBufferColorSpace:Ge}},[Ge]:{primaries:e,whitePoint:n,transfer:di,toXYZ:Na,fromXYZ:Fa,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Ge}}}),s}var ke=hh();function rt(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Kt(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}var Ht,gi=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ht===void 0&&(Ht=Or("canvas")),Ht.width=e.width,Ht.height=e.height;let i=Ht.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ht}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Or("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let l=0;l<r.length;l++)r[l]=rt(r[l]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(rt(t[n]/255)*255):t[n]=rt(t[n]);return{data:t,width:e.width,height:e.height}}else return Ee("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},fh=0,_i=class{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:fh++}),this.uuid=jr(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let r;if(Array.isArray(i)){r=[];for(let l=0,c=i.length;l<c;l++)i[l].isDataTexture?r.push(pr(i[l].image)):r.push(pr(i[l]))}else r=pr(i);n.url=r}return t||(e.images[this.uuid]=n),n}};function pr(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?gi.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(Ee("Texture: Unable to serialize Texture."),{})}var dh=0,mr=new F,en=class s extends Qt{constructor(e=s.DEFAULT_IMAGE,t=s.DEFAULT_MAPPING,n=yn,i=yn,r=Qa,l=eo,c=io,u=to,h=s.DEFAULT_ANISOTROPY,d=Jr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:dh++}),this.uuid=jr(),this.name="",this.source=new _i(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=l,this.anisotropy=h,this.format=c,this.internalFormat=null,this.type=u,this.offset=new He(0,0),this.repeat=new He(1,1),this.center=new He(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Z,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(mr).x}get height(){return this.source.getSize(mr).y}get depth(){return this.source.getSize(mr).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){Ee(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Ee(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==$r)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Cr:e.x=e.x-Math.floor(e.x);break;case yn:e.x=e.x<0?0:1;break;case Rr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Cr:e.y=e.y-Math.floor(e.y);break;case yn:e.y=e.y<0?0:1;break;case Rr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};en.DEFAULT_IMAGE=null;en.DEFAULT_MAPPING=$r;en.DEFAULT_ANISOTROPY=1;var Br=class s{static{s.prototype.isVector4=!0}constructor(e=0,t=0,n=0,i=1){this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,r=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i+l[12]*r,this.y=l[1]*t+l[5]*n+l[9]*i+l[13]*r,this.z=l[2]*t+l[6]*n+l[10]*i+l[14]*r,this.w=l[3]*t+l[7]*n+l[11]*i+l[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r,u=e.elements,h=u[0],d=u[4],p=u[8],v=u[1],_=u[5],g=u[9],x=u[2],A=u[6],E=u[10];if(Math.abs(d-v)<.01&&Math.abs(p-x)<.01&&Math.abs(g-A)<.01){if(Math.abs(d+v)<.1&&Math.abs(p+x)<.1&&Math.abs(g+A)<.1&&Math.abs(h+_+E-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let N=(h+1)/2,O=(_+1)/2,C=(E+1)/2,G=(d+v)/4,z=(p+x)/4,$=(g+A)/4;return N>O&&N>C?N<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(N),i=G/n,r=z/n):O>C?O<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(O),n=G/i,r=$/i):C<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(C),n=z/r,i=$/r),this.set(n,i,r,t),this}let I=Math.sqrt((A-g)*(A-g)+(p-x)*(p-x)+(v-d)*(v-d));return Math.abs(I)<.001&&(I=1),this.x=(A-g)/I,this.y=(p-x)/I,this.z=(v-d)/I,this.w=Math.acos((h+_+E-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=j(this.x,e.x,t.x),this.y=j(this.y,e.y,t.y),this.z=j(this.z,e.z,t.z),this.w=j(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=j(this.x,e,t),this.y=j(this.y,e,t),this.z=j(this.z,e,t),this.w=j(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(j(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};var st=class s{static{s.prototype.isMatrix4=!0}constructor(e,t,n,i,r,l,c,u,h,d,p,v,_,g,x,A){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,l,c,u,h,d,p,v,_,g,x,A)}set(e,t,n,i,r,l,c,u,h,d,p,v,_,g,x,A){let E=this.elements;return E[0]=e,E[4]=t,E[8]=n,E[12]=i,E[1]=r,E[5]=l,E[9]=c,E[13]=u,E[2]=h,E[6]=d,E[10]=p,E[14]=v,E[3]=_,E[7]=g,E[11]=x,E[15]=A,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new s().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Wt.setFromMatrixColumn(e,0).length(),r=1/Wt.setFromMatrixColumn(e,1).length(),l=1/Wt.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*l,t[9]=n[9]*l,t[10]=n[10]*l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,r=e.z,l=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i),d=Math.cos(r),p=Math.sin(r);if(e.order==="XYZ"){let v=l*d,_=l*p,g=c*d,x=c*p;t[0]=u*d,t[4]=-u*p,t[8]=h,t[1]=_+g*h,t[5]=v-x*h,t[9]=-c*u,t[2]=x-v*h,t[6]=g+_*h,t[10]=l*u}else if(e.order==="YXZ"){let v=u*d,_=u*p,g=h*d,x=h*p;t[0]=v+x*c,t[4]=g*c-_,t[8]=l*h,t[1]=l*p,t[5]=l*d,t[9]=-c,t[2]=_*c-g,t[6]=x+v*c,t[10]=l*u}else if(e.order==="ZXY"){let v=u*d,_=u*p,g=h*d,x=h*p;t[0]=v-x*c,t[4]=-l*p,t[8]=g+_*c,t[1]=_+g*c,t[5]=l*d,t[9]=x-v*c,t[2]=-l*h,t[6]=c,t[10]=l*u}else if(e.order==="ZYX"){let v=l*d,_=l*p,g=c*d,x=c*p;t[0]=u*d,t[4]=g*h-_,t[8]=v*h+x,t[1]=u*p,t[5]=x*h+v,t[9]=_*h-g,t[2]=-h,t[6]=c*u,t[10]=l*u}else if(e.order==="YZX"){let v=l*u,_=l*h,g=c*u,x=c*h;t[0]=u*d,t[4]=x-v*p,t[8]=g*p+_,t[1]=p,t[5]=l*d,t[9]=-c*d,t[2]=-h*d,t[6]=_*p+g,t[10]=v-x*p}else if(e.order==="XZY"){let v=l*u,_=l*h,g=c*u,x=c*h;t[0]=u*d,t[4]=-p,t[8]=h*d,t[1]=v*p+x,t[5]=l*d,t[9]=_*p-g,t[2]=g*p-_,t[6]=c*d,t[10]=x*p+v}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ph,e,mh)}lookAt(e,t,n){let i=this.elements;return Ue.subVectors(e,t),Ue.lengthSq()===0&&(Ue.z=1),Ue.normalize(),_t.crossVectors(n,Ue),_t.lengthSq()===0&&(Math.abs(n.z)===1?Ue.x+=1e-4:Ue.z+=1e-4,Ue.normalize(),_t.crossVectors(n,Ue)),_t.normalize(),si.crossVectors(Ue,_t),i[0]=_t.x,i[4]=si.x,i[8]=Ue.x,i[1]=_t.y,i[5]=si.y,i[9]=Ue.y,i[2]=_t.z,i[6]=si.z,i[10]=Ue.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,r=this.elements,l=n[0],c=n[4],u=n[8],h=n[12],d=n[1],p=n[5],v=n[9],_=n[13],g=n[2],x=n[6],A=n[10],E=n[14],I=n[3],N=n[7],O=n[11],C=n[15],G=i[0],z=i[4],$=i[8],Q=i[12],re=i[1],y=i[5],M=i[9],B=i[13],X=i[2],k=i[6],q=i[10],L=i[14],de=i[3],_e=i[7],ee=i[11],pe=i[15];return r[0]=l*G+c*re+u*X+h*de,r[4]=l*z+c*y+u*k+h*_e,r[8]=l*$+c*M+u*q+h*ee,r[12]=l*Q+c*B+u*L+h*pe,r[1]=d*G+p*re+v*X+_*de,r[5]=d*z+p*y+v*k+_*_e,r[9]=d*$+p*M+v*q+_*ee,r[13]=d*Q+p*B+v*L+_*pe,r[2]=g*G+x*re+A*X+E*de,r[6]=g*z+x*y+A*k+E*_e,r[10]=g*$+x*M+A*q+E*ee,r[14]=g*Q+x*B+A*L+E*pe,r[3]=I*G+N*re+O*X+C*de,r[7]=I*z+N*y+O*k+C*_e,r[11]=I*$+N*M+O*q+C*ee,r[15]=I*Q+N*B+O*L+C*pe,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],l=e[1],c=e[5],u=e[9],h=e[13],d=e[2],p=e[6],v=e[10],_=e[14],g=e[3],x=e[7],A=e[11],E=e[15],I=u*_-h*v,N=c*_-h*p,O=c*v-u*p,C=l*_-h*d,G=l*v-u*d,z=l*p-c*d;return t*(x*I-A*N+E*O)-n*(g*I-A*C+E*G)+i*(g*N-x*C+E*z)-r*(g*O-x*G+A*z)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],i=e[8],r=e[1],l=e[5],c=e[9],u=e[2],h=e[6],d=e[10];return t*(l*d-c*h)-n*(r*d-c*u)+i*(r*h-l*u)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],l=e[4],c=e[5],u=e[6],h=e[7],d=e[8],p=e[9],v=e[10],_=e[11],g=e[12],x=e[13],A=e[14],E=e[15],I=t*c-n*l,N=t*u-i*l,O=t*h-r*l,C=n*u-i*c,G=n*h-r*c,z=i*h-r*u,$=d*x-p*g,Q=d*A-v*g,re=d*E-_*g,y=p*A-v*x,M=p*E-_*x,B=v*E-_*A,X=I*B-N*M+O*y+C*re-G*Q+z*$;if(X===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let k=1/X;return e[0]=(c*B-u*M+h*y)*k,e[1]=(i*M-n*B-r*y)*k,e[2]=(x*z-A*G+E*C)*k,e[3]=(v*G-p*z-_*C)*k,e[4]=(u*re-l*B-h*Q)*k,e[5]=(t*B-i*re+r*Q)*k,e[6]=(A*O-g*z-E*N)*k,e[7]=(d*z-v*O+_*N)*k,e[8]=(l*M-c*re+h*$)*k,e[9]=(n*re-t*M-r*$)*k,e[10]=(g*G-x*O+E*I)*k,e[11]=(p*O-d*G-_*I)*k,e[12]=(c*Q-l*y-u*$)*k,e[13]=(t*y-n*Q+i*$)*k,e[14]=(x*N-g*C-A*I)*k,e[15]=(d*C-p*N+v*I)*k,this}scale(e){let t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),r=1-n,l=e.x,c=e.y,u=e.z,h=r*l,d=r*c;return this.set(h*l+n,h*c-i*u,h*u+i*c,0,h*c+i*u,d*c+n,d*u-i*l,0,h*u-i*c,d*u+i*l,r*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,l){return this.set(1,n,r,0,e,1,l,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,r=t._x,l=t._y,c=t._z,u=t._w,h=r+r,d=l+l,p=c+c,v=r*h,_=r*d,g=r*p,x=l*d,A=l*p,E=c*p,I=u*h,N=u*d,O=u*p,C=n.x,G=n.y,z=n.z;return i[0]=(1-(x+E))*C,i[1]=(_+O)*C,i[2]=(g-N)*C,i[3]=0,i[4]=(_-O)*G,i[5]=(1-(v+E))*G,i[6]=(A+I)*G,i[7]=0,i[8]=(g+N)*z,i[9]=(A-I)*z,i[10]=(1-(v+x))*z,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let r=this.determinantAffine();if(r===0)return n.set(1,1,1),t.identity(),this;let l=Wt.set(i[0],i[1],i[2]).length(),c=Wt.set(i[4],i[5],i[6]).length(),u=Wt.set(i[8],i[9],i[10]).length();r<0&&(l=-l),Xe.copy(this);let h=1/l,d=1/c,p=1/u;return Xe.elements[0]*=h,Xe.elements[1]*=h,Xe.elements[2]*=h,Xe.elements[4]*=d,Xe.elements[5]*=d,Xe.elements[6]*=d,Xe.elements[8]*=p,Xe.elements[9]*=p,Xe.elements[10]*=p,t.setFromRotationMatrix(Xe),n.x=l,n.y=c,n.z=u,this}makePerspective(e,t,n,i,r,l,c=vn,u=!1){let h=this.elements,d=2*r/(t-e),p=2*r/(n-i),v=(t+e)/(t-e),_=(n+i)/(n-i),g,x;if(u)g=r/(l-r),x=l*r/(l-r);else if(c===vn)g=-(l+r)/(l-r),x=-2*l*r/(l-r);else if(c===Fr)g=-l/(l-r),x=-l*r/(l-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return h[0]=d,h[4]=0,h[8]=v,h[12]=0,h[1]=0,h[5]=p,h[9]=_,h[13]=0,h[2]=0,h[6]=0,h[10]=g,h[14]=x,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,n,i,r,l,c=vn,u=!1){let h=this.elements,d=2/(t-e),p=2/(n-i),v=-(t+e)/(t-e),_=-(n+i)/(n-i),g,x;if(u)g=1/(l-r),x=l/(l-r);else if(c===vn)g=-2/(l-r),x=-(l+r)/(l-r);else if(c===Fr)g=-1/(l-r),x=-r/(l-r);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return h[0]=d,h[4]=0,h[8]=0,h[12]=v,h[1]=0,h[5]=p,h[9]=0,h[13]=_,h[2]=0,h[6]=0,h[10]=g,h[14]=x,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Wt=new F,Xe=new st,ph=new F(0,0,0),mh=new F(1,1,1),_t=new F,si=new F,Ue=new F,Oa=new st,Ba=new at,Sn=class s{constructor(e=0,t=0,n=0,i=s.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,r=i[0],l=i[4],c=i[8],u=i[1],h=i[5],d=i[9],p=i[2],v=i[6],_=i[10];switch(t){case"XYZ":this._y=Math.asin(j(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,_),this._z=Math.atan2(-l,r)):(this._x=Math.atan2(v,h),this._z=0);break;case"YXZ":this._x=Math.asin(-j(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(c,_),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-p,r),this._z=0);break;case"ZXY":this._x=Math.asin(j(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(-p,_),this._z=Math.atan2(-l,h)):(this._y=0,this._z=Math.atan2(u,r));break;case"ZYX":this._y=Math.asin(-j(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(v,_),this._z=Math.atan2(u,r)):(this._x=0,this._z=Math.atan2(-l,h));break;case"YZX":this._z=Math.asin(j(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-p,r)):(this._x=0,this._y=Math.atan2(c,_));break;case"XZY":this._z=Math.asin(-j(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(v,h),this._y=Math.atan2(c,r)):(this._x=Math.atan2(-d,_),this._y=0);break;default:Ee("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Oa.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Oa,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ba.setFromEuler(this),this.setFromQuaternion(Ba,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Sn.DEFAULT_ORDER="XYZ";var yi=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},gh=0,za=new F,Xt=new at,nt=new st,ai=new F,gn=new F,_h=new F,yh=new at,Va=new F(1,0,0),ka=new F(0,1,0),Ga=new F(0,0,1),Ha={type:"added"},vh={type:"removed"},qt={type:"childadded",child:null},gr={type:"childremoved",child:null},tn=class s extends Qt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:gh++}),this.uuid=jr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=s.DEFAULT_UP.clone();let e=new F,t=new Sn,n=new at,i=new F(1,1,1);function r(){n.setFromEuler(t,!1)}function l(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new st},normalMatrix:{value:new Z}}),this.matrix=new st,this.matrixWorld=new st,this.matrixAutoUpdate=s.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=s.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new yi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Xt.setFromAxisAngle(e,t),this.quaternion.multiply(Xt),this}rotateOnWorldAxis(e,t){return Xt.setFromAxisAngle(e,t),this.quaternion.premultiply(Xt),this}rotateX(e){return this.rotateOnAxis(Va,e)}rotateY(e){return this.rotateOnAxis(ka,e)}rotateZ(e){return this.rotateOnAxis(Ga,e)}translateOnAxis(e,t){return za.copy(e).applyQuaternion(this.quaternion),this.position.add(za.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Va,e)}translateY(e){return this.translateOnAxis(ka,e)}translateZ(e){return this.translateOnAxis(Ga,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(nt.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ai.copy(e):ai.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),gn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?nt.lookAt(gn,ai,this.up):nt.lookAt(ai,gn,this.up),this.quaternion.setFromRotationMatrix(nt),i&&(nt.extractRotation(i.matrixWorld),Xt.setFromRotationMatrix(nt),this.quaternion.premultiply(Xt.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(me("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Ha),qt.child=e,this.dispatchEvent(qt),qt.child=null):me("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(vh),gr.child=e,this.dispatchEvent(gr),gr.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),nt.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),nt.multiply(e.parent.matrixWorld)),e.applyMatrix4(nt),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Ha),qt.child=e,this.dispatchEvent(qt),qt.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let l=this.children[n].getObjectByProperty(e,t);if(l!==void 0)return l}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let r=0,l=i.length;r<l;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,e,_h),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,yh,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,i=e.z,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let r=this.children;for(let l=0,c=r.length;l<c;l++)r[l].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,i.name=this.name,i.castShadow=this.castShadow,i.receiveShadow=this.receiveShadow,i.visible=this.visible,i.frustumCulled=this.frustumCulled,i.renderOrder=this.renderOrder,i.static=this.static,i.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function r(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);let c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){let u=c.shapes;if(Array.isArray(u))for(let h=0,d=u.length;h<d;h++){let p=u[h];r(e.shapes,p)}else r(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let c=[];for(let u=0,h=this.material.length;u<h;u++)c.push(r(e.materials,this.material[u]));i.material=c}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){let u=this.animations[c];i.animations.push(r(e.animations,u))}}if(t){let c=l(e.geometries),u=l(e.materials),h=l(e.textures),d=l(e.images),p=l(e.shapes),v=l(e.skeletons),_=l(e.animations),g=l(e.nodes);c.length>0&&(n.geometries=c),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),d.length>0&&(n.images=d),p.length>0&&(n.shapes=p),v.length>0&&(n.skeletons=v),_.length>0&&(n.animations=_),g.length>0&&(n.nodes=g)}return n.object=i,n;function l(c){let u=[];for(let h in c){let d=c[h];delete d.metadata,u.push(d)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};tn.DEFAULT_UP=new F(0,1,0);tn.DEFAULT_MATRIX_AUTO_UPDATE=!0;tn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var ao={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},yt={h:0,s:0,l:0},oi={h:0,s:0,l:0};function _r(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}var ge=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ge){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ke.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=ke.workingColorSpace){return this.r=e,this.g=t,this.b=n,ke.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=ke.workingColorSpace){if(e=uh(e,1),t=j(t,0,1),n=j(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,l=2*n-r;this.r=_r(l,r,e+1/3),this.g=_r(l,r,e),this.b=_r(l,r,e-1/3)}return ke.colorSpaceToWorking(this,i),this}setStyle(e,t=Ge){function n(r){r!==void 0&&parseFloat(r)<1&&Ee("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:Ee("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let r=i[1],l=r.length;if(l===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(r,16),t);Ee("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ge){let n=ao[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ee("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=rt(e.r),this.g=rt(e.g),this.b=rt(e.b),this}copyLinearToSRGB(e){return this.r=Kt(e.r),this.g=Kt(e.g),this.b=Kt(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ge){return ke.workingToColorSpace(Te.copy(this),e),Math.round(j(Te.r*255,0,255))*65536+Math.round(j(Te.g*255,0,255))*256+Math.round(j(Te.b*255,0,255))}getHexString(e=Ge){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ke.workingColorSpace){ke.workingToColorSpace(Te.copy(this),t);let n=Te.r,i=Te.g,r=Te.b,l=Math.max(n,i,r),c=Math.min(n,i,r),u,h,d=(c+l)/2;if(c===l)u=0,h=0;else{let p=l-c;switch(h=d<=.5?p/(l+c):p/(2-l-c),l){case n:u=(i-r)/p+(i<r?6:0);break;case i:u=(r-n)/p+2;break;case r:u=(n-i)/p+4;break}u/=6}return e.h=u,e.s=h,e.l=d,e}getRGB(e,t=ke.workingColorSpace){return ke.workingToColorSpace(Te.copy(this),t),e.r=Te.r,e.g=Te.g,e.b=Te.b,e}getStyle(e=Ge){ke.workingToColorSpace(Te.copy(this),e);let t=Te.r,n=Te.g,i=Te.b;return e!==Ge?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(yt),this.setHSL(yt.h+e,yt.s+t,yt.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(yt),e.getHSL(oi);let n=hr(yt.h,oi.h,t),i=hr(yt.s,oi.s,t),r=hr(yt.l,oi.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Te=new ge;ge.NAMES=ao;var We=class{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(qe.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qe.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=qe.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let l=0,c=r.count;l<c;l++)e.isMesh===!0?e.getVertexPosition(l,qe):qe.fromBufferAttribute(r,l),qe.applyMatrix4(e.matrixWorld),this.expandByPoint(qe);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),li.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),li.copy(n.boundingBox)),li.applyMatrix4(e.matrixWorld),this.union(li)}let i=e.children;for(let r=0,l=i.length;r<l;r++)this.expandByObject(i[r],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,qe),qe.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(_n),ci.subVectors(this.max,_n),Yt.subVectors(e.a,_n),$t.subVectors(e.b,_n),Zt.subVectors(e.c,_n),vt.subVectors($t,Yt),xt.subVectors(Zt,$t),Ct.subVectors(Yt,Zt);let t=[0,-vt.z,vt.y,0,-xt.z,xt.y,0,-Ct.z,Ct.y,vt.z,0,-vt.x,xt.z,0,-xt.x,Ct.z,0,-Ct.x,-vt.y,vt.x,0,-xt.y,xt.x,0,-Ct.y,Ct.x,0];return!yr(t,Yt,$t,Zt,ci)||(t=[1,0,0,0,1,0,0,0,1],!yr(t,Yt,$t,Zt,ci))?!1:(ui.crossVectors(vt,xt),t=[ui.x,ui.y,ui.z],yr(t,Yt,$t,Zt,ci))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qe).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qe).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(it[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),it[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),it[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),it[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),it[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),it[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),it[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),it[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(it),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},it=[new F,new F,new F,new F,new F,new F,new F,new F],qe=new F,li=new We,Yt=new F,$t=new F,Zt=new F,vt=new F,xt=new F,Ct=new F,_n=new F,ci=new F,ui=new F,Rt=new F;function yr(s,e,t,n,i){for(let r=0,l=s.length-3;r<=l;r+=3){Rt.fromArray(s,r);let c=i.x*Math.abs(Rt.x)+i.y*Math.abs(Rt.y)+i.z*Math.abs(Rt.z),u=e.dot(Rt),h=t.dot(Rt),d=n.dot(Rt);if(Math.max(-Math.max(u,h,d),Math.min(u,h,d))>c)return!1}return!0}var fe=new F,hi=new He,xh=0,nn=class extends Qt{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:xh++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ro,this.updateRanges=[],this.gpuType=no,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)hi.fromBufferAttribute(this,t),hi.applyMatrix3(e),this.setXY(t,hi.x,hi.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)fe.fromBufferAttribute(this,t),fe.applyMatrix3(e),this.setXYZ(t,fe.x,fe.y,fe.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)fe.fromBufferAttribute(this,t),fe.applyMatrix4(e),this.setXYZ(t,fe.x,fe.y,fe.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)fe.fromBufferAttribute(this,t),fe.applyNormalMatrix(e),this.setXYZ(t,fe.x,fe.y,fe.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)fe.fromBufferAttribute(this,t),fe.transformDirection(e),this.setXYZ(t,fe.x,fe.y,fe.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=mn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Le(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=mn(t,this.array)),t}setX(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=mn(t,this.array)),t}setY(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=mn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=mn(t,this.array)),t}setW(e,t){return this.normalized&&(t=Le(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Le(t,this.array),n=Le(n,this.array),i=Le(i,this.array),r=Le(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}};var bn=class extends nn{constructor(e,t,n){super(new Float32Array(e),t,n)}};function oo(s){let e={};for(let t in s){e[t]={};for(let n in s[t]){let i=s[t][n];if(Wa(i))i.isRenderTargetTexture?(Ee("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(Wa(i[0])){let r=[];for(let l=0,c=i.length;l<c;l++)r[l]=i[l].clone();e[t][n]=r}else e[t][n]=i.slice();else e[t][n]=i}}return e}function Ae(s){let e={};for(let t=0;t<s.length;t++){let n=oo(s[t]);for(let i in n)e[i]=n[i]}return e}function Wa(s){return s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)}function Jt(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function vr(s){return s!==void 0&&s.inTangents!==void 0&&s.outTangents!==void 0}var St=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];n:{e:{let l;t:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(r=i,i=t[++n],e<i)break e}l=t.length;break t}if(!(e>=r)){let c=t[1];e<c&&(n=2,r=c);for(let u=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=r,r=t[--n-1],e>=r)break e}l=n,n=0;break t}break n}for(;n<l;){let c=n+l>>>1;e<t[c]?l=c:n=c+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let l=0;l!==i;++l)t[l]=n[r+l];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},vi=class extends St{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ir,endingEnd:Ir}}intervalChanged_(e,t,n){let i=this.parameterPositions,r=e-2,l=e+1,c=i[r],u=i[l];if(c===void 0)switch(this.getSettings_().endingStart){case Lr:r=e,c=2*t-n;break;case Dr:r=i.length-2,c=t+i[r]-i[r+1];break;default:r=e,c=n}if(u===void 0)switch(this.getSettings_().endingEnd){case Lr:l=e,u=2*n-t;break;case Dr:l=1,u=n+i[1]-i[0];break;default:l=e-1,u=t}let h=(n-t)*.5,d=this.valueSize;this._weightPrev=h/(t-c),this._weightNext=h/(u-n),this._offsetPrev=r*d,this._offsetNext=l*d}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=this._offsetPrev,p=this._offsetNext,v=this._weightPrev,_=this._weightNext,g=(n-t)/(i-t),x=g*g,A=x*g,E=-v*A+2*v*x-v*g,I=(1+v)*A+(-1.5-2*v)*x+(-.5+v)*g+1,N=(-1-_)*A+(1.5+_)*x+.5*g,O=_*A-_*x;for(let C=0;C!==c;++C)r[C]=E*l[d+C]+I*l[h+C]+N*l[u+C]+O*l[p+C];return r}},xi=class extends St{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=(n-t)/(i-t),p=1-d;for(let v=0;v!==c;++v)r[v]=l[h+v]*p+l[u+v]*d;return r}},Si=class extends St{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},bi=class extends St{interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,d=this.inTangents,p=this.outTangents;if(!d||!p){let g=(n-t)/(i-t),x=1-g;for(let A=0;A!==c;++A)r[A]=l[h+A]*x+l[u+A]*g;return r}let v=c*2,_=e-1;for(let g=0;g!==c;++g){let x=l[h+g],A=l[u+g],E=_*v+g*2,I=p[E],N=p[E+1],O=e*v+g*2,C=d[O],G=d[O+1],z=bh(n,t,I,C,i);r[g]=lo(z,x,N,G,A)}return r}};function lo(s,e,t,n,i){let r=1-s;return r*r*r*e+3*r*r*s*t+3*r*s*s*n+s*s*s*i}function Sh(s,e,t,n,i){let r=1-s;return 3*r*r*(t-e)+6*r*s*(n-t)+3*s*s*(i-n)}function bh(s,e,t,n,i){let r=(s-e)/(i-e);for(let l=0;l<8;l++){let c=lo(r,e,t,n,i)-s;if(Math.abs(c)<1e-10)break;let u=Sh(r,e,t,n,i);if(Math.abs(u)<1e-10)break;r=Math.max(0,Math.min(1,r-c/u))}return r}var Ne=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Jt(t,this.TimeBufferType),this.values=Jt(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Jt(e.times,Array),values:Jt(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i),vr(e.settings)&&(n.settings={inTangents:Jt(e.settings.inTangents,Array),outTangents:Jt(e.settings.outTangents,Array)})}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Si(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new xi(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new vi(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new bi(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case xn:t=this.InterpolantFactoryMethodDiscrete;break;case pi:t=this.InterpolantFactoryMethodLinear;break;case fi:t=this.InterpolantFactoryMethodSmooth;break;case Pr:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Ee("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return xn;case this.InterpolantFactoryMethodLinear:return pi;case this.InterpolantFactoryMethodSmooth:return fi;case this.InterpolantFactoryMethodBezier:return Pr}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e;vr(this.settings)&&(Xa(this.settings.inTangents,e),Xa(this.settings.outTangents,e))}return this}trim(e,t){let n=this.times,i=n.length,r=0,l=i-1;for(;r!==i&&n[r]<e;)++r;for(;l!==-1&&n[l]>t;)--l;if(++l,r!==0||l!==i){r>=l&&(l=Math.max(l,1),r=l-1);let c=this.getValueSize();this.times=n.slice(r,l),this.values=this.values.slice(r*c,l*c)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(me("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,r=n.length;r===0&&(me("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==r;c++){let u=n[c];if(typeof u=="number"&&isNaN(u)){me("KeyframeTrack: Time is not a valid number.",this,c,u),e=!1;break}if(l!==null&&l>u){me("KeyframeTrack: Out of order keys.",this,c,u,l),e=!1;break}l=u}if(i!==void 0&&oh(i))for(let c=0,u=i.length;c!==u;++c){let h=i[c];if(isNaN(h)){me("KeyframeTrack: Value is not a valid number.",this,c,h),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===fi,r=e.length-1,l=1;for(let c=1;c<r;++c){let u=!1,h=e[c],d=e[c+1];if(h!==d&&(c!==1||h!==e[0]))if(i)u=!0;else{let p=c*n,v=p-n,_=p+n;for(let g=0;g!==n;++g){let x=t[p+g];if(x!==t[v+g]||x!==t[_+g]){u=!0;break}}}if(u){if(c!==l){e[l]=e[c];let p=c*n,v=l*n;for(let _=0;_!==n;++_)t[v+_]=t[p+_]}++l}}if(r>0){e[l]=e[r];for(let c=r*n,u=l*n,h=0;h!==n;++h)t[u+h]=t[c+h];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,vr(this.settings)&&(i.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),i}};function Xa(s,e){for(let t=0,n=s.length;t!==n;t+=2)s[t]*=e}Ne.prototype.ValueTypeName="";Ne.prototype.TimeBufferType=Float32Array;Ne.prototype.ValueBufferType=Float32Array;Ne.prototype.DefaultInterpolation=pi;var bt=class extends Ne{constructor(e,t,n){super(e,t,n)}};bt.prototype.ValueTypeName="bool";bt.prototype.ValueBufferType=Array;bt.prototype.DefaultInterpolation=xn;bt.prototype.InterpolantFactoryMethodLinear=void 0;bt.prototype.InterpolantFactoryMethodSmooth=void 0;var Mi=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};Mi.prototype.ValueTypeName="color";var wi=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};wi.prototype.ValueTypeName="number";var Ti=class extends St{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let r=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=(n-t)/(i-t),h=e*c;for(let d=h+c;h!==d;h+=4)at.slerpFlat(r,0,l,h-c,l,h,u);return r}},Mn=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Ti(this.times,this.values,this.getValueSize(),e)}};Mn.prototype.ValueTypeName="quaternion";Mn.prototype.InterpolantFactoryMethodSmooth=void 0;var Mt=class extends Ne{constructor(e,t,n){super(e,t,n)}};Mt.prototype.ValueTypeName="string";Mt.prototype.ValueBufferType=Array;Mt.prototype.DefaultInterpolation=xn;Mt.prototype.InterpolantFactoryMethodLinear=void 0;Mt.prototype.InterpolantFactoryMethodSmooth=void 0;var Ei=class extends Ne{constructor(e,t,n,i){super(e,t,n,i)}};Ei.prototype.ValueTypeName="vector";var Ai=class{constructor(e,t,n){let i=this,r=!1,l=0,c=0,u,h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(d){c++,r===!1&&i.onStart!==void 0&&i.onStart(d,l,c),r=!0},this.itemEnd=function(d){l++,i.onProgress!==void 0&&i.onProgress(d,l,c),l===c&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return d=d.normalize("NFC"),u?u(d):d},this.setURLModifier=function(d){return u=d,this},this.addHandler=function(d,p){return h.push(d,p),this},this.removeHandler=function(d){let p=h.indexOf(d);return p!==-1&&h.splice(p,2),this},this.getHandler=function(d){for(let p=0,v=h.length;p<v;p+=2){let _=h[p],g=h[p+1];if(_.global&&(_.lastIndex=0),_.test(d))return g}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},co=new Ai,Ci=class{constructor(e){this.manager=e!==void 0?e:co,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Ci.DEFAULT_MATERIAL_NAME="__DEFAULT";var Kr="\\[\\]\\.:\\/",Mh=new RegExp("["+Kr+"]","g"),Qr="[^"+Kr+"]",wh="[^"+Kr.replace("\\.","")+"]",Th=/((?:WC+[\/:])*)/.source.replace("WC",Qr),Eh=/(WCOD+)?/.source.replace("WCOD",wh),Ah=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Qr),Ch=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Qr),Rh=new RegExp("^"+Th+Eh+Ah+Ch+"$"),Ph=["material","materials","bones","map"],zr=class{constructor(e,t,n){let i=n||ae.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},ae=class s{constructor(e,t,n){this.path=t,this.parsedPath=n||s.parseTrackName(t),this.node=s.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new s.Composite(e,t,n):new s(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Mh,"")}static parseTrackName(e){let t=Rh.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let r=n.nodeName.substring(i+1);Ph.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(r){for(let l=0;l<r.length;l++){let c=r[l];if(c.name===t||c.uuid===t)return c;let u=n(c.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=s.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Ee("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){me("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){me("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){me("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===h){h=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){me("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){me("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){me("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){me("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}let l=e[i];if(l===void 0){let h=t.nodeName;me("PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?c=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){me("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){me("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}u=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=r}else l.fromArray!==void 0&&l.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(u=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ae.Composite=zr;ae.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ae.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ae.prototype.GetterByBindingType=[ae.prototype._getValue_direct,ae.prototype._getValue_array,ae.prototype._getValue_arrayElement,ae.prototype._getValue_toArray];ae.prototype.SetterByBindingTypeAndVersioning=[[ae.prototype._setValue_direct,ae.prototype._setValue_direct_setNeedsUpdate,ae.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_array,ae.prototype._setValue_array_setNeedsUpdate,ae.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_arrayElement,ae.prototype._setValue_arrayElement_setNeedsUpdate,ae.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ae.prototype._setValue_fromArray,ae.prototype._setValue_fromArray_setNeedsUpdate,ae.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Hm=new Float32Array(1);var Vr=class s{static{s.prototype.isMatrix2=!0}constructor(e,t,n,i){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){let r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"186"}}));typeof window<"u"&&(window.__THREE__?Ee("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="186");var Ih=`#ifdef USE_ALPHAHASH
|
|
8
|
+
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
9
|
+
#endif`,Lh=`#ifdef USE_ALPHAHASH
|
|
10
|
+
const float ALPHA_HASH_SCALE = 0.05;
|
|
11
|
+
float hash2D( vec2 value ) {
|
|
12
|
+
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
|
|
13
|
+
}
|
|
14
|
+
float hash3D( vec3 value ) {
|
|
15
|
+
return hash2D( vec2( hash2D( value.xy ), value.z ) );
|
|
16
|
+
}
|
|
17
|
+
float getAlphaHashThreshold( vec3 position ) {
|
|
18
|
+
float maxDeriv = max(
|
|
19
|
+
length( dFdx( position.xyz ) ),
|
|
20
|
+
length( dFdy( position.xyz ) )
|
|
21
|
+
);
|
|
22
|
+
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
|
|
23
|
+
vec2 pixScales = vec2(
|
|
24
|
+
exp2( floor( log2( pixScale ) ) ),
|
|
25
|
+
exp2( ceil( log2( pixScale ) ) )
|
|
26
|
+
);
|
|
27
|
+
vec2 alpha = vec2(
|
|
28
|
+
hash3D( floor( pixScales.x * position.xyz ) ),
|
|
29
|
+
hash3D( floor( pixScales.y * position.xyz ) )
|
|
30
|
+
);
|
|
31
|
+
float lerpFactor = fract( log2( pixScale ) );
|
|
32
|
+
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
|
|
33
|
+
float a = min( lerpFactor, 1.0 - lerpFactor );
|
|
34
|
+
vec3 cases = vec3(
|
|
35
|
+
x * x / ( 2.0 * a * ( 1.0 - a ) ),
|
|
36
|
+
( x - 0.5 * a ) / ( 1.0 - a ),
|
|
37
|
+
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
|
|
38
|
+
);
|
|
39
|
+
float threshold = ( x < ( 1.0 - a ) )
|
|
40
|
+
? ( ( x < a ) ? cases.x : cases.y )
|
|
41
|
+
: cases.z;
|
|
42
|
+
return clamp( threshold , 1.0e-6, 1.0 );
|
|
43
|
+
}
|
|
44
|
+
#endif`,Dh=`#ifdef USE_ALPHAMAP
|
|
45
|
+
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
|
|
46
|
+
#endif`,Uh=`#ifdef USE_ALPHAMAP
|
|
47
|
+
uniform sampler2D alphaMap;
|
|
48
|
+
#endif`,Nh=`#ifdef USE_ALPHATEST
|
|
49
|
+
#ifdef ALPHA_TO_COVERAGE
|
|
50
|
+
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
|
|
51
|
+
if ( diffuseColor.a == 0.0 ) discard;
|
|
52
|
+
#else
|
|
53
|
+
if ( diffuseColor.a < alphaTest ) discard;
|
|
54
|
+
#endif
|
|
55
|
+
#endif`,Fh=`#ifdef USE_ALPHATEST
|
|
56
|
+
uniform float alphaTest;
|
|
57
|
+
#endif`,Oh=`#ifdef USE_AOMAP
|
|
58
|
+
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
|
|
59
|
+
reflectedLight.indirectDiffuse *= ambientOcclusion;
|
|
60
|
+
#if defined( USE_CLEARCOAT )
|
|
61
|
+
clearcoatSpecularIndirect *= ambientOcclusion;
|
|
62
|
+
#endif
|
|
63
|
+
#if defined( USE_SHEEN )
|
|
64
|
+
sheenSpecularIndirect *= ambientOcclusion;
|
|
65
|
+
#endif
|
|
66
|
+
#if defined( USE_ENVMAP ) && defined( STANDARD )
|
|
67
|
+
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
68
|
+
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
|
|
69
|
+
#endif
|
|
70
|
+
#endif`,Bh=`#ifdef USE_AOMAP
|
|
71
|
+
uniform sampler2D aoMap;
|
|
72
|
+
uniform float aoMapIntensity;
|
|
73
|
+
#endif`,zh=`#ifdef USE_BATCHING
|
|
74
|
+
#if ! defined( GL_ANGLE_multi_draw )
|
|
75
|
+
#define gl_DrawID _gl_DrawID
|
|
76
|
+
uniform int _gl_DrawID;
|
|
77
|
+
#endif
|
|
78
|
+
uniform highp sampler2D batchingTexture;
|
|
79
|
+
uniform highp usampler2D batchingIdTexture;
|
|
80
|
+
mat4 getBatchingMatrix( const in float i ) {
|
|
81
|
+
int size = textureSize( batchingTexture, 0 ).x;
|
|
82
|
+
int j = int( i ) * 4;
|
|
83
|
+
int x = j % size;
|
|
84
|
+
int y = j / size;
|
|
85
|
+
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
|
|
86
|
+
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
|
|
87
|
+
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
|
|
88
|
+
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
|
|
89
|
+
return mat4( v1, v2, v3, v4 );
|
|
90
|
+
}
|
|
91
|
+
float getIndirectIndex( const in int i ) {
|
|
92
|
+
int size = textureSize( batchingIdTexture, 0 ).x;
|
|
93
|
+
int x = i % size;
|
|
94
|
+
int y = i / size;
|
|
95
|
+
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
|
|
96
|
+
}
|
|
97
|
+
#endif
|
|
98
|
+
#ifdef USE_BATCHING_COLOR
|
|
99
|
+
uniform sampler2D batchingColorTexture;
|
|
100
|
+
vec4 getBatchingColor( const in float i ) {
|
|
101
|
+
int size = textureSize( batchingColorTexture, 0 ).x;
|
|
102
|
+
int j = int( i );
|
|
103
|
+
int x = j % size;
|
|
104
|
+
int y = j / size;
|
|
105
|
+
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
|
|
106
|
+
}
|
|
107
|
+
#endif`,Vh=`#ifdef USE_BATCHING
|
|
108
|
+
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
|
|
109
|
+
#endif`,kh=`vec3 transformed = vec3( position );
|
|
110
|
+
#ifdef USE_ALPHAHASH
|
|
111
|
+
vPosition = vec3( position );
|
|
112
|
+
#endif`,Gh=`vec3 objectNormal = vec3( normal );
|
|
113
|
+
#ifdef USE_TANGENT
|
|
114
|
+
vec3 objectTangent = vec3( tangent.xyz );
|
|
115
|
+
#endif`,Hh=`float G_BlinnPhong_Implicit( ) {
|
|
116
|
+
return 0.25;
|
|
117
|
+
}
|
|
118
|
+
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
|
|
119
|
+
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
|
|
120
|
+
}
|
|
121
|
+
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
|
|
122
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
123
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
124
|
+
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
125
|
+
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
|
|
126
|
+
float G = G_BlinnPhong_Implicit( );
|
|
127
|
+
float D = D_BlinnPhong( shininess, dotNH );
|
|
128
|
+
return F * ( G * D );
|
|
129
|
+
} // validated`,Wh=`#ifdef USE_IRIDESCENCE
|
|
130
|
+
const mat3 XYZ_TO_REC709 = mat3(
|
|
131
|
+
3.2404542, -0.9692660, 0.0556434,
|
|
132
|
+
-1.5371385, 1.8760108, -0.2040259,
|
|
133
|
+
-0.4985314, 0.0415560, 1.0572252
|
|
134
|
+
);
|
|
135
|
+
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
|
|
136
|
+
vec3 sqrtF0 = sqrt( fresnel0 );
|
|
137
|
+
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
|
|
138
|
+
}
|
|
139
|
+
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
|
|
140
|
+
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
|
|
141
|
+
}
|
|
142
|
+
float IorToFresnel0( float transmittedIor, float incidentIor ) {
|
|
143
|
+
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
|
|
144
|
+
}
|
|
145
|
+
vec3 evalSensitivity( float OPD, vec3 shift ) {
|
|
146
|
+
float phase = 2.0 * PI * OPD * 1.0e-9;
|
|
147
|
+
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
|
|
148
|
+
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
|
|
149
|
+
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
|
|
150
|
+
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
|
|
151
|
+
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
|
|
152
|
+
xyz /= 1.0685e-7;
|
|
153
|
+
vec3 rgb = XYZ_TO_REC709 * xyz;
|
|
154
|
+
return rgb;
|
|
155
|
+
}
|
|
156
|
+
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
|
|
157
|
+
vec3 I;
|
|
158
|
+
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
|
|
159
|
+
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
|
|
160
|
+
float cosTheta2Sq = 1.0 - sinTheta2Sq;
|
|
161
|
+
if ( cosTheta2Sq < 0.0 ) {
|
|
162
|
+
return vec3( 1.0 );
|
|
163
|
+
}
|
|
164
|
+
float cosTheta2 = sqrt( cosTheta2Sq );
|
|
165
|
+
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
|
|
166
|
+
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
|
|
167
|
+
float T121 = 1.0 - R12;
|
|
168
|
+
float phi12 = 0.0;
|
|
169
|
+
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
|
|
170
|
+
float phi21 = PI - phi12;
|
|
171
|
+
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
|
|
172
|
+
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
|
|
173
|
+
vec3 phi23 = vec3( 0.0 );
|
|
174
|
+
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
|
|
175
|
+
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
|
|
176
|
+
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
|
|
177
|
+
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
|
|
178
|
+
vec3 phi = vec3( phi21 ) + phi23;
|
|
179
|
+
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
|
|
180
|
+
vec3 r123 = sqrt( R123 );
|
|
181
|
+
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
|
|
182
|
+
vec3 C0 = R12 + Rs;
|
|
183
|
+
I = C0;
|
|
184
|
+
vec3 Cm = Rs - T121;
|
|
185
|
+
for ( int m = 1; m <= 2; ++ m ) {
|
|
186
|
+
Cm *= r123;
|
|
187
|
+
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
|
|
188
|
+
I += Cm * Sm;
|
|
189
|
+
}
|
|
190
|
+
return max( I, vec3( 0.0 ) );
|
|
191
|
+
}
|
|
192
|
+
#endif`,Xh=`#ifdef USE_BUMPMAP
|
|
193
|
+
uniform sampler2D bumpMap;
|
|
194
|
+
uniform float bumpScale;
|
|
195
|
+
vec2 dHdxy_fwd() {
|
|
196
|
+
vec2 dSTdx = dFdx( vBumpMapUv );
|
|
197
|
+
vec2 dSTdy = dFdy( vBumpMapUv );
|
|
198
|
+
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
|
|
199
|
+
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
|
|
200
|
+
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
|
|
201
|
+
return vec2( dBx, dBy );
|
|
202
|
+
}
|
|
203
|
+
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
|
|
204
|
+
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
|
|
205
|
+
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
|
|
206
|
+
vec3 vN = surf_norm;
|
|
207
|
+
vec3 R1 = cross( vSigmaY, vN );
|
|
208
|
+
vec3 R2 = cross( vN, vSigmaX );
|
|
209
|
+
float fDet = dot( vSigmaX, R1 ) * faceDirection;
|
|
210
|
+
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
|
|
211
|
+
return normalize( abs( fDet ) * surf_norm - vGrad );
|
|
212
|
+
}
|
|
213
|
+
#endif`,qh=`#if NUM_CLIPPING_PLANES > 0
|
|
214
|
+
vec4 plane;
|
|
215
|
+
#ifdef ALPHA_TO_COVERAGE
|
|
216
|
+
float distanceToPlane, distanceGradient;
|
|
217
|
+
float clipOpacity = 1.0;
|
|
218
|
+
#pragma unroll_loop_start
|
|
219
|
+
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
220
|
+
plane = clippingPlanes[ i ];
|
|
221
|
+
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
|
222
|
+
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
|
223
|
+
clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
|
224
|
+
if ( clipOpacity == 0.0 ) discard;
|
|
225
|
+
}
|
|
226
|
+
#pragma unroll_loop_end
|
|
227
|
+
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
228
|
+
float unionClipOpacity = 1.0;
|
|
229
|
+
#pragma unroll_loop_start
|
|
230
|
+
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
231
|
+
plane = clippingPlanes[ i ];
|
|
232
|
+
distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
|
|
233
|
+
distanceGradient = fwidth( distanceToPlane ) / 2.0;
|
|
234
|
+
unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
|
|
235
|
+
}
|
|
236
|
+
#pragma unroll_loop_end
|
|
237
|
+
clipOpacity *= 1.0 - unionClipOpacity;
|
|
238
|
+
#endif
|
|
239
|
+
diffuseColor.a *= clipOpacity;
|
|
240
|
+
if ( diffuseColor.a == 0.0 ) discard;
|
|
241
|
+
#else
|
|
242
|
+
#pragma unroll_loop_start
|
|
243
|
+
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
|
|
244
|
+
plane = clippingPlanes[ i ];
|
|
245
|
+
if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
|
|
246
|
+
}
|
|
247
|
+
#pragma unroll_loop_end
|
|
248
|
+
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
|
|
249
|
+
bool clipped = true;
|
|
250
|
+
#pragma unroll_loop_start
|
|
251
|
+
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
|
|
252
|
+
plane = clippingPlanes[ i ];
|
|
253
|
+
clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
|
|
254
|
+
}
|
|
255
|
+
#pragma unroll_loop_end
|
|
256
|
+
if ( clipped ) discard;
|
|
257
|
+
#endif
|
|
258
|
+
#endif
|
|
259
|
+
#endif`,Yh=`#if NUM_CLIPPING_PLANES > 0
|
|
260
|
+
varying vec3 vClipPosition;
|
|
261
|
+
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
|
|
262
|
+
#endif`,$h=`#if NUM_CLIPPING_PLANES > 0
|
|
263
|
+
varying vec3 vClipPosition;
|
|
264
|
+
#endif`,Zh=`#if NUM_CLIPPING_PLANES > 0
|
|
265
|
+
vClipPosition = - mvPosition.xyz;
|
|
266
|
+
#endif`,Jh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
267
|
+
diffuseColor *= vColor;
|
|
268
|
+
#endif`,jh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
269
|
+
varying vec4 vColor;
|
|
270
|
+
#endif`,Kh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
271
|
+
varying vec4 vColor;
|
|
272
|
+
#endif`,Qh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
|
|
273
|
+
vColor = vec4( 1.0 );
|
|
274
|
+
#endif
|
|
275
|
+
#ifdef USE_COLOR_ALPHA
|
|
276
|
+
vColor *= color;
|
|
277
|
+
#elif defined( USE_COLOR )
|
|
278
|
+
vColor.rgb *= color;
|
|
279
|
+
#endif
|
|
280
|
+
#ifdef USE_INSTANCING_COLOR
|
|
281
|
+
vColor.rgb *= instanceColor.rgb;
|
|
282
|
+
#endif
|
|
283
|
+
#ifdef USE_BATCHING_COLOR
|
|
284
|
+
vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
|
|
285
|
+
#endif`,ef=`#define PI 3.141592653589793
|
|
286
|
+
#define PI2 6.283185307179586
|
|
287
|
+
#define PI_HALF 1.5707963267948966
|
|
288
|
+
#define RECIPROCAL_PI 0.3183098861837907
|
|
289
|
+
#define RECIPROCAL_PI2 0.15915494309189535
|
|
290
|
+
#define EPSILON 1e-6
|
|
291
|
+
#ifndef saturate
|
|
292
|
+
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
293
|
+
#endif
|
|
294
|
+
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
|
|
295
|
+
float pow2( const in float x ) { return x*x; }
|
|
296
|
+
vec3 pow2( const in vec3 x ) { return x*x; }
|
|
297
|
+
float pow3( const in float x ) { return x*x*x; }
|
|
298
|
+
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
|
|
299
|
+
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
|
|
300
|
+
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
|
|
301
|
+
highp float rand( const in vec2 uv ) {
|
|
302
|
+
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
|
|
303
|
+
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
|
|
304
|
+
return fract( sin( sn ) * c );
|
|
305
|
+
}
|
|
306
|
+
#ifdef HIGH_PRECISION
|
|
307
|
+
float precisionSafeLength( vec3 v ) { return length( v ); }
|
|
308
|
+
#else
|
|
309
|
+
float precisionSafeLength( vec3 v ) {
|
|
310
|
+
float maxComponent = max3( abs( v ) );
|
|
311
|
+
return length( v / maxComponent ) * maxComponent;
|
|
312
|
+
}
|
|
313
|
+
#endif
|
|
314
|
+
struct IncidentLight {
|
|
315
|
+
vec3 color;
|
|
316
|
+
vec3 direction;
|
|
317
|
+
bool visible;
|
|
318
|
+
};
|
|
319
|
+
struct ReflectedLight {
|
|
320
|
+
vec3 directDiffuse;
|
|
321
|
+
vec3 directSpecular;
|
|
322
|
+
vec3 indirectDiffuse;
|
|
323
|
+
vec3 indirectSpecular;
|
|
324
|
+
};
|
|
325
|
+
#ifdef USE_ALPHAHASH
|
|
326
|
+
varying vec3 vPosition;
|
|
327
|
+
#endif
|
|
328
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
329
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
330
|
+
}
|
|
331
|
+
#define inverseTransformDirection transformDirectionByInverseViewMatrix
|
|
332
|
+
vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
|
|
333
|
+
return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
|
|
334
|
+
}
|
|
335
|
+
vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
|
|
336
|
+
return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );
|
|
337
|
+
}
|
|
338
|
+
bool isPerspectiveMatrix( mat4 m ) {
|
|
339
|
+
return m[ 2 ][ 3 ] == - 1.0;
|
|
340
|
+
}
|
|
341
|
+
vec2 equirectUv( in vec3 dir ) {
|
|
342
|
+
float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
|
|
343
|
+
float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
|
|
344
|
+
return vec2( u, v );
|
|
345
|
+
}
|
|
346
|
+
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
|
|
347
|
+
return RECIPROCAL_PI * diffuseColor;
|
|
348
|
+
}
|
|
349
|
+
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
|
|
350
|
+
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
351
|
+
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
352
|
+
}
|
|
353
|
+
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
|
|
354
|
+
float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
|
|
355
|
+
return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
|
|
356
|
+
} // validated`,tf=`#ifdef ENVMAP_TYPE_CUBE_UV
|
|
357
|
+
#define cubeUV_minMipLevel 4.0
|
|
358
|
+
#define cubeUV_minTileSize 16.0
|
|
359
|
+
float getFace( vec3 direction ) {
|
|
360
|
+
vec3 absDirection = abs( direction );
|
|
361
|
+
float face = - 1.0;
|
|
362
|
+
if ( absDirection.x > absDirection.z ) {
|
|
363
|
+
if ( absDirection.x > absDirection.y )
|
|
364
|
+
face = direction.x > 0.0 ? 0.0 : 3.0;
|
|
365
|
+
else
|
|
366
|
+
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
367
|
+
} else {
|
|
368
|
+
if ( absDirection.z > absDirection.y )
|
|
369
|
+
face = direction.z > 0.0 ? 2.0 : 5.0;
|
|
370
|
+
else
|
|
371
|
+
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
372
|
+
}
|
|
373
|
+
return face;
|
|
374
|
+
}
|
|
375
|
+
vec2 getUV( vec3 direction, float face ) {
|
|
376
|
+
vec2 uv;
|
|
377
|
+
if ( face == 0.0 ) {
|
|
378
|
+
uv = vec2( direction.z, direction.y ) / abs( direction.x );
|
|
379
|
+
} else if ( face == 1.0 ) {
|
|
380
|
+
uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
|
|
381
|
+
} else if ( face == 2.0 ) {
|
|
382
|
+
uv = vec2( - direction.x, direction.y ) / abs( direction.z );
|
|
383
|
+
} else if ( face == 3.0 ) {
|
|
384
|
+
uv = vec2( - direction.z, direction.y ) / abs( direction.x );
|
|
385
|
+
} else if ( face == 4.0 ) {
|
|
386
|
+
uv = vec2( - direction.x, direction.z ) / abs( direction.y );
|
|
387
|
+
} else {
|
|
388
|
+
uv = vec2( direction.x, direction.y ) / abs( direction.z );
|
|
389
|
+
}
|
|
390
|
+
return 0.5 * ( uv + 1.0 );
|
|
391
|
+
}
|
|
392
|
+
vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
|
|
393
|
+
float face = getFace( direction );
|
|
394
|
+
float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
|
|
395
|
+
mipInt = max( mipInt, cubeUV_minMipLevel );
|
|
396
|
+
float faceSize = exp2( mipInt );
|
|
397
|
+
highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
|
|
398
|
+
if ( face > 2.0 ) {
|
|
399
|
+
uv.y += faceSize;
|
|
400
|
+
face -= 3.0;
|
|
401
|
+
}
|
|
402
|
+
uv.x += face * faceSize;
|
|
403
|
+
uv.x += filterInt * 3.0 * cubeUV_minTileSize;
|
|
404
|
+
uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
|
|
405
|
+
uv.x *= CUBEUV_TEXEL_WIDTH;
|
|
406
|
+
uv.y *= CUBEUV_TEXEL_HEIGHT;
|
|
407
|
+
#ifdef texture2DGradEXT
|
|
408
|
+
return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
|
|
409
|
+
#else
|
|
410
|
+
return texture2D( envMap, uv ).rgb;
|
|
411
|
+
#endif
|
|
412
|
+
}
|
|
413
|
+
#define cubeUV_r0 1.0
|
|
414
|
+
#define cubeUV_m0 - 2.0
|
|
415
|
+
#define cubeUV_r1 0.8
|
|
416
|
+
#define cubeUV_m1 - 1.0
|
|
417
|
+
#define cubeUV_r4 0.4
|
|
418
|
+
#define cubeUV_m4 2.0
|
|
419
|
+
#define cubeUV_r5 0.305
|
|
420
|
+
#define cubeUV_m5 3.0
|
|
421
|
+
#define cubeUV_r6 0.21
|
|
422
|
+
#define cubeUV_m6 4.0
|
|
423
|
+
float roughnessToMip( float roughness ) {
|
|
424
|
+
float mip = 0.0;
|
|
425
|
+
if ( roughness >= cubeUV_r1 ) {
|
|
426
|
+
mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
|
|
427
|
+
} else if ( roughness >= cubeUV_r4 ) {
|
|
428
|
+
mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
|
|
429
|
+
} else if ( roughness >= cubeUV_r5 ) {
|
|
430
|
+
mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
|
|
431
|
+
} else if ( roughness >= cubeUV_r6 ) {
|
|
432
|
+
mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
|
|
433
|
+
} else {
|
|
434
|
+
mip = - 2.0 * log2( 1.16 * roughness ); }
|
|
435
|
+
return mip;
|
|
436
|
+
}
|
|
437
|
+
vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
|
|
438
|
+
float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
|
|
439
|
+
float mipF = fract( mip );
|
|
440
|
+
float mipInt = floor( mip );
|
|
441
|
+
vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
|
|
442
|
+
if ( mipF == 0.0 ) {
|
|
443
|
+
return vec4( color0, 1.0 );
|
|
444
|
+
} else {
|
|
445
|
+
vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
|
|
446
|
+
return vec4( mix( color0, color1, mipF ), 1.0 );
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
#endif`,nf=`vec3 transformedNormal = objectNormal;
|
|
450
|
+
#ifdef USE_TANGENT
|
|
451
|
+
vec3 transformedTangent = objectTangent;
|
|
452
|
+
#endif
|
|
453
|
+
#ifdef USE_BATCHING
|
|
454
|
+
mat3 bm = mat3( batchingMatrix );
|
|
455
|
+
transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
|
|
456
|
+
transformedNormal = bm * transformedNormal;
|
|
457
|
+
#ifdef USE_TANGENT
|
|
458
|
+
transformedTangent = bm * transformedTangent;
|
|
459
|
+
#endif
|
|
460
|
+
#endif
|
|
461
|
+
#ifdef USE_INSTANCING
|
|
462
|
+
mat3 im = mat3( instanceMatrix );
|
|
463
|
+
transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
|
|
464
|
+
transformedNormal = im * transformedNormal;
|
|
465
|
+
#ifdef USE_TANGENT
|
|
466
|
+
transformedTangent = im * transformedTangent;
|
|
467
|
+
#endif
|
|
468
|
+
#endif
|
|
469
|
+
transformedNormal = normalMatrix * transformedNormal;
|
|
470
|
+
#ifdef FLIP_SIDED
|
|
471
|
+
transformedNormal = - transformedNormal;
|
|
472
|
+
#endif
|
|
473
|
+
#ifdef USE_TANGENT
|
|
474
|
+
transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
|
|
475
|
+
#endif`,rf=`#ifdef USE_DISPLACEMENTMAP
|
|
476
|
+
uniform sampler2D displacementMap;
|
|
477
|
+
uniform float displacementScale;
|
|
478
|
+
uniform float displacementBias;
|
|
479
|
+
#endif`,sf=`#ifdef USE_DISPLACEMENTMAP
|
|
480
|
+
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
|
|
481
|
+
#endif`,af=`#ifdef USE_EMISSIVEMAP
|
|
482
|
+
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
|
|
483
|
+
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
|
|
484
|
+
emissiveColor = sRGBTransferEOTF( emissiveColor );
|
|
485
|
+
#endif
|
|
486
|
+
totalEmissiveRadiance *= emissiveColor.rgb;
|
|
487
|
+
#endif`,of=`#ifdef USE_EMISSIVEMAP
|
|
488
|
+
uniform sampler2D emissiveMap;
|
|
489
|
+
#endif`,lf="gl_FragColor = linearToOutputTexel( gl_FragColor );",cf=`vec4 LinearTransferOETF( in vec4 value ) {
|
|
490
|
+
return value;
|
|
491
|
+
}
|
|
492
|
+
vec4 sRGBTransferEOTF( in vec4 value ) {
|
|
493
|
+
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
|
|
494
|
+
}
|
|
495
|
+
vec4 sRGBTransferOETF( in vec4 value ) {
|
|
496
|
+
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
|
|
497
|
+
}`,uf=`#ifdef USE_ENVMAP
|
|
498
|
+
#ifdef ENV_WORLDPOS
|
|
499
|
+
vec3 cameraToFrag;
|
|
500
|
+
if ( isOrthographic ) {
|
|
501
|
+
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
502
|
+
} else {
|
|
503
|
+
cameraToFrag = normalize( vWorldPosition - cameraPosition );
|
|
504
|
+
}
|
|
505
|
+
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
|
|
506
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
507
|
+
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
|
|
508
|
+
#else
|
|
509
|
+
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
|
|
510
|
+
#endif
|
|
511
|
+
#else
|
|
512
|
+
vec3 reflectVec = vReflect;
|
|
513
|
+
#endif
|
|
514
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
515
|
+
vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
|
|
516
|
+
#ifdef ENVMAP_BLENDING_MULTIPLY
|
|
517
|
+
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
|
|
518
|
+
#elif defined( ENVMAP_BLENDING_MIX )
|
|
519
|
+
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
|
|
520
|
+
#elif defined( ENVMAP_BLENDING_ADD )
|
|
521
|
+
outgoingLight += envColor.xyz * specularStrength * reflectivity;
|
|
522
|
+
#endif
|
|
523
|
+
#endif
|
|
524
|
+
#endif`,hf=`#ifdef USE_ENVMAP
|
|
525
|
+
uniform float envMapIntensity;
|
|
526
|
+
uniform mat3 envMapRotation;
|
|
527
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
528
|
+
uniform samplerCube envMap;
|
|
529
|
+
#else
|
|
530
|
+
uniform sampler2D envMap;
|
|
531
|
+
#endif
|
|
532
|
+
#endif`,ff=`#ifdef USE_ENVMAP
|
|
533
|
+
uniform float reflectivity;
|
|
534
|
+
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
535
|
+
#define ENV_WORLDPOS
|
|
536
|
+
#endif
|
|
537
|
+
#ifdef ENV_WORLDPOS
|
|
538
|
+
varying vec3 vWorldPosition;
|
|
539
|
+
uniform float refractionRatio;
|
|
540
|
+
#else
|
|
541
|
+
varying vec3 vReflect;
|
|
542
|
+
#endif
|
|
543
|
+
#endif`,df=`#ifdef USE_ENVMAP
|
|
544
|
+
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
|
|
545
|
+
#define ENV_WORLDPOS
|
|
546
|
+
#endif
|
|
547
|
+
#ifdef ENV_WORLDPOS
|
|
548
|
+
|
|
549
|
+
varying vec3 vWorldPosition;
|
|
550
|
+
#else
|
|
551
|
+
varying vec3 vReflect;
|
|
552
|
+
uniform float refractionRatio;
|
|
553
|
+
#endif
|
|
554
|
+
#endif`,pf=`#ifdef USE_ENVMAP
|
|
555
|
+
#ifdef ENV_WORLDPOS
|
|
556
|
+
vWorldPosition = worldPosition.xyz;
|
|
557
|
+
#else
|
|
558
|
+
vec3 cameraToVertex;
|
|
559
|
+
if ( isOrthographic ) {
|
|
560
|
+
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
|
|
561
|
+
} else {
|
|
562
|
+
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
|
|
563
|
+
}
|
|
564
|
+
vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
|
|
565
|
+
#ifdef ENVMAP_MODE_REFLECTION
|
|
566
|
+
vReflect = reflect( cameraToVertex, worldNormal );
|
|
567
|
+
#else
|
|
568
|
+
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
|
|
569
|
+
#endif
|
|
570
|
+
#endif
|
|
571
|
+
#endif`,mf=`#ifdef USE_FOG
|
|
572
|
+
vFogDepth = - mvPosition.z;
|
|
573
|
+
#endif`,gf=`#ifdef USE_FOG
|
|
574
|
+
varying float vFogDepth;
|
|
575
|
+
#endif`,_f=`#ifdef USE_FOG
|
|
576
|
+
#ifdef FOG_EXP2
|
|
577
|
+
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
|
|
578
|
+
#else
|
|
579
|
+
float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
|
|
580
|
+
#endif
|
|
581
|
+
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
|
|
582
|
+
#endif`,yf=`#ifdef USE_FOG
|
|
583
|
+
uniform vec3 fogColor;
|
|
584
|
+
varying float vFogDepth;
|
|
585
|
+
#ifdef FOG_EXP2
|
|
586
|
+
uniform float fogDensity;
|
|
587
|
+
#else
|
|
588
|
+
uniform float fogNear;
|
|
589
|
+
uniform float fogFar;
|
|
590
|
+
#endif
|
|
591
|
+
#endif`,vf=`#ifdef USE_GRADIENTMAP
|
|
592
|
+
uniform sampler2D gradientMap;
|
|
593
|
+
#endif
|
|
594
|
+
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
|
|
595
|
+
float dotNL = dot( normal, lightDirection );
|
|
596
|
+
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
|
|
597
|
+
#ifdef USE_GRADIENTMAP
|
|
598
|
+
return vec3( texture2D( gradientMap, coord ).r );
|
|
599
|
+
#else
|
|
600
|
+
vec2 fw = fwidth( coord ) * 0.5;
|
|
601
|
+
return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
|
|
602
|
+
#endif
|
|
603
|
+
}`,xf=`#ifdef USE_LIGHTMAP
|
|
604
|
+
uniform sampler2D lightMap;
|
|
605
|
+
uniform float lightMapIntensity;
|
|
606
|
+
#endif`,Sf=`LambertMaterial material;
|
|
607
|
+
material.diffuseColor = diffuseColor.rgb;
|
|
608
|
+
material.specularStrength = specularStrength;`,bf=`varying vec3 vViewPosition;
|
|
609
|
+
struct LambertMaterial {
|
|
610
|
+
vec3 diffuseColor;
|
|
611
|
+
float specularStrength;
|
|
612
|
+
};
|
|
613
|
+
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
|
614
|
+
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
615
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
616
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
617
|
+
}
|
|
618
|
+
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
|
|
619
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
620
|
+
}
|
|
621
|
+
#define RE_Direct RE_Direct_Lambert
|
|
622
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Mf=`uniform bool receiveShadow;
|
|
623
|
+
uniform vec3 ambientLightColor;
|
|
624
|
+
#if defined( USE_LIGHT_PROBES )
|
|
625
|
+
uniform vec3 lightProbe[ 9 ];
|
|
626
|
+
#endif
|
|
627
|
+
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
|
|
628
|
+
float x = normal.x, y = normal.y, z = normal.z;
|
|
629
|
+
vec3 result = shCoefficients[ 0 ] * 0.886227;
|
|
630
|
+
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
|
|
631
|
+
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
|
|
632
|
+
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
|
|
633
|
+
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
|
|
634
|
+
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
|
|
635
|
+
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
|
|
636
|
+
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
|
|
637
|
+
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
|
|
638
|
+
return result;
|
|
639
|
+
}
|
|
640
|
+
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
|
|
641
|
+
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
|
|
642
|
+
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
|
|
643
|
+
return irradiance;
|
|
644
|
+
}
|
|
645
|
+
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
|
|
646
|
+
vec3 irradiance = ambientLightColor;
|
|
647
|
+
return irradiance;
|
|
648
|
+
}
|
|
649
|
+
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
|
|
650
|
+
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
|
|
651
|
+
if ( cutoffDistance > 0.0 ) {
|
|
652
|
+
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
|
|
653
|
+
}
|
|
654
|
+
return distanceFalloff;
|
|
655
|
+
}
|
|
656
|
+
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
|
|
657
|
+
return smoothstep( coneCosine, penumbraCosine, angleCosine );
|
|
658
|
+
}
|
|
659
|
+
#if NUM_SUN_LIGHTS > 0
|
|
660
|
+
struct SunLight {
|
|
661
|
+
vec3 direction;
|
|
662
|
+
vec3 color;
|
|
663
|
+
};
|
|
664
|
+
uniform SunLight sunLights[ NUM_SUN_LIGHTS ];
|
|
665
|
+
void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {
|
|
666
|
+
light.color = sunLight.color;
|
|
667
|
+
light.direction = sunLight.direction;
|
|
668
|
+
light.visible = true;
|
|
669
|
+
}
|
|
670
|
+
#endif
|
|
671
|
+
#if NUM_DIR_LIGHTS > 0
|
|
672
|
+
struct DirectionalLight {
|
|
673
|
+
vec3 direction;
|
|
674
|
+
vec3 color;
|
|
675
|
+
};
|
|
676
|
+
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
|
|
677
|
+
void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
|
|
678
|
+
light.color = directionalLight.color;
|
|
679
|
+
light.direction = directionalLight.direction;
|
|
680
|
+
light.visible = true;
|
|
681
|
+
}
|
|
682
|
+
#endif
|
|
683
|
+
#if NUM_POINT_LIGHTS > 0
|
|
684
|
+
struct PointLight {
|
|
685
|
+
vec3 position;
|
|
686
|
+
vec3 color;
|
|
687
|
+
float distance;
|
|
688
|
+
float decay;
|
|
689
|
+
};
|
|
690
|
+
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
|
|
691
|
+
void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
|
692
|
+
vec3 lVector = pointLight.position - geometryPosition;
|
|
693
|
+
light.direction = normalize( lVector );
|
|
694
|
+
float lightDistance = length( lVector );
|
|
695
|
+
light.color = pointLight.color;
|
|
696
|
+
light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
|
|
697
|
+
light.visible = ( light.color != vec3( 0.0 ) );
|
|
698
|
+
}
|
|
699
|
+
#endif
|
|
700
|
+
#if NUM_SPOT_LIGHTS > 0
|
|
701
|
+
struct SpotLight {
|
|
702
|
+
vec3 position;
|
|
703
|
+
vec3 direction;
|
|
704
|
+
vec3 color;
|
|
705
|
+
float distance;
|
|
706
|
+
float decay;
|
|
707
|
+
float coneCos;
|
|
708
|
+
float penumbraCos;
|
|
709
|
+
};
|
|
710
|
+
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
|
|
711
|
+
void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
|
|
712
|
+
vec3 lVector = spotLight.position - geometryPosition;
|
|
713
|
+
light.direction = normalize( lVector );
|
|
714
|
+
float angleCos = dot( light.direction, spotLight.direction );
|
|
715
|
+
float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
|
|
716
|
+
if ( spotAttenuation > 0.0 ) {
|
|
717
|
+
float lightDistance = length( lVector );
|
|
718
|
+
light.color = spotLight.color * spotAttenuation;
|
|
719
|
+
light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
|
|
720
|
+
light.visible = ( light.color != vec3( 0.0 ) );
|
|
721
|
+
} else {
|
|
722
|
+
light.color = vec3( 0.0 );
|
|
723
|
+
light.visible = false;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
#endif
|
|
727
|
+
#if NUM_RECT_AREA_LIGHTS > 0
|
|
728
|
+
struct RectAreaLight {
|
|
729
|
+
vec3 color;
|
|
730
|
+
vec3 position;
|
|
731
|
+
vec3 halfWidth;
|
|
732
|
+
vec3 halfHeight;
|
|
733
|
+
};
|
|
734
|
+
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
|
|
735
|
+
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
|
|
736
|
+
#endif
|
|
737
|
+
#if NUM_HEMI_LIGHTS > 0
|
|
738
|
+
struct HemisphereLight {
|
|
739
|
+
vec3 direction;
|
|
740
|
+
vec3 skyColor;
|
|
741
|
+
vec3 groundColor;
|
|
742
|
+
};
|
|
743
|
+
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
|
|
744
|
+
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
|
|
745
|
+
float dotNL = dot( normal, hemiLight.direction );
|
|
746
|
+
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
|
|
747
|
+
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
|
|
748
|
+
return irradiance;
|
|
749
|
+
}
|
|
750
|
+
#endif
|
|
751
|
+
#include <lightprobes_pars_fragment>`,wf=`#ifdef USE_ENVMAP
|
|
752
|
+
vec3 getIBLIrradiance( const in vec3 normal ) {
|
|
753
|
+
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
754
|
+
vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
|
|
755
|
+
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
|
|
756
|
+
return PI * envMapColor.rgb * envMapIntensity;
|
|
757
|
+
#else
|
|
758
|
+
return vec3( 0.0 );
|
|
759
|
+
#endif
|
|
760
|
+
}
|
|
761
|
+
vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
|
762
|
+
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
763
|
+
vec3 reflectVec = reflect( - viewDir, normal );
|
|
764
|
+
reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
|
|
765
|
+
reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
|
|
766
|
+
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
|
|
767
|
+
return envMapColor.rgb * envMapIntensity;
|
|
768
|
+
#else
|
|
769
|
+
return vec3( 0.0 );
|
|
770
|
+
#endif
|
|
771
|
+
}
|
|
772
|
+
#ifdef USE_RETROREFLECTION
|
|
773
|
+
vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
|
|
774
|
+
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
775
|
+
vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );
|
|
776
|
+
retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );
|
|
777
|
+
vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );
|
|
778
|
+
return envMapColor.rgb * envMapIntensity;
|
|
779
|
+
#else
|
|
780
|
+
return vec3( 0.0 );
|
|
781
|
+
#endif
|
|
782
|
+
}
|
|
783
|
+
#endif
|
|
784
|
+
#ifdef USE_ANISOTROPY
|
|
785
|
+
vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
|
|
786
|
+
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
787
|
+
vec3 bentNormal = cross( bitangent, viewDir );
|
|
788
|
+
bentNormal = normalize( cross( bentNormal, bitangent ) );
|
|
789
|
+
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
|
|
790
|
+
return getIBLRadiance( viewDir, bentNormal, roughness );
|
|
791
|
+
#else
|
|
792
|
+
return vec3( 0.0 );
|
|
793
|
+
#endif
|
|
794
|
+
}
|
|
795
|
+
#ifdef USE_RETROREFLECTION
|
|
796
|
+
vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
|
|
797
|
+
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
798
|
+
vec3 bentNormal = cross( bitangent, viewDir );
|
|
799
|
+
bentNormal = normalize( cross( bentNormal, bitangent ) );
|
|
800
|
+
bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
|
|
801
|
+
return getIBLRetroRadiance( viewDir, bentNormal, roughness );
|
|
802
|
+
#else
|
|
803
|
+
return vec3( 0.0 );
|
|
804
|
+
#endif
|
|
805
|
+
}
|
|
806
|
+
#endif
|
|
807
|
+
#endif
|
|
808
|
+
#endif`,Tf=`ToonMaterial material;
|
|
809
|
+
material.diffuseColor = diffuseColor.rgb;`,Ef=`varying vec3 vViewPosition;
|
|
810
|
+
struct ToonMaterial {
|
|
811
|
+
vec3 diffuseColor;
|
|
812
|
+
};
|
|
813
|
+
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
814
|
+
vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
|
|
815
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
816
|
+
}
|
|
817
|
+
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
|
|
818
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
819
|
+
}
|
|
820
|
+
#define RE_Direct RE_Direct_Toon
|
|
821
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Af=`BlinnPhongMaterial material;
|
|
822
|
+
material.diffuseColor = diffuseColor.rgb;
|
|
823
|
+
material.specularColor = specular;
|
|
824
|
+
material.specularShininess = shininess;
|
|
825
|
+
material.specularStrength = specularStrength;`,Cf=`varying vec3 vViewPosition;
|
|
826
|
+
struct BlinnPhongMaterial {
|
|
827
|
+
vec3 diffuseColor;
|
|
828
|
+
vec3 specularColor;
|
|
829
|
+
float specularShininess;
|
|
830
|
+
float specularStrength;
|
|
831
|
+
};
|
|
832
|
+
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
833
|
+
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
834
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
835
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
836
|
+
reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
|
|
837
|
+
}
|
|
838
|
+
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
|
|
839
|
+
reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
|
|
840
|
+
}
|
|
841
|
+
#define RE_Direct RE_Direct_BlinnPhong
|
|
842
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Rf=`PhysicalMaterial material;
|
|
843
|
+
material.diffuseColor = diffuseColor.rgb;
|
|
844
|
+
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
|
|
845
|
+
material.metalness = metalnessFactor;
|
|
846
|
+
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
|
|
847
|
+
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
|
|
848
|
+
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
|
|
849
|
+
material.roughness = min( material.roughness, 1.0 );
|
|
850
|
+
#ifdef IOR
|
|
851
|
+
material.ior = ior;
|
|
852
|
+
#ifdef USE_SPECULAR
|
|
853
|
+
float specularIntensityFactor = specularIntensity;
|
|
854
|
+
vec3 specularColorFactor = specularColor;
|
|
855
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
856
|
+
specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
|
|
857
|
+
#endif
|
|
858
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
859
|
+
specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
|
|
860
|
+
#endif
|
|
861
|
+
material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
|
|
862
|
+
#else
|
|
863
|
+
float specularIntensityFactor = 1.0;
|
|
864
|
+
vec3 specularColorFactor = vec3( 1.0 );
|
|
865
|
+
material.specularF90 = 1.0;
|
|
866
|
+
#endif
|
|
867
|
+
material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
|
|
868
|
+
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
|
|
869
|
+
#else
|
|
870
|
+
material.specularColor = vec3( 0.04 );
|
|
871
|
+
material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
|
|
872
|
+
material.specularF90 = 1.0;
|
|
873
|
+
#endif
|
|
874
|
+
#ifdef USE_CLEARCOAT
|
|
875
|
+
material.clearcoat = clearcoat;
|
|
876
|
+
material.clearcoatRoughness = clearcoatRoughness;
|
|
877
|
+
material.clearcoatF0 = vec3( 0.04 );
|
|
878
|
+
material.clearcoatF90 = 1.0;
|
|
879
|
+
#ifdef USE_CLEARCOATMAP
|
|
880
|
+
material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
|
|
881
|
+
#endif
|
|
882
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
883
|
+
material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
|
|
884
|
+
#endif
|
|
885
|
+
material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
|
|
886
|
+
material.clearcoatRoughness += geometryRoughness;
|
|
887
|
+
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
|
|
888
|
+
#endif
|
|
889
|
+
#ifdef USE_DISPERSION
|
|
890
|
+
material.dispersion = dispersion;
|
|
891
|
+
#endif
|
|
892
|
+
#ifdef USE_RETROREFLECTION
|
|
893
|
+
material.retroreflectivity = retroreflectivity;
|
|
894
|
+
#endif
|
|
895
|
+
#ifdef USE_IRIDESCENCE
|
|
896
|
+
material.iridescence = iridescence;
|
|
897
|
+
material.iridescenceIOR = iridescenceIOR;
|
|
898
|
+
#ifdef USE_IRIDESCENCEMAP
|
|
899
|
+
material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
|
|
900
|
+
#endif
|
|
901
|
+
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
902
|
+
material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
|
|
903
|
+
#else
|
|
904
|
+
material.iridescenceThickness = iridescenceThicknessMaximum;
|
|
905
|
+
#endif
|
|
906
|
+
#endif
|
|
907
|
+
#ifdef USE_SHEEN
|
|
908
|
+
material.sheenColor = sheenColor;
|
|
909
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
910
|
+
material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
|
|
911
|
+
#endif
|
|
912
|
+
material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
|
|
913
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
914
|
+
material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
|
|
915
|
+
#endif
|
|
916
|
+
#endif
|
|
917
|
+
#ifdef USE_ANISOTROPY
|
|
918
|
+
#ifdef USE_ANISOTROPYMAP
|
|
919
|
+
mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
|
|
920
|
+
vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
|
|
921
|
+
vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
|
|
922
|
+
#else
|
|
923
|
+
vec2 anisotropyV = anisotropyVector;
|
|
924
|
+
#endif
|
|
925
|
+
material.anisotropy = length( anisotropyV );
|
|
926
|
+
if( material.anisotropy == 0.0 ) {
|
|
927
|
+
anisotropyV = vec2( 1.0, 0.0 );
|
|
928
|
+
} else {
|
|
929
|
+
anisotropyV /= material.anisotropy;
|
|
930
|
+
material.anisotropy = saturate( material.anisotropy );
|
|
931
|
+
}
|
|
932
|
+
material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
|
|
933
|
+
material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
|
|
934
|
+
material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
|
|
935
|
+
#endif`,Pf=`uniform sampler2D dfgLUT;
|
|
936
|
+
struct PhysicalMaterial {
|
|
937
|
+
vec3 diffuseColor;
|
|
938
|
+
vec3 diffuseContribution;
|
|
939
|
+
vec3 specularColor;
|
|
940
|
+
vec3 specularColorBlended;
|
|
941
|
+
float roughness;
|
|
942
|
+
float metalness;
|
|
943
|
+
float specularF90;
|
|
944
|
+
float dispersion;
|
|
945
|
+
vec2 dfg;
|
|
946
|
+
vec3 multiScatteringCompensation;
|
|
947
|
+
#ifdef USE_RETROREFLECTION
|
|
948
|
+
float retroreflectivity;
|
|
949
|
+
#endif
|
|
950
|
+
#ifdef USE_CLEARCOAT
|
|
951
|
+
float clearcoat;
|
|
952
|
+
float clearcoatRoughness;
|
|
953
|
+
vec3 clearcoatF0;
|
|
954
|
+
float clearcoatF90;
|
|
955
|
+
#endif
|
|
956
|
+
#ifdef USE_IRIDESCENCE
|
|
957
|
+
float iridescence;
|
|
958
|
+
float iridescenceIOR;
|
|
959
|
+
float iridescenceThickness;
|
|
960
|
+
vec3 iridescenceFresnel;
|
|
961
|
+
vec3 iridescenceF0Dielectric;
|
|
962
|
+
vec3 iridescenceF0Metallic;
|
|
963
|
+
#endif
|
|
964
|
+
#ifdef USE_SHEEN
|
|
965
|
+
vec3 sheenColor;
|
|
966
|
+
float sheenRoughness;
|
|
967
|
+
#endif
|
|
968
|
+
#ifdef IOR
|
|
969
|
+
float ior;
|
|
970
|
+
#endif
|
|
971
|
+
#ifdef USE_TRANSMISSION
|
|
972
|
+
float transmission;
|
|
973
|
+
float transmissionAlpha;
|
|
974
|
+
float thickness;
|
|
975
|
+
float attenuationDistance;
|
|
976
|
+
vec3 attenuationColor;
|
|
977
|
+
#endif
|
|
978
|
+
#ifdef USE_ANISOTROPY
|
|
979
|
+
float anisotropy;
|
|
980
|
+
float alphaT;
|
|
981
|
+
vec3 anisotropyT;
|
|
982
|
+
vec3 anisotropyB;
|
|
983
|
+
#endif
|
|
984
|
+
};
|
|
985
|
+
vec3 clearcoatSpecularDirect = vec3( 0.0 );
|
|
986
|
+
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
|
|
987
|
+
vec3 sheenSpecularDirect = vec3( 0.0 );
|
|
988
|
+
vec3 sheenSpecularIndirect = vec3(0.0 );
|
|
989
|
+
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
|
|
990
|
+
float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
|
|
991
|
+
float x2 = x * x;
|
|
992
|
+
float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
|
|
993
|
+
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
|
|
994
|
+
}
|
|
995
|
+
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
|
|
996
|
+
float a2 = pow2( alpha );
|
|
997
|
+
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
|
|
998
|
+
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
|
|
999
|
+
return 0.5 / max( gv + gl, EPSILON );
|
|
1000
|
+
}
|
|
1001
|
+
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
1002
|
+
float a2 = pow2( alpha );
|
|
1003
|
+
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
|
|
1004
|
+
return RECIPROCAL_PI * a2 / pow2( denom );
|
|
1005
|
+
}
|
|
1006
|
+
#ifdef USE_ANISOTROPY
|
|
1007
|
+
float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
|
|
1008
|
+
float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
|
|
1009
|
+
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
|
|
1010
|
+
return 0.5 / max( gv + gl, EPSILON );
|
|
1011
|
+
}
|
|
1012
|
+
float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
|
|
1013
|
+
float a2 = alphaT * alphaB;
|
|
1014
|
+
highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
|
|
1015
|
+
highp float v2 = dot( v, v );
|
|
1016
|
+
float w2 = a2 / v2;
|
|
1017
|
+
return RECIPROCAL_PI * a2 * pow2 ( w2 );
|
|
1018
|
+
}
|
|
1019
|
+
#endif
|
|
1020
|
+
#ifdef USE_CLEARCOAT
|
|
1021
|
+
vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
|
|
1022
|
+
vec3 f0 = material.clearcoatF0;
|
|
1023
|
+
float f90 = material.clearcoatF90;
|
|
1024
|
+
float roughness = material.clearcoatRoughness;
|
|
1025
|
+
float alpha = pow2( roughness );
|
|
1026
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
1027
|
+
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1028
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1029
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
1030
|
+
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
1031
|
+
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
1032
|
+
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
1033
|
+
float D = D_GGX( alpha, dotNH );
|
|
1034
|
+
return F * ( V * D );
|
|
1035
|
+
}
|
|
1036
|
+
#endif
|
|
1037
|
+
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
|
|
1038
|
+
vec3 f0 = material.specularColorBlended;
|
|
1039
|
+
float f90 = material.specularF90;
|
|
1040
|
+
float roughness = material.roughness;
|
|
1041
|
+
float alpha = pow2( roughness );
|
|
1042
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
1043
|
+
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1044
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1045
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
1046
|
+
float dotVH = saturate( dot( viewDir, halfDir ) );
|
|
1047
|
+
vec3 F = F_Schlick( f0, f90, dotVH );
|
|
1048
|
+
#ifdef USE_IRIDESCENCE
|
|
1049
|
+
F = mix( F, material.iridescenceFresnel, material.iridescence );
|
|
1050
|
+
#endif
|
|
1051
|
+
#ifdef USE_ANISOTROPY
|
|
1052
|
+
float dotTL = dot( material.anisotropyT, lightDir );
|
|
1053
|
+
float dotTV = dot( material.anisotropyT, viewDir );
|
|
1054
|
+
float dotTH = dot( material.anisotropyT, halfDir );
|
|
1055
|
+
float dotBL = dot( material.anisotropyB, lightDir );
|
|
1056
|
+
float dotBV = dot( material.anisotropyB, viewDir );
|
|
1057
|
+
float dotBH = dot( material.anisotropyB, halfDir );
|
|
1058
|
+
float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
|
|
1059
|
+
float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
|
|
1060
|
+
#else
|
|
1061
|
+
float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
|
|
1062
|
+
float D = D_GGX( alpha, dotNH );
|
|
1063
|
+
#endif
|
|
1064
|
+
return F * ( V * D );
|
|
1065
|
+
}
|
|
1066
|
+
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
|
|
1067
|
+
const float LUT_SIZE = 64.0;
|
|
1068
|
+
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
|
|
1069
|
+
const float LUT_BIAS = 0.5 / LUT_SIZE;
|
|
1070
|
+
float dotNV = saturate( dot( N, V ) );
|
|
1071
|
+
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
|
|
1072
|
+
uv = uv * LUT_SCALE + LUT_BIAS;
|
|
1073
|
+
return uv;
|
|
1074
|
+
}
|
|
1075
|
+
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
|
|
1076
|
+
float l = length( f );
|
|
1077
|
+
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
|
|
1078
|
+
}
|
|
1079
|
+
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
|
|
1080
|
+
float x = dot( v1, v2 );
|
|
1081
|
+
float y = abs( x );
|
|
1082
|
+
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
|
|
1083
|
+
float b = 3.4175940 + ( 4.1616724 + y ) * y;
|
|
1084
|
+
float v = a / b;
|
|
1085
|
+
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
|
|
1086
|
+
return cross( v1, v2 ) * theta_sintheta;
|
|
1087
|
+
}
|
|
1088
|
+
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
|
|
1089
|
+
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
|
|
1090
|
+
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
|
|
1091
|
+
vec3 lightNormal = cross( v1, v2 );
|
|
1092
|
+
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
|
|
1093
|
+
vec3 T1, T2;
|
|
1094
|
+
T1 = normalize( V - N * dot( V, N ) );
|
|
1095
|
+
T2 = - cross( N, T1 );
|
|
1096
|
+
mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
|
|
1097
|
+
vec3 coords[ 4 ];
|
|
1098
|
+
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
|
|
1099
|
+
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
|
|
1100
|
+
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
|
|
1101
|
+
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
|
|
1102
|
+
coords[ 0 ] = normalize( coords[ 0 ] );
|
|
1103
|
+
coords[ 1 ] = normalize( coords[ 1 ] );
|
|
1104
|
+
coords[ 2 ] = normalize( coords[ 2 ] );
|
|
1105
|
+
coords[ 3 ] = normalize( coords[ 3 ] );
|
|
1106
|
+
vec3 vectorFormFactor = vec3( 0.0 );
|
|
1107
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
|
|
1108
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
|
|
1109
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
|
|
1110
|
+
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
|
|
1111
|
+
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
|
|
1112
|
+
return vec3( result );
|
|
1113
|
+
}
|
|
1114
|
+
#if defined( USE_SHEEN )
|
|
1115
|
+
float D_Charlie( float roughness, float dotNH ) {
|
|
1116
|
+
float alpha = pow2( roughness );
|
|
1117
|
+
float invAlpha = 1.0 / alpha;
|
|
1118
|
+
float cos2h = dotNH * dotNH;
|
|
1119
|
+
float sin2h = max( 1.0 - cos2h, 0.0078125 );
|
|
1120
|
+
return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
|
|
1121
|
+
}
|
|
1122
|
+
float V_Neubelt( float dotNV, float dotNL ) {
|
|
1123
|
+
return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
|
|
1124
|
+
}
|
|
1125
|
+
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
|
|
1126
|
+
vec3 halfDir = normalize( lightDir + viewDir );
|
|
1127
|
+
float dotNL = saturate( dot( normal, lightDir ) );
|
|
1128
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1129
|
+
float dotNH = saturate( dot( normal, halfDir ) );
|
|
1130
|
+
float D = D_Charlie( sheenRoughness, dotNH );
|
|
1131
|
+
float V = V_Neubelt( dotNV, dotNL );
|
|
1132
|
+
return sheenColor * ( D * V );
|
|
1133
|
+
}
|
|
1134
|
+
#endif
|
|
1135
|
+
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
|
|
1136
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1137
|
+
float r2 = roughness * roughness;
|
|
1138
|
+
float rInv = 1.0 / ( roughness + 0.1 );
|
|
1139
|
+
float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
|
|
1140
|
+
float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
|
|
1141
|
+
float DG = exp( a * dotNV + b );
|
|
1142
|
+
return saturate( DG );
|
|
1143
|
+
}
|
|
1144
|
+
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
|
1145
|
+
float dotNV = saturate( dot( normal, viewDir ) );
|
|
1146
|
+
vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
|
|
1147
|
+
return specularColor * fab.x + specularF90 * fab.y;
|
|
1148
|
+
}
|
|
1149
|
+
#ifdef USE_IRIDESCENCE
|
|
1150
|
+
void computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
1151
|
+
#else
|
|
1152
|
+
void computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
1153
|
+
#endif
|
|
1154
|
+
#ifdef USE_IRIDESCENCE
|
|
1155
|
+
vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
|
|
1156
|
+
#else
|
|
1157
|
+
vec3 Fr = specularColor;
|
|
1158
|
+
#endif
|
|
1159
|
+
vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
|
|
1160
|
+
float Ess = fab.x + fab.y;
|
|
1161
|
+
float Ems = 1.0 - Ess;
|
|
1162
|
+
vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
|
|
1163
|
+
singleScatter += FssEss;
|
|
1164
|
+
multiScatter += Fms * Ems;
|
|
1165
|
+
}
|
|
1166
|
+
#if NUM_RECT_AREA_LIGHTS > 0
|
|
1167
|
+
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1168
|
+
vec3 normal = geometryNormal;
|
|
1169
|
+
vec3 viewDir = geometryViewDir;
|
|
1170
|
+
vec3 position = geometryPosition;
|
|
1171
|
+
vec3 lightPos = rectAreaLight.position;
|
|
1172
|
+
vec3 halfWidth = rectAreaLight.halfWidth;
|
|
1173
|
+
vec3 halfHeight = rectAreaLight.halfHeight;
|
|
1174
|
+
vec3 lightColor = rectAreaLight.color;
|
|
1175
|
+
float roughness = material.roughness;
|
|
1176
|
+
vec3 rectCoords[ 4 ];
|
|
1177
|
+
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
|
|
1178
|
+
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
|
|
1179
|
+
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
|
|
1180
|
+
vec2 uv = LTC_Uv( normal, viewDir, roughness );
|
|
1181
|
+
vec4 t1 = texture2D( ltc_1, uv );
|
|
1182
|
+
vec4 t2 = texture2D( ltc_2, uv );
|
|
1183
|
+
mat3 mInv = mat3(
|
|
1184
|
+
vec3( t1.x, 0, t1.y ),
|
|
1185
|
+
vec3( 0, 1, 0 ),
|
|
1186
|
+
vec3( t1.z, 0, t1.w )
|
|
1187
|
+
);
|
|
1188
|
+
vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
|
|
1189
|
+
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
|
|
1190
|
+
reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
|
|
1191
|
+
#ifdef USE_CLEARCOAT
|
|
1192
|
+
vec3 Ncc = geometryClearcoatNormal;
|
|
1193
|
+
vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
|
|
1194
|
+
vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
|
|
1195
|
+
vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
|
|
1196
|
+
mat3 mInvClearcoat = mat3(
|
|
1197
|
+
vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
|
|
1198
|
+
vec3( 0, 1, 0 ),
|
|
1199
|
+
vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
|
|
1200
|
+
);
|
|
1201
|
+
vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
|
|
1202
|
+
clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
|
|
1203
|
+
#endif
|
|
1204
|
+
}
|
|
1205
|
+
#endif
|
|
1206
|
+
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1207
|
+
float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
|
|
1208
|
+
vec3 irradiance = dotNL * directLight.color;
|
|
1209
|
+
#ifdef USE_CLEARCOAT
|
|
1210
|
+
float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
|
|
1211
|
+
vec3 ccIrradiance = dotNLcc * directLight.color;
|
|
1212
|
+
clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
|
|
1213
|
+
#endif
|
|
1214
|
+
#ifdef USE_SHEEN
|
|
1215
|
+
|
|
1216
|
+
sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
|
|
1217
|
+
|
|
1218
|
+
float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
|
1219
|
+
float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
|
|
1220
|
+
|
|
1221
|
+
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
|
|
1222
|
+
|
|
1223
|
+
irradiance *= sheenEnergyComp;
|
|
1224
|
+
|
|
1225
|
+
#endif
|
|
1226
|
+
vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
|
|
1227
|
+
#ifdef USE_RETROREFLECTION
|
|
1228
|
+
vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );
|
|
1229
|
+
vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );
|
|
1230
|
+
specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );
|
|
1231
|
+
#endif
|
|
1232
|
+
reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;
|
|
1233
|
+
vec3 halfDir = normalize( directLight.direction + geometryViewDir );
|
|
1234
|
+
float dotVH = saturate( dot( geometryViewDir, halfDir ) );
|
|
1235
|
+
vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );
|
|
1236
|
+
#ifdef USE_RETROREFLECTION
|
|
1237
|
+
vec3 retroHalfDir = normalize( directLight.direction + retroViewDir );
|
|
1238
|
+
float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );
|
|
1239
|
+
vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );
|
|
1240
|
+
F = mix( F, retroF, saturate( material.retroreflectivity ) );
|
|
1241
|
+
#endif
|
|
1242
|
+
reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );
|
|
1243
|
+
}
|
|
1244
|
+
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
|
|
1245
|
+
vec3 singleScattering = vec3( 0.0 );
|
|
1246
|
+
vec3 multiScattering = vec3( 0.0 );
|
|
1247
|
+
#ifdef USE_IRIDESCENCE
|
|
1248
|
+
computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );
|
|
1249
|
+
#else
|
|
1250
|
+
computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );
|
|
1251
|
+
#endif
|
|
1252
|
+
vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
|
|
1253
|
+
#ifdef USE_SHEEN
|
|
1254
|
+
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
|
1255
|
+
sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;
|
|
1256
|
+
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
|
|
1257
|
+
diffuse *= sheenEnergyComp;
|
|
1258
|
+
#endif
|
|
1259
|
+
reflectedLight.indirectDiffuse += diffuse;
|
|
1260
|
+
}
|
|
1261
|
+
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
|
|
1262
|
+
#ifdef USE_CLEARCOAT
|
|
1263
|
+
clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
|
|
1264
|
+
#endif
|
|
1265
|
+
#ifdef USE_SHEEN
|
|
1266
|
+
sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
|
|
1267
|
+
#endif
|
|
1268
|
+
vec3 singleScatteringDielectric = vec3( 0.0 );
|
|
1269
|
+
vec3 multiScatteringDielectric = vec3( 0.0 );
|
|
1270
|
+
vec3 singleScatteringMetallic = vec3( 0.0 );
|
|
1271
|
+
vec3 multiScatteringMetallic = vec3( 0.0 );
|
|
1272
|
+
#ifdef USE_IRIDESCENCE
|
|
1273
|
+
computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );
|
|
1274
|
+
computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );
|
|
1275
|
+
#else
|
|
1276
|
+
computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );
|
|
1277
|
+
computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );
|
|
1278
|
+
#endif
|
|
1279
|
+
vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
|
|
1280
|
+
vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
|
|
1281
|
+
vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
|
|
1282
|
+
vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
|
|
1283
|
+
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
|
|
1284
|
+
vec3 indirectSpecular = radiance * singleScattering;
|
|
1285
|
+
indirectSpecular += multiScattering * cosineWeightedIrradiance;
|
|
1286
|
+
vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
|
|
1287
|
+
#ifdef USE_SHEEN
|
|
1288
|
+
float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
|
|
1289
|
+
float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
|
|
1290
|
+
indirectSpecular *= sheenEnergyComp;
|
|
1291
|
+
indirectDiffuse *= sheenEnergyComp;
|
|
1292
|
+
#endif
|
|
1293
|
+
reflectedLight.indirectSpecular += indirectSpecular;
|
|
1294
|
+
reflectedLight.indirectDiffuse += indirectDiffuse;
|
|
1295
|
+
}
|
|
1296
|
+
#define RE_Direct RE_Direct_Physical
|
|
1297
|
+
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
|
|
1298
|
+
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
|
|
1299
|
+
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
|
|
1300
|
+
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
|
|
1301
|
+
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
|
|
1302
|
+
}`,If=`
|
|
1303
|
+
vec3 geometryPosition = - vViewPosition;
|
|
1304
|
+
vec3 geometryNormal = normal;
|
|
1305
|
+
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
|
|
1306
|
+
vec3 geometryClearcoatNormal = vec3( 0.0 );
|
|
1307
|
+
#ifdef USE_CLEARCOAT
|
|
1308
|
+
geometryClearcoatNormal = clearcoatNormal;
|
|
1309
|
+
#endif
|
|
1310
|
+
#ifdef USE_IRIDESCENCE
|
|
1311
|
+
float dotNVi = saturate( dot( normal, geometryViewDir ) );
|
|
1312
|
+
if ( material.iridescenceThickness == 0.0 ) {
|
|
1313
|
+
material.iridescence = 0.0;
|
|
1314
|
+
} else {
|
|
1315
|
+
material.iridescence = saturate( material.iridescence );
|
|
1316
|
+
}
|
|
1317
|
+
if ( material.iridescence > 0.0 ) {
|
|
1318
|
+
vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
|
|
1319
|
+
vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
|
|
1320
|
+
material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );
|
|
1321
|
+
material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );
|
|
1322
|
+
material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );
|
|
1323
|
+
}
|
|
1324
|
+
#endif
|
|
1325
|
+
#ifdef STANDARD
|
|
1326
|
+
float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );
|
|
1327
|
+
material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;
|
|
1328
|
+
#if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )
|
|
1329
|
+
float EssMs = material.dfg.x + material.dfg.y;
|
|
1330
|
+
material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );
|
|
1331
|
+
#endif
|
|
1332
|
+
#endif
|
|
1333
|
+
IncidentLight directLight;
|
|
1334
|
+
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1335
|
+
PointLight pointLight;
|
|
1336
|
+
#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
|
|
1337
|
+
PointLightShadow pointLightShadow;
|
|
1338
|
+
#endif
|
|
1339
|
+
#pragma unroll_loop_start
|
|
1340
|
+
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
|
|
1341
|
+
pointLight = pointLights[ i ];
|
|
1342
|
+
getPointLightInfo( pointLight, geometryPosition, directLight );
|
|
1343
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
|
|
1344
|
+
pointLightShadow = pointLightShadows[ i ];
|
|
1345
|
+
directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
|
|
1346
|
+
#endif
|
|
1347
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1348
|
+
}
|
|
1349
|
+
#pragma unroll_loop_end
|
|
1350
|
+
#endif
|
|
1351
|
+
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1352
|
+
SpotLight spotLight;
|
|
1353
|
+
vec4 spotColor;
|
|
1354
|
+
vec3 spotLightCoord;
|
|
1355
|
+
bool inSpotLightMap;
|
|
1356
|
+
#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1357
|
+
SpotLightShadow spotLightShadow;
|
|
1358
|
+
#endif
|
|
1359
|
+
#pragma unroll_loop_start
|
|
1360
|
+
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
|
|
1361
|
+
spotLight = spotLights[ i ];
|
|
1362
|
+
getSpotLightInfo( spotLight, geometryPosition, directLight );
|
|
1363
|
+
#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|
1364
|
+
#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
|
|
1365
|
+
#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1366
|
+
#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
|
|
1367
|
+
#else
|
|
1368
|
+
#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
|
|
1369
|
+
#endif
|
|
1370
|
+
#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
|
|
1371
|
+
spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
|
|
1372
|
+
inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
|
|
1373
|
+
spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
|
|
1374
|
+
directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
|
|
1375
|
+
#endif
|
|
1376
|
+
#undef SPOT_LIGHT_MAP_INDEX
|
|
1377
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
1378
|
+
spotLightShadow = spotLightShadows[ i ];
|
|
1379
|
+
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|
1380
|
+
#endif
|
|
1381
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1382
|
+
}
|
|
1383
|
+
#pragma unroll_loop_end
|
|
1384
|
+
#endif
|
|
1385
|
+
#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1386
|
+
SunLight sunLight;
|
|
1387
|
+
#if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0
|
|
1388
|
+
SunLightShadow sunLightShadow;
|
|
1389
|
+
#endif
|
|
1390
|
+
#pragma unroll_loop_start
|
|
1391
|
+
for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {
|
|
1392
|
+
sunLight = sunLights[ i ];
|
|
1393
|
+
getSunLightInfo( sunLight, directLight );
|
|
1394
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )
|
|
1395
|
+
sunLightShadow = sunLightShadows[ i ];
|
|
1396
|
+
directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;
|
|
1397
|
+
#endif
|
|
1398
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1399
|
+
}
|
|
1400
|
+
#pragma unroll_loop_end
|
|
1401
|
+
#endif
|
|
1402
|
+
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
|
|
1403
|
+
DirectionalLight directionalLight;
|
|
1404
|
+
#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
|
|
1405
|
+
DirectionalLightShadow directionalLightShadow;
|
|
1406
|
+
#endif
|
|
1407
|
+
#pragma unroll_loop_start
|
|
1408
|
+
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
|
|
1409
|
+
directionalLight = directionalLights[ i ];
|
|
1410
|
+
getDirectionalLightInfo( directionalLight, directLight );
|
|
1411
|
+
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
|
|
1412
|
+
directionalLightShadow = directionalLightShadows[ i ];
|
|
1413
|
+
directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
1414
|
+
#endif
|
|
1415
|
+
RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1416
|
+
}
|
|
1417
|
+
#pragma unroll_loop_end
|
|
1418
|
+
#endif
|
|
1419
|
+
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
|
|
1420
|
+
RectAreaLight rectAreaLight;
|
|
1421
|
+
#pragma unroll_loop_start
|
|
1422
|
+
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
|
|
1423
|
+
rectAreaLight = rectAreaLights[ i ];
|
|
1424
|
+
RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1425
|
+
}
|
|
1426
|
+
#pragma unroll_loop_end
|
|
1427
|
+
#endif
|
|
1428
|
+
#if defined( RE_IndirectDiffuse )
|
|
1429
|
+
vec3 iblIrradiance = vec3( 0.0 );
|
|
1430
|
+
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
|
|
1431
|
+
#if defined( USE_LIGHT_PROBES )
|
|
1432
|
+
irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
|
|
1433
|
+
#endif
|
|
1434
|
+
#if ( NUM_HEMI_LIGHTS > 0 )
|
|
1435
|
+
#pragma unroll_loop_start
|
|
1436
|
+
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
|
|
1437
|
+
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
|
|
1438
|
+
}
|
|
1439
|
+
#pragma unroll_loop_end
|
|
1440
|
+
#endif
|
|
1441
|
+
#ifdef USE_LIGHT_PROBES_GRID
|
|
1442
|
+
vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
|
|
1443
|
+
vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
|
|
1444
|
+
irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
|
|
1445
|
+
#endif
|
|
1446
|
+
#endif
|
|
1447
|
+
#if defined( RE_IndirectSpecular )
|
|
1448
|
+
vec3 radiance = vec3( 0.0 );
|
|
1449
|
+
vec3 clearcoatRadiance = vec3( 0.0 );
|
|
1450
|
+
#endif`,Lf=`#if defined( RE_IndirectDiffuse )
|
|
1451
|
+
#ifdef USE_LIGHTMAP
|
|
1452
|
+
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
1453
|
+
vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
|
|
1454
|
+
irradiance += lightMapIrradiance;
|
|
1455
|
+
#endif
|
|
1456
|
+
#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
|
|
1457
|
+
#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
|
|
1458
|
+
iblIrradiance += getIBLIrradiance( geometryNormal );
|
|
1459
|
+
#endif
|
|
1460
|
+
#endif
|
|
1461
|
+
#endif
|
|
1462
|
+
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
|
|
1463
|
+
#ifdef USE_ANISOTROPY
|
|
1464
|
+
vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
|
1465
|
+
#else
|
|
1466
|
+
vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
|
|
1467
|
+
#endif
|
|
1468
|
+
#ifdef USE_RETROREFLECTION
|
|
1469
|
+
#ifdef USE_ANISOTROPY
|
|
1470
|
+
vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
|
|
1471
|
+
#else
|
|
1472
|
+
vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );
|
|
1473
|
+
#endif
|
|
1474
|
+
iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );
|
|
1475
|
+
#endif
|
|
1476
|
+
radiance += iblRadiance;
|
|
1477
|
+
#ifdef USE_CLEARCOAT
|
|
1478
|
+
clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
|
|
1479
|
+
#endif
|
|
1480
|
+
#endif`,Df=`#if defined( RE_IndirectDiffuse )
|
|
1481
|
+
#if defined( LAMBERT ) || defined( PHONG )
|
|
1482
|
+
irradiance += iblIrradiance;
|
|
1483
|
+
#endif
|
|
1484
|
+
RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1485
|
+
#endif
|
|
1486
|
+
#if defined( RE_IndirectSpecular )
|
|
1487
|
+
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
|
|
1488
|
+
#endif`,Uf=`#ifdef USE_LIGHT_PROBES_GRID
|
|
1489
|
+
uniform highp sampler3D probesSH;
|
|
1490
|
+
uniform vec3 probesMin;
|
|
1491
|
+
uniform vec3 probesMax;
|
|
1492
|
+
uniform vec3 probesResolution;
|
|
1493
|
+
vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
|
|
1494
|
+
vec3 res = probesResolution;
|
|
1495
|
+
vec3 gridRange = probesMax - probesMin;
|
|
1496
|
+
vec3 resMinusOne = res - 1.0;
|
|
1497
|
+
vec3 probeSpacing = gridRange / resMinusOne;
|
|
1498
|
+
vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
|
|
1499
|
+
vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
|
|
1500
|
+
uvw = uvw * resMinusOne / res + 0.5 / res;
|
|
1501
|
+
float nz = res.z;
|
|
1502
|
+
float paddedSlices = nz + 2.0;
|
|
1503
|
+
float atlasDepth = 7.0 * paddedSlices;
|
|
1504
|
+
float uvZBase = uvw.z * nz + 1.0;
|
|
1505
|
+
vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );
|
|
1506
|
+
vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );
|
|
1507
|
+
vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );
|
|
1508
|
+
vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );
|
|
1509
|
+
vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );
|
|
1510
|
+
vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );
|
|
1511
|
+
vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );
|
|
1512
|
+
vec3 c0 = s0.xyz;
|
|
1513
|
+
vec3 c1 = vec3( s0.w, s1.xy );
|
|
1514
|
+
vec3 c2 = vec3( s1.zw, s2.x );
|
|
1515
|
+
vec3 c3 = s2.yzw;
|
|
1516
|
+
vec3 c4 = s3.xyz;
|
|
1517
|
+
vec3 c5 = vec3( s3.w, s4.xy );
|
|
1518
|
+
vec3 c6 = vec3( s4.zw, s5.x );
|
|
1519
|
+
vec3 c7 = s5.yzw;
|
|
1520
|
+
vec3 c8 = s6.xyz;
|
|
1521
|
+
float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
|
|
1522
|
+
vec3 result = c0 * 0.886227;
|
|
1523
|
+
result += c1 * 2.0 * 0.511664 * y;
|
|
1524
|
+
result += c2 * 2.0 * 0.511664 * z;
|
|
1525
|
+
result += c3 * 2.0 * 0.511664 * x;
|
|
1526
|
+
result += c4 * 2.0 * 0.429043 * x * y;
|
|
1527
|
+
result += c5 * 2.0 * 0.429043 * y * z;
|
|
1528
|
+
result += c6 * ( 0.743125 * z * z - 0.247708 );
|
|
1529
|
+
result += c7 * 2.0 * 0.429043 * x * z;
|
|
1530
|
+
result += c8 * 0.429043 * ( x * x - y * y );
|
|
1531
|
+
return max( result, vec3( 0.0 ) );
|
|
1532
|
+
}
|
|
1533
|
+
#endif`,Nf=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1534
|
+
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
|
|
1535
|
+
#endif`,Ff=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
|
|
1536
|
+
uniform float logDepthBufFC;
|
|
1537
|
+
varying float vFragDepth;
|
|
1538
|
+
varying float vIsPerspective;
|
|
1539
|
+
#endif`,Of=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1540
|
+
varying float vFragDepth;
|
|
1541
|
+
varying float vIsPerspective;
|
|
1542
|
+
#endif`,Bf=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
|
|
1543
|
+
vFragDepth = 1.0 + gl_Position.w;
|
|
1544
|
+
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
|
|
1545
|
+
#endif`,zf=`#ifdef USE_MAP
|
|
1546
|
+
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
|
|
1547
|
+
#ifdef DECODE_VIDEO_TEXTURE
|
|
1548
|
+
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
|
|
1549
|
+
#endif
|
|
1550
|
+
diffuseColor *= sampledDiffuseColor;
|
|
1551
|
+
#endif`,Vf=`#ifdef USE_MAP
|
|
1552
|
+
uniform sampler2D map;
|
|
1553
|
+
#endif`,kf=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1554
|
+
#if defined( USE_POINTS_UV )
|
|
1555
|
+
vec2 uv = vUv;
|
|
1556
|
+
#else
|
|
1557
|
+
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
|
|
1558
|
+
#endif
|
|
1559
|
+
#endif
|
|
1560
|
+
#ifdef USE_MAP
|
|
1561
|
+
diffuseColor *= texture2D( map, uv );
|
|
1562
|
+
#endif
|
|
1563
|
+
#ifdef USE_ALPHAMAP
|
|
1564
|
+
diffuseColor.a *= texture2D( alphaMap, uv ).g;
|
|
1565
|
+
#endif`,Gf=`#if defined( USE_POINTS_UV )
|
|
1566
|
+
varying vec2 vUv;
|
|
1567
|
+
#else
|
|
1568
|
+
#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
|
|
1569
|
+
uniform mat3 uvTransform;
|
|
1570
|
+
#endif
|
|
1571
|
+
#endif
|
|
1572
|
+
#ifdef USE_MAP
|
|
1573
|
+
uniform sampler2D map;
|
|
1574
|
+
#endif
|
|
1575
|
+
#ifdef USE_ALPHAMAP
|
|
1576
|
+
uniform sampler2D alphaMap;
|
|
1577
|
+
#endif`,Hf=`float metalnessFactor = metalness;
|
|
1578
|
+
#ifdef USE_METALNESSMAP
|
|
1579
|
+
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
|
|
1580
|
+
metalnessFactor *= texelMetalness.b;
|
|
1581
|
+
#endif`,Wf=`#ifdef USE_METALNESSMAP
|
|
1582
|
+
uniform sampler2D metalnessMap;
|
|
1583
|
+
#endif`,Xf=`#ifdef USE_INSTANCING_MORPH
|
|
1584
|
+
float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1585
|
+
float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
|
|
1586
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1587
|
+
morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
|
|
1588
|
+
}
|
|
1589
|
+
#endif`,qf=`#if defined( USE_MORPHCOLORS )
|
|
1590
|
+
vColor *= morphTargetBaseInfluence;
|
|
1591
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1592
|
+
#if defined( USE_COLOR_ALPHA )
|
|
1593
|
+
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
|
|
1594
|
+
#elif defined( USE_COLOR )
|
|
1595
|
+
if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
|
|
1596
|
+
#endif
|
|
1597
|
+
}
|
|
1598
|
+
#endif`,Yf=`#ifdef USE_MORPHNORMALS
|
|
1599
|
+
objectNormal *= morphTargetBaseInfluence;
|
|
1600
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1601
|
+
if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
|
|
1602
|
+
}
|
|
1603
|
+
#endif`,$f=`#ifdef USE_MORPHTARGETS
|
|
1604
|
+
#ifndef USE_INSTANCING_MORPH
|
|
1605
|
+
uniform float morphTargetBaseInfluence;
|
|
1606
|
+
uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
|
|
1607
|
+
#endif
|
|
1608
|
+
uniform sampler2DArray morphTargetsTexture;
|
|
1609
|
+
uniform ivec2 morphTargetsTextureSize;
|
|
1610
|
+
vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
|
|
1611
|
+
int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
|
|
1612
|
+
int y = texelIndex / morphTargetsTextureSize.x;
|
|
1613
|
+
int x = texelIndex - y * morphTargetsTextureSize.x;
|
|
1614
|
+
ivec3 morphUV = ivec3( x, y, morphTargetIndex );
|
|
1615
|
+
return texelFetch( morphTargetsTexture, morphUV, 0 );
|
|
1616
|
+
}
|
|
1617
|
+
#endif`,Zf=`#ifdef USE_MORPHTARGETS
|
|
1618
|
+
transformed *= morphTargetBaseInfluence;
|
|
1619
|
+
for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
|
|
1620
|
+
if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
|
|
1621
|
+
}
|
|
1622
|
+
#endif`,Jf=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
|
|
1623
|
+
#ifdef FLAT_SHADED
|
|
1624
|
+
vec3 fdx = dFdx( vViewPosition );
|
|
1625
|
+
vec3 fdy = dFdy( vViewPosition );
|
|
1626
|
+
vec3 normal = normalize( cross( fdx, fdy ) );
|
|
1627
|
+
#else
|
|
1628
|
+
vec3 normal = normalize( vNormal );
|
|
1629
|
+
#ifdef DOUBLE_SIDED
|
|
1630
|
+
normal *= faceDirection;
|
|
1631
|
+
#endif
|
|
1632
|
+
#endif
|
|
1633
|
+
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
|
|
1634
|
+
#ifdef USE_TANGENT
|
|
1635
|
+
mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|
1636
|
+
#else
|
|
1637
|
+
mat3 tbn = getTangentFrame( - vViewPosition, normal,
|
|
1638
|
+
#if defined( USE_NORMALMAP )
|
|
1639
|
+
vNormalMapUv
|
|
1640
|
+
#elif defined( USE_CLEARCOAT_NORMALMAP )
|
|
1641
|
+
vClearcoatNormalMapUv
|
|
1642
|
+
#else
|
|
1643
|
+
vUv
|
|
1644
|
+
#endif
|
|
1645
|
+
);
|
|
1646
|
+
#endif
|
|
1647
|
+
#ifdef DOUBLE_SIDED
|
|
1648
|
+
tbn[0] *= faceDirection;
|
|
1649
|
+
tbn[1] *= faceDirection;
|
|
1650
|
+
#endif
|
|
1651
|
+
#endif
|
|
1652
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1653
|
+
#ifdef USE_TANGENT
|
|
1654
|
+
mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
|
|
1655
|
+
#else
|
|
1656
|
+
mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
|
|
1657
|
+
#endif
|
|
1658
|
+
#ifdef DOUBLE_SIDED
|
|
1659
|
+
tbn2[0] *= faceDirection;
|
|
1660
|
+
tbn2[1] *= faceDirection;
|
|
1661
|
+
#endif
|
|
1662
|
+
#endif
|
|
1663
|
+
vec3 nonPerturbedNormal = normal;`,jf=`#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1664
|
+
normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1665
|
+
#ifdef FLIP_SIDED
|
|
1666
|
+
normal = - normal;
|
|
1667
|
+
#endif
|
|
1668
|
+
#ifdef DOUBLE_SIDED
|
|
1669
|
+
normal = normal * faceDirection;
|
|
1670
|
+
#endif
|
|
1671
|
+
normal = normalize( normalMatrix * normal );
|
|
1672
|
+
#elif defined( USE_NORMALMAP_TANGENTSPACE )
|
|
1673
|
+
vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1674
|
+
#if defined( USE_PACKED_NORMALMAP )
|
|
1675
|
+
mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
|
|
1676
|
+
#endif
|
|
1677
|
+
mapN.xy *= normalScale;
|
|
1678
|
+
normal = normalize( tbn * mapN );
|
|
1679
|
+
#elif defined( USE_BUMPMAP )
|
|
1680
|
+
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
|
|
1681
|
+
#endif`,Kf=`#ifndef FLAT_SHADED
|
|
1682
|
+
varying vec3 vNormal;
|
|
1683
|
+
#ifdef USE_TANGENT
|
|
1684
|
+
varying vec3 vTangent;
|
|
1685
|
+
varying vec3 vBitangent;
|
|
1686
|
+
#endif
|
|
1687
|
+
#endif`,Qf=`#ifndef FLAT_SHADED
|
|
1688
|
+
varying vec3 vNormal;
|
|
1689
|
+
#ifdef USE_TANGENT
|
|
1690
|
+
varying vec3 vTangent;
|
|
1691
|
+
varying vec3 vBitangent;
|
|
1692
|
+
#endif
|
|
1693
|
+
#endif`,ed=`#ifndef FLAT_SHADED
|
|
1694
|
+
vNormal = normalize( transformedNormal );
|
|
1695
|
+
#ifdef USE_TANGENT
|
|
1696
|
+
vTangent = normalize( transformedTangent );
|
|
1697
|
+
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
|
|
1698
|
+
#ifdef FLIP_SIDED
|
|
1699
|
+
vBitangent = - vBitangent;
|
|
1700
|
+
#endif
|
|
1701
|
+
#endif
|
|
1702
|
+
#endif`,td=`#ifdef USE_NORMALMAP
|
|
1703
|
+
uniform sampler2D normalMap;
|
|
1704
|
+
uniform vec2 normalScale;
|
|
1705
|
+
#endif
|
|
1706
|
+
#ifdef USE_NORMALMAP_OBJECTSPACE
|
|
1707
|
+
uniform mat3 normalMatrix;
|
|
1708
|
+
#endif
|
|
1709
|
+
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
|
|
1710
|
+
mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
|
|
1711
|
+
vec3 q0 = dFdx( eye_pos.xyz );
|
|
1712
|
+
vec3 q1 = dFdy( eye_pos.xyz );
|
|
1713
|
+
vec2 st0 = dFdx( uv.st );
|
|
1714
|
+
vec2 st1 = dFdy( uv.st );
|
|
1715
|
+
vec3 N = surf_norm;
|
|
1716
|
+
vec3 q1perp = cross( q1, N );
|
|
1717
|
+
vec3 q0perp = cross( N, q0 );
|
|
1718
|
+
vec3 T = q1perp * st0.x + q0perp * st1.x;
|
|
1719
|
+
vec3 B = q1perp * st0.y + q0perp * st1.y;
|
|
1720
|
+
float det = max( dot( T, T ), dot( B, B ) );
|
|
1721
|
+
float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
|
|
1722
|
+
return mat3( T * scale, B * scale, N );
|
|
1723
|
+
}
|
|
1724
|
+
#endif`,nd=`#ifdef USE_CLEARCOAT
|
|
1725
|
+
vec3 clearcoatNormal = nonPerturbedNormal;
|
|
1726
|
+
#endif`,id=`#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1727
|
+
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
|
|
1728
|
+
clearcoatMapN.xy *= clearcoatNormalScale;
|
|
1729
|
+
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
|
|
1730
|
+
#endif`,rd=`#ifdef USE_CLEARCOATMAP
|
|
1731
|
+
uniform sampler2D clearcoatMap;
|
|
1732
|
+
#endif
|
|
1733
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
1734
|
+
uniform sampler2D clearcoatNormalMap;
|
|
1735
|
+
uniform vec2 clearcoatNormalScale;
|
|
1736
|
+
#endif
|
|
1737
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
1738
|
+
uniform sampler2D clearcoatRoughnessMap;
|
|
1739
|
+
#endif`,sd=`#ifdef USE_IRIDESCENCEMAP
|
|
1740
|
+
uniform sampler2D iridescenceMap;
|
|
1741
|
+
#endif
|
|
1742
|
+
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
1743
|
+
uniform sampler2D iridescenceThicknessMap;
|
|
1744
|
+
#endif`,ad=`#ifdef OPAQUE
|
|
1745
|
+
diffuseColor.a = 1.0;
|
|
1746
|
+
#endif
|
|
1747
|
+
#ifdef USE_TRANSMISSION
|
|
1748
|
+
diffuseColor.a *= material.transmissionAlpha;
|
|
1749
|
+
#endif
|
|
1750
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,od=`vec3 packNormalToRGB( const in vec3 normal ) {
|
|
1751
|
+
return normalize( normal ) * 0.5 + 0.5;
|
|
1752
|
+
}
|
|
1753
|
+
vec3 unpackRGBToNormal( const in vec3 rgb ) {
|
|
1754
|
+
return 2.0 * rgb.xyz - 1.0;
|
|
1755
|
+
}
|
|
1756
|
+
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
|
|
1757
|
+
const float Inv255 = 1. / 255.;
|
|
1758
|
+
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
|
|
1759
|
+
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
|
|
1760
|
+
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
|
|
1761
|
+
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
|
|
1762
|
+
vec4 packDepthToRGBA( const in float v ) {
|
|
1763
|
+
if( v <= 0.0 )
|
|
1764
|
+
return vec4( 0., 0., 0., 0. );
|
|
1765
|
+
if( v >= 1.0 )
|
|
1766
|
+
return vec4( 1., 1., 1., 1. );
|
|
1767
|
+
float vuf;
|
|
1768
|
+
float af = modf( v * PackFactors.a, vuf );
|
|
1769
|
+
float bf = modf( vuf * ShiftRight8, vuf );
|
|
1770
|
+
float gf = modf( vuf * ShiftRight8, vuf );
|
|
1771
|
+
return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
|
|
1772
|
+
}
|
|
1773
|
+
vec3 packDepthToRGB( const in float v ) {
|
|
1774
|
+
if( v <= 0.0 )
|
|
1775
|
+
return vec3( 0., 0., 0. );
|
|
1776
|
+
if( v >= 1.0 )
|
|
1777
|
+
return vec3( 1., 1., 1. );
|
|
1778
|
+
float vuf;
|
|
1779
|
+
float bf = modf( v * PackFactors.b, vuf );
|
|
1780
|
+
float gf = modf( vuf * ShiftRight8, vuf );
|
|
1781
|
+
return vec3( vuf * Inv255, gf * PackUpscale, bf );
|
|
1782
|
+
}
|
|
1783
|
+
vec2 packDepthToRG( const in float v ) {
|
|
1784
|
+
if( v <= 0.0 )
|
|
1785
|
+
return vec2( 0., 0. );
|
|
1786
|
+
if( v >= 1.0 )
|
|
1787
|
+
return vec2( 1., 1. );
|
|
1788
|
+
float vuf;
|
|
1789
|
+
float gf = modf( v * 256., vuf );
|
|
1790
|
+
return vec2( vuf * Inv255, gf );
|
|
1791
|
+
}
|
|
1792
|
+
float unpackRGBAToDepth( const in vec4 v ) {
|
|
1793
|
+
return dot( v, UnpackFactors4 );
|
|
1794
|
+
}
|
|
1795
|
+
float unpackRGBToDepth( const in vec3 v ) {
|
|
1796
|
+
return dot( v, UnpackFactors3 );
|
|
1797
|
+
}
|
|
1798
|
+
float unpackRGToDepth( const in vec2 v ) {
|
|
1799
|
+
return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
|
|
1800
|
+
}
|
|
1801
|
+
vec4 pack2HalfToRGBA( const in vec2 v ) {
|
|
1802
|
+
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
|
|
1803
|
+
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
|
|
1804
|
+
}
|
|
1805
|
+
vec2 unpackRGBATo2Half( const in vec4 v ) {
|
|
1806
|
+
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
|
|
1807
|
+
}
|
|
1808
|
+
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1809
|
+
return ( viewZ + near ) / ( near - far );
|
|
1810
|
+
}
|
|
1811
|
+
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1812
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1813
|
+
|
|
1814
|
+
return depth * ( far - near ) - far;
|
|
1815
|
+
#else
|
|
1816
|
+
return depth * ( near - far ) - near;
|
|
1817
|
+
#endif
|
|
1818
|
+
}
|
|
1819
|
+
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
|
|
1820
|
+
return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
|
|
1821
|
+
}
|
|
1822
|
+
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
|
|
1823
|
+
|
|
1824
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1825
|
+
return ( near * far ) / ( ( near - far ) * depth - near );
|
|
1826
|
+
#else
|
|
1827
|
+
return ( near * far ) / ( ( far - near ) * depth - far );
|
|
1828
|
+
#endif
|
|
1829
|
+
}`,ld=`#ifdef PREMULTIPLIED_ALPHA
|
|
1830
|
+
gl_FragColor.rgb *= gl_FragColor.a;
|
|
1831
|
+
#endif`,cd=`vec4 mvPosition = vec4( transformed, 1.0 );
|
|
1832
|
+
#ifdef USE_BATCHING
|
|
1833
|
+
mvPosition = batchingMatrix * mvPosition;
|
|
1834
|
+
#endif
|
|
1835
|
+
#ifdef USE_INSTANCING
|
|
1836
|
+
mvPosition = instanceMatrix * mvPosition;
|
|
1837
|
+
#endif
|
|
1838
|
+
mvPosition = modelViewMatrix * mvPosition;
|
|
1839
|
+
gl_Position = projectionMatrix * mvPosition;`,ud=`#ifdef DITHERING
|
|
1840
|
+
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
|
|
1841
|
+
#endif`,hd=`#ifdef DITHERING
|
|
1842
|
+
vec3 dithering( vec3 color ) {
|
|
1843
|
+
float grid_position = rand( gl_FragCoord.xy );
|
|
1844
|
+
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
|
|
1845
|
+
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
|
|
1846
|
+
return color + dither_shift_RGB;
|
|
1847
|
+
}
|
|
1848
|
+
#endif`,fd=`float roughnessFactor = roughness;
|
|
1849
|
+
#ifdef USE_ROUGHNESSMAP
|
|
1850
|
+
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
|
|
1851
|
+
roughnessFactor *= texelRoughness.g;
|
|
1852
|
+
#endif`,dd=`#ifdef USE_ROUGHNESSMAP
|
|
1853
|
+
uniform sampler2D roughnessMap;
|
|
1854
|
+
#endif`,pd=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
1855
|
+
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
1856
|
+
#endif
|
|
1857
|
+
#if NUM_SPOT_LIGHT_MAPS > 0
|
|
1858
|
+
uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
|
|
1859
|
+
#endif
|
|
1860
|
+
#ifdef USE_SHADOWMAP
|
|
1861
|
+
#if NUM_SUN_LIGHT_SHADOWS > 0
|
|
1862
|
+
#define SUN_LIGHT_CASCADES 2
|
|
1863
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1864
|
+
uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
|
|
1865
|
+
#else
|
|
1866
|
+
uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
|
|
1867
|
+
#endif
|
|
1868
|
+
uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
|
|
1869
|
+
uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
|
|
1870
|
+
varying vec4 vSunShadowWorldPosition;
|
|
1871
|
+
varying vec3 vSunShadowWorldNormal;
|
|
1872
|
+
struct SunLightShadow {
|
|
1873
|
+
float shadowIntensity;
|
|
1874
|
+
float shadowBias;
|
|
1875
|
+
float shadowNormalBias;
|
|
1876
|
+
float shadowRadius;
|
|
1877
|
+
vec2 shadowMapSize;
|
|
1878
|
+
};
|
|
1879
|
+
uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];
|
|
1880
|
+
#endif
|
|
1881
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
1882
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1883
|
+
uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1884
|
+
#else
|
|
1885
|
+
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1886
|
+
#endif
|
|
1887
|
+
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1888
|
+
struct DirectionalLightShadow {
|
|
1889
|
+
float shadowIntensity;
|
|
1890
|
+
float shadowBias;
|
|
1891
|
+
float shadowNormalBias;
|
|
1892
|
+
float shadowRadius;
|
|
1893
|
+
vec2 shadowMapSize;
|
|
1894
|
+
};
|
|
1895
|
+
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
1896
|
+
#endif
|
|
1897
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
1898
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1899
|
+
uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1900
|
+
#else
|
|
1901
|
+
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1902
|
+
#endif
|
|
1903
|
+
struct SpotLightShadow {
|
|
1904
|
+
float shadowIntensity;
|
|
1905
|
+
float shadowBias;
|
|
1906
|
+
float shadowNormalBias;
|
|
1907
|
+
float shadowRadius;
|
|
1908
|
+
vec2 shadowMapSize;
|
|
1909
|
+
};
|
|
1910
|
+
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
1911
|
+
#endif
|
|
1912
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
1913
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1914
|
+
uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1915
|
+
#elif defined( SHADOWMAP_TYPE_BASIC )
|
|
1916
|
+
uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1917
|
+
#endif
|
|
1918
|
+
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1919
|
+
struct PointLightShadow {
|
|
1920
|
+
float shadowIntensity;
|
|
1921
|
+
float shadowBias;
|
|
1922
|
+
float shadowNormalBias;
|
|
1923
|
+
float shadowRadius;
|
|
1924
|
+
vec2 shadowMapSize;
|
|
1925
|
+
float shadowCameraNear;
|
|
1926
|
+
float shadowCameraFar;
|
|
1927
|
+
};
|
|
1928
|
+
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
1929
|
+
#endif
|
|
1930
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1931
|
+
float interleavedGradientNoise( vec2 position ) {
|
|
1932
|
+
return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
|
|
1933
|
+
}
|
|
1934
|
+
vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
|
|
1935
|
+
const float goldenAngle = 2.399963229728653;
|
|
1936
|
+
float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
|
|
1937
|
+
float theta = float( sampleIndex ) * goldenAngle + phi;
|
|
1938
|
+
return vec2( cos( theta ), sin( theta ) ) * r;
|
|
1939
|
+
}
|
|
1940
|
+
#endif
|
|
1941
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
1942
|
+
float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1943
|
+
float shadow = 1.0;
|
|
1944
|
+
shadowCoord.xyz /= shadowCoord.w;
|
|
1945
|
+
shadowCoord.z += shadowBias;
|
|
1946
|
+
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
1947
|
+
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
1948
|
+
if ( frustumTest ) {
|
|
1949
|
+
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
|
|
1950
|
+
float radius = shadowRadius * texelSize.x;
|
|
1951
|
+
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
|
|
1952
|
+
shadow = (
|
|
1953
|
+
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
1954
|
+
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
1955
|
+
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
1956
|
+
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
|
|
1957
|
+
texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
|
|
1958
|
+
) * 0.2;
|
|
1959
|
+
}
|
|
1960
|
+
return mix( 1.0, shadow, shadowIntensity );
|
|
1961
|
+
}
|
|
1962
|
+
#elif defined( SHADOWMAP_TYPE_VSM )
|
|
1963
|
+
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1964
|
+
float shadow = 1.0;
|
|
1965
|
+
shadowCoord.xyz /= shadowCoord.w;
|
|
1966
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1967
|
+
shadowCoord.z -= shadowBias;
|
|
1968
|
+
#else
|
|
1969
|
+
shadowCoord.z += shadowBias;
|
|
1970
|
+
#endif
|
|
1971
|
+
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
1972
|
+
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
1973
|
+
if ( frustumTest ) {
|
|
1974
|
+
vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
|
|
1975
|
+
float mean = distribution.x;
|
|
1976
|
+
float variance = distribution.y * distribution.y;
|
|
1977
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
1978
|
+
float hard_shadow = step( mean, shadowCoord.z );
|
|
1979
|
+
#else
|
|
1980
|
+
float hard_shadow = step( shadowCoord.z, mean );
|
|
1981
|
+
#endif
|
|
1982
|
+
|
|
1983
|
+
if ( hard_shadow == 1.0 ) {
|
|
1984
|
+
shadow = 1.0;
|
|
1985
|
+
} else {
|
|
1986
|
+
variance = max( variance, 0.0000001 );
|
|
1987
|
+
float d = shadowCoord.z - mean;
|
|
1988
|
+
float p_max = variance / ( variance + d * d );
|
|
1989
|
+
p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
|
|
1990
|
+
shadow = max( hard_shadow, p_max );
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
return mix( 1.0, shadow, shadowIntensity );
|
|
1994
|
+
}
|
|
1995
|
+
#else
|
|
1996
|
+
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
|
|
1997
|
+
float shadow = 1.0;
|
|
1998
|
+
shadowCoord.xyz /= shadowCoord.w;
|
|
1999
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
2000
|
+
shadowCoord.z -= shadowBias;
|
|
2001
|
+
#else
|
|
2002
|
+
shadowCoord.z += shadowBias;
|
|
2003
|
+
#endif
|
|
2004
|
+
bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
|
|
2005
|
+
bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
|
|
2006
|
+
if ( frustumTest ) {
|
|
2007
|
+
float depth = texture2D( shadowMap, shadowCoord.xy ).r;
|
|
2008
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
2009
|
+
shadow = step( depth, shadowCoord.z );
|
|
2010
|
+
#else
|
|
2011
|
+
shadow = step( shadowCoord.z, depth );
|
|
2012
|
+
#endif
|
|
2013
|
+
}
|
|
2014
|
+
return mix( 1.0, shadow, shadowIntensity );
|
|
2015
|
+
}
|
|
2016
|
+
#endif
|
|
2017
|
+
#if NUM_SUN_LIGHT_SHADOWS > 0
|
|
2018
|
+
float getSunShadow(
|
|
2019
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
2020
|
+
sampler2DShadow shadowMap,
|
|
2021
|
+
#else
|
|
2022
|
+
sampler2D shadowMap,
|
|
2023
|
+
#endif
|
|
2024
|
+
SunLightShadow sunLightShadow,
|
|
2025
|
+
int shadowIndex
|
|
2026
|
+
) {
|
|
2027
|
+
vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );
|
|
2028
|
+
float viewDepth = vSunShadowWorldPosition.w;
|
|
2029
|
+
int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;
|
|
2030
|
+
float shadow = 1.0;
|
|
2031
|
+
for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {
|
|
2032
|
+
vec4 cascade = sunShadowCascade[ cascadeOffset + i ];
|
|
2033
|
+
if ( viewDepth >= cascade.x && viewDepth < cascade.y ) {
|
|
2034
|
+
float cascadeShadow = getShadow(
|
|
2035
|
+
shadowMap,
|
|
2036
|
+
sunLightShadow.shadowMapSize,
|
|
2037
|
+
sunLightShadow.shadowIntensity,
|
|
2038
|
+
sunLightShadow.shadowBias,
|
|
2039
|
+
sunLightShadow.shadowRadius,
|
|
2040
|
+
sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition
|
|
2041
|
+
);
|
|
2042
|
+
shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
return shadow;
|
|
2046
|
+
}
|
|
2047
|
+
#endif
|
|
2048
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
2049
|
+
#if defined( SHADOWMAP_TYPE_PCF )
|
|
2050
|
+
float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
2051
|
+
float shadow = 1.0;
|
|
2052
|
+
vec3 lightToPosition = shadowCoord.xyz;
|
|
2053
|
+
vec3 bd3D = normalize( lightToPosition );
|
|
2054
|
+
vec3 absVec = abs( lightToPosition );
|
|
2055
|
+
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
|
|
2056
|
+
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
|
|
2057
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
2058
|
+
float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
2059
|
+
dp -= shadowBias;
|
|
2060
|
+
#else
|
|
2061
|
+
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
2062
|
+
dp += shadowBias;
|
|
2063
|
+
#endif
|
|
2064
|
+
float texelSize = shadowRadius / shadowMapSize.x;
|
|
2065
|
+
vec3 absDir = abs( bd3D );
|
|
2066
|
+
vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
|
|
2067
|
+
tangent = normalize( cross( bd3D, tangent ) );
|
|
2068
|
+
vec3 bitangent = cross( bd3D, tangent );
|
|
2069
|
+
float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
|
|
2070
|
+
vec2 sample0 = vogelDiskSample( 0, 5, phi );
|
|
2071
|
+
vec2 sample1 = vogelDiskSample( 1, 5, phi );
|
|
2072
|
+
vec2 sample2 = vogelDiskSample( 2, 5, phi );
|
|
2073
|
+
vec2 sample3 = vogelDiskSample( 3, 5, phi );
|
|
2074
|
+
vec2 sample4 = vogelDiskSample( 4, 5, phi );
|
|
2075
|
+
shadow = (
|
|
2076
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
|
|
2077
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
|
|
2078
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
|
|
2079
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
|
|
2080
|
+
texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
|
|
2081
|
+
) * 0.2;
|
|
2082
|
+
}
|
|
2083
|
+
return mix( 1.0, shadow, shadowIntensity );
|
|
2084
|
+
}
|
|
2085
|
+
#elif defined( SHADOWMAP_TYPE_BASIC )
|
|
2086
|
+
float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
|
|
2087
|
+
float shadow = 1.0;
|
|
2088
|
+
vec3 lightToPosition = shadowCoord.xyz;
|
|
2089
|
+
vec3 absVec = abs( lightToPosition );
|
|
2090
|
+
float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
|
|
2091
|
+
if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
|
|
2092
|
+
float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
|
|
2093
|
+
dp += shadowBias;
|
|
2094
|
+
vec3 bd3D = normalize( lightToPosition );
|
|
2095
|
+
float depth = textureCube( shadowMap, bd3D ).r;
|
|
2096
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
2097
|
+
depth = 1.0 - depth;
|
|
2098
|
+
#endif
|
|
2099
|
+
shadow = step( dp, depth );
|
|
2100
|
+
}
|
|
2101
|
+
return mix( 1.0, shadow, shadowIntensity );
|
|
2102
|
+
}
|
|
2103
|
+
#endif
|
|
2104
|
+
#endif
|
|
2105
|
+
#endif`,md=`#if NUM_SPOT_LIGHT_COORDS > 0
|
|
2106
|
+
uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
|
|
2107
|
+
varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
|
|
2108
|
+
#endif
|
|
2109
|
+
#ifdef USE_SHADOWMAP
|
|
2110
|
+
#if NUM_SUN_LIGHT_SHADOWS > 0
|
|
2111
|
+
varying vec4 vSunShadowWorldPosition;
|
|
2112
|
+
varying vec3 vSunShadowWorldNormal;
|
|
2113
|
+
#endif
|
|
2114
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
2115
|
+
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
|
|
2116
|
+
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
|
|
2117
|
+
struct DirectionalLightShadow {
|
|
2118
|
+
float shadowIntensity;
|
|
2119
|
+
float shadowBias;
|
|
2120
|
+
float shadowNormalBias;
|
|
2121
|
+
float shadowRadius;
|
|
2122
|
+
vec2 shadowMapSize;
|
|
2123
|
+
};
|
|
2124
|
+
uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
|
|
2125
|
+
#endif
|
|
2126
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
2127
|
+
struct SpotLightShadow {
|
|
2128
|
+
float shadowIntensity;
|
|
2129
|
+
float shadowBias;
|
|
2130
|
+
float shadowNormalBias;
|
|
2131
|
+
float shadowRadius;
|
|
2132
|
+
vec2 shadowMapSize;
|
|
2133
|
+
};
|
|
2134
|
+
uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
|
|
2135
|
+
#endif
|
|
2136
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
2137
|
+
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
|
|
2138
|
+
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
|
|
2139
|
+
struct PointLightShadow {
|
|
2140
|
+
float shadowIntensity;
|
|
2141
|
+
float shadowBias;
|
|
2142
|
+
float shadowNormalBias;
|
|
2143
|
+
float shadowRadius;
|
|
2144
|
+
vec2 shadowMapSize;
|
|
2145
|
+
float shadowCameraNear;
|
|
2146
|
+
float shadowCameraFar;
|
|
2147
|
+
};
|
|
2148
|
+
uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
|
|
2149
|
+
#endif
|
|
2150
|
+
#endif`,gd=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
|
|
2151
|
+
#ifdef HAS_NORMAL
|
|
2152
|
+
vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
|
|
2153
|
+
#else
|
|
2154
|
+
vec3 shadowWorldNormal = vec3( 0.0 );
|
|
2155
|
+
#endif
|
|
2156
|
+
vec4 shadowWorldPosition;
|
|
2157
|
+
#endif
|
|
2158
|
+
#if defined( USE_SHADOWMAP )
|
|
2159
|
+
#if NUM_SUN_LIGHT_SHADOWS > 0
|
|
2160
|
+
vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );
|
|
2161
|
+
vSunShadowWorldNormal = shadowWorldNormal;
|
|
2162
|
+
#endif
|
|
2163
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
2164
|
+
#pragma unroll_loop_start
|
|
2165
|
+
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
2166
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
|
|
2167
|
+
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
|
|
2168
|
+
}
|
|
2169
|
+
#pragma unroll_loop_end
|
|
2170
|
+
#endif
|
|
2171
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0
|
|
2172
|
+
#pragma unroll_loop_start
|
|
2173
|
+
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
2174
|
+
shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
|
|
2175
|
+
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
|
|
2176
|
+
}
|
|
2177
|
+
#pragma unroll_loop_end
|
|
2178
|
+
#endif
|
|
2179
|
+
#endif
|
|
2180
|
+
#if NUM_SPOT_LIGHT_COORDS > 0
|
|
2181
|
+
#pragma unroll_loop_start
|
|
2182
|
+
for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
|
|
2183
|
+
shadowWorldPosition = worldPosition;
|
|
2184
|
+
#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
|
|
2185
|
+
shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
|
|
2186
|
+
#endif
|
|
2187
|
+
vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
|
|
2188
|
+
}
|
|
2189
|
+
#pragma unroll_loop_end
|
|
2190
|
+
#endif`,_d=`float getShadowMask() {
|
|
2191
|
+
float shadow = 1.0;
|
|
2192
|
+
#ifdef USE_SHADOWMAP
|
|
2193
|
+
#if NUM_SUN_LIGHT_SHADOWS > 0
|
|
2194
|
+
SunLightShadow sunLight;
|
|
2195
|
+
#pragma unroll_loop_start
|
|
2196
|
+
for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {
|
|
2197
|
+
sunLight = sunLightShadows[ i ];
|
|
2198
|
+
shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;
|
|
2199
|
+
}
|
|
2200
|
+
#pragma unroll_loop_end
|
|
2201
|
+
#endif
|
|
2202
|
+
#if NUM_DIR_LIGHT_SHADOWS > 0
|
|
2203
|
+
DirectionalLightShadow directionalLight;
|
|
2204
|
+
#pragma unroll_loop_start
|
|
2205
|
+
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
|
|
2206
|
+
directionalLight = directionalLightShadows[ i ];
|
|
2207
|
+
shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
|
|
2208
|
+
}
|
|
2209
|
+
#pragma unroll_loop_end
|
|
2210
|
+
#endif
|
|
2211
|
+
#if NUM_SPOT_LIGHT_SHADOWS > 0
|
|
2212
|
+
SpotLightShadow spotLight;
|
|
2213
|
+
#pragma unroll_loop_start
|
|
2214
|
+
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
|
|
2215
|
+
spotLight = spotLightShadows[ i ];
|
|
2216
|
+
shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
|
|
2217
|
+
}
|
|
2218
|
+
#pragma unroll_loop_end
|
|
2219
|
+
#endif
|
|
2220
|
+
#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
|
|
2221
|
+
PointLightShadow pointLight;
|
|
2222
|
+
#pragma unroll_loop_start
|
|
2223
|
+
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
|
|
2224
|
+
pointLight = pointLightShadows[ i ];
|
|
2225
|
+
shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
|
|
2226
|
+
}
|
|
2227
|
+
#pragma unroll_loop_end
|
|
2228
|
+
#endif
|
|
2229
|
+
#endif
|
|
2230
|
+
return shadow;
|
|
2231
|
+
}`,yd=`#ifdef USE_SKINNING
|
|
2232
|
+
mat4 boneMatX = getBoneMatrix( skinIndex.x );
|
|
2233
|
+
mat4 boneMatY = getBoneMatrix( skinIndex.y );
|
|
2234
|
+
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
|
|
2235
|
+
mat4 boneMatW = getBoneMatrix( skinIndex.w );
|
|
2236
|
+
#endif`,vd=`#ifdef USE_SKINNING
|
|
2237
|
+
uniform mat4 bindMatrix;
|
|
2238
|
+
uniform mat4 bindMatrixInverse;
|
|
2239
|
+
uniform highp sampler2D boneTexture;
|
|
2240
|
+
mat4 getBoneMatrix( const in float i ) {
|
|
2241
|
+
int size = textureSize( boneTexture, 0 ).x;
|
|
2242
|
+
int j = int( i ) * 4;
|
|
2243
|
+
int x = j % size;
|
|
2244
|
+
int y = j / size;
|
|
2245
|
+
vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
|
|
2246
|
+
vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
|
|
2247
|
+
vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
|
|
2248
|
+
vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
|
|
2249
|
+
return mat4( v1, v2, v3, v4 );
|
|
2250
|
+
}
|
|
2251
|
+
#endif`,xd=`#ifdef USE_SKINNING
|
|
2252
|
+
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
|
|
2253
|
+
vec4 skinned = vec4( 0.0 );
|
|
2254
|
+
skinned += boneMatX * skinVertex * skinWeight.x;
|
|
2255
|
+
skinned += boneMatY * skinVertex * skinWeight.y;
|
|
2256
|
+
skinned += boneMatZ * skinVertex * skinWeight.z;
|
|
2257
|
+
skinned += boneMatW * skinVertex * skinWeight.w;
|
|
2258
|
+
transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
2259
|
+
#endif`,Sd=`#ifdef USE_SKINNING
|
|
2260
|
+
mat4 skinMatrix = mat4( 0.0 );
|
|
2261
|
+
skinMatrix += skinWeight.x * boneMatX;
|
|
2262
|
+
skinMatrix += skinWeight.y * boneMatY;
|
|
2263
|
+
skinMatrix += skinWeight.z * boneMatZ;
|
|
2264
|
+
skinMatrix += skinWeight.w * boneMatW;
|
|
2265
|
+
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
|
|
2266
|
+
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
|
|
2267
|
+
#ifdef USE_TANGENT
|
|
2268
|
+
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
2269
|
+
#endif
|
|
2270
|
+
#endif`,bd=`float specularStrength;
|
|
2271
|
+
#ifdef USE_SPECULARMAP
|
|
2272
|
+
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
|
|
2273
|
+
specularStrength = texelSpecular.r;
|
|
2274
|
+
#else
|
|
2275
|
+
specularStrength = 1.0;
|
|
2276
|
+
#endif`,Md=`#ifdef USE_SPECULARMAP
|
|
2277
|
+
uniform sampler2D specularMap;
|
|
2278
|
+
#endif`,wd=`#if defined( TONE_MAPPING )
|
|
2279
|
+
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
|
|
2280
|
+
#endif`,Td=`#ifndef saturate
|
|
2281
|
+
#define saturate( a ) clamp( a, 0.0, 1.0 )
|
|
2282
|
+
#endif
|
|
2283
|
+
uniform float toneMappingExposure;
|
|
2284
|
+
vec3 LinearToneMapping( vec3 color ) {
|
|
2285
|
+
return saturate( toneMappingExposure * color );
|
|
2286
|
+
}
|
|
2287
|
+
vec3 ReinhardToneMapping( vec3 color ) {
|
|
2288
|
+
color *= toneMappingExposure;
|
|
2289
|
+
return saturate( color / ( vec3( 1.0 ) + color ) );
|
|
2290
|
+
}
|
|
2291
|
+
vec3 CineonToneMapping( vec3 color ) {
|
|
2292
|
+
color *= toneMappingExposure;
|
|
2293
|
+
color = max( vec3( 0.0 ), color - 0.004 );
|
|
2294
|
+
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
|
|
2295
|
+
}
|
|
2296
|
+
vec3 RRTAndODTFit( vec3 v ) {
|
|
2297
|
+
vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
|
|
2298
|
+
vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
|
|
2299
|
+
return a / b;
|
|
2300
|
+
}
|
|
2301
|
+
vec3 ACESFilmicToneMapping( vec3 color ) {
|
|
2302
|
+
const mat3 ACESInputMat = mat3(
|
|
2303
|
+
vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),
|
|
2304
|
+
vec3( 0.04823, 0.01566, 0.83777 )
|
|
2305
|
+
);
|
|
2306
|
+
const mat3 ACESOutputMat = mat3(
|
|
2307
|
+
vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),
|
|
2308
|
+
vec3( -0.07367, -0.00605, 1.07602 )
|
|
2309
|
+
);
|
|
2310
|
+
color *= toneMappingExposure / 0.6;
|
|
2311
|
+
color = ACESInputMat * color;
|
|
2312
|
+
color = RRTAndODTFit( color );
|
|
2313
|
+
color = ACESOutputMat * color;
|
|
2314
|
+
return saturate( color );
|
|
2315
|
+
}
|
|
2316
|
+
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
|
|
2317
|
+
vec3( 1.6605, - 0.1246, - 0.0182 ),
|
|
2318
|
+
vec3( - 0.5876, 1.1329, - 0.1006 ),
|
|
2319
|
+
vec3( - 0.0728, - 0.0083, 1.1187 )
|
|
2320
|
+
);
|
|
2321
|
+
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
|
|
2322
|
+
vec3( 0.6274, 0.0691, 0.0164 ),
|
|
2323
|
+
vec3( 0.3293, 0.9195, 0.0880 ),
|
|
2324
|
+
vec3( 0.0433, 0.0113, 0.8956 )
|
|
2325
|
+
);
|
|
2326
|
+
vec3 agxDefaultContrastApprox( vec3 x ) {
|
|
2327
|
+
vec3 x2 = x * x;
|
|
2328
|
+
vec3 x4 = x2 * x2;
|
|
2329
|
+
return + 15.5 * x4 * x2
|
|
2330
|
+
- 40.14 * x4 * x
|
|
2331
|
+
+ 31.96 * x4
|
|
2332
|
+
- 6.868 * x2 * x
|
|
2333
|
+
+ 0.4298 * x2
|
|
2334
|
+
+ 0.1191 * x
|
|
2335
|
+
- 0.00232;
|
|
2336
|
+
}
|
|
2337
|
+
vec3 AgXToneMapping( vec3 color ) {
|
|
2338
|
+
const mat3 AgXInsetMatrix = mat3(
|
|
2339
|
+
vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
|
|
2340
|
+
vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
|
|
2341
|
+
vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
|
|
2342
|
+
);
|
|
2343
|
+
const mat3 AgXOutsetMatrix = mat3(
|
|
2344
|
+
vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
|
|
2345
|
+
vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
|
|
2346
|
+
vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
|
|
2347
|
+
);
|
|
2348
|
+
const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;
|
|
2349
|
+
color *= toneMappingExposure;
|
|
2350
|
+
color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
|
|
2351
|
+
color = AgXInsetMatrix * color;
|
|
2352
|
+
color = max( color, 1e-10 ); color = log2( color );
|
|
2353
|
+
color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
|
|
2354
|
+
color = clamp( color, 0.0, 1.0 );
|
|
2355
|
+
color = agxDefaultContrastApprox( color );
|
|
2356
|
+
color = AgXOutsetMatrix * color;
|
|
2357
|
+
color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
|
|
2358
|
+
color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
|
|
2359
|
+
color = clamp( color, 0.0, 1.0 );
|
|
2360
|
+
return color;
|
|
2361
|
+
}
|
|
2362
|
+
vec3 NeutralToneMapping( vec3 color ) {
|
|
2363
|
+
const float StartCompression = 0.8 - 0.04;
|
|
2364
|
+
const float Desaturation = 0.15;
|
|
2365
|
+
color *= toneMappingExposure;
|
|
2366
|
+
float x = min( color.r, min( color.g, color.b ) );
|
|
2367
|
+
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
|
2368
|
+
color -= offset;
|
|
2369
|
+
float peak = max( color.r, max( color.g, color.b ) );
|
|
2370
|
+
if ( peak < StartCompression ) return color;
|
|
2371
|
+
float d = 1. - StartCompression;
|
|
2372
|
+
float newPeak = 1. - d * d / ( peak + d - StartCompression );
|
|
2373
|
+
color *= newPeak / peak;
|
|
2374
|
+
float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
|
|
2375
|
+
return mix( color, vec3( newPeak ), g );
|
|
2376
|
+
}
|
|
2377
|
+
vec3 CustomToneMapping( vec3 color ) { return color; }`,Ed=`#ifdef USE_TRANSMISSION
|
|
2378
|
+
material.transmission = transmission;
|
|
2379
|
+
material.transmissionAlpha = 1.0;
|
|
2380
|
+
material.thickness = thickness;
|
|
2381
|
+
material.attenuationDistance = attenuationDistance;
|
|
2382
|
+
material.attenuationColor = attenuationColor;
|
|
2383
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
2384
|
+
material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
|
|
2385
|
+
#endif
|
|
2386
|
+
#ifdef USE_THICKNESSMAP
|
|
2387
|
+
material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
|
|
2388
|
+
#endif
|
|
2389
|
+
vec3 pos = vWorldPosition;
|
|
2390
|
+
vec3 v = normalize( cameraPosition - pos );
|
|
2391
|
+
vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );
|
|
2392
|
+
vec4 transmitted = getIBLVolumeRefraction(
|
|
2393
|
+
n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
|
|
2394
|
+
pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
|
|
2395
|
+
material.attenuationColor, material.attenuationDistance );
|
|
2396
|
+
material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
|
|
2397
|
+
totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
|
|
2398
|
+
#endif`,Ad=`#ifdef USE_TRANSMISSION
|
|
2399
|
+
uniform float transmission;
|
|
2400
|
+
uniform float thickness;
|
|
2401
|
+
uniform float attenuationDistance;
|
|
2402
|
+
uniform vec3 attenuationColor;
|
|
2403
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
2404
|
+
uniform sampler2D transmissionMap;
|
|
2405
|
+
#endif
|
|
2406
|
+
#ifdef USE_THICKNESSMAP
|
|
2407
|
+
uniform sampler2D thicknessMap;
|
|
2408
|
+
#endif
|
|
2409
|
+
uniform vec2 transmissionSamplerSize;
|
|
2410
|
+
uniform sampler2D transmissionSamplerMap;
|
|
2411
|
+
uniform mat4 modelMatrix;
|
|
2412
|
+
uniform mat4 projectionMatrix;
|
|
2413
|
+
varying vec3 vWorldPosition;
|
|
2414
|
+
float w0( float a ) {
|
|
2415
|
+
return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
|
|
2416
|
+
}
|
|
2417
|
+
float w1( float a ) {
|
|
2418
|
+
return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );
|
|
2419
|
+
}
|
|
2420
|
+
float w2( float a ){
|
|
2421
|
+
return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
|
|
2422
|
+
}
|
|
2423
|
+
float w3( float a ) {
|
|
2424
|
+
return ( 1.0 / 6.0 ) * ( a * a * a );
|
|
2425
|
+
}
|
|
2426
|
+
float g0( float a ) {
|
|
2427
|
+
return w0( a ) + w1( a );
|
|
2428
|
+
}
|
|
2429
|
+
float g1( float a ) {
|
|
2430
|
+
return w2( a ) + w3( a );
|
|
2431
|
+
}
|
|
2432
|
+
float h0( float a ) {
|
|
2433
|
+
return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
|
|
2434
|
+
}
|
|
2435
|
+
float h1( float a ) {
|
|
2436
|
+
return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
|
|
2437
|
+
}
|
|
2438
|
+
vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
|
|
2439
|
+
uv = uv * texelSize.zw + 0.5;
|
|
2440
|
+
vec2 iuv = floor( uv );
|
|
2441
|
+
vec2 fuv = fract( uv );
|
|
2442
|
+
float g0x = g0( fuv.x );
|
|
2443
|
+
float g1x = g1( fuv.x );
|
|
2444
|
+
float h0x = h0( fuv.x );
|
|
2445
|
+
float h1x = h1( fuv.x );
|
|
2446
|
+
float h0y = h0( fuv.y );
|
|
2447
|
+
float h1y = h1( fuv.y );
|
|
2448
|
+
vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|
2449
|
+
vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
|
|
2450
|
+
vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|
2451
|
+
vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
|
|
2452
|
+
return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
|
|
2453
|
+
g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
|
|
2454
|
+
}
|
|
2455
|
+
vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
|
|
2456
|
+
vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
|
|
2457
|
+
vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
|
|
2458
|
+
vec2 fLodSizeInv = 1.0 / fLodSize;
|
|
2459
|
+
vec2 cLodSizeInv = 1.0 / cLodSize;
|
|
2460
|
+
vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
|
|
2461
|
+
vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
|
|
2462
|
+
return mix( fSample, cSample, fract( lod ) );
|
|
2463
|
+
}
|
|
2464
|
+
vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
|
|
2465
|
+
vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
|
|
2466
|
+
vec3 modelScale;
|
|
2467
|
+
modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
|
|
2468
|
+
modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
|
|
2469
|
+
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|
2470
|
+
return normalize( refractionVector ) * thickness * modelScale;
|
|
2471
|
+
}
|
|
2472
|
+
float applyIorToRoughness( const in float roughness, const in float ior ) {
|
|
2473
|
+
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|
2474
|
+
}
|
|
2475
|
+
vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
|
|
2476
|
+
float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|
2477
|
+
return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
|
|
2478
|
+
}
|
|
2479
|
+
vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
2480
|
+
if ( isinf( attenuationDistance ) ) {
|
|
2481
|
+
return vec3( 1.0 );
|
|
2482
|
+
} else {
|
|
2483
|
+
vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
|
|
2484
|
+
vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
|
|
2488
|
+
const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
|
|
2489
|
+
const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
|
|
2490
|
+
const in vec3 attenuationColor, const in float attenuationDistance ) {
|
|
2491
|
+
vec4 transmittedLight;
|
|
2492
|
+
vec3 transmittance;
|
|
2493
|
+
#ifdef USE_DISPERSION
|
|
2494
|
+
float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
|
|
2495
|
+
vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
|
|
2496
|
+
for ( int i = 0; i < 3; i ++ ) {
|
|
2497
|
+
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
|
|
2498
|
+
vec3 refractedRayExit = position + transmissionRay;
|
|
2499
|
+
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
2500
|
+
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
2501
|
+
refractionCoords += 1.0;
|
|
2502
|
+
refractionCoords /= 2.0;
|
|
2503
|
+
vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
|
|
2504
|
+
transmittedLight[ i ] = transmissionSample[ i ];
|
|
2505
|
+
transmittedLight.a += transmissionSample.a;
|
|
2506
|
+
transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
|
|
2507
|
+
}
|
|
2508
|
+
transmittedLight.a /= 3.0;
|
|
2509
|
+
#else
|
|
2510
|
+
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|
2511
|
+
vec3 refractedRayExit = position + transmissionRay;
|
|
2512
|
+
vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
|
|
2513
|
+
vec2 refractionCoords = ndcPos.xy / ndcPos.w;
|
|
2514
|
+
refractionCoords += 1.0;
|
|
2515
|
+
refractionCoords /= 2.0;
|
|
2516
|
+
transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
|
|
2517
|
+
transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
|
|
2518
|
+
#endif
|
|
2519
|
+
vec3 attenuatedColor = transmittance * transmittedLight.rgb;
|
|
2520
|
+
vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
|
|
2521
|
+
float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
|
|
2522
|
+
return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
|
|
2523
|
+
}
|
|
2524
|
+
#endif`,Cd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2525
|
+
varying vec2 vUv;
|
|
2526
|
+
#endif
|
|
2527
|
+
#ifdef USE_MAP
|
|
2528
|
+
varying vec2 vMapUv;
|
|
2529
|
+
#endif
|
|
2530
|
+
#ifdef USE_ALPHAMAP
|
|
2531
|
+
varying vec2 vAlphaMapUv;
|
|
2532
|
+
#endif
|
|
2533
|
+
#ifdef USE_LIGHTMAP
|
|
2534
|
+
varying vec2 vLightMapUv;
|
|
2535
|
+
#endif
|
|
2536
|
+
#ifdef USE_AOMAP
|
|
2537
|
+
varying vec2 vAoMapUv;
|
|
2538
|
+
#endif
|
|
2539
|
+
#ifdef USE_BUMPMAP
|
|
2540
|
+
varying vec2 vBumpMapUv;
|
|
2541
|
+
#endif
|
|
2542
|
+
#ifdef USE_NORMALMAP
|
|
2543
|
+
varying vec2 vNormalMapUv;
|
|
2544
|
+
#endif
|
|
2545
|
+
#ifdef USE_EMISSIVEMAP
|
|
2546
|
+
varying vec2 vEmissiveMapUv;
|
|
2547
|
+
#endif
|
|
2548
|
+
#ifdef USE_METALNESSMAP
|
|
2549
|
+
varying vec2 vMetalnessMapUv;
|
|
2550
|
+
#endif
|
|
2551
|
+
#ifdef USE_ROUGHNESSMAP
|
|
2552
|
+
varying vec2 vRoughnessMapUv;
|
|
2553
|
+
#endif
|
|
2554
|
+
#ifdef USE_ANISOTROPYMAP
|
|
2555
|
+
varying vec2 vAnisotropyMapUv;
|
|
2556
|
+
#endif
|
|
2557
|
+
#ifdef USE_CLEARCOATMAP
|
|
2558
|
+
varying vec2 vClearcoatMapUv;
|
|
2559
|
+
#endif
|
|
2560
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2561
|
+
varying vec2 vClearcoatNormalMapUv;
|
|
2562
|
+
#endif
|
|
2563
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2564
|
+
varying vec2 vClearcoatRoughnessMapUv;
|
|
2565
|
+
#endif
|
|
2566
|
+
#ifdef USE_IRIDESCENCEMAP
|
|
2567
|
+
varying vec2 vIridescenceMapUv;
|
|
2568
|
+
#endif
|
|
2569
|
+
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2570
|
+
varying vec2 vIridescenceThicknessMapUv;
|
|
2571
|
+
#endif
|
|
2572
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
2573
|
+
varying vec2 vSheenColorMapUv;
|
|
2574
|
+
#endif
|
|
2575
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2576
|
+
varying vec2 vSheenRoughnessMapUv;
|
|
2577
|
+
#endif
|
|
2578
|
+
#ifdef USE_SPECULARMAP
|
|
2579
|
+
varying vec2 vSpecularMapUv;
|
|
2580
|
+
#endif
|
|
2581
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
2582
|
+
varying vec2 vSpecularColorMapUv;
|
|
2583
|
+
#endif
|
|
2584
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2585
|
+
varying vec2 vSpecularIntensityMapUv;
|
|
2586
|
+
#endif
|
|
2587
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
2588
|
+
uniform mat3 transmissionMapTransform;
|
|
2589
|
+
varying vec2 vTransmissionMapUv;
|
|
2590
|
+
#endif
|
|
2591
|
+
#ifdef USE_THICKNESSMAP
|
|
2592
|
+
uniform mat3 thicknessMapTransform;
|
|
2593
|
+
varying vec2 vThicknessMapUv;
|
|
2594
|
+
#endif`,Rd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2595
|
+
varying vec2 vUv;
|
|
2596
|
+
#endif
|
|
2597
|
+
#ifdef USE_MAP
|
|
2598
|
+
uniform mat3 mapTransform;
|
|
2599
|
+
varying vec2 vMapUv;
|
|
2600
|
+
#endif
|
|
2601
|
+
#ifdef USE_ALPHAMAP
|
|
2602
|
+
uniform mat3 alphaMapTransform;
|
|
2603
|
+
varying vec2 vAlphaMapUv;
|
|
2604
|
+
#endif
|
|
2605
|
+
#ifdef USE_LIGHTMAP
|
|
2606
|
+
uniform mat3 lightMapTransform;
|
|
2607
|
+
varying vec2 vLightMapUv;
|
|
2608
|
+
#endif
|
|
2609
|
+
#ifdef USE_AOMAP
|
|
2610
|
+
uniform mat3 aoMapTransform;
|
|
2611
|
+
varying vec2 vAoMapUv;
|
|
2612
|
+
#endif
|
|
2613
|
+
#ifdef USE_BUMPMAP
|
|
2614
|
+
uniform mat3 bumpMapTransform;
|
|
2615
|
+
varying vec2 vBumpMapUv;
|
|
2616
|
+
#endif
|
|
2617
|
+
#ifdef USE_NORMALMAP
|
|
2618
|
+
uniform mat3 normalMapTransform;
|
|
2619
|
+
varying vec2 vNormalMapUv;
|
|
2620
|
+
#endif
|
|
2621
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
2622
|
+
uniform mat3 displacementMapTransform;
|
|
2623
|
+
varying vec2 vDisplacementMapUv;
|
|
2624
|
+
#endif
|
|
2625
|
+
#ifdef USE_EMISSIVEMAP
|
|
2626
|
+
uniform mat3 emissiveMapTransform;
|
|
2627
|
+
varying vec2 vEmissiveMapUv;
|
|
2628
|
+
#endif
|
|
2629
|
+
#ifdef USE_METALNESSMAP
|
|
2630
|
+
uniform mat3 metalnessMapTransform;
|
|
2631
|
+
varying vec2 vMetalnessMapUv;
|
|
2632
|
+
#endif
|
|
2633
|
+
#ifdef USE_ROUGHNESSMAP
|
|
2634
|
+
uniform mat3 roughnessMapTransform;
|
|
2635
|
+
varying vec2 vRoughnessMapUv;
|
|
2636
|
+
#endif
|
|
2637
|
+
#ifdef USE_ANISOTROPYMAP
|
|
2638
|
+
uniform mat3 anisotropyMapTransform;
|
|
2639
|
+
varying vec2 vAnisotropyMapUv;
|
|
2640
|
+
#endif
|
|
2641
|
+
#ifdef USE_CLEARCOATMAP
|
|
2642
|
+
uniform mat3 clearcoatMapTransform;
|
|
2643
|
+
varying vec2 vClearcoatMapUv;
|
|
2644
|
+
#endif
|
|
2645
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2646
|
+
uniform mat3 clearcoatNormalMapTransform;
|
|
2647
|
+
varying vec2 vClearcoatNormalMapUv;
|
|
2648
|
+
#endif
|
|
2649
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2650
|
+
uniform mat3 clearcoatRoughnessMapTransform;
|
|
2651
|
+
varying vec2 vClearcoatRoughnessMapUv;
|
|
2652
|
+
#endif
|
|
2653
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
2654
|
+
uniform mat3 sheenColorMapTransform;
|
|
2655
|
+
varying vec2 vSheenColorMapUv;
|
|
2656
|
+
#endif
|
|
2657
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2658
|
+
uniform mat3 sheenRoughnessMapTransform;
|
|
2659
|
+
varying vec2 vSheenRoughnessMapUv;
|
|
2660
|
+
#endif
|
|
2661
|
+
#ifdef USE_IRIDESCENCEMAP
|
|
2662
|
+
uniform mat3 iridescenceMapTransform;
|
|
2663
|
+
varying vec2 vIridescenceMapUv;
|
|
2664
|
+
#endif
|
|
2665
|
+
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2666
|
+
uniform mat3 iridescenceThicknessMapTransform;
|
|
2667
|
+
varying vec2 vIridescenceThicknessMapUv;
|
|
2668
|
+
#endif
|
|
2669
|
+
#ifdef USE_SPECULARMAP
|
|
2670
|
+
uniform mat3 specularMapTransform;
|
|
2671
|
+
varying vec2 vSpecularMapUv;
|
|
2672
|
+
#endif
|
|
2673
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
2674
|
+
uniform mat3 specularColorMapTransform;
|
|
2675
|
+
varying vec2 vSpecularColorMapUv;
|
|
2676
|
+
#endif
|
|
2677
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2678
|
+
uniform mat3 specularIntensityMapTransform;
|
|
2679
|
+
varying vec2 vSpecularIntensityMapUv;
|
|
2680
|
+
#endif
|
|
2681
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
2682
|
+
uniform mat3 transmissionMapTransform;
|
|
2683
|
+
varying vec2 vTransmissionMapUv;
|
|
2684
|
+
#endif
|
|
2685
|
+
#ifdef USE_THICKNESSMAP
|
|
2686
|
+
uniform mat3 thicknessMapTransform;
|
|
2687
|
+
varying vec2 vThicknessMapUv;
|
|
2688
|
+
#endif`,Pd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
2689
|
+
vUv = vec3( uv, 1 ).xy;
|
|
2690
|
+
#endif
|
|
2691
|
+
#ifdef USE_MAP
|
|
2692
|
+
vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
|
|
2693
|
+
#endif
|
|
2694
|
+
#ifdef USE_ALPHAMAP
|
|
2695
|
+
vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
|
|
2696
|
+
#endif
|
|
2697
|
+
#ifdef USE_LIGHTMAP
|
|
2698
|
+
vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
|
|
2699
|
+
#endif
|
|
2700
|
+
#ifdef USE_AOMAP
|
|
2701
|
+
vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
|
|
2702
|
+
#endif
|
|
2703
|
+
#ifdef USE_BUMPMAP
|
|
2704
|
+
vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
|
|
2705
|
+
#endif
|
|
2706
|
+
#ifdef USE_NORMALMAP
|
|
2707
|
+
vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
|
|
2708
|
+
#endif
|
|
2709
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
2710
|
+
vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
|
|
2711
|
+
#endif
|
|
2712
|
+
#ifdef USE_EMISSIVEMAP
|
|
2713
|
+
vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
|
|
2714
|
+
#endif
|
|
2715
|
+
#ifdef USE_METALNESSMAP
|
|
2716
|
+
vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
|
|
2717
|
+
#endif
|
|
2718
|
+
#ifdef USE_ROUGHNESSMAP
|
|
2719
|
+
vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2720
|
+
#endif
|
|
2721
|
+
#ifdef USE_ANISOTROPYMAP
|
|
2722
|
+
vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
|
|
2723
|
+
#endif
|
|
2724
|
+
#ifdef USE_CLEARCOATMAP
|
|
2725
|
+
vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
|
|
2726
|
+
#endif
|
|
2727
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
2728
|
+
vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
|
|
2729
|
+
#endif
|
|
2730
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
2731
|
+
vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2732
|
+
#endif
|
|
2733
|
+
#ifdef USE_IRIDESCENCEMAP
|
|
2734
|
+
vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
|
|
2735
|
+
#endif
|
|
2736
|
+
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
2737
|
+
vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
|
|
2738
|
+
#endif
|
|
2739
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
2740
|
+
vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
|
|
2741
|
+
#endif
|
|
2742
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
2743
|
+
vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
|
|
2744
|
+
#endif
|
|
2745
|
+
#ifdef USE_SPECULARMAP
|
|
2746
|
+
vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
|
|
2747
|
+
#endif
|
|
2748
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
2749
|
+
vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
|
|
2750
|
+
#endif
|
|
2751
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
2752
|
+
vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
|
|
2753
|
+
#endif
|
|
2754
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
2755
|
+
vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
|
|
2756
|
+
#endif
|
|
2757
|
+
#ifdef USE_THICKNESSMAP
|
|
2758
|
+
vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
|
|
2759
|
+
#endif`,Id=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
|
|
2760
|
+
vec4 worldPosition = vec4( transformed, 1.0 );
|
|
2761
|
+
#ifdef USE_BATCHING
|
|
2762
|
+
worldPosition = batchingMatrix * worldPosition;
|
|
2763
|
+
#endif
|
|
2764
|
+
#ifdef USE_INSTANCING
|
|
2765
|
+
worldPosition = instanceMatrix * worldPosition;
|
|
2766
|
+
#endif
|
|
2767
|
+
worldPosition = modelMatrix * worldPosition;
|
|
2768
|
+
#endif`,Ld=`varying vec2 vUv;
|
|
2769
|
+
uniform mat3 uvTransform;
|
|
2770
|
+
void main() {
|
|
2771
|
+
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
2772
|
+
gl_Position = vec4( position.xy, 1.0, 1.0 );
|
|
2773
|
+
}`,Dd=`uniform sampler2D t2D;
|
|
2774
|
+
uniform float backgroundIntensity;
|
|
2775
|
+
varying vec2 vUv;
|
|
2776
|
+
void main() {
|
|
2777
|
+
vec4 texColor = texture2D( t2D, vUv );
|
|
2778
|
+
#ifdef DECODE_VIDEO_TEXTURE
|
|
2779
|
+
texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
|
|
2780
|
+
#endif
|
|
2781
|
+
texColor.rgb *= backgroundIntensity;
|
|
2782
|
+
gl_FragColor = texColor;
|
|
2783
|
+
#include <tonemapping_fragment>
|
|
2784
|
+
#include <colorspace_fragment>
|
|
2785
|
+
}`,Ud=`varying vec3 vWorldDirection;
|
|
2786
|
+
#include <common>
|
|
2787
|
+
void main() {
|
|
2788
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2789
|
+
#include <begin_vertex>
|
|
2790
|
+
#include <project_vertex>
|
|
2791
|
+
gl_Position.z = gl_Position.w;
|
|
2792
|
+
}`,Nd=`#ifdef ENVMAP_TYPE_CUBE
|
|
2793
|
+
uniform samplerCube envMap;
|
|
2794
|
+
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2795
|
+
uniform sampler2D envMap;
|
|
2796
|
+
#endif
|
|
2797
|
+
uniform float backgroundBlurriness;
|
|
2798
|
+
uniform float backgroundIntensity;
|
|
2799
|
+
uniform mat3 backgroundRotation;
|
|
2800
|
+
varying vec3 vWorldDirection;
|
|
2801
|
+
#include <cube_uv_reflection_fragment>
|
|
2802
|
+
void main() {
|
|
2803
|
+
#ifdef ENVMAP_TYPE_CUBE
|
|
2804
|
+
vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
|
|
2805
|
+
#elif defined( ENVMAP_TYPE_CUBE_UV )
|
|
2806
|
+
vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
|
|
2807
|
+
#else
|
|
2808
|
+
vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
2809
|
+
#endif
|
|
2810
|
+
texColor.rgb *= backgroundIntensity;
|
|
2811
|
+
gl_FragColor = texColor;
|
|
2812
|
+
#include <tonemapping_fragment>
|
|
2813
|
+
#include <colorspace_fragment>
|
|
2814
|
+
}`,Fd=`varying vec3 vWorldDirection;
|
|
2815
|
+
#include <common>
|
|
2816
|
+
void main() {
|
|
2817
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2818
|
+
#include <begin_vertex>
|
|
2819
|
+
#include <project_vertex>
|
|
2820
|
+
gl_Position.z = gl_Position.w;
|
|
2821
|
+
}`,Od=`uniform samplerCube tCube;
|
|
2822
|
+
uniform float tFlip;
|
|
2823
|
+
uniform float opacity;
|
|
2824
|
+
varying vec3 vWorldDirection;
|
|
2825
|
+
void main() {
|
|
2826
|
+
vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
|
|
2827
|
+
gl_FragColor = texColor;
|
|
2828
|
+
gl_FragColor.a *= opacity;
|
|
2829
|
+
#include <tonemapping_fragment>
|
|
2830
|
+
#include <colorspace_fragment>
|
|
2831
|
+
}`,Bd=`#include <common>
|
|
2832
|
+
#include <batching_pars_vertex>
|
|
2833
|
+
#include <uv_pars_vertex>
|
|
2834
|
+
#include <displacementmap_pars_vertex>
|
|
2835
|
+
#include <morphtarget_pars_vertex>
|
|
2836
|
+
#include <skinning_pars_vertex>
|
|
2837
|
+
#include <logdepthbuf_pars_vertex>
|
|
2838
|
+
#include <clipping_planes_pars_vertex>
|
|
2839
|
+
varying vec2 vHighPrecisionZW;
|
|
2840
|
+
void main() {
|
|
2841
|
+
#include <uv_vertex>
|
|
2842
|
+
#include <batching_vertex>
|
|
2843
|
+
#include <skinbase_vertex>
|
|
2844
|
+
#include <morphinstance_vertex>
|
|
2845
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
2846
|
+
#include <beginnormal_vertex>
|
|
2847
|
+
#include <morphnormal_vertex>
|
|
2848
|
+
#include <skinnormal_vertex>
|
|
2849
|
+
#endif
|
|
2850
|
+
#include <begin_vertex>
|
|
2851
|
+
#include <morphtarget_vertex>
|
|
2852
|
+
#include <skinning_vertex>
|
|
2853
|
+
#include <displacementmap_vertex>
|
|
2854
|
+
#include <project_vertex>
|
|
2855
|
+
#include <logdepthbuf_vertex>
|
|
2856
|
+
#include <clipping_planes_vertex>
|
|
2857
|
+
vHighPrecisionZW = gl_Position.zw;
|
|
2858
|
+
}`,zd=`#if DEPTH_PACKING == 3200
|
|
2859
|
+
uniform float opacity;
|
|
2860
|
+
#endif
|
|
2861
|
+
#include <common>
|
|
2862
|
+
#include <packing>
|
|
2863
|
+
#include <uv_pars_fragment>
|
|
2864
|
+
#include <map_pars_fragment>
|
|
2865
|
+
#include <alphamap_pars_fragment>
|
|
2866
|
+
#include <alphatest_pars_fragment>
|
|
2867
|
+
#include <alphahash_pars_fragment>
|
|
2868
|
+
#include <logdepthbuf_pars_fragment>
|
|
2869
|
+
#include <clipping_planes_pars_fragment>
|
|
2870
|
+
varying vec2 vHighPrecisionZW;
|
|
2871
|
+
void main() {
|
|
2872
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
2873
|
+
#include <clipping_planes_fragment>
|
|
2874
|
+
#if DEPTH_PACKING == 3200
|
|
2875
|
+
diffuseColor.a = opacity;
|
|
2876
|
+
#endif
|
|
2877
|
+
#include <map_fragment>
|
|
2878
|
+
#include <alphamap_fragment>
|
|
2879
|
+
#include <alphatest_fragment>
|
|
2880
|
+
#include <alphahash_fragment>
|
|
2881
|
+
#include <logdepthbuf_fragment>
|
|
2882
|
+
#ifdef USE_REVERSED_DEPTH_BUFFER
|
|
2883
|
+
float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
|
|
2884
|
+
#else
|
|
2885
|
+
float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
|
|
2886
|
+
#endif
|
|
2887
|
+
#if DEPTH_PACKING == 3200
|
|
2888
|
+
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
|
|
2889
|
+
#elif DEPTH_PACKING == 3201
|
|
2890
|
+
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
2891
|
+
#elif DEPTH_PACKING == 3202
|
|
2892
|
+
gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
|
|
2893
|
+
#elif DEPTH_PACKING == 3203
|
|
2894
|
+
gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
|
|
2895
|
+
#endif
|
|
2896
|
+
}`,Vd=`#define DISTANCE
|
|
2897
|
+
varying vec3 vWorldPosition;
|
|
2898
|
+
#include <common>
|
|
2899
|
+
#include <batching_pars_vertex>
|
|
2900
|
+
#include <uv_pars_vertex>
|
|
2901
|
+
#include <displacementmap_pars_vertex>
|
|
2902
|
+
#include <morphtarget_pars_vertex>
|
|
2903
|
+
#include <skinning_pars_vertex>
|
|
2904
|
+
#include <clipping_planes_pars_vertex>
|
|
2905
|
+
void main() {
|
|
2906
|
+
#include <uv_vertex>
|
|
2907
|
+
#include <batching_vertex>
|
|
2908
|
+
#include <skinbase_vertex>
|
|
2909
|
+
#include <morphinstance_vertex>
|
|
2910
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
2911
|
+
#include <beginnormal_vertex>
|
|
2912
|
+
#include <morphnormal_vertex>
|
|
2913
|
+
#include <skinnormal_vertex>
|
|
2914
|
+
#endif
|
|
2915
|
+
#include <begin_vertex>
|
|
2916
|
+
#include <morphtarget_vertex>
|
|
2917
|
+
#include <skinning_vertex>
|
|
2918
|
+
#include <displacementmap_vertex>
|
|
2919
|
+
#include <project_vertex>
|
|
2920
|
+
#include <worldpos_vertex>
|
|
2921
|
+
#include <clipping_planes_vertex>
|
|
2922
|
+
vWorldPosition = worldPosition.xyz;
|
|
2923
|
+
}`,kd=`#define DISTANCE
|
|
2924
|
+
uniform vec3 referencePosition;
|
|
2925
|
+
uniform float nearDistance;
|
|
2926
|
+
uniform float farDistance;
|
|
2927
|
+
varying vec3 vWorldPosition;
|
|
2928
|
+
#include <common>
|
|
2929
|
+
#include <uv_pars_fragment>
|
|
2930
|
+
#include <map_pars_fragment>
|
|
2931
|
+
#include <alphamap_pars_fragment>
|
|
2932
|
+
#include <alphatest_pars_fragment>
|
|
2933
|
+
#include <alphahash_pars_fragment>
|
|
2934
|
+
#include <clipping_planes_pars_fragment>
|
|
2935
|
+
void main() {
|
|
2936
|
+
vec4 diffuseColor = vec4( 1.0 );
|
|
2937
|
+
#include <clipping_planes_fragment>
|
|
2938
|
+
#include <map_fragment>
|
|
2939
|
+
#include <alphamap_fragment>
|
|
2940
|
+
#include <alphatest_fragment>
|
|
2941
|
+
#include <alphahash_fragment>
|
|
2942
|
+
float dist = length( vWorldPosition - referencePosition );
|
|
2943
|
+
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
|
|
2944
|
+
dist = saturate( dist );
|
|
2945
|
+
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
|
|
2946
|
+
}`,Gd=`varying vec3 vWorldDirection;
|
|
2947
|
+
#include <common>
|
|
2948
|
+
void main() {
|
|
2949
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
2950
|
+
#include <begin_vertex>
|
|
2951
|
+
#include <project_vertex>
|
|
2952
|
+
}`,Hd=`uniform sampler2D tEquirect;
|
|
2953
|
+
varying vec3 vWorldDirection;
|
|
2954
|
+
#include <common>
|
|
2955
|
+
void main() {
|
|
2956
|
+
vec3 direction = normalize( vWorldDirection );
|
|
2957
|
+
vec2 sampleUV = equirectUv( direction );
|
|
2958
|
+
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
2959
|
+
#include <tonemapping_fragment>
|
|
2960
|
+
#include <colorspace_fragment>
|
|
2961
|
+
}`,Wd=`uniform float scale;
|
|
2962
|
+
attribute float lineDistance;
|
|
2963
|
+
varying float vLineDistance;
|
|
2964
|
+
#include <common>
|
|
2965
|
+
#include <uv_pars_vertex>
|
|
2966
|
+
#include <color_pars_vertex>
|
|
2967
|
+
#include <fog_pars_vertex>
|
|
2968
|
+
#include <morphtarget_pars_vertex>
|
|
2969
|
+
#include <logdepthbuf_pars_vertex>
|
|
2970
|
+
#include <clipping_planes_pars_vertex>
|
|
2971
|
+
void main() {
|
|
2972
|
+
vLineDistance = scale * lineDistance;
|
|
2973
|
+
#include <uv_vertex>
|
|
2974
|
+
#include <color_vertex>
|
|
2975
|
+
#include <morphinstance_vertex>
|
|
2976
|
+
#include <morphcolor_vertex>
|
|
2977
|
+
#include <begin_vertex>
|
|
2978
|
+
#include <morphtarget_vertex>
|
|
2979
|
+
#include <project_vertex>
|
|
2980
|
+
#include <logdepthbuf_vertex>
|
|
2981
|
+
#include <clipping_planes_vertex>
|
|
2982
|
+
#include <fog_vertex>
|
|
2983
|
+
}`,Xd=`uniform vec3 diffuse;
|
|
2984
|
+
uniform float opacity;
|
|
2985
|
+
uniform float dashSize;
|
|
2986
|
+
uniform float totalSize;
|
|
2987
|
+
varying float vLineDistance;
|
|
2988
|
+
#include <common>
|
|
2989
|
+
#include <color_pars_fragment>
|
|
2990
|
+
#include <uv_pars_fragment>
|
|
2991
|
+
#include <map_pars_fragment>
|
|
2992
|
+
#include <fog_pars_fragment>
|
|
2993
|
+
#include <logdepthbuf_pars_fragment>
|
|
2994
|
+
#include <clipping_planes_pars_fragment>
|
|
2995
|
+
void main() {
|
|
2996
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
2997
|
+
#include <clipping_planes_fragment>
|
|
2998
|
+
if ( mod( vLineDistance, totalSize ) > dashSize ) {
|
|
2999
|
+
discard;
|
|
3000
|
+
}
|
|
3001
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
3002
|
+
#include <logdepthbuf_fragment>
|
|
3003
|
+
#include <map_fragment>
|
|
3004
|
+
#include <color_fragment>
|
|
3005
|
+
outgoingLight = diffuseColor.rgb;
|
|
3006
|
+
#include <opaque_fragment>
|
|
3007
|
+
#include <tonemapping_fragment>
|
|
3008
|
+
#include <colorspace_fragment>
|
|
3009
|
+
#include <fog_fragment>
|
|
3010
|
+
#include <premultiplied_alpha_fragment>
|
|
3011
|
+
}`,qd=`#include <common>
|
|
3012
|
+
#include <batching_pars_vertex>
|
|
3013
|
+
#include <uv_pars_vertex>
|
|
3014
|
+
#include <envmap_pars_vertex>
|
|
3015
|
+
#include <color_pars_vertex>
|
|
3016
|
+
#include <fog_pars_vertex>
|
|
3017
|
+
#include <morphtarget_pars_vertex>
|
|
3018
|
+
#include <skinning_pars_vertex>
|
|
3019
|
+
#include <logdepthbuf_pars_vertex>
|
|
3020
|
+
#include <clipping_planes_pars_vertex>
|
|
3021
|
+
void main() {
|
|
3022
|
+
#include <uv_vertex>
|
|
3023
|
+
#include <color_vertex>
|
|
3024
|
+
#include <morphinstance_vertex>
|
|
3025
|
+
#include <morphcolor_vertex>
|
|
3026
|
+
#include <batching_vertex>
|
|
3027
|
+
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
|
|
3028
|
+
#include <beginnormal_vertex>
|
|
3029
|
+
#include <morphnormal_vertex>
|
|
3030
|
+
#include <skinbase_vertex>
|
|
3031
|
+
#include <skinnormal_vertex>
|
|
3032
|
+
#include <defaultnormal_vertex>
|
|
3033
|
+
#endif
|
|
3034
|
+
#include <begin_vertex>
|
|
3035
|
+
#include <morphtarget_vertex>
|
|
3036
|
+
#include <skinning_vertex>
|
|
3037
|
+
#include <project_vertex>
|
|
3038
|
+
#include <logdepthbuf_vertex>
|
|
3039
|
+
#include <clipping_planes_vertex>
|
|
3040
|
+
#include <worldpos_vertex>
|
|
3041
|
+
#include <envmap_vertex>
|
|
3042
|
+
#include <fog_vertex>
|
|
3043
|
+
}`,Yd=`uniform vec3 diffuse;
|
|
3044
|
+
uniform float opacity;
|
|
3045
|
+
#ifndef FLAT_SHADED
|
|
3046
|
+
varying vec3 vNormal;
|
|
3047
|
+
#endif
|
|
3048
|
+
#include <common>
|
|
3049
|
+
#include <dithering_pars_fragment>
|
|
3050
|
+
#include <color_pars_fragment>
|
|
3051
|
+
#include <uv_pars_fragment>
|
|
3052
|
+
#include <map_pars_fragment>
|
|
3053
|
+
#include <alphamap_pars_fragment>
|
|
3054
|
+
#include <alphatest_pars_fragment>
|
|
3055
|
+
#include <alphahash_pars_fragment>
|
|
3056
|
+
#include <aomap_pars_fragment>
|
|
3057
|
+
#include <lightmap_pars_fragment>
|
|
3058
|
+
#include <envmap_common_pars_fragment>
|
|
3059
|
+
#include <envmap_pars_fragment>
|
|
3060
|
+
#include <fog_pars_fragment>
|
|
3061
|
+
#include <specularmap_pars_fragment>
|
|
3062
|
+
#include <logdepthbuf_pars_fragment>
|
|
3063
|
+
#include <clipping_planes_pars_fragment>
|
|
3064
|
+
void main() {
|
|
3065
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3066
|
+
#include <clipping_planes_fragment>
|
|
3067
|
+
#include <logdepthbuf_fragment>
|
|
3068
|
+
#include <map_fragment>
|
|
3069
|
+
#include <color_fragment>
|
|
3070
|
+
#include <alphamap_fragment>
|
|
3071
|
+
#include <alphatest_fragment>
|
|
3072
|
+
#include <alphahash_fragment>
|
|
3073
|
+
#include <specularmap_fragment>
|
|
3074
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3075
|
+
#ifdef USE_LIGHTMAP
|
|
3076
|
+
vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
|
|
3077
|
+
reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
|
|
3078
|
+
#else
|
|
3079
|
+
reflectedLight.indirectDiffuse += vec3( 1.0 );
|
|
3080
|
+
#endif
|
|
3081
|
+
#include <aomap_fragment>
|
|
3082
|
+
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
|
|
3083
|
+
vec3 outgoingLight = reflectedLight.indirectDiffuse;
|
|
3084
|
+
#include <envmap_fragment>
|
|
3085
|
+
#include <opaque_fragment>
|
|
3086
|
+
#include <tonemapping_fragment>
|
|
3087
|
+
#include <colorspace_fragment>
|
|
3088
|
+
#include <fog_fragment>
|
|
3089
|
+
#include <premultiplied_alpha_fragment>
|
|
3090
|
+
#include <dithering_fragment>
|
|
3091
|
+
}`,$d=`#define LAMBERT
|
|
3092
|
+
varying vec3 vViewPosition;
|
|
3093
|
+
#include <common>
|
|
3094
|
+
#include <batching_pars_vertex>
|
|
3095
|
+
#include <uv_pars_vertex>
|
|
3096
|
+
#include <displacementmap_pars_vertex>
|
|
3097
|
+
#include <envmap_pars_vertex>
|
|
3098
|
+
#include <color_pars_vertex>
|
|
3099
|
+
#include <fog_pars_vertex>
|
|
3100
|
+
#include <normal_pars_vertex>
|
|
3101
|
+
#include <morphtarget_pars_vertex>
|
|
3102
|
+
#include <skinning_pars_vertex>
|
|
3103
|
+
#include <shadowmap_pars_vertex>
|
|
3104
|
+
#include <logdepthbuf_pars_vertex>
|
|
3105
|
+
#include <clipping_planes_pars_vertex>
|
|
3106
|
+
void main() {
|
|
3107
|
+
#include <uv_vertex>
|
|
3108
|
+
#include <color_vertex>
|
|
3109
|
+
#include <morphinstance_vertex>
|
|
3110
|
+
#include <morphcolor_vertex>
|
|
3111
|
+
#include <batching_vertex>
|
|
3112
|
+
#include <beginnormal_vertex>
|
|
3113
|
+
#include <morphnormal_vertex>
|
|
3114
|
+
#include <skinbase_vertex>
|
|
3115
|
+
#include <skinnormal_vertex>
|
|
3116
|
+
#include <defaultnormal_vertex>
|
|
3117
|
+
#include <normal_vertex>
|
|
3118
|
+
#include <begin_vertex>
|
|
3119
|
+
#include <morphtarget_vertex>
|
|
3120
|
+
#include <skinning_vertex>
|
|
3121
|
+
#include <displacementmap_vertex>
|
|
3122
|
+
#include <project_vertex>
|
|
3123
|
+
#include <logdepthbuf_vertex>
|
|
3124
|
+
#include <clipping_planes_vertex>
|
|
3125
|
+
vViewPosition = - mvPosition.xyz;
|
|
3126
|
+
#include <worldpos_vertex>
|
|
3127
|
+
#include <envmap_vertex>
|
|
3128
|
+
#include <shadowmap_vertex>
|
|
3129
|
+
#include <fog_vertex>
|
|
3130
|
+
}`,Zd=`#define LAMBERT
|
|
3131
|
+
uniform vec3 diffuse;
|
|
3132
|
+
uniform vec3 emissive;
|
|
3133
|
+
uniform float opacity;
|
|
3134
|
+
#include <common>
|
|
3135
|
+
#include <dithering_pars_fragment>
|
|
3136
|
+
#include <color_pars_fragment>
|
|
3137
|
+
#include <uv_pars_fragment>
|
|
3138
|
+
#include <map_pars_fragment>
|
|
3139
|
+
#include <alphamap_pars_fragment>
|
|
3140
|
+
#include <alphatest_pars_fragment>
|
|
3141
|
+
#include <alphahash_pars_fragment>
|
|
3142
|
+
#include <aomap_pars_fragment>
|
|
3143
|
+
#include <lightmap_pars_fragment>
|
|
3144
|
+
#include <emissivemap_pars_fragment>
|
|
3145
|
+
#include <cube_uv_reflection_fragment>
|
|
3146
|
+
#include <envmap_common_pars_fragment>
|
|
3147
|
+
#include <envmap_pars_fragment>
|
|
3148
|
+
#include <envmap_physical_pars_fragment>
|
|
3149
|
+
#include <fog_pars_fragment>
|
|
3150
|
+
#include <bsdfs>
|
|
3151
|
+
#include <lights_pars_begin>
|
|
3152
|
+
#include <normal_pars_fragment>
|
|
3153
|
+
#include <lights_lambert_pars_fragment>
|
|
3154
|
+
#include <shadowmap_pars_fragment>
|
|
3155
|
+
#include <bumpmap_pars_fragment>
|
|
3156
|
+
#include <normalmap_pars_fragment>
|
|
3157
|
+
#include <specularmap_pars_fragment>
|
|
3158
|
+
#include <logdepthbuf_pars_fragment>
|
|
3159
|
+
#include <clipping_planes_pars_fragment>
|
|
3160
|
+
void main() {
|
|
3161
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3162
|
+
#include <clipping_planes_fragment>
|
|
3163
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3164
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
3165
|
+
#include <logdepthbuf_fragment>
|
|
3166
|
+
#include <map_fragment>
|
|
3167
|
+
#include <color_fragment>
|
|
3168
|
+
#include <alphamap_fragment>
|
|
3169
|
+
#include <alphatest_fragment>
|
|
3170
|
+
#include <alphahash_fragment>
|
|
3171
|
+
#include <specularmap_fragment>
|
|
3172
|
+
#include <normal_fragment_begin>
|
|
3173
|
+
#include <normal_fragment_maps>
|
|
3174
|
+
#include <emissivemap_fragment>
|
|
3175
|
+
#include <lights_lambert_fragment>
|
|
3176
|
+
#include <lights_fragment_begin>
|
|
3177
|
+
#include <lights_fragment_maps>
|
|
3178
|
+
#include <lights_fragment_end>
|
|
3179
|
+
#include <aomap_fragment>
|
|
3180
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
3181
|
+
#include <envmap_fragment>
|
|
3182
|
+
#include <opaque_fragment>
|
|
3183
|
+
#include <tonemapping_fragment>
|
|
3184
|
+
#include <colorspace_fragment>
|
|
3185
|
+
#include <fog_fragment>
|
|
3186
|
+
#include <premultiplied_alpha_fragment>
|
|
3187
|
+
#include <dithering_fragment>
|
|
3188
|
+
}`,Jd=`#define MATCAP
|
|
3189
|
+
varying vec3 vViewPosition;
|
|
3190
|
+
#include <common>
|
|
3191
|
+
#include <batching_pars_vertex>
|
|
3192
|
+
#include <uv_pars_vertex>
|
|
3193
|
+
#include <color_pars_vertex>
|
|
3194
|
+
#include <displacementmap_pars_vertex>
|
|
3195
|
+
#include <fog_pars_vertex>
|
|
3196
|
+
#include <normal_pars_vertex>
|
|
3197
|
+
#include <morphtarget_pars_vertex>
|
|
3198
|
+
#include <skinning_pars_vertex>
|
|
3199
|
+
#include <logdepthbuf_pars_vertex>
|
|
3200
|
+
#include <clipping_planes_pars_vertex>
|
|
3201
|
+
void main() {
|
|
3202
|
+
#include <uv_vertex>
|
|
3203
|
+
#include <color_vertex>
|
|
3204
|
+
#include <morphinstance_vertex>
|
|
3205
|
+
#include <morphcolor_vertex>
|
|
3206
|
+
#include <batching_vertex>
|
|
3207
|
+
#include <beginnormal_vertex>
|
|
3208
|
+
#include <morphnormal_vertex>
|
|
3209
|
+
#include <skinbase_vertex>
|
|
3210
|
+
#include <skinnormal_vertex>
|
|
3211
|
+
#include <defaultnormal_vertex>
|
|
3212
|
+
#include <normal_vertex>
|
|
3213
|
+
#include <begin_vertex>
|
|
3214
|
+
#include <morphtarget_vertex>
|
|
3215
|
+
#include <skinning_vertex>
|
|
3216
|
+
#include <displacementmap_vertex>
|
|
3217
|
+
#include <project_vertex>
|
|
3218
|
+
#include <logdepthbuf_vertex>
|
|
3219
|
+
#include <clipping_planes_vertex>
|
|
3220
|
+
#include <fog_vertex>
|
|
3221
|
+
vViewPosition = - mvPosition.xyz;
|
|
3222
|
+
}`,jd=`#define MATCAP
|
|
3223
|
+
uniform vec3 diffuse;
|
|
3224
|
+
uniform float opacity;
|
|
3225
|
+
uniform sampler2D matcap;
|
|
3226
|
+
varying vec3 vViewPosition;
|
|
3227
|
+
#include <common>
|
|
3228
|
+
#include <dithering_pars_fragment>
|
|
3229
|
+
#include <color_pars_fragment>
|
|
3230
|
+
#include <uv_pars_fragment>
|
|
3231
|
+
#include <map_pars_fragment>
|
|
3232
|
+
#include <alphamap_pars_fragment>
|
|
3233
|
+
#include <alphatest_pars_fragment>
|
|
3234
|
+
#include <alphahash_pars_fragment>
|
|
3235
|
+
#include <fog_pars_fragment>
|
|
3236
|
+
#include <normal_pars_fragment>
|
|
3237
|
+
#include <bumpmap_pars_fragment>
|
|
3238
|
+
#include <normalmap_pars_fragment>
|
|
3239
|
+
#include <logdepthbuf_pars_fragment>
|
|
3240
|
+
#include <clipping_planes_pars_fragment>
|
|
3241
|
+
void main() {
|
|
3242
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3243
|
+
#include <clipping_planes_fragment>
|
|
3244
|
+
#include <logdepthbuf_fragment>
|
|
3245
|
+
#include <map_fragment>
|
|
3246
|
+
#include <color_fragment>
|
|
3247
|
+
#include <alphamap_fragment>
|
|
3248
|
+
#include <alphatest_fragment>
|
|
3249
|
+
#include <alphahash_fragment>
|
|
3250
|
+
#include <normal_fragment_begin>
|
|
3251
|
+
#include <normal_fragment_maps>
|
|
3252
|
+
vec3 viewDir = normalize( vViewPosition );
|
|
3253
|
+
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
3254
|
+
vec3 y = cross( viewDir, x );
|
|
3255
|
+
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
|
|
3256
|
+
#ifdef USE_MATCAP
|
|
3257
|
+
vec4 matcapColor = texture2D( matcap, uv );
|
|
3258
|
+
#else
|
|
3259
|
+
vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
|
|
3260
|
+
#endif
|
|
3261
|
+
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
|
|
3262
|
+
#include <opaque_fragment>
|
|
3263
|
+
#include <tonemapping_fragment>
|
|
3264
|
+
#include <colorspace_fragment>
|
|
3265
|
+
#include <fog_fragment>
|
|
3266
|
+
#include <premultiplied_alpha_fragment>
|
|
3267
|
+
#include <dithering_fragment>
|
|
3268
|
+
}`,Kd=`#define NORMAL
|
|
3269
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3270
|
+
varying vec3 vViewPosition;
|
|
3271
|
+
#endif
|
|
3272
|
+
#include <common>
|
|
3273
|
+
#include <batching_pars_vertex>
|
|
3274
|
+
#include <uv_pars_vertex>
|
|
3275
|
+
#include <displacementmap_pars_vertex>
|
|
3276
|
+
#include <normal_pars_vertex>
|
|
3277
|
+
#include <morphtarget_pars_vertex>
|
|
3278
|
+
#include <skinning_pars_vertex>
|
|
3279
|
+
#include <logdepthbuf_pars_vertex>
|
|
3280
|
+
#include <clipping_planes_pars_vertex>
|
|
3281
|
+
void main() {
|
|
3282
|
+
#include <uv_vertex>
|
|
3283
|
+
#include <batching_vertex>
|
|
3284
|
+
#include <beginnormal_vertex>
|
|
3285
|
+
#include <morphinstance_vertex>
|
|
3286
|
+
#include <morphnormal_vertex>
|
|
3287
|
+
#include <skinbase_vertex>
|
|
3288
|
+
#include <skinnormal_vertex>
|
|
3289
|
+
#include <defaultnormal_vertex>
|
|
3290
|
+
#include <normal_vertex>
|
|
3291
|
+
#include <begin_vertex>
|
|
3292
|
+
#include <morphtarget_vertex>
|
|
3293
|
+
#include <skinning_vertex>
|
|
3294
|
+
#include <displacementmap_vertex>
|
|
3295
|
+
#include <project_vertex>
|
|
3296
|
+
#include <logdepthbuf_vertex>
|
|
3297
|
+
#include <clipping_planes_vertex>
|
|
3298
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3299
|
+
vViewPosition = - mvPosition.xyz;
|
|
3300
|
+
#endif
|
|
3301
|
+
}`,Qd=`#define NORMAL
|
|
3302
|
+
uniform float opacity;
|
|
3303
|
+
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
|
|
3304
|
+
varying vec3 vViewPosition;
|
|
3305
|
+
#endif
|
|
3306
|
+
#include <uv_pars_fragment>
|
|
3307
|
+
#include <normal_pars_fragment>
|
|
3308
|
+
#include <bumpmap_pars_fragment>
|
|
3309
|
+
#include <normalmap_pars_fragment>
|
|
3310
|
+
#include <logdepthbuf_pars_fragment>
|
|
3311
|
+
#include <clipping_planes_pars_fragment>
|
|
3312
|
+
void main() {
|
|
3313
|
+
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
|
|
3314
|
+
#include <clipping_planes_fragment>
|
|
3315
|
+
#include <logdepthbuf_fragment>
|
|
3316
|
+
#include <normal_fragment_begin>
|
|
3317
|
+
#include <normal_fragment_maps>
|
|
3318
|
+
gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
|
|
3319
|
+
#ifdef OPAQUE
|
|
3320
|
+
gl_FragColor.a = 1.0;
|
|
3321
|
+
#endif
|
|
3322
|
+
}`,ep=`#define PHONG
|
|
3323
|
+
varying vec3 vViewPosition;
|
|
3324
|
+
#include <common>
|
|
3325
|
+
#include <batching_pars_vertex>
|
|
3326
|
+
#include <uv_pars_vertex>
|
|
3327
|
+
#include <displacementmap_pars_vertex>
|
|
3328
|
+
#include <envmap_pars_vertex>
|
|
3329
|
+
#include <color_pars_vertex>
|
|
3330
|
+
#include <fog_pars_vertex>
|
|
3331
|
+
#include <normal_pars_vertex>
|
|
3332
|
+
#include <morphtarget_pars_vertex>
|
|
3333
|
+
#include <skinning_pars_vertex>
|
|
3334
|
+
#include <shadowmap_pars_vertex>
|
|
3335
|
+
#include <logdepthbuf_pars_vertex>
|
|
3336
|
+
#include <clipping_planes_pars_vertex>
|
|
3337
|
+
void main() {
|
|
3338
|
+
#include <uv_vertex>
|
|
3339
|
+
#include <color_vertex>
|
|
3340
|
+
#include <morphcolor_vertex>
|
|
3341
|
+
#include <batching_vertex>
|
|
3342
|
+
#include <beginnormal_vertex>
|
|
3343
|
+
#include <morphinstance_vertex>
|
|
3344
|
+
#include <morphnormal_vertex>
|
|
3345
|
+
#include <skinbase_vertex>
|
|
3346
|
+
#include <skinnormal_vertex>
|
|
3347
|
+
#include <defaultnormal_vertex>
|
|
3348
|
+
#include <normal_vertex>
|
|
3349
|
+
#include <begin_vertex>
|
|
3350
|
+
#include <morphtarget_vertex>
|
|
3351
|
+
#include <skinning_vertex>
|
|
3352
|
+
#include <displacementmap_vertex>
|
|
3353
|
+
#include <project_vertex>
|
|
3354
|
+
#include <logdepthbuf_vertex>
|
|
3355
|
+
#include <clipping_planes_vertex>
|
|
3356
|
+
vViewPosition = - mvPosition.xyz;
|
|
3357
|
+
#include <worldpos_vertex>
|
|
3358
|
+
#include <envmap_vertex>
|
|
3359
|
+
#include <shadowmap_vertex>
|
|
3360
|
+
#include <fog_vertex>
|
|
3361
|
+
}`,tp=`#define PHONG
|
|
3362
|
+
uniform vec3 diffuse;
|
|
3363
|
+
uniform vec3 emissive;
|
|
3364
|
+
uniform vec3 specular;
|
|
3365
|
+
uniform float shininess;
|
|
3366
|
+
uniform float opacity;
|
|
3367
|
+
#include <common>
|
|
3368
|
+
#include <dithering_pars_fragment>
|
|
3369
|
+
#include <color_pars_fragment>
|
|
3370
|
+
#include <uv_pars_fragment>
|
|
3371
|
+
#include <map_pars_fragment>
|
|
3372
|
+
#include <alphamap_pars_fragment>
|
|
3373
|
+
#include <alphatest_pars_fragment>
|
|
3374
|
+
#include <alphahash_pars_fragment>
|
|
3375
|
+
#include <aomap_pars_fragment>
|
|
3376
|
+
#include <lightmap_pars_fragment>
|
|
3377
|
+
#include <emissivemap_pars_fragment>
|
|
3378
|
+
#include <cube_uv_reflection_fragment>
|
|
3379
|
+
#include <envmap_common_pars_fragment>
|
|
3380
|
+
#include <envmap_pars_fragment>
|
|
3381
|
+
#include <envmap_physical_pars_fragment>
|
|
3382
|
+
#include <fog_pars_fragment>
|
|
3383
|
+
#include <bsdfs>
|
|
3384
|
+
#include <lights_pars_begin>
|
|
3385
|
+
#include <normal_pars_fragment>
|
|
3386
|
+
#include <lights_phong_pars_fragment>
|
|
3387
|
+
#include <shadowmap_pars_fragment>
|
|
3388
|
+
#include <bumpmap_pars_fragment>
|
|
3389
|
+
#include <normalmap_pars_fragment>
|
|
3390
|
+
#include <specularmap_pars_fragment>
|
|
3391
|
+
#include <logdepthbuf_pars_fragment>
|
|
3392
|
+
#include <clipping_planes_pars_fragment>
|
|
3393
|
+
void main() {
|
|
3394
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3395
|
+
#include <clipping_planes_fragment>
|
|
3396
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3397
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
3398
|
+
#include <logdepthbuf_fragment>
|
|
3399
|
+
#include <map_fragment>
|
|
3400
|
+
#include <color_fragment>
|
|
3401
|
+
#include <alphamap_fragment>
|
|
3402
|
+
#include <alphatest_fragment>
|
|
3403
|
+
#include <alphahash_fragment>
|
|
3404
|
+
#include <specularmap_fragment>
|
|
3405
|
+
#include <normal_fragment_begin>
|
|
3406
|
+
#include <normal_fragment_maps>
|
|
3407
|
+
#include <emissivemap_fragment>
|
|
3408
|
+
#include <lights_phong_fragment>
|
|
3409
|
+
#include <lights_fragment_begin>
|
|
3410
|
+
#include <lights_fragment_maps>
|
|
3411
|
+
#include <lights_fragment_end>
|
|
3412
|
+
#include <aomap_fragment>
|
|
3413
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
|
|
3414
|
+
#include <envmap_fragment>
|
|
3415
|
+
#include <opaque_fragment>
|
|
3416
|
+
#include <tonemapping_fragment>
|
|
3417
|
+
#include <colorspace_fragment>
|
|
3418
|
+
#include <fog_fragment>
|
|
3419
|
+
#include <premultiplied_alpha_fragment>
|
|
3420
|
+
#include <dithering_fragment>
|
|
3421
|
+
}`,np=`#define STANDARD
|
|
3422
|
+
varying vec3 vViewPosition;
|
|
3423
|
+
#ifdef USE_TRANSMISSION
|
|
3424
|
+
varying vec3 vWorldPosition;
|
|
3425
|
+
#endif
|
|
3426
|
+
#include <common>
|
|
3427
|
+
#include <batching_pars_vertex>
|
|
3428
|
+
#include <uv_pars_vertex>
|
|
3429
|
+
#include <displacementmap_pars_vertex>
|
|
3430
|
+
#include <color_pars_vertex>
|
|
3431
|
+
#include <fog_pars_vertex>
|
|
3432
|
+
#include <normal_pars_vertex>
|
|
3433
|
+
#include <morphtarget_pars_vertex>
|
|
3434
|
+
#include <skinning_pars_vertex>
|
|
3435
|
+
#include <shadowmap_pars_vertex>
|
|
3436
|
+
#include <logdepthbuf_pars_vertex>
|
|
3437
|
+
#include <clipping_planes_pars_vertex>
|
|
3438
|
+
void main() {
|
|
3439
|
+
#include <uv_vertex>
|
|
3440
|
+
#include <color_vertex>
|
|
3441
|
+
#include <morphinstance_vertex>
|
|
3442
|
+
#include <morphcolor_vertex>
|
|
3443
|
+
#include <batching_vertex>
|
|
3444
|
+
#include <beginnormal_vertex>
|
|
3445
|
+
#include <morphnormal_vertex>
|
|
3446
|
+
#include <skinbase_vertex>
|
|
3447
|
+
#include <skinnormal_vertex>
|
|
3448
|
+
#include <defaultnormal_vertex>
|
|
3449
|
+
#include <normal_vertex>
|
|
3450
|
+
#include <begin_vertex>
|
|
3451
|
+
#include <morphtarget_vertex>
|
|
3452
|
+
#include <skinning_vertex>
|
|
3453
|
+
#include <displacementmap_vertex>
|
|
3454
|
+
#include <project_vertex>
|
|
3455
|
+
#include <logdepthbuf_vertex>
|
|
3456
|
+
#include <clipping_planes_vertex>
|
|
3457
|
+
vViewPosition = - mvPosition.xyz;
|
|
3458
|
+
#include <worldpos_vertex>
|
|
3459
|
+
#include <shadowmap_vertex>
|
|
3460
|
+
#include <fog_vertex>
|
|
3461
|
+
#ifdef USE_TRANSMISSION
|
|
3462
|
+
vWorldPosition = worldPosition.xyz;
|
|
3463
|
+
#endif
|
|
3464
|
+
}`,ip=`#define STANDARD
|
|
3465
|
+
#ifdef PHYSICAL
|
|
3466
|
+
#define IOR
|
|
3467
|
+
#define USE_SPECULAR
|
|
3468
|
+
#endif
|
|
3469
|
+
uniform vec3 diffuse;
|
|
3470
|
+
uniform vec3 emissive;
|
|
3471
|
+
uniform float roughness;
|
|
3472
|
+
uniform float metalness;
|
|
3473
|
+
uniform float opacity;
|
|
3474
|
+
#ifdef IOR
|
|
3475
|
+
uniform float ior;
|
|
3476
|
+
#endif
|
|
3477
|
+
#ifdef USE_SPECULAR
|
|
3478
|
+
uniform float specularIntensity;
|
|
3479
|
+
uniform vec3 specularColor;
|
|
3480
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
3481
|
+
uniform sampler2D specularColorMap;
|
|
3482
|
+
#endif
|
|
3483
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
3484
|
+
uniform sampler2D specularIntensityMap;
|
|
3485
|
+
#endif
|
|
3486
|
+
#endif
|
|
3487
|
+
#ifdef USE_CLEARCOAT
|
|
3488
|
+
uniform float clearcoat;
|
|
3489
|
+
uniform float clearcoatRoughness;
|
|
3490
|
+
#endif
|
|
3491
|
+
#ifdef USE_DISPERSION
|
|
3492
|
+
uniform float dispersion;
|
|
3493
|
+
#endif
|
|
3494
|
+
#ifdef USE_RETROREFLECTION
|
|
3495
|
+
uniform float retroreflectivity;
|
|
3496
|
+
#endif
|
|
3497
|
+
#ifdef USE_IRIDESCENCE
|
|
3498
|
+
uniform float iridescence;
|
|
3499
|
+
uniform float iridescenceIOR;
|
|
3500
|
+
uniform float iridescenceThicknessMinimum;
|
|
3501
|
+
uniform float iridescenceThicknessMaximum;
|
|
3502
|
+
#endif
|
|
3503
|
+
#ifdef USE_SHEEN
|
|
3504
|
+
uniform vec3 sheenColor;
|
|
3505
|
+
uniform float sheenRoughness;
|
|
3506
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
3507
|
+
uniform sampler2D sheenColorMap;
|
|
3508
|
+
#endif
|
|
3509
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
3510
|
+
uniform sampler2D sheenRoughnessMap;
|
|
3511
|
+
#endif
|
|
3512
|
+
#endif
|
|
3513
|
+
#ifdef USE_ANISOTROPY
|
|
3514
|
+
uniform vec2 anisotropyVector;
|
|
3515
|
+
#ifdef USE_ANISOTROPYMAP
|
|
3516
|
+
uniform sampler2D anisotropyMap;
|
|
3517
|
+
#endif
|
|
3518
|
+
#endif
|
|
3519
|
+
varying vec3 vViewPosition;
|
|
3520
|
+
#include <common>
|
|
3521
|
+
#include <dithering_pars_fragment>
|
|
3522
|
+
#include <color_pars_fragment>
|
|
3523
|
+
#include <uv_pars_fragment>
|
|
3524
|
+
#include <map_pars_fragment>
|
|
3525
|
+
#include <alphamap_pars_fragment>
|
|
3526
|
+
#include <alphatest_pars_fragment>
|
|
3527
|
+
#include <alphahash_pars_fragment>
|
|
3528
|
+
#include <aomap_pars_fragment>
|
|
3529
|
+
#include <lightmap_pars_fragment>
|
|
3530
|
+
#include <emissivemap_pars_fragment>
|
|
3531
|
+
#include <iridescence_fragment>
|
|
3532
|
+
#include <cube_uv_reflection_fragment>
|
|
3533
|
+
#include <envmap_common_pars_fragment>
|
|
3534
|
+
#include <envmap_physical_pars_fragment>
|
|
3535
|
+
#include <fog_pars_fragment>
|
|
3536
|
+
#include <lights_pars_begin>
|
|
3537
|
+
#include <normal_pars_fragment>
|
|
3538
|
+
#include <lights_physical_pars_fragment>
|
|
3539
|
+
#include <transmission_pars_fragment>
|
|
3540
|
+
#include <shadowmap_pars_fragment>
|
|
3541
|
+
#include <bumpmap_pars_fragment>
|
|
3542
|
+
#include <normalmap_pars_fragment>
|
|
3543
|
+
#include <clearcoat_pars_fragment>
|
|
3544
|
+
#include <iridescence_pars_fragment>
|
|
3545
|
+
#include <roughnessmap_pars_fragment>
|
|
3546
|
+
#include <metalnessmap_pars_fragment>
|
|
3547
|
+
#include <logdepthbuf_pars_fragment>
|
|
3548
|
+
#include <clipping_planes_pars_fragment>
|
|
3549
|
+
void main() {
|
|
3550
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3551
|
+
#include <clipping_planes_fragment>
|
|
3552
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3553
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
3554
|
+
#include <logdepthbuf_fragment>
|
|
3555
|
+
#include <map_fragment>
|
|
3556
|
+
#include <color_fragment>
|
|
3557
|
+
#include <alphamap_fragment>
|
|
3558
|
+
#include <alphatest_fragment>
|
|
3559
|
+
#include <alphahash_fragment>
|
|
3560
|
+
#include <roughnessmap_fragment>
|
|
3561
|
+
#include <metalnessmap_fragment>
|
|
3562
|
+
#include <normal_fragment_begin>
|
|
3563
|
+
#include <normal_fragment_maps>
|
|
3564
|
+
#include <clearcoat_normal_fragment_begin>
|
|
3565
|
+
#include <clearcoat_normal_fragment_maps>
|
|
3566
|
+
#include <emissivemap_fragment>
|
|
3567
|
+
#include <lights_physical_fragment>
|
|
3568
|
+
#include <lights_fragment_begin>
|
|
3569
|
+
#include <lights_fragment_maps>
|
|
3570
|
+
#include <lights_fragment_end>
|
|
3571
|
+
#include <aomap_fragment>
|
|
3572
|
+
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
|
3573
|
+
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
|
3574
|
+
#include <transmission_fragment>
|
|
3575
|
+
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
|
3576
|
+
#ifdef USE_SHEEN
|
|
3577
|
+
|
|
3578
|
+
outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
|
|
3579
|
+
|
|
3580
|
+
#endif
|
|
3581
|
+
#ifdef USE_CLEARCOAT
|
|
3582
|
+
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
|
|
3583
|
+
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
|
3584
|
+
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
|
|
3585
|
+
#endif
|
|
3586
|
+
#include <opaque_fragment>
|
|
3587
|
+
#include <tonemapping_fragment>
|
|
3588
|
+
#include <colorspace_fragment>
|
|
3589
|
+
#include <fog_fragment>
|
|
3590
|
+
#include <premultiplied_alpha_fragment>
|
|
3591
|
+
#include <dithering_fragment>
|
|
3592
|
+
}`,rp=`#define TOON
|
|
3593
|
+
varying vec3 vViewPosition;
|
|
3594
|
+
#include <common>
|
|
3595
|
+
#include <batching_pars_vertex>
|
|
3596
|
+
#include <uv_pars_vertex>
|
|
3597
|
+
#include <displacementmap_pars_vertex>
|
|
3598
|
+
#include <color_pars_vertex>
|
|
3599
|
+
#include <fog_pars_vertex>
|
|
3600
|
+
#include <normal_pars_vertex>
|
|
3601
|
+
#include <morphtarget_pars_vertex>
|
|
3602
|
+
#include <skinning_pars_vertex>
|
|
3603
|
+
#include <shadowmap_pars_vertex>
|
|
3604
|
+
#include <logdepthbuf_pars_vertex>
|
|
3605
|
+
#include <clipping_planes_pars_vertex>
|
|
3606
|
+
void main() {
|
|
3607
|
+
#include <uv_vertex>
|
|
3608
|
+
#include <color_vertex>
|
|
3609
|
+
#include <morphinstance_vertex>
|
|
3610
|
+
#include <morphcolor_vertex>
|
|
3611
|
+
#include <batching_vertex>
|
|
3612
|
+
#include <beginnormal_vertex>
|
|
3613
|
+
#include <morphnormal_vertex>
|
|
3614
|
+
#include <skinbase_vertex>
|
|
3615
|
+
#include <skinnormal_vertex>
|
|
3616
|
+
#include <defaultnormal_vertex>
|
|
3617
|
+
#include <normal_vertex>
|
|
3618
|
+
#include <begin_vertex>
|
|
3619
|
+
#include <morphtarget_vertex>
|
|
3620
|
+
#include <skinning_vertex>
|
|
3621
|
+
#include <displacementmap_vertex>
|
|
3622
|
+
#include <project_vertex>
|
|
3623
|
+
#include <logdepthbuf_vertex>
|
|
3624
|
+
#include <clipping_planes_vertex>
|
|
3625
|
+
vViewPosition = - mvPosition.xyz;
|
|
3626
|
+
#include <worldpos_vertex>
|
|
3627
|
+
#include <shadowmap_vertex>
|
|
3628
|
+
#include <fog_vertex>
|
|
3629
|
+
}`,sp=`#define TOON
|
|
3630
|
+
uniform vec3 diffuse;
|
|
3631
|
+
uniform vec3 emissive;
|
|
3632
|
+
uniform float opacity;
|
|
3633
|
+
#include <common>
|
|
3634
|
+
#include <dithering_pars_fragment>
|
|
3635
|
+
#include <color_pars_fragment>
|
|
3636
|
+
#include <uv_pars_fragment>
|
|
3637
|
+
#include <map_pars_fragment>
|
|
3638
|
+
#include <alphamap_pars_fragment>
|
|
3639
|
+
#include <alphatest_pars_fragment>
|
|
3640
|
+
#include <alphahash_pars_fragment>
|
|
3641
|
+
#include <aomap_pars_fragment>
|
|
3642
|
+
#include <lightmap_pars_fragment>
|
|
3643
|
+
#include <emissivemap_pars_fragment>
|
|
3644
|
+
#include <gradientmap_pars_fragment>
|
|
3645
|
+
#include <fog_pars_fragment>
|
|
3646
|
+
#include <bsdfs>
|
|
3647
|
+
#include <lights_pars_begin>
|
|
3648
|
+
#include <normal_pars_fragment>
|
|
3649
|
+
#include <lights_toon_pars_fragment>
|
|
3650
|
+
#include <shadowmap_pars_fragment>
|
|
3651
|
+
#include <bumpmap_pars_fragment>
|
|
3652
|
+
#include <normalmap_pars_fragment>
|
|
3653
|
+
#include <logdepthbuf_pars_fragment>
|
|
3654
|
+
#include <clipping_planes_pars_fragment>
|
|
3655
|
+
void main() {
|
|
3656
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3657
|
+
#include <clipping_planes_fragment>
|
|
3658
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
3659
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
3660
|
+
#include <logdepthbuf_fragment>
|
|
3661
|
+
#include <map_fragment>
|
|
3662
|
+
#include <color_fragment>
|
|
3663
|
+
#include <alphamap_fragment>
|
|
3664
|
+
#include <alphatest_fragment>
|
|
3665
|
+
#include <alphahash_fragment>
|
|
3666
|
+
#include <normal_fragment_begin>
|
|
3667
|
+
#include <normal_fragment_maps>
|
|
3668
|
+
#include <emissivemap_fragment>
|
|
3669
|
+
#include <lights_toon_fragment>
|
|
3670
|
+
#include <lights_fragment_begin>
|
|
3671
|
+
#include <lights_fragment_maps>
|
|
3672
|
+
#include <lights_fragment_end>
|
|
3673
|
+
#include <aomap_fragment>
|
|
3674
|
+
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
|
|
3675
|
+
#include <opaque_fragment>
|
|
3676
|
+
#include <tonemapping_fragment>
|
|
3677
|
+
#include <colorspace_fragment>
|
|
3678
|
+
#include <fog_fragment>
|
|
3679
|
+
#include <premultiplied_alpha_fragment>
|
|
3680
|
+
#include <dithering_fragment>
|
|
3681
|
+
}`,ap=`uniform float size;
|
|
3682
|
+
uniform float scale;
|
|
3683
|
+
#include <common>
|
|
3684
|
+
#include <color_pars_vertex>
|
|
3685
|
+
#include <fog_pars_vertex>
|
|
3686
|
+
#include <morphtarget_pars_vertex>
|
|
3687
|
+
#include <logdepthbuf_pars_vertex>
|
|
3688
|
+
#include <clipping_planes_pars_vertex>
|
|
3689
|
+
#ifdef USE_POINTS_UV
|
|
3690
|
+
varying vec2 vUv;
|
|
3691
|
+
uniform mat3 uvTransform;
|
|
3692
|
+
#endif
|
|
3693
|
+
void main() {
|
|
3694
|
+
#ifdef USE_POINTS_UV
|
|
3695
|
+
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
|
|
3696
|
+
#endif
|
|
3697
|
+
#include <color_vertex>
|
|
3698
|
+
#include <morphinstance_vertex>
|
|
3699
|
+
#include <morphcolor_vertex>
|
|
3700
|
+
#include <begin_vertex>
|
|
3701
|
+
#include <morphtarget_vertex>
|
|
3702
|
+
#include <project_vertex>
|
|
3703
|
+
gl_PointSize = size;
|
|
3704
|
+
#ifdef USE_SIZEATTENUATION
|
|
3705
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
3706
|
+
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
|
|
3707
|
+
#endif
|
|
3708
|
+
#include <logdepthbuf_vertex>
|
|
3709
|
+
#include <clipping_planes_vertex>
|
|
3710
|
+
#include <worldpos_vertex>
|
|
3711
|
+
#include <fog_vertex>
|
|
3712
|
+
}`,op=`uniform vec3 diffuse;
|
|
3713
|
+
uniform float opacity;
|
|
3714
|
+
#include <common>
|
|
3715
|
+
#include <color_pars_fragment>
|
|
3716
|
+
#include <map_particle_pars_fragment>
|
|
3717
|
+
#include <alphatest_pars_fragment>
|
|
3718
|
+
#include <alphahash_pars_fragment>
|
|
3719
|
+
#include <fog_pars_fragment>
|
|
3720
|
+
#include <logdepthbuf_pars_fragment>
|
|
3721
|
+
#include <clipping_planes_pars_fragment>
|
|
3722
|
+
void main() {
|
|
3723
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3724
|
+
#include <clipping_planes_fragment>
|
|
3725
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
3726
|
+
#include <logdepthbuf_fragment>
|
|
3727
|
+
#include <map_particle_fragment>
|
|
3728
|
+
#include <color_fragment>
|
|
3729
|
+
#include <alphatest_fragment>
|
|
3730
|
+
#include <alphahash_fragment>
|
|
3731
|
+
outgoingLight = diffuseColor.rgb;
|
|
3732
|
+
#include <opaque_fragment>
|
|
3733
|
+
#include <tonemapping_fragment>
|
|
3734
|
+
#include <colorspace_fragment>
|
|
3735
|
+
#include <fog_fragment>
|
|
3736
|
+
#include <premultiplied_alpha_fragment>
|
|
3737
|
+
}`,lp=`#include <common>
|
|
3738
|
+
#include <batching_pars_vertex>
|
|
3739
|
+
#include <fog_pars_vertex>
|
|
3740
|
+
#include <morphtarget_pars_vertex>
|
|
3741
|
+
#include <skinning_pars_vertex>
|
|
3742
|
+
#include <logdepthbuf_pars_vertex>
|
|
3743
|
+
#include <shadowmap_pars_vertex>
|
|
3744
|
+
void main() {
|
|
3745
|
+
#include <batching_vertex>
|
|
3746
|
+
#include <beginnormal_vertex>
|
|
3747
|
+
#include <morphinstance_vertex>
|
|
3748
|
+
#include <morphnormal_vertex>
|
|
3749
|
+
#include <skinbase_vertex>
|
|
3750
|
+
#include <skinnormal_vertex>
|
|
3751
|
+
#include <defaultnormal_vertex>
|
|
3752
|
+
#include <begin_vertex>
|
|
3753
|
+
#include <morphtarget_vertex>
|
|
3754
|
+
#include <skinning_vertex>
|
|
3755
|
+
#include <project_vertex>
|
|
3756
|
+
#include <logdepthbuf_vertex>
|
|
3757
|
+
#include <worldpos_vertex>
|
|
3758
|
+
#include <shadowmap_vertex>
|
|
3759
|
+
#include <fog_vertex>
|
|
3760
|
+
}`,cp=`uniform vec3 color;
|
|
3761
|
+
uniform float opacity;
|
|
3762
|
+
#include <common>
|
|
3763
|
+
#include <fog_pars_fragment>
|
|
3764
|
+
#include <bsdfs>
|
|
3765
|
+
#include <lights_pars_begin>
|
|
3766
|
+
#include <logdepthbuf_pars_fragment>
|
|
3767
|
+
#include <shadowmap_pars_fragment>
|
|
3768
|
+
#include <shadowmask_pars_fragment>
|
|
3769
|
+
void main() {
|
|
3770
|
+
#include <logdepthbuf_fragment>
|
|
3771
|
+
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
|
|
3772
|
+
#include <tonemapping_fragment>
|
|
3773
|
+
#include <colorspace_fragment>
|
|
3774
|
+
#include <fog_fragment>
|
|
3775
|
+
#include <premultiplied_alpha_fragment>
|
|
3776
|
+
}`,up=`uniform float rotation;
|
|
3777
|
+
uniform vec2 center;
|
|
3778
|
+
#include <common>
|
|
3779
|
+
#include <uv_pars_vertex>
|
|
3780
|
+
#include <fog_pars_vertex>
|
|
3781
|
+
#include <logdepthbuf_pars_vertex>
|
|
3782
|
+
#include <clipping_planes_pars_vertex>
|
|
3783
|
+
void main() {
|
|
3784
|
+
#include <uv_vertex>
|
|
3785
|
+
vec4 mvPosition = modelViewMatrix[ 3 ];
|
|
3786
|
+
vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
|
|
3787
|
+
#ifndef USE_SIZEATTENUATION
|
|
3788
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
3789
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
3790
|
+
#endif
|
|
3791
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
|
|
3792
|
+
vec2 rotatedPosition;
|
|
3793
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
3794
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
3795
|
+
mvPosition.xy += rotatedPosition;
|
|
3796
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
3797
|
+
#include <logdepthbuf_vertex>
|
|
3798
|
+
#include <clipping_planes_vertex>
|
|
3799
|
+
#include <fog_vertex>
|
|
3800
|
+
}`,hp=`uniform vec3 diffuse;
|
|
3801
|
+
uniform float opacity;
|
|
3802
|
+
#include <common>
|
|
3803
|
+
#include <uv_pars_fragment>
|
|
3804
|
+
#include <map_pars_fragment>
|
|
3805
|
+
#include <alphamap_pars_fragment>
|
|
3806
|
+
#include <alphatest_pars_fragment>
|
|
3807
|
+
#include <alphahash_pars_fragment>
|
|
3808
|
+
#include <fog_pars_fragment>
|
|
3809
|
+
#include <logdepthbuf_pars_fragment>
|
|
3810
|
+
#include <clipping_planes_pars_fragment>
|
|
3811
|
+
void main() {
|
|
3812
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
3813
|
+
#include <clipping_planes_fragment>
|
|
3814
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
3815
|
+
#include <logdepthbuf_fragment>
|
|
3816
|
+
#include <map_fragment>
|
|
3817
|
+
#include <alphamap_fragment>
|
|
3818
|
+
#include <alphatest_fragment>
|
|
3819
|
+
#include <alphahash_fragment>
|
|
3820
|
+
outgoingLight = diffuseColor.rgb;
|
|
3821
|
+
#include <opaque_fragment>
|
|
3822
|
+
#include <tonemapping_fragment>
|
|
3823
|
+
#include <colorspace_fragment>
|
|
3824
|
+
#include <fog_fragment>
|
|
3825
|
+
}`,J={alphahash_fragment:Ih,alphahash_pars_fragment:Lh,alphamap_fragment:Dh,alphamap_pars_fragment:Uh,alphatest_fragment:Nh,alphatest_pars_fragment:Fh,aomap_fragment:Oh,aomap_pars_fragment:Bh,batching_pars_vertex:zh,batching_vertex:Vh,begin_vertex:kh,beginnormal_vertex:Gh,bsdfs:Hh,iridescence_fragment:Wh,bumpmap_pars_fragment:Xh,clipping_planes_fragment:qh,clipping_planes_pars_fragment:Yh,clipping_planes_pars_vertex:$h,clipping_planes_vertex:Zh,color_fragment:Jh,color_pars_fragment:jh,color_pars_vertex:Kh,color_vertex:Qh,common:ef,cube_uv_reflection_fragment:tf,defaultnormal_vertex:nf,displacementmap_pars_vertex:rf,displacementmap_vertex:sf,emissivemap_fragment:af,emissivemap_pars_fragment:of,colorspace_fragment:lf,colorspace_pars_fragment:cf,envmap_fragment:uf,envmap_common_pars_fragment:hf,envmap_pars_fragment:ff,envmap_pars_vertex:df,envmap_physical_pars_fragment:wf,envmap_vertex:pf,fog_vertex:mf,fog_pars_vertex:gf,fog_fragment:_f,fog_pars_fragment:yf,gradientmap_pars_fragment:vf,lightmap_pars_fragment:xf,lights_lambert_fragment:Sf,lights_lambert_pars_fragment:bf,lights_pars_begin:Mf,lights_toon_fragment:Tf,lights_toon_pars_fragment:Ef,lights_phong_fragment:Af,lights_phong_pars_fragment:Cf,lights_physical_fragment:Rf,lights_physical_pars_fragment:Pf,lights_fragment_begin:If,lights_fragment_maps:Lf,lights_fragment_end:Df,lightprobes_pars_fragment:Uf,logdepthbuf_fragment:Nf,logdepthbuf_pars_fragment:Ff,logdepthbuf_pars_vertex:Of,logdepthbuf_vertex:Bf,map_fragment:zf,map_pars_fragment:Vf,map_particle_fragment:kf,map_particle_pars_fragment:Gf,metalnessmap_fragment:Hf,metalnessmap_pars_fragment:Wf,morphinstance_vertex:Xf,morphcolor_vertex:qf,morphnormal_vertex:Yf,morphtarget_pars_vertex:$f,morphtarget_vertex:Zf,normal_fragment_begin:Jf,normal_fragment_maps:jf,normal_pars_fragment:Kf,normal_pars_vertex:Qf,normal_vertex:ed,normalmap_pars_fragment:td,clearcoat_normal_fragment_begin:nd,clearcoat_normal_fragment_maps:id,clearcoat_pars_fragment:rd,iridescence_pars_fragment:sd,opaque_fragment:ad,packing:od,premultiplied_alpha_fragment:ld,project_vertex:cd,dithering_fragment:ud,dithering_pars_fragment:hd,roughnessmap_fragment:fd,roughnessmap_pars_fragment:dd,shadowmap_pars_fragment:pd,shadowmap_pars_vertex:md,shadowmap_vertex:gd,shadowmask_pars_fragment:_d,skinbase_vertex:yd,skinning_pars_vertex:vd,skinning_vertex:xd,skinnormal_vertex:Sd,specularmap_fragment:bd,specularmap_pars_fragment:Md,tonemapping_fragment:wd,tonemapping_pars_fragment:Td,transmission_fragment:Ed,transmission_pars_fragment:Ad,uv_pars_fragment:Cd,uv_pars_vertex:Rd,uv_vertex:Pd,worldpos_vertex:Id,background_vert:Ld,background_frag:Dd,backgroundCube_vert:Ud,backgroundCube_frag:Nd,cube_vert:Fd,cube_frag:Od,depth_vert:Bd,depth_frag:zd,distance_vert:Vd,distance_frag:kd,equirect_vert:Gd,equirect_frag:Hd,linedashed_vert:Wd,linedashed_frag:Xd,meshbasic_vert:qd,meshbasic_frag:Yd,meshlambert_vert:$d,meshlambert_frag:Zd,meshmatcap_vert:Jd,meshmatcap_frag:jd,meshnormal_vert:Kd,meshnormal_frag:Qd,meshphong_vert:ep,meshphong_frag:tp,meshphysical_vert:np,meshphysical_frag:ip,meshtoon_vert:rp,meshtoon_frag:sp,points_vert:ap,points_frag:op,shadow_vert:lp,shadow_frag:cp,sprite_vert:up,sprite_frag:hp},U={common:{diffuse:{value:new ge(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Z},alphaMap:{value:null},alphaMapTransform:{value:new Z},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Z}},envmap:{envMap:{value:null},envMapRotation:{value:new Z},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Z}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Z}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Z},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Z},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Z},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Z}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Z}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Z}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ge(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new F},probesMax:{value:new F},probesResolution:{value:new F}},points:{diffuse:{value:new ge(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Z},alphaTest:{value:0},uvTransform:{value:new Z}},sprite:{diffuse:{value:new ge(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Z},alphaMap:{value:null},alphaMapTransform:{value:new Z},alphaTest:{value:0}}},uo={basic:{uniforms:Ae([U.common,U.specularmap,U.envmap,U.aomap,U.lightmap,U.fog]),vertexShader:J.meshbasic_vert,fragmentShader:J.meshbasic_frag},lambert:{uniforms:Ae([U.common,U.specularmap,U.envmap,U.aomap,U.lightmap,U.emissivemap,U.bumpmap,U.normalmap,U.displacementmap,U.fog,U.lights,{emissive:{value:new ge(0)},envMapIntensity:{value:1}}]),vertexShader:J.meshlambert_vert,fragmentShader:J.meshlambert_frag},phong:{uniforms:Ae([U.common,U.specularmap,U.envmap,U.aomap,U.lightmap,U.emissivemap,U.bumpmap,U.normalmap,U.displacementmap,U.fog,U.lights,{emissive:{value:new ge(0)},specular:{value:new ge(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:J.meshphong_vert,fragmentShader:J.meshphong_frag},standard:{uniforms:Ae([U.common,U.envmap,U.aomap,U.lightmap,U.emissivemap,U.bumpmap,U.normalmap,U.displacementmap,U.roughnessmap,U.metalnessmap,U.fog,U.lights,{emissive:{value:new ge(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:J.meshphysical_vert,fragmentShader:J.meshphysical_frag},toon:{uniforms:Ae([U.common,U.aomap,U.lightmap,U.emissivemap,U.bumpmap,U.normalmap,U.displacementmap,U.gradientmap,U.fog,U.lights,{emissive:{value:new ge(0)}}]),vertexShader:J.meshtoon_vert,fragmentShader:J.meshtoon_frag},matcap:{uniforms:Ae([U.common,U.bumpmap,U.normalmap,U.displacementmap,U.fog,{matcap:{value:null}}]),vertexShader:J.meshmatcap_vert,fragmentShader:J.meshmatcap_frag},points:{uniforms:Ae([U.points,U.fog]),vertexShader:J.points_vert,fragmentShader:J.points_frag},dashed:{uniforms:Ae([U.common,U.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:J.linedashed_vert,fragmentShader:J.linedashed_frag},depth:{uniforms:Ae([U.common,U.displacementmap]),vertexShader:J.depth_vert,fragmentShader:J.depth_frag},normal:{uniforms:Ae([U.common,U.bumpmap,U.normalmap,U.displacementmap,{opacity:{value:1}}]),vertexShader:J.meshnormal_vert,fragmentShader:J.meshnormal_frag},sprite:{uniforms:Ae([U.sprite,U.fog]),vertexShader:J.sprite_vert,fragmentShader:J.sprite_frag},background:{uniforms:{uvTransform:{value:new Z},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:J.background_vert,fragmentShader:J.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Z}},vertexShader:J.backgroundCube_vert,fragmentShader:J.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:J.cube_vert,fragmentShader:J.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:J.equirect_vert,fragmentShader:J.equirect_frag},distance:{uniforms:Ae([U.common,U.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:J.distance_vert,fragmentShader:J.distance_frag},shadow:{uniforms:Ae([U.lights,U.fog,{color:{value:new ge(0)},opacity:{value:1}}]),vertexShader:J.shadow_vert,fragmentShader:J.shadow_frag}};uo.physical={uniforms:Ae([uo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Z},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Z},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Z},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Z},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Z},sheen:{value:0},sheenColor:{value:new ge(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Z},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Z},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Z},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Z},attenuationDistance:{value:0},attenuationColor:{value:new ge(0)},specularColor:{value:new ge(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Z},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Z},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Z}}]),vertexShader:J.meshphysical_vert,fragmentShader:J.meshphysical_frag};var fp=new Z;fp.set(-1,0,0,0,1,0,0,0,1);var bS={[kr]:"LINEAR_TONE_MAPPING",[Gr]:"REINHARD_TONE_MAPPING",[Hr]:"CINEON_TONE_MAPPING",[Wr]:"ACES_FILMIC_TONE_MAPPING",[qr]:"AGX_TONE_MAPPING",[Yr]:"NEUTRAL_TONE_MAPPING",[Xr]:"CUSTOM_TONE_MAPPING"};var MS=new Float32Array(16),wS=new Float32Array(9),TS=new Float32Array(4);var ES={[kr]:"Linear",[Gr]:"Reinhard",[Hr]:"Cineon",[Wr]:"ACESFilmic",[qr]:"AgX",[Yr]:"Neutral",[Xr]:"Custom"};var AS={[qa]:"SHADOWMAP_TYPE_PCF",[Ya]:"SHADOWMAP_TYPE_VSM"};var CS={[ja]:"ENVMAP_TYPE_CUBE",[Zr]:"ENVMAP_TYPE_CUBE",[Ka]:"ENVMAP_TYPE_CUBE_UV"};var RS={[Zr]:"ENVMAP_MODE_REFRACTION"};var PS={[$a]:"ENVMAP_BLENDING_MULTIPLY",[Za]:"ENVMAP_BLENDING_MIX",[Ja]:"ENVMAP_BLENDING_ADD"};var dp=new Z;dp.set(-1,0,0,0,1,0,0,0,1);var IS=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);import pp from"@giro3d/giro3d/core/geographic/CoordinateSystem.js";import mp from"@giro3d/giro3d/core/OperationCounter.js";import{defer as ho}from"@giro3d/giro3d/core/RequestQueue.js";import gp from"@giro3d/giro3d/utils/Fetcher.js";import{nonNull as wt}from"@giro3d/giro3d/utils/tsutils.js";import{getLazPerf as _p}from"@giro3d/giro3d/sources/las/config.js";import{extractAttributes as yp,getDimensionsToRead as vp}from"@giro3d/giro3d/sources/las/dimension.js";import{getPerPointFilters as xp}from"@giro3d/giro3d/sources/las/filter.js";import{createBufferAttribute as Sp,readColor as bp,readPosition as Mp,readScalarAttribute as wp}from"@giro3d/giro3d/sources/las/readers.js";import{createLasView as Tp}from"@giro3d/giro3d/sources/las/worker.js";import{PointCloudSourceBase as Ep}from"@giro3d/giro3d/sources/PointCloudSource.js";function Ap(s,e){let t=c=>async()=>{let h=await(await gp.blob(c)).arrayBuffer();return new Uint8Array(h)};async function n(c){let u=await _p();return Ri.Las.PointData.decompressFile(c,u)}async function i(c){return(await s.get()).queue("DecodeLazFile",{buffer:c.buffer},[c.buffer]).then(h=>new Uint8Array(h))}class r extends Ep{isLASSource=!0;type="LASSource";_opCounter=new mp;_filters=[];_options={decimate:1,enableWorkers:!0,compressColorsToUint8:!0};_header=null;_volume=null;_buffer=null;get loading(){return this._opCounter.loading}get progress(){return this._opCounter.progress}get filters(){return this._filters}set filters(u){this._filters.length=0,this._filters.push(...u),this.dispatchEvent({type:"updated"})}constructor(u){if(super(),this._opCounter.addEventListener("changed",()=>this.dispatchEvent({type:"progress"})),this._options.compressColorsToUint8=u.compressColorsTo8Bit??this._options.compressColorsToUint8,this._options.decimate=u.decimate??1,this._options.decimate<1)throw new Error("decimate should be at least 1");this._options.enableWorkers=u.enableWorkers??!0,u.filters!=null&&u.filters.length>0&&this._filters.push(...u.filters),this._getter=typeof u.url=="string"?t(u.url):u.url}async initializeOnce(){this._opCounter.increment(),this._buffer=await this._getter().finally(()=>this._opCounter.decrement()),this._header=fo.Header.parse(new Uint8Array(this._buffer));let{min:u,max:h}=this._header;return this._volume=new We().set(new F(u[0],u[1],u[2]),new F(h[0],h[1],h[2])),this}async getView(u){this._opCounter.increment();let h=new Uint8Array(wt(this._buffer)),d=wt(this._header),p;return this._options.enableWorkers===!1?p=await n(h).finally(()=>this._opCounter.decrement()):p=await i(h).finally(()=>this._opCounter.decrement()),Tp(p,d,void 0,u)}async getMetadata(){let u=wt(this._header,"not initialized"),h=await this.getView(),d={pointCount:u.pointCount,volume:wt(this._volume),attributes:yp(h.dimensions,wt(this._volume),this._options.compressColorsToUint8,null)},p=wt(this._buffer,"not initialized"),v=(x,A)=>{if(A>=p.byteLength)throw new Error;return new Uint8Array(p.slice(x,A))},_=await Ri.Las.Vlr.walk((x,A)=>Promise.resolve(v(x,A)),u),g=Ri.Las.Vlr.find(_,"LASF_Projection",2112);if(g&&g.contentLength){let x=g.contentOffset,A=x+g.contentLength,E=po.Binary.toCString(v(x,A));if(E!==null&&E)try{d.crs=pp.fromWkt(E)}catch(I){console.error(`Failed to parse WKT for LAS "${this.id}": `,I)}}return Promise.resolve(d)}async getHierarchy(){let{min:u,max:h,pointCount:d}=wt(this._header,"not initialized"),p=new We().set(new F(u[0],u[1],u[2]),new F(h[0],h[1],h[2]));return{depth:0,volume:p,id:"root",hasData:!0,geometricError:0,center:p.getCenter(new F),sourceId:this.id,pointCount:d}}async getNodeData(u){let h=u.attributes??[],d=vp(h,u.position,this._filters),p=await this.getView(d),{min:v}=wt(this._volume),_=v.clone(),g=this._options.decimate??1,x=u.signal,A=xp(this._filters,p),E=this._options.compressColorsToUint8;this._opCounter.increment(h.length);let I,N;if(u.position){this._opCounter.increment();let C=await ho(()=>Mp(p,_,g,A)).finally(()=>this._opCounter.decrement());I=new bn(new Float32Array(C.buffer),3),N=C.localBoundingBox}let O=await Promise.all(h.map(async C=>{let G;C.interpretation==="color"?G=()=>bp(p,g,E,A):G=()=>wp(p,C,g,A);let z=await ho(G,x).finally(()=>this._opCounter.decrement());return Sp(z,C,E)}));return Promise.resolve({origin:_,pointCount:I?.count??O[0]?.count,localBoundingBox:N,position:I,attributes:O})}getMemoryUsage(u){this._buffer!=null&&u.objects.set(this.id,{cpuMemory:this._buffer.byteLength,gpuMemory:0})}dispose(){s.dispose(),this._buffer=null,this._header=null,this._volume=null,this._filters.length=0}}function l(c,u){return new class extends c{initialize(){return this._initializePromise||(this._initializePromise=Promise.resolve().then(()=>this.initializeOnce()).then(h=>(this._ready=!0,this.dispatchEvent({type:"initialized"}),h))),this._initializePromise}async getNodeData(h){h.signal?.throwIfAborted();try{let d=await super.getNodeData(h);return h.signal?.throwIfAborted(),d}catch(d){throw h.signal?.throwIfAborted(),d}}}(u)}return l(r,e)}var wn=Fn(ur());import{GlobalCache as mo}from"@giro3d/giro3d/core/Cache.js";import go from"@giro3d/giro3d/core/geographic/CoordinateSystem.js";import*as Pt from"@giro3d/giro3d/core/Octree.js";import Cp from"@giro3d/giro3d/core/OperationCounter.js";import Rp from"@giro3d/giro3d/core/RequestQueue.js";import Pp from"@giro3d/giro3d/utils/Fetcher.js";import{nonNull as es}from"@giro3d/giro3d/utils/tsutils.js";import{getLazPerf as Ip}from"@giro3d/giro3d/sources/las/config.js";import{extractAttributes as Lp,getDimensionsToRead as Dp}from"@giro3d/giro3d/sources/las/dimension.js";import{createBufferAttribute as Up}from"@giro3d/giro3d/sources/las/readers.js";import{createLasView as Np,readView as Fp}from"@giro3d/giro3d/sources/las/worker.js";import{PointCloudSourceBase as Op}from"@giro3d/giro3d/sources/PointCloudSource.js";function Bp(s,e){let t=new Rp,n=_=>async(g,x)=>{let E=await(await Pp.blob(_,{headers:{Range:`bytes=${g}-${x-1}`}})).arrayBuffer();return new Uint8Array(E)};async function i(_,g){let x=await Ip();return wn.Las.PointData.decompressChunk(_,g,x)}async function r(_,g){return(await s.get()).queue("DecodeLazChunk",{buffer:_.buffer,metadata:g},[_.buffer]).then(A=>new Uint8Array(A))}let l=new F,c=new F;function u(_,g,x,A,E,I,N){let O=x.depth+1,C=x.x*2+E,G=x.y*2+I,z=x.z*2+N,$=`${O}-${C}-${G}-${z}`,Q=g.get($);if(!Q)return;let re=x.volume.getCenter(l),y=x.volume.getSize(c).divideScalar(2),M=pe=>pe===0?-1:0,B=re.x+y.x*M(E),X=re.y+y.y*M(I),k=re.z+y.z*M(N),q=new F(B,X,k),L=q.clone().add(y),de=new We(q,L),_e=de.getCenter(new F);return Pt.create({depth:O,x:C,y:G,z,id:$,center:_e,pointCount:Q.pointCount,geometricError:A,hasData:Q.pointCount>0,sourceId:_,volume:de},de,x)}async function h(_,g,x){let{nodes:A,pages:E}=await wn.Copc.loadHierarchyPage(_,g);for(let[I,N]of Object.entries(A))x.set(I,N);for(let I of Object.values(E))I&&await h(_,I,x)}class d extends Op{isCOPCSource=!0;type="COPCSource";_opCounter=new Cp;_nodeMap=new Map;_filters=[];_options={decimate:1,enableWorkers:!0,compressColorsToUint8:!0};get loading(){return this._opCounter.loading}get progress(){return this._opCounter.progress}get filters(){return this._filters}set filters(g){this._filters.length=0,g!=null&&this._filters.push(...g),this.dispatchEvent({type:"updated"})}constructor(g){if(super(),this._opCounter.addEventListener("changed",()=>this.dispatchEvent({type:"progress"})),this._options.compressColorsToUint8=g.compressColorsTo8Bit??this._options.compressColorsToUint8,this._options.decimate=g.decimate??1,this._options.decimate<1)throw new Error("decimate should be at least 1");this._options.enableWorkers=g.enableWorkers??!0,g.filters!=null&&g.filters.length>0&&this._filters.push(...g.filters),this._getter=typeof g.url=="string"?n(g.url):g.url}async initializeOnce(){let g=this._opCounter;g.increment(3);let x=await wn.Copc.create(this._getter).finally(()=>g.decrement()),[A,E,I]=x.header.min,[N,O,C]=x.header.max,G=new We(new F(A,E,I),new F(N,O,C)),z=new Map;await h(this._getter,x.info.rootHierarchyPage,z).finally(()=>g.decrement());let $=es(z.get("0-0-0-0"),"FATAL: no root node in the LAS file."),Q=await this.loadPointDataView(this._getter,x,$).finally(()=>g.decrement());return this._data={copc:x,nodes:z,volume:G,dimensions:Q.dimensions},this}getMetadata(){let g=this.ensureInitialized(),x=go.unknown;if(typeof g.copc.wkt<"u")try{x=go.fromWkt(g.copc.wkt)}catch(E){console.error(`Failed to parse WKT for COPC "${this.id}": `,E)}let A={pointCount:g.copc.header.pointCount,attributes:Lp(g.dimensions,g.volume,this._options.compressColorsToUint8,g.copc.info.gpsTimeRange),volume:g.volume,crs:x};return Promise.resolve(A)}getHierarchy(){let{copc:g,nodes:x}=this.ensureInitialized(),[A,E,I,N,O,C]=g.info.cube,G=new We(new F(A,E,I),new F(N,O,C)),z=es(x.get("0-0-0-0")),$=g.info.spacing,Q=Pt.create({depth:0,x:0,y:0,z:0,id:"0-0-0-0",volume:G,center:G.getCenter(new F),pointCount:z.pointCount,geometricError:$,hasData:z.pointCount>0,sourceId:this.id},G);return Pt.populate(Q,y=>{let M=$/2**(y.depth+1);return[u(this.id,x,y,M,0,0,0),u(this.id,x,y,M,1,0,0),u(this.id,x,y,M,1,1,0),u(this.id,x,y,M,0,1,0),u(this.id,x,y,M,0,0,1),u(this.id,x,y,M,1,0,1),u(this.id,x,y,M,1,1,1),u(this.id,x,y,M,0,1,1)]}),Pt.traverse(Q,y=>(this._nodeMap.set(y.id,y),!0)),Promise.resolve(Q)}async getNodeData(g){let{nodes:x,copc:A}=this.ensureInitialized(),E=g.node.id,I=-g.node.depth,N=x.get(E);if(!N)throw new Error("no such node: "+E);let O=g.signal;O?.throwIfAborted();let C=g.attributes??[],G=Dp(C,g.position,this._filters),z=es(this._nodeMap.get(E)),$=this._options.decimate,{x:Q,y:re,z:y}=g.node.center,M={pointCount:N.pointCount,pointDataRecordFormat:A.header.pointDataRecordFormat,pointDataRecordLength:A.header.pointDataRecordLength},B;this._options.enableWorkers?B=await this.loadNodeDataWithWorker(N,I,O,A,M,g,Q,re,y,G,$):B=await this.loadNodeData(A,N,G,I,O,Q,re,y,$,g),O?.throwIfAborted();let X,k;if(B.position){X=new nn(new Float32Array(B.position.buffer),3);let[L,de,_e,ee,pe,Tn]=B.position.localBoundingBox;k=new We(new F(L,de,_e),new F(ee,pe,Tn))}let q=C.map((L,de)=>{let _e=B.attributes[de];if(_e!=null)return Up(_e,L,this._options.compressColorsToUint8)});return{pointCount:X?.count??q[0]?.count,origin:z.center,localBoundingBox:k,position:X,attributes:q}}async loadNodeData(g,x,A,E,I,N,O,C,G,z){let $=await this._opCounter.wrap(this.loadPointDataView(this._getter,g,x,A,E,I));return I?.throwIfAborted(),Fp({view:$,origin:{x:N,y:O,z:C},stride:G,position:z.position,attributes:z.attributes??[],compressColors:this._options.compressColorsToUint8,filters:this._filters})}async loadNodeDataWithWorker(g,x,A,E,I,N,O,C,G,z,$){let Q=await this._opCounter.wrap(this.loadPointDataViewBuffer(this._getter,g,x));A?.throwIfAborted();let re=Q.slice(0);try{return this._opCounter.increment(),await(await s.get()).queue("ReadView",{buffer:re,header:E.header,metadata:I,position:N.position,origin:{x:O,y:C,z:G},include:z,filters:this._filters,eb:E.eb,stride:$,attributes:N.attributes??[],compressColors:this._options.compressColorsToUint8},[re])}finally{this._opCounter.decrement()}}ensureInitialized(){if(!this._data)throw new Error("not initialized");return this._data}async loadPointDataViewBuffer(g,x,A){let{pointDataOffset:E,pointDataLength:I}=x,N=`${this.id}-${E}-${I}`,O=mo.get(N);return O!=null?O.buffer:t.enqueue({id:N,priority:A,request:async()=>{let C=await g(E,E+I);return mo.set(N,C,{size:C.byteLength}),C.buffer}})}async loadPointDataView(g,x,A,E,I,N){let O=await this.loadPointDataViewBuffer(g,A,I);N?.throwIfAborted();let C;if(this._options.enableWorkers){let G=new Uint8Array(O.slice(0));C=await r(G,{pointCount:A.pointCount,pointDataRecordFormat:x.header.pointDataRecordFormat,pointDataRecordLength:x.header.pointDataRecordLength})}else{let G=new Uint8Array(O);C=await i(G,{pointCount:A.pointCount,pointDataRecordFormat:x.header.pointDataRecordFormat,pointDataRecordLength:x.header.pointDataRecordLength})}return N?.throwIfAborted(),Np(C,x.header,x.eb,E)}getMemoryUsage(){}dispose(){s.dispose(),this._data=void 0,this._nodeMap.clear(),this._filters.length=0}}function p(_){return _.isCOPCSource===!0}function v(_,g){return new class extends _{initialize(){return this._initializePromise||(this._initializePromise=Promise.resolve().then(()=>this.initializeOnce()).then(x=>(this._ready=!0,this.dispatchEvent({type:"initialized"}),x))),this._initializePromise}async getNodeData(x){x.signal?.throwIfAborted();try{let A=await super.getNodeData(x);return x.signal?.throwIfAborted(),A}catch(A){throw x.signal?.throwIfAborted(),A}}}(g)}return v(d,e)}function Vp(s,e){if(typeof s.prototype.loadNodeData!="function")throw new Error("Missing reviewed PointCloud loading method.");let t=new AbortController,n,i=()=>{t.signal.aborted||(t.abort(new Error("aborted")),n&&(n.frozen=!0))};return n=new class extends s{async loadNodeData(r,l,c){if(t.signal.aborted||l?.aborted)return;let u=new AbortController,h=()=>u.abort(new Error("aborted"));t.signal.addEventListener("abort",h,{once:!0}),l?.addEventListener("abort",h,{once:!0});try{return(t.signal.aborted||l?.aborted)&&h(),await super.loadNodeData(r,u.signal,c)}finally{t.signal.removeEventListener("abort",h),l?.removeEventListener("abort",h)}}clear(){t.signal.aborted||super.clear()}dispose(){try{i()}finally{super.dispose()}}}(e),{entity:n,stop:i}}function cb(s){return Vp(zp,s)}export{Bp as createCOPCSource,Ap as createLASSource,cb as createOwnedPointCloud};
|
|
3826
|
+
/*! Bundled license information:
|
|
3827
|
+
|
|
3828
|
+
three/build/three.core.js:
|
|
3829
|
+
three/build/three.module.js:
|
|
3830
|
+
(**
|
|
3831
|
+
* @license
|
|
3832
|
+
* Copyright 2010-2026 Three.js Authors
|
|
3833
|
+
* SPDX-License-Identifier: MIT
|
|
3834
|
+
*)
|
|
3835
|
+
*/
|