commit 3c69bc58bfe4bb2e687edacdf6da7e26bfc2c340 Author: lb Date: Fri Jun 30 11:08:43 2023 +0800 init diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7e3649a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce341eb --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/npm-debug.log* +/yarn-error.log +/yarn.lock +/package-lock.json + +# production +/dist + +# misc +.DS_Store + +# umi +/src/.umi +/src/.umi-production +/src/.umi-test +/.env.local + + +v3dApp/ \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..0d4222f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ +**/*.md +**/*.svg +**/*.ejs +**/*.html +package.json +.umi +.umi-production +.umi-test diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..94beb14 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 80, + "overrides": [ + { + "files": ".prettierrc", + "options": { "parser": "json" } + } + ] +} diff --git a/.umirc.ts b/.umirc.ts new file mode 100644 index 0000000..80fbf38 --- /dev/null +++ b/.umirc.ts @@ -0,0 +1,30 @@ +import { defineConfig } from 'umi'; + +export default defineConfig({ + nodeModulesTransform: { + type: 'none', + }, + routes: [ + { path: '/', component: '@/pages/index' }, + ], + proxy: { + '/api': { + target: 'http://localhost:3000', + changeOrigin: true, + pathRewrite: { '^/api': '' }, + }, + }, + + fastRefresh: {}, + chainWebpack(conf) { + // ....other config + conf.module + .rule('mjs$') + .test(/\.mjs$/) + .include + .add(/node_modules/) + .end() + .type('javascript/auto'); + }, + +}); diff --git a/README.md b/README.md new file mode 100644 index 0000000..07afeb7 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# umi project + +## Getting Started + +Install dependencies, + +```bash +$ yarn +``` + +Start the dev server, + +```bash +$ yarn start +``` diff --git a/package.json b/package.json new file mode 100644 index 0000000..6747448 --- /dev/null +++ b/package.json @@ -0,0 +1,49 @@ +{ + "private": true, + "scripts": { + "start": "umi dev", + "build": "umi build", + "postinstall": "umi generate tmp", + "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'", + "test": "umi-test", + "test:coverage": "umi-test --coverage" + }, + "gitHooks": { + "pre-commit": "lint-staged" + }, + "lint-staged": { + "*.{js,jsx,less,md,json}": [ + "prettier --write" + ], + "*.ts?(x)": [ + "prettier --parser=typescript --write" + ] + }, + "dependencies": { + "@ant-design/icons": "^4.7.0", + "@jiaminghi/data-view-react": "^1.2.5", + "antd": "^4.20.6", + "echarts": "^5.3.2", + "echarts-for-react": "^3.0.2", + "framer-motion": "^6.3.3", + "less": "^4.1.3", + "less-loader": "^11.0.0", + "react": "^16.8.6", + "react-dom": "^16.8.6", + "react-router-dom": "^6.3.0", + "style-components": "^0.1.0", + "styled-components": "^5.3.5", + "umi": "^3.5.23" + }, + "devDependencies": { + "@babel/runtime": "^7.18.0", + "@types/react": "^17.0.0", + "@types/react-dom": "^17.0.0", + "@umijs/preset-react": "1.x", + "@umijs/test": "^3.5.23", + "lint-staged": "^10.0.7", + "prettier": "^2.2.0", + "typescript": "^4.1.2", + "yorkie": "^2.0.0" + } +} diff --git a/public/v3d.js b/public/v3d.js new file mode 100644 index 0000000..a097680 --- /dev/null +++ b/public/v3d.js @@ -0,0 +1,352 @@ +function _extends(){return(_extends=Object.assign||function(e){for(var t=1;tthis.length)&&(t=this.length),this.substring(t-e.length,t)===e});class n{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}removeEventListener(e,t){if(void 0!==this._listeners){const n=this._listeners[e];void 0===n||-1!==(e=n.indexOf(t))&&n.splice(e,1)}}dispatchEvent(n){if(void 0!==this._listeners){const e=this._listeners[n.type];if(void 0!==e){n.target=this;const r=e.slice(0);for(let e=0,t=r.length;e>8&255]+yn[e>>16&255]+yn[e>>24&255]+"-"+yn[255&t]+yn[t>>8&255]+"-"+yn[t>>16&15|64]+yn[t>>24&255]+"-"+yn[63&n|128]+yn[n>>8&255]+"-"+yn[n>>16&255]+yn[n>>24&255]+yn[255&r]+yn[r>>8&255]+yn[r>>16&255]+yn[r>>24&255];return i.toUpperCase()}function ft(e,t,n){return Math.max(t,Math.min(n,e))}function Sn(e,t){return(e%t+t)%t}function Tn(e,t,n){return(1-n)*e+n*t}function Cn(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)}function En(e){return e*Mn}function Ln(e){return e*An}function Rn(e){return 0==(e&e-1)&&0!==e}function Pn(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function In(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function Nn(e){let t=5381,n=e.length;for(;n;)t=33*t^e.charCodeAt(--n);return t>>>0}function Dn(e,t,n,r){n=Math.exp(-n/r);return e*n+(1-n)*t}function On(e,t,n,r,i){let a=Dn(e,t,n,r);return a=Math.abs(e-t)e?rNumber.EPSILON&&(p=Math.sqrt(p),a=Math.atan2(p,a*h),e=Math.sin(e*a)/p,o=Math.sin(o*a)/p),o*h);s=s*e+n*a,l=l*e+r*a,c=c*e+d*a,u=u*e+i*a,e===1-o&&(p=1/Math.sqrt(s*s+l*l+c*c+u*u),s*=p,l*=p,c*=p,u*=p)}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],n=n[r+3],r=i[a],c=i[a+1],u=i[a+2],i=i[a+3];return e[t]=o*i+n*r+s*u-l*c,e[t+1]=s*i+n*c+l*r-o*u,e[t+2]=l*i+n*u+o*c-s*r,e[t+3]=n*i-o*r-s*c-l*u,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,r){return this._x=e,this._y=t,this._z=n,this._w=r,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){if(!e||!e.isEuler)throw new Error("v3d.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e._order;const o=Math.cos,s=Math.sin;var l=o(n/2),c=o(r/2),u=o(i/2),d=s(n/2),h=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=d*c*u+l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u-d*h*p;break;case"YXZ":this._x=d*c*u+l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u+d*h*p;break;case"ZXY":this._x=d*c*u-l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u-d*h*p;break;case"ZYX":this._x=d*c*u-l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u+d*h*p;break;case"YZX":this._x=d*c*u+l*h*p,this._y=l*h*u+d*c*p,this._z=l*c*p-d*h*u,this._w=l*c*u-d*h*p;break;case"XZY":this._x=d*c*u-l*h*p,this._y=l*h*u-d*c*p,this._z=l*c*p+d*h*u,this._w=l*c*u+d*h*p;break;default:console.warn("v3d.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){var t=t/2,n=Math.sin(t);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(t),this._onChangeCallback(),this}setFromRotationMatrix(e){var e=e.elements,t=e[0],n=e[4],r=e[8],i=e[1],a=e[5],o=e[9],s=e[2],l=e[6],e=e[10],c=t+a+e;return 0Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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(ft(this.dot(e),-1,1)))}rotateTowards(e,t){var n=this.angleTo(e);if(0===n)return this;t=Math.min(1,t/n);return this.slerp(e,t),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(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(this._x=this._x*(e=1/e),this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e,t){return void 0!==t?(console.warn("v3d.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions(a, b) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){var n=e._x,r=e._y,i=e._z,e=e._w,a=t._x,o=t._y,s=t._z,t=t._w;return this._x=n*t+e*a+r*s-i*o,this._y=r*t+e*o+i*a-n*s,this._z=i*t+e*s+n*o-r*a,this._w=e*t-n*a-r*o-i*s,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w;let o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),1<=o)return this._w=a,this._x=n,this._y=r,this._z=i,this;e=1-o*o;if(e<=Number.EPSILON)return this._w=(s=1-t)*a+t*this._w,this._x=s*n+t*this._x,this._y=s*r+t*this._y,this._z=s*i+t*this._z,this.normalize(),this._onChangeCallback(),this;var s=Math.sqrt(e),e=Math.atan2(s,o),l=Math.sin((1-t)*e)/s,t=Math.sin(t*e)/s;return this._w=a*l+this._w*t,this._x=n*l+this._x*t,this._y=r*l+this._y*t,this._z=i*l+this._z*t,this._onChangeCallback(),this}slerpQuaternions(e,t,n){this.copy(e).slerp(t,n)}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}de.prototype.isQuaternion=!0;class vt{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(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("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("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,t){return void 0!==t?(console.warn("v3d.Vector3: .add() now only accepts one argument. Use .addVectors(a, b) instead."),this.addVectors(e,t)):(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,t){return void 0!==t?(console.warn("v3d.Vector3: .sub() now only accepts one argument. Use .subVectors(a, b) instead."),this.subVectors(e,t)):(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,t){return void 0!==t?(console.warn("v3d.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors(a, b) instead."),this.multiplyVectors(e,t)):(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 e&&e.isEuler||console.error("v3d.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(qn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(qn.setFromAxisAngle(e,t))}applyMatrix3(e){var t=this.x,n=this.y,r=this.z,e=e.elements;return this.x=e[0]*t+e[3]*n+e[6]*r,this.y=e[1]*t+e[4]*n+e[7]*r,this.z=e[2]*t+e[5]*n+e[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){var t=this.x,n=this.y,r=this.z,e=e.elements,i=1/(e[3]*t+e[7]*n+e[11]*r+e[15]);return this.x=(e[0]*t+e[4]*n+e[8]*r+e[12])*i,this.y=(e[1]*t+e[5]*n+e[9]*r+e[13])*i,this.z=(e[2]*t+e[6]*n+e[10]*r+e[14])*i,this}applyQuaternion(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,e=e.w,s=e*t+a*r-o*n,l=e*n+o*t-i*r,c=e*r+i*n-a*t,t=-i*t-a*n-o*r;return this.x=s*e+t*-i+l*-o-c*-a,this.y=l*e+t*-a+c*-i-s*-o,this.z=c*e+t*-o+s*-a-l*-i,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){var t=this.x,n=this.y,r=this.z,e=e.elements;return this.x=e[0]*t+e[4]*n+e[8]*r,this.y=e[1]*t+e[5]*n+e[9]*r,this.z=e[2]*t+e[6]*n+e[10]*r,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,t){return void 0!==t?(console.warn("v3d.Vector3: .cross() now only accepts one argument. Use .crossVectors(a, b) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){var n=e.x,r=e.y,e=e.z,i=t.x,a=t.y,t=t.z;return this.x=r*t-e*a,this.y=e*i-n*t,this.z=n*a-r*i,this}projectOnVector(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);t=e.dot(this)/t;return this.copy(e).multiplyScalar(t)}projectOnPlane(e){return Zn.copy(this).projectOnVector(e),this.sub(Zn)}reflect(e){return this.sub(Zn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;e=this.dot(e)/t;return Math.acos(ft(e,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){var t=this.x-e.x,n=this.y-e.y,e=this.z-e.z;return t*t+n*n+e*e}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){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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){e=e.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),e=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=e,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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,n){return void 0!==n&&console.warn("v3d.Vector3: offset has been removed from .fromBufferAttribute()."),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}}vt.prototype.isVector3=!0;const Zn=new vt,qn=new de;class g{constructor(e=new vt(1/0,1/0,1/0),t=new vt(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(n){let r=1/0,i=1/0,a=1/0,o=-1/0,s=-1/0,l=-1/0;for(let e=0,t=n.length;eo&&(o=c),u>s&&(s=u),d>l&&(l=d)}return this.min.set(r,i,a),this.max.set(o,s,l),this}setFromBufferAttribute(n){let r=1/0,i=1/0,a=1/0,o=-1/0,s=-1/0,l=-1/0;for(let e=0,t=n.count;eo&&(o=c),u>s&&(s=u),d>l&&(l=d)}return this.min.set(r,i,a),this.max.set(o,s,l),this}setFromPoints(n){this.makeEmpty();for(let e=0,t=n.length;ethis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Kn),Kn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return n=0=-e.constant}intersectsTriangle(e){return!this.isEmpty()&&(this.getCenter(ar),or.subVectors(this.max,ar),$n.subVectors(e.a,ar),er.subVectors(e.b,ar),tr.subVectors(e.c,ar),nr.subVectors(er,$n),rr.subVectors(tr,er),ir.subVectors($n,tr),!!cr([0,-nr.z,nr.y,0,-rr.z,rr.y,0,-ir.z,ir.y,nr.z,0,-nr.x,rr.z,0,-rr.x,ir.z,0,-ir.x,-nr.y,nr.x,0,-rr.y,rr.x,0,-ir.y,ir.x,0],$n,er,tr,or)&&(!!cr([1,0,0,0,1,0,0,0,1],$n,er,tr,or)&&(sr.crossVectors(nr,rr),cr([sr.x,sr.y,sr.z],$n,er,tr,or))))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){const t=Kn.copy(e).clamp(this.min,this.max);return t.sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(Kn).length(),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()||(Qn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Qn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Qn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Qn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Qn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Qn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Qn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Qn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Qn)),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)}}g.prototype.isBox3=!0;const Qn=[new vt,new vt,new vt,new vt,new vt,new vt,new vt,new vt],Kn=new vt,Jn=new g,$n=new vt,er=new vt,tr=new vt,nr=new vt,rr=new vt,ir=new vt,ar=new vt,or=new vt,sr=new vt,lr=new vt;function cr(n,r,i,a,o){for(let e=0,t=n.length-3;e<=t;e+=3){lr.fromArray(n,e);var s=o.x*Math.abs(lr.x)+o.y*Math.abs(lr.y)+o.z*Math.abs(lr.z),l=r.dot(lr),c=i.dot(lr),u=a.dot(lr);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>s)return!1}return!0}const ur=new g,dr=new vt,hr=new vt,pr=new vt;class fr{constructor(e=new vt,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(n,e){const r=this.center;void 0!==e?r.copy(e):ur.setFromPoints(n).getCenter(r);let i=0;for(let e=0,t=n.length;ethis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){pr.subVectors(e,this.center);var t,e=pr.lengthSq();return e>this.radius*this.radius&&(t=.5*((e=Math.sqrt(e))-this.radius),this.center.add(pr.multiplyScalar(t/e)),this.radius+=t),this}union(e){return 0===this.center.distanceToSquared(e.center)?this.radius=Math.max(this.radius,e.radius):(hr.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(dr.copy(e.center).add(hr)),this.expandByPoint(dr.copy(e.center).sub(hr))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const mr=new vt,vr=new vt,gr=new vt,_r=new vt,xr=new vt,yr=new vt,br=new vt;class Mr{constructor(e=new vt,t=new vt(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,mr)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);e=t.dot(this.direction);return e<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(e).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){var t=mr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(mr.copy(this.direction).multiplyScalar(t).add(this.origin),mr.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){vr.copy(e).add(t).multiplyScalar(.5),gr.copy(t).sub(e).normalize(),_r.copy(this.origin).sub(vr);var e=.5*e.distanceTo(t),t=-this.direction.dot(gr),i=_r.dot(this.direction),a=-_r.dot(gr),o=_r.lengthSq(),s=Math.abs(1-t*t);let l,c,u,d;return u=0=-d?c<=d?(s=1/s,l*=s,c*=s,l*(l+t*c+2*i)+c*(t*l+c+2*a)+o):(c=e,-(l=Math.max(0,-(t*c+i)))*l+c*(c+2*a)+o):(c=-e,-(l=Math.max(0,-(t*c+i)))*l+c*(c+2*a)+o):c<=-d?(l=Math.max(0,-(-t*e+i)),c=0a||i>r?null:((i>n||n!=n)&&(n=i),(as||o>r?null:((o>n||n!=n)&&(n=o),(r=sa)return null;r=-o*_r.dot(br);return r<0?null:this.at(r/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class gt{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}setRGB(e,t,n){return this.r=e,this.g=t,this.b=n,this}setHSL(e,t,n){return e=Sn(e,1),t=ft(t,0,1),n=ft(n,0,1),0===t?this.r=this.g=this.b=n:(this.r=Br(t=2*n-(n=n<=.5?n*(1+t):n+t-n*t),n,e+1/3),this.g=Br(t,n,e),this.b=Br(t,n,e-1/3)),this}setStyle(t){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("v3d.Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let e;var i,a,o,s=r[1],l=r[2];switch(s){case"rgb":case"rgba":if(e=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,n(e[4]),this;if(e=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,n(e[4]),this;break;case"hsl":case"hsla":if(e=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return i=parseFloat(e[1])/360,a=parseInt(e[2],10)/100,o=parseInt(e[3],10)/100,n(e[4]),this.setHSL(i,a,o)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const e=r[1];s=e.length;if(3===s)return this.r=parseInt(e.charAt(0)+e.charAt(0),16)/255,this.g=parseInt(e.charAt(1)+e.charAt(1),16)/255,this.b=parseInt(e.charAt(2)+e.charAt(2),16)/255,this;if(6===s)return this.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,this.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,this.b=parseInt(e.charAt(4)+e.charAt(5),16)/255,this}return t&&0r&&(r=n[e]);return r}const Ti={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ci(e,t){return new Ti[e](t)}function xt(e){return void 0!==e}function Ei(t,n,r){for(let e=0;en.far?null:{distance:r,point:ia.clone(),object:e})}(e,t,n,r,Xi,ji,Yi,ra);return m&&(s&&(ea.fromBufferAttribute(s,c),ta.fromBufferAttribute(s,u),na.fromBufferAttribute(s,d),m.uv=ui.getUV(ra,Xi,ji,Yi,ea,ta,na,new Be)),l&&(ea.fromBufferAttribute(l,c),ta.fromBufferAttribute(l,u),na.fromBufferAttribute(l,d),m.uv2=ui.getUV(ra,Xi,ji,Yi,ea,ta,na,new Be)),i={a:c,b:u,c:d,normal:new vt,materialIndex:0},ui.getNormal(Xi,ji,Yi,i.normal),m.face=i),m}ee.prototype.isMesh=!0;class oa extends S{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};const C=this,E=(r=Math.floor(r),i=Math.floor(i),a=Math.floor(a),[]),L=[],R=[],P=[];let I=0,N=0;function o(n,r,i,a,o,e,t,s,l,c,u){var d=e/l,h=t/c,p=e/2,f=t/2,m=s/2,v=l+1,g=c+1;let _=0,x=0;const y=new vt;for(let t=0;t + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize(vWorldDirection); + + vec2 sampleUV = equirectUv(direction); + + gl_FragColor = texture2D(tEquirect, sampleUV); + + } + `},r=new oa(5,5,5);const i=new T({name:"CubemapFromEquirect",uniforms:sa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Fe,blending:ce}),a=(i.uniforms.tEquirect.value=t,new ee(r,i));n=t.minFilter;t.minFilter===He&&(t.minFilter=ht);const o=new ha(1,10,this);return o.update(e,a),t.minFilter=n,a.geometry.dispose(),a.material.dispose(),this}clear(t,n,r,i){var e=t.getRenderTarget();for(let e=0;e<6;e++)t.setRenderTarget(this,e),t.clear(n,r,i);t.setRenderTarget(e)}}fa.prototype.isWebGLCubeRenderTarget=!0;const ma={checkWebGL:function(){try{const e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl")&&!e.getContext("experimental-webgl"))}catch(e){return!1}},checkWebGL2:function(){try{const e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}},checkWorkers:function(){return!!window.Worker},checkFileAPI:function(){return window.File&&window.FileReader&&window.FileList&&window.Blob},genWebGLErrorMessage:function(){const e=document.createElement("div");return e.setAttribute("class","v3d-webgl-error"),e.innerHTML=(window.WebGLRenderingContext?["Ouch! Your graphics card does not support WebGL.
",'Find out how to fix it here.']:["Ouch! Your browser does not support WebGL.
",'Find out how to fix it here.']).join("\n"),e},showWebGLErrorMessage:function(e){(e=e||document.body).appendChild(ma.genWebGLErrorMessage());const t=document.getElementById("v3d_preloader_container");t&&(t.style.visibility="hidden")},checkIOS:function(){return(/iPad|iPhone|iPod/.test(navigator.platform)||"MacIntel"===navigator.platform&&1 0.0) {\ndistanceFalloff *= pow2(saturate(1.0 - pow4(lightDistance / cutoffDistance)));\n}\nreturn distanceFalloff;\n#else\nif(cutoffDistance > 0.0 && decayExponent > 0.0) {\nreturn pow(saturate(-lightDistance / cutoffDistance + 1.0), decayExponent);\n}\nreturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert(const in vec3 diffuseColor) {\nreturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick(const in vec3 specularColor, const in float dotVH) {\nfloat fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);\nreturn (1.0 - specularColor) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent(const in vec3 F0, const in float dotNV, const in float roughness) {\nfloat fresnel = exp2((-5.55473 * dotNV - 6.98316) * dotNV);\nvec3 Fr = max(vec3(1.0 - roughness), F0) - F0;\nreturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {\nfloat a2 = pow2(alpha);\nfloat gl = dotNL + sqrt(a2 + (1.0 - a2) * pow2(dotNL));\nfloat gv = dotNV + sqrt(a2 + (1.0 - a2) * pow2(dotNV));\nreturn 1.0 / (gl * gv);\n}\nfloat G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\nfloat a2 = pow2(alpha);\nfloat gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\nfloat gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\nreturn 0.5 / max(gv + gl, EPSILON);\n}\nfloat D_GGX(const in float alpha, const in float dotNH) {\nfloat a2 = pow2(alpha);\nfloat denom = pow2(dotNH) * (a2 - 1.0) + 1.0;\nreturn RECIPROCAL_PI * a2 / pow2(denom);\n}\nvec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness) {\nfloat alpha = pow2(clamp(roughness, 0.04, 1.0));\nvec3 halfDir = normalize(incidentLight.direction + viewDir);\nfloat dotNL = saturate(dot(normal, incidentLight.direction));\nfloat dotNV = saturate(dot(normal, viewDir));\nfloat dotNH = saturate(dot(normal, halfDir));\nfloat dotLH = saturate(dot(incidentLight.direction, halfDir));\nvec3 F = F_Schlick(specularColor, dotLH);\nfloat G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV);\nfloat D = D_GGX(alpha, dotNH);\nreturn F * (G * D);\n}\nvec2 LTC_Uv(const in vec3 N, const in vec3 V, const in float roughness) {\nconst float LUT_SIZE = 64.0;\nconst float LUT_SCALE = (LUT_SIZE - 1.0) / LUT_SIZE;\nconst float LUT_BIAS = 0.5 / LUT_SIZE;\nfloat dotNV = saturate(dot(N, V));\nvec2 uv = vec2(roughness, sqrt(1.0 - dotNV));\nuv = uv * LUT_SCALE + LUT_BIAS;\nreturn uv;\n}\nfloat LTC_ClippedSphereFormFactor(const in vec3 f) {\nfloat l = length(f);\nreturn max((l * l + f.z) / (l + 1.0), 0.0);\n}\nvec3 LTC_EdgeVectorFormFactor(const in vec3 v1, const in vec3 v2) {\nfloat x = dot(v1, v2);\nfloat y = abs(x);\nfloat a = 0.8543985 + (0.4965155 + 0.0145206 * y) * y;\nfloat b = 3.4175940 + (4.1616724 + y) * y;\nfloat v = a / b;\nfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt(max(1.0 - x * x, 1e-7)) - v;\nreturn cross(v1, v2) * theta_sintheta;\n}\nvec3 LTC_Evaluate(const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[4]) {\nvec3 v1 = rectCoords[1] - rectCoords[0];\nvec3 v2 = rectCoords[3] - rectCoords[0];\nvec3 lightNormal = cross(v1, v2);\nif(dot(lightNormal, P - rectCoords[0]) < 0.0) return vec3(0.0);\nvec3 T1, T2;\nT1 = normalize(V - N * dot(V, N));\nT2 = - cross(N, T1);\nmat3 mat = mInv * transposeMat3(mat3(T1, T2, N));\nvec3 coords[4];\ncoords[0] = mat * (rectCoords[0] - P);\ncoords[1] = mat * (rectCoords[1] - P);\ncoords[2] = mat * (rectCoords[2] - P);\ncoords[3] = mat * (rectCoords[3] - P);\ncoords[0] = normalize(coords[0]);\ncoords[1] = normalize(coords[1]);\ncoords[2] = normalize(coords[2]);\ncoords[3] = normalize(coords[3]);\nvec3 vectorFormFactor = vec3(0.0);\nvectorFormFactor += LTC_EdgeVectorFormFactor(coords[0], coords[1]);\nvectorFormFactor += LTC_EdgeVectorFormFactor(coords[1], coords[2]);\nvectorFormFactor += LTC_EdgeVectorFormFactor(coords[2], coords[3]);\nvectorFormFactor += LTC_EdgeVectorFormFactor(coords[3], coords[0]);\nfloat result = LTC_ClippedSphereFormFactor(vectorFormFactor);\nreturn vec3(result);\n}\nvec2 get_BRDF_SpecCoeffsBlender(float x, float y) {\nvec3 xyFactors0 = vec3(x * x, y * y, x * y);\nvec3 xyFactors1 = vec3(x, y, 1);\nvec3 a0a1a2 = vec3(0.33749372, 0.15167605, 1.09684597);\nvec3 a3a4a5 = vec3(-1.26123466, -0.927699, 0.9199188);\nvec3 b0b1b2 = vec3(0.41699717, 0.44675109, 0.79947684);\nvec3 b3b4b5 = vec3(-1.19307849, -0.89813958, 0.89305222);\nvec3 c0c1c2 = vec3(0.29920727, 0.09505591, -0.9136233);\nvec3 c3c4c5 = vec3(0.77055201, 0.13006674, -0.23085581);\nvec3 d0d1d2 = vec3(15.05004149, 7.98517355, 13.30473726);\nvec3 d3d4d5 = vec3(-32.00353547, -12.97743434, 17.83646751);\nfloat coeff0 = (dot(xyFactors0, a0a1a2) + dot(xyFactors1, a3a4a5))\n/ (dot(xyFactors0, b0b1b2) + dot(xyFactors1, b3b4b5));\nfloat coeff1 = (dot(xyFactors0, c0c1c2) + dot(xyFactors1, c3c4c5))\n/ (dot(xyFactors0, d0d1d2) + dot(xyFactors1, d3d4d5));\ncoeff1 = clamp(coeff1, 0.0, 1.0);\nreturn vec2(coeff0, coeff1);\n}\nvec3 BRDF_Specular_GGX_Environment(const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness) {\nfloat dotNV = saturate(dot(normal, viewDir));\nvec2 brdf = integrateSpecularBRDF(dotNV, roughness);\nreturn specularColor * brdf.x + brdf.y;\n}\nvec3 BRDF_Specular_GGX_Environment_Blender_Approx(const in GeometricContext geometry,\nconst in vec3 fresnelRefl0, const in vec3 fresnelRefl90,\nconst in float roughness, const int useCoat) {\nvec3 normal = geometry.normal;\n#ifdef CLEARCOAT\nif (useCoat == 1) {\nnormal = geometry.clearcoatNormal;\n}\n#endif\nfloat dotNV = saturate(dot(normal, geometry.viewDir));\nfloat angle = acos(abs(dotNV)) / PI_HALF;\nvec2 specCoeffs = get_BRDF_SpecCoeffsBlender(angle, roughness);\nvec3 specular = specCoeffs.x * fresnelRefl0\n+ specCoeffs.y * fresnelRefl90\n* vec3(saturate(50.0 * linearToRelativeLuminance(fresnelRefl0)));\n#if defined (COMPAT_SATURATE_SPEC_ENV_BLENDER_APPROX)\nspecular = saturate(specular);\n#endif\nreturn specular;\n}\nvoid BRDF_Specular_Multiscattering_Environment(const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {\nfloat dotNV = saturate(dot(geometry.normal, geometry.viewDir));\nvec3 F = F_Schlick_RoughnessDependent(specularColor, dotNV, roughness);\nvec2 brdf = integrateSpecularBRDF(dotNV, roughness);\nvec3 FssEss = F * brdf.x + brdf.y;\nfloat Ess = brdf.x + brdf.y;\nfloat Ems = 1.0 - Ess;\nvec3 Favg = specularColor + (1.0 - specularColor) * 0.047619;\nvec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);\nsingleScatter += FssEss;\nmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit() {\nreturn 0.25;\n}\nfloat D_BlinnPhong(const in float shininess, const in float dotNH) {\nreturn RECIPROCAL_PI * (shininess * 0.5 + 1.0) * pow(dotNH, shininess);\n}\nvec3 BRDF_Specular_BlinnPhong(const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess) {\nvec3 halfDir = normalize(incidentLight.direction + geometry.viewDir);\nfloat dotNH = saturate(dot(geometry.normal, halfDir));\nfloat dotLH = saturate(dot(incidentLight.direction, halfDir));\nvec3 F = F_Schlick(specularColor, dotLH);\nfloat G = G_BlinnPhong_Implicit();\nfloat D = D_BlinnPhong(shininess, dotNH);\nreturn F * (G * D);\n}\nfloat GGXRoughnessToBlinnExponent(const in float ggxRoughness) {\nreturn (2.0 / pow2(ggxRoughness + 0.0001) - 2.0);\n}\nfloat BlinnExponentToGGXRoughness(const in float blinnExponent) {\nreturn sqrt(2.0 / (blinnExponent + 2.0));\n}\n#if defined(USE_SHEEN)\nfloat D_Charlie(float roughness, float NoH) {\nfloat invAlpha = 1.0 / roughness;\nfloat cos2h = NoH * NoH;\nfloat sin2h = max(1.0 - cos2h, 0.0078125);\nreturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\nreturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen(const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor) {\nvec3 N = geometry.normal;\nvec3 V = geometry.viewDir;\nvec3 H = normalize(V + L);\nfloat dotNH = saturate(dot(N, H));\nreturn specularColor * D_Charlie(roughness, dotNH) * V_Neubelt(dot(N, V), dot(N, L));\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\nuniform sampler2D bumpMap;\nuniform float bumpScale;\nvec2 dHdxy_fwd() {\nvec2 dSTdx = dFdx(vUv);\nvec2 dSTdy = dFdy(vUv);\nfloat Hll = bumpScale * texture2D(bumpMap, vUv).x;\nfloat dBx = bumpScale * texture2D(bumpMap, vUv + dSTdx).x - Hll;\nfloat dBy = bumpScale * texture2D(bumpMap, vUv + dSTdy).x - Hll;\nreturn vec2(dBx, dBy);\n}\nvec3 perturbNormalArb(vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection) {\nvec3 vSigmaX = vec3(dFdx(surf_pos.x), dFdx(surf_pos.y), dFdx(surf_pos.z));\nvec3 vSigmaY = vec3(dFdy(surf_pos.x), dFdy(surf_pos.y), dFdy(surf_pos.z));\nvec3 vN = surf_norm;\nvec3 R1 = cross(vSigmaY, vN);\nvec3 R2 = cross(vN, vSigmaX);\nfloat fDet = dot(vSigmaX, R1) * faceDirection;\nvec3 vGrad = sign(fDet) * (dHdxy.x * R1 + dHdxy.y * R2);\nreturn normalize(abs(fDet) * surf_norm - vGrad);\n}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\nvec4 plane;\n#pragma unroll_loop_start\nfor (int i = 0; i < UNION_CLIPPING_PLANES; i++) {\nplane = clippingPlanes[i];\nif (dot(vClipPosition, plane.xyz) > plane.w) discard;\n}\n#pragma unroll_loop_end\n#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\nbool clipped = true;\n#pragma unroll_loop_start\nfor (int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i++) {\nplane = clippingPlanes[i];\nclipped = (dot(vClipPosition, plane.xyz) > plane.w) && clipped;\n}\n#pragma unroll_loop_end\nif (clipped) discard;\n#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\nvarying vec3 vClipPosition;\nuniform vec4 clippingPlanes[NUM_CLIPPING_PLANES];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\nvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\nvClipPosition = -mvPosition.xyz;\n#endif",color_fragment:"#if defined(USE_COLOR_ALPHA)\ndiffuseColor *= vColor;\n#elif defined(USE_COLOR)\ndiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined(USE_COLOR_ALPHA)\nvarying vec4 vColor;\n#elif defined(USE_COLOR)\nvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined(USE_COLOR_ALPHA)\nvarying vec4 vColor;\n#elif defined(USE_COLOR) || defined(USE_INSTANCING_COLOR)\nvarying vec3 vColor;\n#endif",color_vertex:"#if defined(USE_COLOR_ALPHA)\nvColor = vec4(1.0);\n#elif defined(USE_COLOR) || defined(USE_INSTANCING_COLOR)\nvColor = vec3(1.0);\n#endif\n#ifdef USE_COLOR\nvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\nvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp(a, 0.0, 1.0)\n#endif\n#define whiteComplement(a) (1.0 - saturate(a))\n#define RECIPROCAL_3 0.333333333333\nfloat pow2(const in float x) { return x*x; }\nfloat pow3(const in float x) { return x*x*x; }\nfloat pow4(const in float x) { float x2 = x*x; return x2*x2; }\nfloat average(const in vec3 color) { return dot(color, vec3(0.3333)); }\nhighp float rand(const in vec2 uv) {\nconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\nhighp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, PI);\nreturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\nfloat precisionSafeLength(vec3 v) { return length(v); }\n#else\nfloat max3(vec3 v) { return max(max(v.x, v.y), v.z); }\nfloat precisionSafeLength(vec3 v) {\nfloat maxComponent = max3(abs(v));\nreturn length(v / maxComponent) * maxComponent;\n}\n#endif\nstruct IncidentLight {\nvec3 color;\nvec3 direction;\nbool visible;\n};\nstruct ReflectedLight {\nvec3 directDiffuse;\nvec3 directSpecular;\nvec3 indirectDiffuse;\nvec3 indirectSpecular;\n};\nstruct GeometricContext {\nvec3 position;\nvec3 normal;\nvec3 viewDir;\nvec3 probeNormal;\n#ifdef CLEARCOAT\nvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection(in vec3 dir, in mat4 matrix) {\nreturn normalize((matrix * vec4(dir, 0.0)).xyz);\n}\nvec3 inverseTransformDirection(in vec3 dir, in mat4 matrix) {\nreturn normalize((vec4(dir, 0.0) * matrix).xyz);\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\nfloat distance = dot(planeNormal, point - pointOnPlane);\nreturn - distance * planeNormal + point;\n}\nfloat sideOfPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal) {\nreturn sign(dot(point - pointOnPlane, planeNormal));\n}\nvec3 linePlaneIntersect(in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal) {\nreturn lineDirection * (dot(planeNormal, pointOnPlane - pointOnLine) / dot(planeNormal, lineDirection)) + pointOnLine;\n}\nmat3 transposeMat3(const in mat3 m) {\nmat3 tmp;\ntmp[0] = vec3(m[0].x, m[1].x, m[2].x);\ntmp[1] = vec3(m[0].y, m[1].y, m[2].y);\ntmp[2] = vec3(m[0].z, m[1].z, m[2].z);\nreturn tmp;\n}\nfloat linearToRelativeLuminance(const in vec3 color) {\nvec3 weights = vec3(0.2126, 0.7152, 0.0722);\nreturn dot(weights, color.rgb);\n}\nbool isPerspectiveMatrix(mat4 m) {\nreturn m[2][3] == - 1.0;\n}\nvec2 equirectUv(in vec3 dir) {\nfloat u = atan(dir.z, dir.x) * RECIPROCAL_PI2 + 0.5;\nfloat v = asin(clamp(dir.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\nreturn vec2(u, v);\n}\nfloat smootherstep(float edge0, float edge1, float x) {\nfloat t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\nreturn t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n}\nhighp vec3 rand3(const in vec3 v) {\nconst highp float c = 43758.5453;\nconst highp mat3 coeffs = mat3(\n165.15, 253.34, 323.22,\n241.49, 329.07, 147.79,\n376.31, 143.45, 281.63\n);\nhighp vec3 sn = mod(coeffs * v, PI);\nreturn fract(sin(sn) * c);\n}\nfloat powCompat(const in float val, const in float power) {\nif (power == 0.0)\nreturn 1.0;\nelse if (val < 0.0) {\nif (mod(-power, 2.0) == 0.0)\nreturn pow(abs(val), power);\nelse\nreturn -pow(abs(val), power);\n} else if (val == 0.0)\nreturn 0.0;\nreturn pow(abs(val), power);\n}\nfloat maxFromRGB(vec3 rgb) {\nreturn max(max(rgb.r, rgb.g), rgb.b);\n}\nbool isOrtho(const in mat4 m) {\nif (m[3][3] != 0.0)\nreturn true;\nelse\nreturn false;\n}\nvec3 swizzleUpZ(const vec3 vec) {\nreturn vec3(vec[0], -vec[2], vec[1]);\n}\nvec3 swizzleUpY(const vec3 vec) {\nreturn vec3(vec[0], vec[2], -vec[1]);\n}\nvec3 xyz_to_sRGB(vec3 xyz) {\nmat3 convMat = mat3(\n3.2406, -0.9689, 0.0557,\n-1.5372, 1.8758, -0.2040,\n-0.4986, 0.0415, 1.0570\n);\nreturn convMat * xyz;\n}\nvec3 xyY_to_XYZ(float x, float y, float Y) {\nfloat X = 0.0;\nfloat Z = 0.0;\nif (y != 0.0) {\nX = (Y / y) * x;\nZ = (Y / y) * (1.0 - x - y);\n}\nreturn vec3(X, Y, Z);\n}\nvec3 octUVToCubeVec(vec2 octUV, vec2 texelSize) {\noctUV = (1.0 + 2.0 * texelSize) * octUV - texelSize;\noctUV = octUV * 2.0 - 1.0;\nfloat x = octUV.x;\nfloat z = -octUV.y;\nfloat absX = abs(x);\nfloat absZ = abs(z);\nvec3 cubeVec = vec3(x, 1.0 - absX - absZ, z);\nif (absX + absZ > 1.0) {\ncubeVec.xz = -(vec2(absZ, absX) - 1.0) * sign(vec2(x, z));\n}\nreturn cubeVec;\n}\nvec2 cubeVecToOctUV(vec3 cubeVec, vec2 texelSize) {\ncubeVec /= dot(vec3(1.0), abs(cubeVec));\nvec2 octUV = vec2(cubeVec.x, -cubeVec.z);\nif (cubeVec.y < 0.0) {\noctUV = sign(octUV) * (1.0 - abs(octUV.ts));\n}\noctUV = (octUV + 1.0) / 2.0;\noctUV = (1.0 - 2.0 * texelSize) * octUV + texelSize;\nreturn octUV;\n}\n#if __VERSION__ == 100\nfloat cosh(float x) {\nreturn (exp(x) + exp(-x)) / 2.0;\n}\nvec2 cosh(vec2 x) {\nreturn (exp(x) + exp(-x)) / 2.0;\n}\nvec3 cosh(vec3 x) {\nreturn (exp(x) + exp(-x)) / 2.0;\n}\nvec4 cosh(vec4 x) {\nreturn (exp(x) + exp(-x)) / 2.0;\n}\nfloat sinh(float x) {\nreturn (exp(x) - exp(-x)) / 2.0;\n}\nvec2 sinh(vec2 x) {\nreturn (exp(x) - exp(-x)) / 2.0;\n}\nvec3 sinh(vec3 x) {\nreturn (exp(x) - exp(-x)) / 2.0;\n}\nvec4 sinh(vec4 x) {\nreturn (exp(x) - exp(-x)) / 2.0;\n}\nfloat tanh(float x) {\nfloat exp2x = exp(2.0 * x);\nreturn (exp2x - 1.0) / (exp2x + 1.0);\n}\nvec2 tanh(vec2 x) {\nvec2 exp2x = exp(2.0 * x);\nreturn (exp2x - 1.0) / (exp2x + 1.0);\n}\nvec3 tanh(vec3 x) {\nvec3 exp2x = exp(2.0 * x);\nreturn (exp2x - 1.0) / (exp2x + 1.0);\n}\nvec4 tanh(vec4 x) {\nvec4 exp2x = exp(2.0 * x);\nreturn (exp2x - 1.0) / (exp2x + 1.0);\n}\nfloat trunc(float x) {\nreturn floor(abs(x)) * sign(x);\n}\nvec2 trunc(vec2 x) {\nreturn floor(abs(x)) * sign(x);\n}\nvec3 trunc(vec3 x) {\nreturn floor(abs(x)) * sign(x);\n}\nvec4 trunc(vec4 x) {\nreturn floor(abs(x)) * sign(x);\n}\n#endif\nfloat getSmoothFactor(float a, float b, float smoothness) {\nreturn max(smoothness - abs(a - b), 0.0) / smoothness;\n}\nfloat smoothMin(float a, float b, float smoothness) {\nfloat smoothFac = getSmoothFactor(a, b, smoothness);\nreturn min(a, b) - smoothFac * smoothFac * smoothFac * smoothness * (1.0 / 6.0);\n}\nfloat smoothMax(float a, float b, float smoothness) {\nfloat smoothFac = getSmoothFactor(a, b, smoothness);\nreturn max(a, b) + smoothFac * smoothFac * smoothFac * smoothness * (1.0 / 6.0);\n}\nvec3 vec3RotateAxisAngle(vec3 vector, vec3 axis, float angle) {\nvec3 axisNorm = normalize(axis);\nfloat x = axisNorm.x, y = axisNorm.y, z = axisNorm.z;\nfloat s = sin(angle), c = cos(angle);\nreturn mat3(\nx * x * (1.0 - c) + c, x * y * (1.0 - c) + z * s, x * z * (1.0 - c) - y * s,\nx * y * (1.0 - c) - z * s, y * y * (1.0 - c) + c, y * z * (1.0 - c) + x * s,\nx * z * (1.0 - c) + y * s, y * z * (1.0 - c) - x * s, z * z * (1.0 - c) + c\n) * vector;\n}\nmat3 mat3RotateX(float angle) {\nfloat s = sin(angle), c = cos(angle);\nreturn mat3(1.0, 0.0, 0.0,\n0.0, c, s,\n0.0, -s, c);\n}\nmat3 mat3RotateY(float angle) {\nfloat s = sin(angle), c = cos(angle);\nreturn mat3(c, 0.0, -s,\n0.0, 1.0, 0.0,\ns, 0.0, c);\n}\nmat3 mat3RotateZ(float angle) {\nfloat s = sin(angle), c = cos(angle);\nreturn mat3(c, s, 0.0,\n-s, c, 0.0,\n0.0, 0.0, 1.0);\n}\nvec3 vec3RotateXAngle(vec3 vector, float angle) {\nreturn mat3RotateX(angle) * vector;\n}\nvec3 vec3RotateYAngle(vec3 vector, float angle) {\nreturn mat3RotateY(angle) * vector;\n}\nvec3 vec3RotateZAngle(vec3 vector, float angle) {\nreturn mat3RotateZ(angle) * vector;\n}\nvec4 eulerToAxisAngle(vec3 euler) {\nfloat c1 = cos(euler.x / 2.0), c2 = cos(euler.y / 2.0), c3 = cos(euler.z / 2.0);\nfloat s1 = sin(euler.x / 2.0), s2 = sin(euler.y / 2.0), s3 = sin(euler.z / 2.0);\nvec4 axisAngle = vec4(\ns1 * c2 * c3 - c1 * s2 * s3,\nc1 * s2 * c3 + s1 * c2 * s3,\nc1 * c2 * s3 - s1 * s2 * c3,\n2.0 * acos(c1 * c2 * c3 + s1 * s2 * s3)\n);\naxisAngle.xyz = length(axisAngle.xyz) > 0.0 ? normalize(axisAngle.xyz) : vec3(1.0, 0.0, 0.0);\nreturn axisAngle;\n}\nfloat mat3GetDeterminant(mat3 mat) {\nreturn mat[0][0] * mat[1][1] * mat[2][2]\n+ mat[0][2] * mat[1][0] * mat[2][1]\n+ mat[0][1] * mat[1][2] * mat[2][0]\n- mat[0][2] * mat[1][1] * mat[2][0]\n- mat[0][0] * mat[1][2] * mat[2][1]\n- mat[0][1] * mat[1][0] * mat[2][2];\n}\nmat3 mat3GetInverseTransposed(mat3 mat) {\nfloat det = mat3GetDeterminant(mat);\nfloat a00 = (mat[1][1] * mat[2][2] - mat[1][2] * mat[2][1]) / det;\nfloat a01 = - (mat[1][0] * mat[2][2] - mat[1][2] * mat[2][0]) / det;\nfloat a02 = (mat[1][0] * mat[2][1] - mat[1][1] * mat[2][0]) / det;\nfloat a10 = - (mat[0][1] * mat[2][2] - mat[0][2] * mat[2][1]) / det;\nfloat a11 = (mat[0][0] * mat[2][2] - mat[0][2] * mat[2][0]) / det;\nfloat a12 = - (mat[0][0] * mat[2][1] - mat[0][1] * mat[2][0]) / det;\nfloat a20 = (mat[0][1] * mat[1][2] - mat[0][2] * mat[1][1]) / det;\nfloat a21 = - (mat[0][0] * mat[1][2] - mat[0][2] * mat[1][0]) / det;\nfloat a22 = (mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0]) / det;\nreturn mat3(\na00, a01, a02,\na10, a11, a12,\na20, a21, a22\n);\n}\nmat3 toMat3(mat4 mat) {\nreturn mat3(mat[0][0], mat[0][1], mat[0][2],\nmat[1][0], mat[1][1], mat[1][2],\nmat[2][0], mat[2][1], mat[2][2]);\n}\nmat4 toMat4(mat3 mat) {\nreturn mat4(mat[0][0], mat[0][1], mat[0][2], 0.0,\nmat[1][0], mat[1][1], mat[1][2], 0.0,\nmat[2][0], mat[2][1], mat[2][2], 0.0,\n0.0, 0.0, 0.0, 1.0);\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\nfloat getFace(vec3 direction) {\nvec3 absDirection = abs(direction);\nfloat face = -1.0;\nif (absDirection.x > absDirection.z) {\nif (absDirection.x > absDirection.y) {\nface = direction.x > 0.0 ? 0.0 : 3.0;\n} else {\nface = direction.y > 0.0 ? 1.0 : 4.0;\n}\n} else {\nif (absDirection.z > absDirection.y) {\nface = direction.z > 0.0 ? 2.0 : 5.0;\n} else {\nface = direction.y > 0.0 ? 1.0 : 4.0;\n}\n}\nreturn face;\n}\nvec2 getUV(vec3 direction, float face) {\nvec2 uv;\nif (face == 0.0) {\nuv = vec2(-direction.z, direction.y) / abs(direction.x);\n} else if (face == 1.0) {\nuv = vec2(direction.x, -direction.z) / abs(direction.y);\n} else if (face == 2.0) {\nuv = direction.xy / abs(direction.z);\n} else if (face == 3.0) {\nuv = vec2(direction.z, direction.y) / abs(direction.x);\n} else if (face == 4.0) {\nuv = direction.xz / abs(direction.y);\n} else {\nuv = vec2(-direction.x, direction.y) / abs(direction.z);\n}\nreturn 0.5 * (uv + 1.0);\n}\n#ifndef cubeUV_maxTileSize\n#define cubeUV_maxTileSize 256.0\n#endif\n#define cubeUV_lodIdxMin 0.0\n#define cubeUV_lodIdxLastDownscaled 4.0\n#define cubeUV_lodIdxMax 10.0\n#define cubeUV_minTileSize (cubeUV_maxTileSize / exp2(cubeUV_lodIdxLastDownscaled))\nfloat getLodTileSize(float lodIdx) {\nreturn cubeUV_maxTileSize / exp2(min(lodIdx, cubeUV_lodIdxLastDownscaled));\n}\nfloat getLodFilterLevel(float lodIdx) {\nreturn max(lodIdx - cubeUV_lodIdxLastDownscaled, 0.0);\n}\nvec2 fixCubeUVSeams(vec2 uv, float faceSize) {\nfloat BORDER_WIDTH_PX = max(cubeUV_maxTileSize / 256.0 - 1.0, 0.0);\nfloat scale = (faceSize - BORDER_WIDTH_PX) / faceSize;\nfloat offset = 0.5 * BORDER_WIDTH_PX / faceSize;\nreturn uv * scale + offset;\n}\nvec2 getUVPixels(vec3 direction, float lodIdx) {\nfloat face = getFace(direction);\nfloat faceSize = getLodTileSize(lodIdx);\nfloat filterLevel = getLodFilterLevel(lodIdx);\nvec2 uv = getUV(direction, face);\nuv = fixCubeUVSeams(uv, faceSize);\nuv *= (faceSize - 1.0);\nif (face > 2.0) {\nuv.y += faceSize;\nface -= 3.0;\n}\nuv.x += face * faceSize;\nif (lodIdx > 0.0) {\nuv.y += 2.0 * cubeUV_maxTileSize;\n}\nuv.y += filterLevel * 2.0 * cubeUV_minTileSize;\nuv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\nreturn uv;\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float lodIdx) {\nfloat texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\nvec2 uv = getUVPixels(direction, lodIdx);\nvec2 f = fract(uv);\nuv += 0.5 - f;\nuv *= texelSize;\nvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\nuv.x += texelSize;\nvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\nuv.y += texelSize;\nvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\nuv.x -= texelSize;\nvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\nvec3 tm = mix(tl, tr, f.x);\nvec3 bm = mix(bl, br, f.x);\nreturn mix(tm, bm, f.y);\n}\nvec3 sampleCubeUV(sampler2D envMap, vec3 direction, float lodIdx) {\nfloat texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\nvec2 uv = getUVPixels(direction, lodIdx);\nuv += 0.5;\nuv *= texelSize;\nreturn envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n}\n#define cubeUV_r0 1.0\n#define cubeUV_v0 0.339\n#define cubeUV_m0 -2.0\n#define cubeUV_r1 0.8\n#define cubeUV_v1 0.276\n#define cubeUV_m1 -1.0\n#define cubeUV_r4 0.4\n#define cubeUV_v4 0.046\n#define cubeUV_m4 2.0\n#define cubeUV_r5 0.305\n#define cubeUV_v5 0.016\n#define cubeUV_m5 3.0\n#define cubeUV_r6 0.21\n#define cubeUV_v6 0.0038\n#define cubeUV_m6 4.0\nfloat roughnessToMip(float roughness) {\nfloat r = roughness;\nfloat r2 = r * r;\nfloat r3 = r2 * r;\nroughness = -1.20278049 * r3 + 1.86860137 * r2 + 0.32478081 * r + 0.0098139;\nreturn roughness * (cubeUV_lodIdxMax - cubeUV_lodIdxMin);\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\nfloat lodIdx = clamp(roughnessToMip(roughness), cubeUV_lodIdxMin,\ncubeUV_lodIdxMax);\nfloat lodIdxF = fract(lodIdx);\nfloat lodIdxI = floor(lodIdx);\nvec3 color0 = sampleCubeUV(envMap, sampleDir, lodIdxI);\nif (lodIdxF == 0.0) {\nreturn vec4(color0, 1.0);\n} else {\nvec3 color1 = sampleCubeUV(envMap, sampleDir, lodIdxI + 1.0);\nreturn vec4(mix(color0, color1, lodIdxF), 1.0);\n}\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\nmat3 m = mat3(instanceMatrix);\ntransformedNormal /= vec3(dot(m[0], m[0]), dot(m[1], m[1]), dot(m[2], m[2]));\ntransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\ntransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\nvec3 transformedTangent = (modelViewMatrix * vec4(objectTangent, 0.0)).xyz;\n#ifdef FLIP_SIDED\ntransformedTangent = - transformedTangent;\n#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\nuniform sampler2D displacementMap;\nuniform float displacementScale;\nuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\ntransformed += normalize(objectNormal) * (texture2D(displacementMap, vUv).x * displacementScale + displacementBias);\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\nvec4 emissiveColor = texture2D(emissiveMap, vUv);\nemissiveColor.rgb = emissiveMapTexelToLinear(emissiveColor).rgb;\ntotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\nuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel(gl_FragColor);",encodings_pars_fragment:"\nvec4 LinearToLinear(in vec4 value) {\nreturn value;\n}\nvec4 GammaToLinear(in vec4 value, in float gammaFactor) {\nvalue = max(value, vec4(0.0));\nreturn vec4(pow(value.rgb, vec3(gammaFactor)), value.a);\n}\nvec4 LinearToGamma(in vec4 value, in float gammaFactor) {\nvalue = max(value, vec4(0.0));\nreturn vec4(pow(value.rgb, vec3(1.0 / gammaFactor)), value.a);\n}\nvec4 sRGBToLinear(in vec4 value) {\n#ifdef COMPAT_SIMPLIFIED_SRGB\nreturn vec4(pow(value.rgb, vec3(2.2)), value.a);\n#else\nvalue = max(value, vec4(0.0));\nreturn 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);\n#endif\n}\nvec4 LinearTosRGB(in vec4 value) {\n#ifdef COMPAT_SIMPLIFIED_SRGB\nreturn vec4(pow(value.rgb, vec3(1.0/2.2)), value.a);\n#else\nvalue = max(value, vec4(0.0));\nreturn 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);\n#endif\n}\nvec4 RGBEToLinear(in vec4 value) {\nreturn vec4(value.rgb * exp2(value.a * 255.0 - 128.0), 1.0);\n}\nvec4 LinearToRGBE(in vec4 value) {\nfloat maxComponent = max(max(value.r, value.g), value.b);\nfloat fExp = clamp(ceil(log2(maxComponent)), -128.0, 127.0);\nreturn vec4(value.rgb / exp2(fExp), (fExp + 128.0) / 255.0);\n}\nvec4 RGBMToLinear(in vec4 value, in float maxRange) {\nreturn vec4(value.rgb * value.a * maxRange, 1.0);\n}\nvec4 LinearToRGBM(in vec4 value, in float maxRange) {\nfloat maxRGB = max(value.r, max(value.g, value.b));\nfloat M = clamp(maxRGB / maxRange, 0.0, 1.0);\nM = ceil(M * 255.0) / 255.0;\nreturn vec4(value.rgb / (M * maxRange), M);\n}\nvec4 RGBDToLinear(in vec4 value, in float maxRange) {\nreturn vec4(value.rgb * ((maxRange / 255.0) / value.a), 1.0);\n}\nvec4 LinearToRGBD(in vec4 value, in float maxRange) {\nfloat maxRGB = max(value.r, max(value.g, value.b));\nfloat D = max(maxRange / maxRGB, 1.0);\nD = clamp(floor(D) / 255.0, 0.0, 1.0);\nreturn vec4(value.rgb * (D * (255.0 / maxRange)), D);\n}\nconst mat3 cLogLuvM = mat3(0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969);\nvec4 LinearToLogLuv(in vec4 value) {\nvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\nXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\nvec4 vResult;\nvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\nfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\nvResult.w = fract(Le);\nvResult.z = (Le - (floor(vResult.w * 255.0)) / 255.0) / 255.0;\nreturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3(6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268);\nvec4 LogLuvToLinear(in vec4 value) {\nfloat Le = value.z * 255.0 + value.w;\nvec3 Xp_Y_XYZp;\nXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\nXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\nXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\nvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\nreturn vec4(max(vRGB, 0.0), 1.0);\n}",envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef ENV_WORLDPOS\nvec3 cameraToFrag;\nif (isOrthographic) {\ncameraToFrag = normalize(vec3(- viewMatrix[0][2], - viewMatrix[1][2], - viewMatrix[2][2]));\n} else {\ncameraToFrag = normalize(vWorldPosition - cameraPosition);\n}\nvec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\n#ifdef ENVMAP_MODE_REFLECTION\nvec3 reflectVec = reflect(cameraToFrag, worldNormal);\n#else\nvec3 reflectVec = refract(cameraToFrag, worldNormal, refractionRatio);\n#endif\n#else\nvec3 reflectVec = vReflect;\n#endif\n#ifdef ENVMAP_TYPE_CUBE\nvec4 envColor = textureCube(envMap, vec3(flipEnvMap * reflectVec.x, reflectVec.yz));\n#elif defined(ENVMAP_TYPE_CUBE_UV)\nvec4 envColor = textureCubeUV(envMap, reflectVec, 0.0);\n#elif defined(ENVMAP_TYPE_EQUIREC)\nvec2 sampleUV;\nreflectVec = normalize(reflectVec);\nsampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\nsampleUV.x = atan(reflectVec.z, reflectVec.x) * RECIPROCAL_PI2 + 0.5;\nvec4 envColor = texture2D(envMap, sampleUV);\n#else\nvec4 envColor = vec4(0.0);\n#endif\n#ifndef ENVMAP_TYPE_CUBE_UV\nenvColor = envMapTexelToLinear(envColor);\n#endif\n#ifdef ENVMAP_BLENDING_MULTIPLY\noutgoingLight = mix(outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity);\n#elif defined(ENVMAP_BLENDING_MIX)\noutgoingLight = mix(outgoingLight, envColor.xyz, specularStrength * reflectivity);\n#elif defined(ENVMAP_BLENDING_ADD)\noutgoingLight += envColor.xyz * specularStrength * reflectivity;\n#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\nuniform float envMapIntensity;\nuniform float flipEnvMap;\nuniform int maxMipLevel;\n#ifdef ENVMAP_TYPE_CUBE\nuniform samplerCube envMap;\n#else\nuniform sampler2D envMap;\n#endif\n#if defined(ENVMAP_TYPE_CUBE) && defined(NODE) || defined(ENVMAP_TYPE_CUBE_UV)\nfloat calcGeometryRoughness(vec3 geometryNormal) {\nvec3 dxy = max(abs(dFdx(geometryNormal)), abs(dFdy(geometryNormal)));\nreturn max(max(dxy.x, dxy.y), dxy.z);\n}\nfloat calcCubeUVAdjustedRoughness(float origRoughness, float geomRoughness) {\nreturn min(max(origRoughness, 0.0525) + geomRoughness, 1.0);\n}\n#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\n#if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) || defined(PHONG)\n#define ENV_WORLDPOS\n#endif\n#ifdef ENV_WORLDPOS\nvarying vec3 vWorldPosition;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n#if defined(USE_BUMPMAP) || defined(USE_NORMALMAP) ||defined(PHONG)\n#define ENV_WORLDPOS\n#endif\n#ifdef ENV_WORLDPOS\n\nvarying vec3 vWorldPosition;\n#else\nvarying vec3 vReflect;\nuniform float refractionRatio;\n#endif\n#endif",envmap_physical_pars_fragment:"#if defined(USE_ENVMAP)\n#define ENVMAP_PARALLAX_INFINITE 0\n#define ENVMAP_PARALLAX_SPHERE 1\n#define ENVMAP_PARALLAX_BOX 2\n#ifdef ENVMAP_MODE_REFRACTION\nuniform float refractionRatio;\n#endif\nuniform int envMapParallaxType;\nuniform mat4 envMapParallaxMatrix;\nuniform mat4 envMapParallaxMatrixInv;\nvec3 correctParallax(vec3 directionVecWorld, vec3 posWorld, int parallaxType) {\nvec3 posProbe = (envMapParallaxMatrix * vec4(posWorld, 1.0)).xyz;\nvec3 reflectVecProbe = transformDirection(directionVecWorld, envMapParallaxMatrix);\nif (parallaxType == ENVMAP_PARALLAX_SPHERE) {\nfloat b = 2.0 * dot(reflectVecProbe, posProbe);\nfloat c = dot(posProbe, posProbe) - 1.0;\nfloat D = b * b - 4.0 * c;\nif (D >= 0.0) {\nfloat x = (sqrt(D) - b) / 2.0;\nreflectVecProbe = posProbe + x * reflectVecProbe;\n}\n} else if (parallaxType == ENVMAP_PARALLAX_BOX) {\nvec3 scalePos = (vec3(1.0) - posProbe) / reflectVecProbe;\nvec3 scaleNeg = (vec3(-1.0) - posProbe) / reflectVecProbe;\nvec3 scalePosNeg = mix(scaleNeg, scalePos, step(vec3(0.0), reflectVecProbe));\nfloat x = min(scalePosNeg.x, min(scalePosNeg.y, scalePosNeg.z));\nreflectVecProbe = posProbe + x * reflectVecProbe;\n}\nvec3 directionVecWorldCorrected = transformDirection(reflectVecProbe,\nenvMapParallaxMatrixInv);\nreturn directionVecWorldCorrected;\n}\nvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel) {\nvec3 worldNormal = inverseTransformDirection(geometry.probeNormal, viewMatrix);\n#ifdef ENVMAP_TYPE_CUBE\nvec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\n#ifdef TEXTURE_LOD_EXT\nvec4 envMapColor = textureCubeLodEXT(envMap, queryVec, float(maxMIPLevel));\n#else\nvec4 envMapColor = textureCube(envMap, queryVec, float(maxMIPLevel));\n#endif\nenvMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n#elif defined(ENVMAP_TYPE_CUBE_UV)\nvec3 queryVec = vec3(flipEnvMap * worldNormal.x, worldNormal.yz);\nvec4 envMapColor = textureCubeUV(envMap, queryVec, 1.0);\n#else\nvec4 envMapColor = vec4(0.0);\n#endif\nreturn PI * envMapColor.rgb * envMapIntensity;\n}\nfloat getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {\nfloat maxMIPLevelScalar = float(maxMIPLevel);\nfloat clapmedBlinnShininessExponent = min(blinnShininessExponent, 30000.0);\nfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248\n- 0.5 * log2(pow2(clapmedBlinnShininessExponent) + 1.0);\nreturn clamp(desiredMIPLevel, 0.0, maxMIPLevelScalar);\n}\nvec3 _getLightProbeIndirect(const float blinnShininessExponent,\nconst int maxMIPLevel, vec3 directionVec) {\nfloat specularMIPLevel = getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);\n#ifdef ENVMAP_TYPE_CUBE\nvec3 queryVec = vec3(flipEnvMap * directionVec.x, directionVec.yz);\n#ifdef TEXTURE_LOD_EXT\nvec4 envMapColor = textureCubeLodEXT(envMap, queryVec, specularMIPLevel);\n#else\nvec4 envMapColor = textureCube(envMap, queryVec, specularMIPLevel);\n#endif\nenvMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n#elif defined(ENVMAP_TYPE_CUBE_UV)\nvec3 queryVec = vec3(flipEnvMap * directionVec.x, directionVec.yz);\nvec4 envMapColor = textureCubeUV(envMap, queryVec,\nBlinnExponentToGGXRoughness(blinnShininessExponent));\n#elif defined(ENVMAP_TYPE_EQUIREC)\nvec2 sampleUV;\nsampleUV.y = asin(clamp(directionVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\nsampleUV.x = atan(directionVec.z, directionVec.x) * RECIPROCAL_PI2 + 0.5;\n#ifdef TEXTURE_LOD_EXT\nvec4 envMapColor = texture2DLodEXT(envMap, sampleUV, specularMIPLevel);\n#else\nvec4 envMapColor = texture2D(envMap, sampleUV, specularMIPLevel);\n#endif\nenvMapColor.rgb = envMapTexelToLinear(envMapColor).rgb;\n#endif\nreturn envMapColor.rgb * envMapIntensity;\n}\nvec3 getLightProbeIndirectRadiance(\nconst GeometricContext geometry, const float blinnShininessExponent,\nconst int maxMIPLevel, const int useCoat) {\nvec3 normal = geometry.normal;\n#ifdef CLEARCOAT\nif (useCoat == 1) {\nnormal = geometry.clearcoatNormal;\n}\n#endif\n#ifdef ENVMAP_MODE_REFLECTION\nvec3 directionVec = reflect(-geometry.viewDir, normal);\n#else\nvec3 directionVec = refract(-geometry.viewDir, normal, refractionRatio);\n#endif\ndirectionVec = inverseTransformDirection(directionVec, viewMatrix);\nvec3 posWorld = (invViewMatrix * vec4(geometry.position, 1.0)).xyz;\nif (envMapParallaxType != ENVMAP_PARALLAX_INFINITE) {\ndirectionVec = correctParallax(directionVec, posWorld, envMapParallaxType);\n}\nreturn _getLightProbeIndirect(blinnShininessExponent, maxMIPLevel,\ndirectionVec);\n}\nvec3 getLightProbeIndirectRefraction(\nconst GeometricContext geometry, const float blinnShininessExponent,\nconst int maxMIPLevel, const float refrRatio) {\nvec3 directionVec = refract(-geometry.viewDir, geometry.normal, refrRatio);\ndirectionVec = inverseTransformDirection(directionVec, viewMatrix);\nvec3 posWorld = (invViewMatrix * vec4(geometry.position, 1.0)).xyz;\nif (envMapParallaxType != ENVMAP_PARALLAX_INFINITE) {\ndirectionVec = correctParallax(directionVec, posWorld, envMapParallaxType);\n}\nreturn _getLightProbeIndirect(blinnShininessExponent, maxMIPLevel,\ndirectionVec);\n}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n#ifdef ENV_WORLDPOS\nvWorldPosition = worldPosition.xyz;\n#else\nvec3 cameraToVertex;\nif (isOrthographic) {\ncameraToVertex = normalize(vec3(- viewMatrix[0][2], - viewMatrix[1][2], - viewMatrix[2][2]));\n} else {\ncameraToVertex = normalize(worldPosition.xyz - cameraPosition);\n}\nvec3 worldNormal = inverseTransformDirection(transformedNormal, viewMatrix);\n#ifdef ENVMAP_MODE_REFLECTION\nvReflect = reflect(cameraToVertex, worldNormal);\n#else\nvReflect = refract(cameraToVertex, worldNormal, refractionRatio);\n#endif\n#endif\n#endif",fog_vertex:"#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\nvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n#ifdef FOG_EXP2\nfloat fogFactor = 1.0 - exp(- fogDensity * fogDensity * fogDepth * fogDepth);\n#else\nfloat fogFactor = smoothstep(fogNear, fogFar, fogDepth);\n#endif\ngl_FragColor.rgb = mix(gl_FragColor.rgb, fogColor, fogFactor);\n#endif",fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\nvarying float fogDepth;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\nuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance(vec3 normal, vec3 lightDirection) {\nfloat dotNL = dot(normal, lightDirection);\nvec2 coord = vec2(dotNL * 0.5 + 0.5, 0.0);\n#ifdef USE_GRADIENTMAP\nreturn texture2D(gradientMap, coord).rgb;\n#else\nreturn (coord.x < 0.7) ? vec3(0.7) : vec3(1.0);\n#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\nvec4 lightMapTexel= texture2D(lightMap, vUv2);\nreflectedLight.indirectDiffuse += PI * lightMapTexelToLinear(lightMapTexel).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nuniform sampler2D lightMap;\nuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3(1.0);\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.probeNormal = geometry.normal = normalize(transformedNormal);\ngeometry.viewDir = (isOrthographic) ? vec3(0, 0, 1) : normalize(-mvPosition.xyz);\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.probeNormal = backGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3(0.0);\nvIndirectFront = vec3(0.0);\n#ifdef DOUBLE_SIDED\nvLightBack = vec3(0.0);\nvIndirectBack = vec3(0.0);\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance(ambientLightColor);\nvIndirectFront += getLightProbeIrradiance(lightProbe, geometry);\n#ifdef DOUBLE_SIDED\nvIndirectBack += getAmbientLightIrradiance(ambientLightColor);\nvIndirectBack += getLightProbeIrradiance(lightProbe, backGeometry);\n#endif\n#if NUM_POINT_LIGHTS > 0\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_POINT_LIGHTS; i++) {\ngetPointDirectLightIrradiance(pointLights[i], geometry, directLight);\ndotNL = dot(geometry.normal, directLight.direction);\ndirectLightColor_Diffuse = PI * directLight.color;\nvLightFront += saturate(dotNL) * directLightColor_Diffuse;\n#ifdef DOUBLE_SIDED\nvLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n#endif\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\ngetSpotDirectLightIrradiance(spotLights[i], geometry, directLight);\ndotNL = dot(geometry.normal, directLight.direction);\ndirectLightColor_Diffuse = PI * directLight.color;\nvLightFront += saturate(dotNL) * directLightColor_Diffuse;\n#ifdef DOUBLE_SIDED\nvLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n#endif\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_DIR_LIGHTS; i++) {\ngetDirectionalDirectLightIrradiance(directionalLights[i], geometry, directLight);\ndotNL = dot(geometry.normal, directLight.direction);\ndirectLightColor_Diffuse = PI * directLight.color;\nvLightFront += saturate(dotNL) * directLightColor_Diffuse;\n#ifdef DOUBLE_SIDED\nvLightBack += saturate(-dotNL) * directLightColor_Diffuse;\n#endif\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_HEMI_LIGHTS; i++) {\nvIndirectFront += getHemisphereLightIrradiance(hemisphereLights[i], geometry);\n#ifdef DOUBLE_SIDED\nvIndirectBack += getHemisphereLightIrradiance(hemisphereLights[i], backGeometry);\n#endif\n}\n#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[9];\nvec3 shGetIrradianceAt(in vec3 normal, in vec3 shCoefficients[9]) {\nfloat x = normal.x, y = normal.y, z = normal.z;\nvec3 result = shCoefficients[0] * 0.886227;\nresult += shCoefficients[1] * 2.0 * 0.511664 * y;\nresult += shCoefficients[2] * 2.0 * 0.511664 * z;\nresult += shCoefficients[3] * 2.0 * 0.511664 * x;\nresult += shCoefficients[4] * 2.0 * 0.429043 * x * y;\nresult += shCoefficients[5] * 2.0 * 0.429043 * y * z;\nresult += shCoefficients[6] * (0.743125 * z * z - 0.247708);\nresult += shCoefficients[7] * 2.0 * 0.429043 * x * z;\nresult += shCoefficients[8] * 0.429043 * (x * x - y * y);\nreturn result;\n}\nvec3 getLightProbeIrradiance(const in vec3 lightProbe[9], const in GeometricContext geometry) {\nvec3 worldNormal = inverseTransformDirection(geometry.probeNormal, viewMatrix);\nvec3 irradiance = shGetIrradianceAt(worldNormal, lightProbe);\nreturn irradiance;\n}\nvec3 getAmbientLightIrradiance(const in vec3 ambientLightColor) {\nvec3 irradiance = ambientLightColor;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nirradiance *= PI;\n#endif\nreturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\nstruct DirectionalLight {\nvec3 direction;\nvec3 color;\n};\nuniform DirectionalLight directionalLights[NUM_DIR_LIGHTS];\nvoid getDirectionalDirectLightIrradiance(const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight) {\ndirectLight.color = directionalLight.color;\ndirectLight.direction = directionalLight.direction;\ndirectLight.visible = true;\n}\n#endif\n#if NUM_POINT_LIGHTS > 0\nstruct PointLight {\nvec3 position;\nvec3 color;\nfloat distance;\nfloat decay;\n};\nuniform PointLight pointLights[NUM_POINT_LIGHTS];\nvoid getPointDirectLightIrradiance(const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight) {\nvec3 lVector = pointLight.position - geometry.position;\ndirectLight.direction = normalize(lVector);\nfloat lightDistance = length(lVector);\ndirectLight.color = pointLight.color;\ndirectLight.color *= punctualLightIntensityToIrradianceFactor(lightDistance, pointLight.distance, pointLight.decay);\ndirectLight.visible = (directLight.color != vec3(0.0));\n}\n#endif\n#if NUM_SPOT_LIGHTS > 0\nstruct SpotLight {\nvec3 position;\nvec3 direction;\nvec3 color;\nfloat distance;\nfloat decay;\nfloat coneCos;\nfloat penumbraCos;\n};\nuniform SpotLight spotLights[NUM_SPOT_LIGHTS];\nvoid getSpotDirectLightIrradiance(const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight) {\nvec3 lVector = spotLight.position - geometry.position;\ndirectLight.direction = normalize(lVector);\nfloat lightDistance = length(lVector);\nfloat angleCos = dot(directLight.direction, spotLight.direction);\n#if defined(MT_MAX) && defined(PHYSICALLY_CORRECT_LIGHTS)\nfloat coneCosDecayed = 2.0 * spotLight.coneCos - spotLight.penumbraCos;\nif (angleCos > coneCosDecayed) {\nfloat spotEffect = pow(max(angleCos, 0.0), log(0.5) / log(spotLight.penumbraCos) - 1.0);\nif (angleCos < spotLight.coneCos) {\nfloat decayFac = 1.0 + (spotLight.coneCos - angleCos)\n/ (spotLight.coneCos - spotLight.penumbraCos);\nspotEffect *= pow2(decayFac) * (3.0 - 2.0 * decayFac);\n}\ndirectLight.color = spotLight.color * spotEffect\n* punctualLightIntensityToIrradianceFactor(lightDistance,\nspotLight.distance, spotLight.decay);\ndirectLight.visible = true;\n} else {\ndirectLight.color = vec3(0.0);\ndirectLight.visible = false;\n}\n#else\nif (angleCos > spotLight.coneCos) {\nfloat spotEffect = smoothstep(spotLight.coneCos, spotLight.penumbraCos, angleCos);\ndirectLight.color = spotLight.color * spotEffect\n* punctualLightIntensityToIrradianceFactor(lightDistance,\nspotLight.distance, spotLight.decay);\ndirectLight.visible = true;\n} else {\ndirectLight.color = vec3(0.0);\ndirectLight.visible = false;\n}\n#endif\n}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\nstruct RectAreaLight {\nvec3 color;\nvec3 position;\nvec3 halfWidth;\nvec3 halfHeight;\n};\nuniform sampler2D ltc_1;\nuniform sampler2D ltc_2;\nuniform RectAreaLight rectAreaLights[NUM_RECT_AREA_LIGHTS];\n#endif\n#if NUM_HEMI_LIGHTS > 0\nstruct HemisphereLight {\nvec3 direction;\nvec3 skyColor;\nvec3 groundColor;\n};\nuniform HemisphereLight hemisphereLights[NUM_HEMI_LIGHTS];\nvec3 getHemisphereLightIrradiance(const in HemisphereLight hemiLight, const in GeometricContext geometry) {\nfloat dotNL = dot(geometry.probeNormal, hemiLight.direction);\nfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\nvec3 irradiance = mix(hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight);\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nirradiance *= PI;\n#endif\nreturn irradiance;\n}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\nvec3 diffuseColor;\n};\nvoid RE_Direct_Toon(const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight) {\nvec3 irradiance = getGradientIrradiance(geometry.normal, directLight.direction) * directLight.color;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nirradiance *= PI;\n#endif\nreflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectDiffuse_Toon(const in vec3 irradiance, const in vec3 iblIrradiance,\nconst in GeometricContext geometry, const in ToonMaterial material,\ninout ReflectedLight reflectedLight) {\nreflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD(material) (0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\nvec3 diffuseColor;\nvec3 specularColor;\nfloat specularShininess;\nfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong(const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight) {\nfloat dotNL = saturate(dot(geometry.normal, directLight.direction));\nvec3 irradiance = dotNL * directLight.color;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nirradiance *= PI;\n#endif\nreflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\nreflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong(directLight, geometry, material.specularColor, material.specularShininess) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong(const in vec3 irradiance, const in vec3 iblIrradiance,\nconst in GeometricContext geometry, const in BlinnPhongMaterial material,\ninout ReflectedLight reflectedLight) {\nreflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD(material) (0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * (1.0 - metalnessFactor);\nvec3 dxy = max(abs(dFdx(geometryNormal)), abs(dFdy(geometryNormal)));\nfloat geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);\nmaterial.specularRoughness = max(roughnessFactor, 0.0525);\nmaterial.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min(material.specularRoughness, 1.0);\n#ifdef REFLECTIVITY\nmaterial.specularColor = mix(vec3(MAXIMUM_SPECULAR_COEFFICIENT * pow2(reflectivity)), diffuseColor.rgb, metalnessFactor);\n#else\nmaterial.specularColor = mix(vec3(DEFAULT_SPECULAR_COEFFICIENT), diffuseColor.rgb, metalnessFactor);\n#endif\n#ifdef CLEARCOAT\nmaterial.clearcoat = clearcoat;\nmaterial.clearcoatRoughness = clearcoatRoughness;\n#ifdef USE_CLEARCOATMAP\nmaterial.clearcoat *= texture2D(clearcoatMap, vUv).x;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\nmaterial.clearcoatRoughness *= texture2D(clearcoatRoughnessMap, vUv).y;\n#endif\nmaterial.clearcoat = saturate(material.clearcoat);\nmaterial.clearcoatRoughness = max(material.clearcoatRoughness, 0.0525);\nmaterial.clearcoatRoughness += geometryRoughness;\nmaterial.clearcoatRoughness = min(material.clearcoatRoughness, 1.0);\n#endif\n#ifdef USE_SHEEN\nmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\nvec3 diffuseColor;\nfloat specularRoughness;\nvec3 specularColor;\n#ifdef CLEARCOAT\nfloat clearcoat;\nfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\nvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox(const in float roughness, const in float dotNL) {\nreturn DEFAULT_SPECULAR_COEFFICIENT + (1.0 - DEFAULT_SPECULAR_COEFFICIENT) * (pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\nvoid RE_Direct_RectArea_Physical(const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\nvec3 normal = geometry.normal;\nvec3 viewDir = geometry.viewDir;\nvec3 position = geometry.position;\nvec3 lightPos = rectAreaLight.position;\nvec3 halfWidth = rectAreaLight.halfWidth;\nvec3 halfHeight = rectAreaLight.halfHeight;\nvec3 lightColor = rectAreaLight.color;\nfloat roughness = material.specularRoughness;\nvec3 rectCoords[4];\nrectCoords[0] = lightPos + halfWidth - halfHeight;\nrectCoords[1] = lightPos - halfWidth - halfHeight;\nrectCoords[2] = lightPos - halfWidth + halfHeight;\nrectCoords[3] = lightPos + halfWidth + halfHeight;\nvec2 uv = LTC_Uv(normal, viewDir, roughness);\nvec4 t1 = texture2D(ltc_1, uv);\nvec4 t2 = texture2D(ltc_2, uv);\nmat3 mInv = mat3(\nvec3(t1.x, 0, t1.y),\nvec3( 0, 1, 0),\nvec3(t1.z, 0, t1.w)\n);\nvec3 fresnel = (material.specularColor * t2.x + (vec3(1.0) - material.specularColor) * t2.y);\nreflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords);\nreflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords);\n}\n#endif\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\nfloat dotNL = saturate(dot(geometry.normal, directLight.direction));\nvec3 irradiance = dotNL * directLight.color;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nirradiance *= PI;\n#endif\n#ifdef CLEARCOAT\nfloat ccDotNL = saturate(dot(geometry.clearcoatNormal, directLight.direction));\nvec3 ccIrradiance = ccDotNL * directLight.color;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nccIrradiance *= PI;\n#endif\nfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox(material.clearcoatRoughness, ccDotNL);\nreflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.clearcoatNormal, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearcoatRoughness);\n#else\nfloat clearcoatDHR = 0.0;\n#endif\n#ifdef USE_SHEEN\nreflectedLight.directSpecular += (1.0 - clearcoatDHR) * irradiance * BRDF_Specular_Sheen(\nmaterial.specularRoughness,\ndirectLight.direction,\ngeometry,\nmaterial.sheenColor\n);\n#else\nreflectedLight.directSpecular += (1.0 - clearcoatDHR) * irradiance * BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n#endif\nreflectedLight.directDiffuse += (1.0 - clearcoatDHR) * irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in vec3 iblIrradiance,\nconst in GeometricContext geometry, const in PhysicalMaterial material,\ninout ReflectedLight reflectedLight) {\nreflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectSpecular_Physical(const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n#ifdef CLEARCOAT\nfloat ccDotNV = saturate(dot(geometry.clearcoatNormal, geometry.viewDir));\nreflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment(geometry.viewDir, geometry.clearcoatNormal, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearcoatRoughness);\nfloat ccDotNL = ccDotNV;\nfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox(material.clearcoatRoughness, ccDotNL);\n#else\nfloat clearcoatDHR = 0.0;\n#endif\nfloat clearcoatInv = 1.0 - clearcoatDHR;\nvec3 singleScattering = vec3(0.0);\nvec3 multiScattering = vec3(0.0);\nvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\nBRDF_Specular_Multiscattering_Environment(geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering);\nvec3 diffuse = material.diffuseColor * (1.0 - (singleScattering + multiScattering));\nreflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\nreflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\nreflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n#define Material_ClearCoat_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.clearcoatRoughness)\nfloat computeSpecularOcclusion(const in float dotNV, const in float ambientOcclusion, const in float roughness) {\nreturn saturate(pow(abs(dotNV + ambientOcclusion), exp2(- 16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = (isOrthographic) ? vec3(0, 0, 1) : normalize(vViewPosition);\n#ifdef CLEARCOAT\ngeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef PROBE_NORMAL\ngeometry.probeNormal = PROBE_NORMAL;\n#else\ngeometry.probeNormal = normal;\n#endif\nIncidentLight directLight;\n#if (NUM_POINT_LIGHTS > 0) && (defined(RE_Direct) || defined(RE_DirectDiffuse) || defined(RE_DirectSpecular))\nPointLight pointLight;\n#if defined(USE_SHADOWMAP) && NUM_POINT_LIGHT_SHADOWS > 0\nPointLightShadow pointLightShadow;\n#endif\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_POINT_LIGHTS; i++) {\npointLight = pointLights[i];\ngetPointDirectLightIrradiance(pointLight, geometry, directLight);\n#if defined(USE_SHADOWMAP) && ((i) < NUM_POINT_LIGHT_SHADOWS)\npointLightShadow = pointLightShadows[i];\ndirectLight.color *= all(bvec2(directLight.visible, receiveShadow)) ?\ngetPointShadow(pointLightShadow, pointShadowMap[i], vPointShadowCoord[i]) : 1.0;\n#endif\n#if defined(RE_Direct)\nRE_Direct(directLight, geometry, material, reflectedLight);\n#else\n#if defined(RE_DirectDiffuse)\nRE_DirectDiffuse(directLight, geometry, material, reflectedLight);\n#endif\n#if defined(RE_DirectSpecular)\nRE_DirectSpecular(directLight, geometry, material, reflectedLight);\n#endif\n#endif\n}\n#pragma unroll_loop_end\n#endif\n#if (NUM_SPOT_LIGHTS > 0) && (defined(RE_Direct) || defined(RE_DirectDiffuse) || defined(RE_DirectSpecular))\nSpotLight spotLight;\n#if defined(USE_SHADOWMAP) && NUM_SPOT_LIGHT_SHADOWS > 0\nSpotLightShadow spotLightShadow;\n#endif\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\nspotLight = spotLights[i];\ngetSpotDirectLightIrradiance(spotLight, geometry, directLight);\n#if defined(USE_SHADOWMAP) && ((i) < NUM_SPOT_LIGHT_SHADOWS)\nspotLightShadow = spotLightShadows[i];\nif (all(bvec2(directLight.visible, receiveShadow))) {\nif (spotLightShadow.shadow == 1) {\nfloat distWorld = 0.0;\n#if defined(SHADOWMAP_TYPE_ESM)\ndistWorld = length((invViewMatrix * vec4(spotLight.position\n- geometry.position, 0.0)).xyz);\n#endif\ndirectLight.color *= getSpotShadow(spotLightShadow, spotShadowMap[i],\nvSpotShadowCoord[i], distWorld);\n} else if (spotLightShadow.shadow == 2) {\ndirectLight.color *= getSpotOmniShadow(spotLightShadow,\nspotShadowMap[i], vSpotShadowCoord[i]);\n}\n}\n#endif\n#if defined(RE_Direct)\nRE_Direct(directLight, geometry, material, reflectedLight);\n#else\n#if defined(RE_DirectDiffuse)\nRE_DirectDiffuse(directLight, geometry, material, reflectedLight);\n#endif\n#if defined(RE_DirectSpecular)\nRE_DirectSpecular(directLight, geometry, material, reflectedLight);\n#endif\n#endif\n}\n#pragma unroll_loop_end\n#endif\n#if (NUM_DIR_LIGHTS > 0) && (defined(RE_Direct) || defined(RE_DirectDiffuse) || defined(RE_DirectSpecular))\nDirectionalLight directionalLight;\n#if defined(USE_SHADOWMAP) && NUM_DIR_LIGHT_SHADOWS > 0\nDirectionalLightShadow directionalLightShadow;\n#endif\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_DIR_LIGHTS; i++) {\ndirectionalLight = directionalLights[i];\ngetDirectionalDirectLightIrradiance(directionalLight, geometry, directLight);\n#if defined(USE_SHADOWMAP) && ((i) < NUM_DIR_LIGHT_SHADOWS)\ndirectionalLightShadow = directionalLightShadows[i];\nfloat distWorld = 0.0;\n#if defined(SHADOWMAP_TYPE_ESM)\ndistWorld = length((invViewMatrix * vec4(directionalLightShadow.position\n- directionalLight.direction * directionalLightShadow.shadowCameraNear\n- geometry.position, 0.0)).xyz);\n#endif\ndirectLight.color *= all(bvec3(directLight.visible, receiveShadow,\nvViewPosition.z < directionalLightShadow.maxDistance))\n? getDirShadow(directionalLightShadow, directionalShadowMap[i],\nvDirectionalShadowCoord[i], distWorld) : 1.0;\n#endif\n#if defined(RE_Direct)\nRE_Direct(directLight, geometry, material, reflectedLight);\n#else\n#if defined(RE_DirectDiffuse)\nRE_DirectDiffuse(directLight, geometry, material, reflectedLight);\n#endif\n#if defined(RE_DirectSpecular)\nRE_DirectSpecular(directLight, geometry, material, reflectedLight);\n#endif\n#endif\n}\n#pragma unroll_loop_end\n#endif\n#if (NUM_RECT_AREA_LIGHTS > 0) && defined(RE_Direct_RectArea)\nRectAreaLight rectAreaLight;\n#if defined(USE_SHADOWMAP) && NUM_RECT_AREA_LIGHT_SHADOWS > 0\nRectAreaLightShadow rectAreaLightShadow;\n#endif\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_RECT_AREA_LIGHTS; i++) {\nrectAreaLight = rectAreaLights[i];\n#if defined(USE_SHADOWMAP) && ((i) < NUM_RECT_AREA_LIGHT_SHADOWS)\nrectAreaLightShadow = rectAreaLightShadows[i];\nrectAreaLight.color *= receiveShadow ?\ngetRectAreaShadow(rectAreaLightShadow, rectAreaShadowMap[i], vRectAreaShadowCoord[i]) : 1.0;\n#endif\nRE_Direct_RectArea(rectAreaLight, geometry, material, reflectedLight);\n}\n#pragma unroll_loop_end\n#endif\n#if defined(RE_IndirectDiffuse) || defined(RE_IndirectSpecular)\nvec3 iblIrradiance = vec3(0.0);\n#endif\n#if defined(RE_IndirectDiffuse)\nvec3 irradiance = getAmbientLightIrradiance(ambientLightColor);\nirradiance += getLightProbeIrradiance(lightProbe, geometry);\n#if (NUM_HEMI_LIGHTS > 0)\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_HEMI_LIGHTS; i++) {\nirradiance += getHemisphereLightIrradiance(hemisphereLights[i], geometry);\n}\n#pragma unroll_loop_end\n#endif\n#endif\n#if defined(RE_IndirectSpecular)\nvec3 radiance = vec3(0.0);\nvec3 clearcoatRadiance = vec3(0.0);\n#endif\n#if defined(RE_Refraction)\nvec3 refraction = vec3(0.0);\n#endif",lights_fragment_maps:"#if defined(RE_IndirectDiffuse)\n#ifdef USE_LIGHTMAP\nvec4 lightMapTexel= texture2D(lightMap, vUv2);\nvec3 lightMapIrradiance = lightMapTexelToLinear(lightMapTexel).rgb * lightMapIntensity;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nlightMapIrradiance *= PI;\n#endif\nirradiance += lightMapIrradiance;\n#endif\n#if defined(USE_ENVMAP) && defined(STANDARD) && defined(ENVMAP_TYPE_CUBE_UV)\niblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel);\n#endif\n#endif\n#if defined(USE_ENVMAP) && (defined(STANDARD) || defined(PHYSICAL)) && defined(RE_IndirectSpecular)\nradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent(material), maxMipLevel, 0);\n#if defined(USE_SSR) && !defined(USE_SSR_REFRACT)\nradiance = computeSSR(radiance, geometry.normal, 0.0);\n#endif\n#if defined(USE_PLANE_REFLECTION)\nradiance = computePlaneReflection(radiance, material.specularRoughness, geometry.position, geometry.normal);\n#endif\n#ifdef CLEARCOAT\nclearcoatRadiance += getLightProbeIndirectRadiance(geometry, Material_ClearCoat_BlinnShininessExponent(material), maxMipLevel, 1);\n#endif\n#endif\n#if defined(USE_ENVMAP) && defined(RE_Refraction)\nrefraction += getLightProbeIndirectRefraction(geometry,\nMaterial_Refraction_BlinnShininessExponent(material), maxMipLevel,\n1.0 / material.refractionIOR);\n#ifdef USE_SSR_REFRACT\nrefraction = computeSSR(refraction, geometry.normal, material.refractionIOR);\n#endif\n#endif",lights_fragment_end:"#if defined(RE_IndirectDiffuse)\nRE_IndirectDiffuse(irradiance, iblIrradiance, geometry, material, reflectedLight);\n#endif\n#if defined(RE_IndirectSpecular)\nRE_IndirectSpecular(radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight);\n#endif\n#if defined(RE_Refraction)\nRE_Refraction(refraction, material, refractedLight);\n#endif",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\ngl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\nuniform float logDepthBufFC;\nvarying float vFragDepth;\nvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n#ifdef USE_LOGDEPTHBUF_EXT\nvarying float vFragDepth;\nvarying float vIsPerspective;\n#else\nuniform float logDepthBufFC;\n#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n#ifdef USE_LOGDEPTHBUF_EXT\nvFragDepth = 1.0 + gl_Position.w;\nvIsPerspective = float(isPerspectiveMatrix(projectionMatrix));\n#else\nif (isPerspectiveMatrix(projectionMatrix)) {\ngl_Position.z = log2(max(EPSILON, gl_Position.w + 1.0)) * logDepthBufFC - 1.0;\ngl_Position.z *= gl_Position.w;\n}\n#endif\n#endif",map_fragment:"#ifdef USE_MAP\nvec4 texelColor = texture2D(map, vUv);\ntexelColor = mapTexelToLinear(texelColor);\ndiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined(USE_MAP) || defined(USE_ALPHAMAP)\nvec2 uv = (uvTransform * vec3(gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1)).xy;\n#endif\n#ifdef USE_MAP\nvec4 mapTexel = texture2D(map, uv);\ndiffuseColor *= mapTexelToLinear(mapTexel);\n#endif\n#ifdef USE_ALPHAMAP\ndiffuseColor.a *= texture2D(alphaMap, uv).g;\n#endif",map_particle_pars_fragment:"#if defined(USE_MAP) || defined(USE_ALPHAMAP)\nuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\nuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\nvec4 texelMetalness = texture2D(metalnessMap, vUv);\nmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\nuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n#if NUM_MORPH_TARGETS > 0\nobjectNormal += (morphNormal0 - normal) * morphTargetInfluences[0];\n#endif\n#if NUM_MORPH_TARGETS > 1\nobjectNormal += (morphNormal1 - normal) * morphTargetInfluences[1];\n#endif\n#if NUM_MORPH_TARGETS > 2\nobjectNormal += (morphNormal2 - normal) * morphTargetInfluences[2];\n#endif\n#if NUM_MORPH_TARGETS > 3\nobjectNormal += (morphNormal3 - normal) * morphTargetInfluences[3];\n#endif\n#if NUM_MORPH_TARGETS > 4\nobjectNormal += (morphNormal4 - normal) * morphTargetInfluences[4];\n#endif\n#if NUM_MORPH_TARGETS > 5\nobjectNormal += (morphNormal5 - normal) * morphTargetInfluences[5];\n#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetBaseInfluence;\n#ifndef USE_MORPHNORMALS\nuniform float morphTargetInfluences[12];\n#else\nuniform float morphTargetInfluences[6];\n#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\ntransformed *= morphTargetBaseInfluence;\n#if NUM_MORPH_TARGETS > 0\ntransformed += morphTarget0 * morphTargetInfluences[0];\n#endif\n#if NUM_MORPH_TARGETS > 1\ntransformed += morphTarget1 * morphTargetInfluences[1];\n#endif\n#if NUM_MORPH_TARGETS > 2\ntransformed += morphTarget2 * morphTargetInfluences[2];\n#endif\n#if NUM_MORPH_TARGETS > 3\ntransformed += morphTarget3 * morphTargetInfluences[3];\n#endif\n#if NUM_MORPH_TARGETS > 4\ntransformed += morphTarget4 * morphTargetInfluences[4];\n#endif\n#if NUM_MORPH_TARGETS > 5\ntransformed += morphTarget5 * morphTargetInfluences[5];\n#endif\n#ifndef USE_MORPHNORMALS\n#if NUM_MORPH_TARGETS > 6\ntransformed += morphTarget6 * morphTargetInfluences[6];\n#endif\n#if NUM_MORPH_TARGETS > 7\ntransformed += morphTarget7 * morphTargetInfluences[7];\n#endif\n#if NUM_MORPH_TARGETS > 8\ntransformed += morphTarget8 * morphTargetInfluences[8];\n#endif\n#if NUM_MORPH_TARGETS > 9\ntransformed += morphTarget9 * morphTargetInfluences[9];\n#endif\n#if NUM_MORPH_TARGETS > 10\ntransformed += morphTarget10 * morphTargetInfluences[10];\n#endif\n#if NUM_MORPH_TARGETS > 11\ntransformed += morphTarget1 * morphTargetInfluences[11];\n#endif\n#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\nvec3 fdx = vec3(dFdx(vViewPosition.x), dFdx(vViewPosition.y), dFdx(vViewPosition.z));\nvec3 fdy = vec3(dFdy(vViewPosition.x), dFdy(vViewPosition.y), dFdy(vViewPosition.z));\nvec3 normal = normalize(cross(fdx, fdy));\n#else\nvec3 normal = normalize(vNormal);\n#ifdef DOUBLE_SIDED\n#ifdef FRONT_FACING_VALUE\nbool frontFacing = FRONT_FACING_VALUE;\n#else\nbool frontFacing = gl_FrontFacing;\n#endif\nnormal = normal * (float(frontFacing) * 2.0 - 1.0);\n#endif\n#ifdef USE_TANGENT\nvec3 tangent = normalize(vTangent);\nvec3 bitangent = normalize(vBitangent);\n#ifdef DOUBLE_SIDED\ntangent = tangent * faceDirection;\nbitangent = bitangent * faceDirection;\n#endif\n#if defined(TANGENTSPACE_NORMALMAP) || defined(USE_CLEARCOAT_NORMALMAP)\nmat3 vTBN = mat3(tangent, bitangent, normal);\n#endif\n#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\nnormal = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\n#ifdef FLIP_SIDED\nnormal = - normal;\n#endif\n#ifdef DOUBLE_SIDED\nnormal = normal * faceDirection;\n#endif\nnormal = normalize(normalMatrix * normal);\n#elif defined(TANGENTSPACE_NORMALMAP)\nvec3 mapN = texture2D(normalMap, vUv).xyz * 2.0 - 1.0;\nmapN.xy *= normalScale;\n#ifdef USE_TANGENT\nnormal = normalize(vTBN * mapN);\n#else\nnormal = perturbNormal2Arb(-vViewPosition, normal, mapN, faceDirection);\n#endif\n#elif defined(USE_BUMPMAP)\nnormal = perturbNormalArb(-vViewPosition, normal, dHdxy_fwd(), faceDirection);\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\nuniform sampler2D normalMap;\nuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat3 normalMatrix;\n#endif\n#if !defined (USE_TANGENT) && (defined (TANGENTSPACE_NORMALMAP) || defined (USE_CLEARCOAT_NORMALMAP))\nvec3 perturbNormal2Arb(vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection) {\nvec3 q0 = vec3(dFdx(eye_pos.x), dFdx(eye_pos.y), dFdx(eye_pos.z));\nvec3 q1 = vec3(dFdy(eye_pos.x), dFdy(eye_pos.y), dFdy(eye_pos.z));\nvec2 st0 = dFdx(vUv.st);\nvec2 st1 = dFdy(vUv.st);\nvec3 N = surf_norm;\nvec3 q1perp = cross(q1, N);\nvec3 q0perp = cross(N, q0);\nvec3 T = q1perp * st0.x + q0perp * st1.x;\nvec3 B = q1perp * st0.y + q0perp * st1.y;\nfloat det = max(dot(T, T), dot(B, B));\nfloat scale = (det == 0.0) ? 0.0 : faceDirection * inversesqrt(det);\nreturn normalize(T * (mapN.x * scale) + B * (mapN.y * scale) + N * mapN.z);\n}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\nvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\nvec3 clearcoatMapN = texture2D(clearcoatNormalMap, vUv).xyz * 2.0 - 1.0;\nclearcoatMapN.xy *= clearcoatNormalScale;\n#ifdef USE_TANGENT\nclearcoatNormal = normalize(vTBN * clearcoatMapN);\n#else\nclearcoatNormal = perturbNormal2Arb(- vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection);\n#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\nuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\nuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\nuniform sampler2D clearcoatNormalMap;\nuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB(const in vec3 normal) {\nreturn normalize(normal) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal(const in vec3 rgb) {\nreturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;\nconst float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3(256. * 256. * 256., 256. * 256., 256.);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.);\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA(const in float v) {\nvec4 r = vec4(fract(v * PackFactors), v);\nr.yzw -= r.xyz * ShiftRight8;\nreturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\nreturn dot(v, UnpackFactors);\n}\nvec4 pack2HalfToRGBA(vec2 v) {\nvec4 r = vec4(v.x, fract(v.x * 255.0), v.y, fract(v.y * 255.0));\nreturn vec4(r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half(vec4 v) {\nreturn vec2(v.x + (v.y / 255.0), v.z + (v.w / 255.0));\n}\nfloat viewZToOrthographicDepth(const in float viewZ, const in float near, const in float far) {\nreturn (viewZ + near) / (near - far);\n}\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\nreturn linearClipZ * (near - far) - near;\n}\nfloat viewZToPerspectiveDepth(const in float viewZ, const in float near, const in float far) {\nreturn ((near + viewZ) * far) / ((far - near) * viewZ);\n}\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\nreturn (near * far) / ((far - near) * invClipZ - far);\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\ngl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4(transformed, 1.0);\n#ifdef USE_INSTANCING\nmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;\n#if defined(BACKGROUND_DEPTH)\ngl_Position.z = gl_Position.w;\n#endif",dithering_fragment:"#ifdef DITHERING\ngl_FragColor.rgb = dithering(gl_FragColor.rgb);\n#endif",dithering_pars_fragment:"#ifdef DITHERING\nvec3 dithering(vec3 color) {\nfloat grid_position = rand(gl_FragCoord.xy);\nvec3 dither_shift_RGB = vec3(0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0);\ndither_shift_RGB = mix(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position);\nreturn color + dither_shift_RGB;\n}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\nvec4 texelRoughness = texture2D(roughnessMap, vUv);\nroughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\nuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"\n#define BIAS_FRUSTUM_SCALE_COEFF 30.0\n#define ESM_SPOT_SINGLE_BLUR_COEFF 0.25\n#define PCF_POISSON_SPOT_OMNI_BLUR_COEFF 4.0\n#define PCF_POISSON_POINT_BLUR_COEFF 2.5\n#define PCF_PCF_SOFT_DIR_SPOT_BLUR_COEFF 0.5\n#define ESM_BIAS_COEFF 100.0\n#ifndef ESM_DISTANCE_SCALE\n#define ESM_DISTANCE_SCALE 1.0\n#endif\n#ifdef USE_SHADOWMAP\n#if NUM_DIR_LIGHT_SHADOWS > 0\nuniform sampler2D directionalShadowMap[NUM_DIR_LIGHT_SHADOWS];\nvarying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHT_SHADOWS];\nstruct DirectionalLightShadow {\nfloat shadowBias;\nfloat shadowNormalBias;\nfloat shadowRadius;\nvec2 shadowMapSize;\nvec3 position;\nfloat shadowCameraNear;\nfloat maxDistance;\nfloat expBias;\n};\nuniform DirectionalLightShadow directionalLightShadows[NUM_DIR_LIGHT_SHADOWS];\n#endif\n#if NUM_SPOT_LIGHT_SHADOWS > 0\nuniform sampler2D spotShadowMap[NUM_SPOT_LIGHT_SHADOWS];\nvarying vec4 vSpotShadowCoord[NUM_SPOT_LIGHT_SHADOWS];\nstruct SpotLightShadow {\nfloat shadowBias;\nfloat shadowNormalBias;\nfloat shadowRadius;\nvec2 shadowMapSize;\nint shadow;\nfloat shadowCameraNear;\nfloat shadowCameraFar;\nfloat expBias;\n};\nuniform SpotLightShadow spotLightShadows[NUM_SPOT_LIGHT_SHADOWS];\n#endif\n#if NUM_POINT_LIGHT_SHADOWS > 0\nuniform sampler2D pointShadowMap[NUM_POINT_LIGHT_SHADOWS];\nvarying vec4 vPointShadowCoord[NUM_POINT_LIGHT_SHADOWS];\nstruct PointLightShadow {\nfloat shadowBias;\nfloat shadowNormalBias;\nfloat shadowRadius;\nvec2 shadowMapSize;\nfloat shadowCameraNear;\nfloat shadowCameraFar;\nfloat expBias;\n};\nuniform PointLightShadow pointLightShadows[NUM_POINT_LIGHT_SHADOWS];\n#endif\n#if NUM_RECT_AREA_LIGHT_SHADOWS > 0\nuniform sampler2D rectAreaShadowMap[NUM_RECT_AREA_LIGHT_SHADOWS];\nvarying vec4 vRectAreaShadowCoord[NUM_RECT_AREA_LIGHT_SHADOWS];\nstruct RectAreaLightShadow {\nfloat shadowBias;\nfloat shadowNormalBias;\nfloat shadowRadius;\nvec2 shadowMapSize;\nfloat shadowCameraNear;\nfloat shadowCameraFar;\nfloat expBias;\n};\nuniform RectAreaLightShadow rectAreaLightShadows[NUM_RECT_AREA_LIGHT_SHADOWS];\n#endif\nconst vec3 PERMUTE_DIR_X = vec3(1.0, 0.0, 0.0);\nconst vec3 PERMUTE_DIR_Y = vec3(0.0, 1.0, 0.0);\nconst vec3 PERMUTE_DIR_Z = vec3(0.0, 0.0, 1.0);\nconst mat4 POISSON_DISK_0 = mat4(\n0.954845, 0.242214, -0.623893, -0.235473,\n-0.173288, 0.799228, 0.605969, -0.548050,\n-0.560406, 0.327647, -0.448307, -0.774344,\n0.308258, 0.417332, -0.125623, -0.056098\n);\nconst mat4 POISSON_DISK_1 = mat4(\n0.145585, -0.305634, 0.264060, -0.661648,\n0.617942, 0.652121, -0.041412, -0.893582,\n0.463911, 0.039752, 0.212664, 0.810727,\n-0.955989, -0.014390, -0.652588, 0.671204\n);\nfloat texture2DCompare(sampler2D depths, vec2 uv, float compare) {\nreturn step(compare, unpackRGBAToDepth(texture2D(depths, uv)));\n}\nvec2 texture2DDistribution(sampler2D shadow, vec2 uv) {\nreturn unpackRGBATo2Half(texture2D(shadow, uv));\n}\nfloat VSMShadow (sampler2D shadow, vec2 uv, float compare){\nfloat occlusion = 1.0;\nvec2 distribution = texture2DDistribution(shadow, uv);\nfloat hard_shadow = step(compare , distribution.x);\nif (hard_shadow != 1.0) {\nfloat distance = compare - distribution.x ;\nfloat variance = max(0.00000, distribution.y * distribution.y);\nfloat softness_probability = variance / (variance + distance * distance);\nsoftness_probability = clamp((softness_probability - 0.3) / (0.95 - 0.3), 0.0, 1.0);\nocclusion = clamp(max(hard_shadow, softness_probability), 0.0, 1.0);\n}\nreturn occlusion;\n}\nfloat texture2DShadowLerp(sampler2D depths, vec2 size, vec2 uv, float compare) {\nconst vec2 offset = vec2(0.0, 1.0);\nvec2 texelSize = vec2(1.0) / size;\nvec2 centroidUV = floor(uv * size + 0.5) / size;\nfloat lb = texture2DCompare(depths, centroidUV + texelSize * offset.xx, compare);\nfloat lt = texture2DCompare(depths, centroidUV + texelSize * offset.xy, compare);\nfloat rb = texture2DCompare(depths, centroidUV + texelSize * offset.yx, compare);\nfloat rt = texture2DCompare(depths, centroidUV + texelSize * offset.yy, compare);\nvec2 f = fract(uv * size + 0.5);\nfloat a = mix(lb, lt, f.y);\nfloat b = mix(rb, rt, f.y);\nfloat c = mix(a, b, f.x);\nreturn c;\n}\nvec2 cubeToUV(vec3 v, float texelSizeY) {\nvec3 absV = abs(v);\nfloat scaleToCube = 1.0 / max(absV.x, max(absV.y, absV.z));\nabsV *= scaleToCube;\nv *= scaleToCube * (1.0 - 2.0 * texelSizeY);\nvec2 planar = v.xy;\nfloat almostATexel = 1.5 * texelSizeY;\nfloat almostOne = 1.0 - almostATexel;\nif (absV.z >= almostOne) {\nif (v.z > 0.0)\nplanar.x = 4.0 - v.x;\n} else if (absV.x >= almostOne) {\nfloat signX = sign(v.x);\nplanar.x = v.z * signX + 2.0 * signX;\n} else if (absV.y >= almostOne) {\nfloat signY = sign(v.y);\nplanar.x = v.x + 2.0 * signY + 2.0;\nplanar.y = v.z * signY - 2.0;\n}\nreturn vec2(0.125, 0.25) * planar + vec2(0.375, 0.75);\n}\nfloat texture2DShadowAvgCube(sampler2D depths, vec2 size, vec3 bd3D, float compare) {\nvec2 texelSize = vec2(1.0) / size;\nvec3 dirX = normalize(abs(bd3D.y) < 0.99999 ? vec3(bd3D.z, 0.0, -bd3D.x)\n: vec3(0.0, -bd3D.z, bd3D.y));\nvec3 dirY = cross(bd3D, dirX);\nfloat theta = PI_HALF * texelSize.y;\nvec3 sX = sin(theta) * dirX;\nvec3 sY = sin(theta) * dirY;\nfloat cosT = cos(theta);\nvec3 sampleVec[4];\nsampleVec[0] = bd3D;\nsampleVec[1] = bd3D * cosT + sY;\nsampleVec[2] = bd3D * cosT + sX;\nsampleVec[3] = sampleVec[2] * cosT + sY;\nfloat avg = 0.0;\nfor (int i = 0; i < 4; i++) {\navg += texture2DCompare(depths, cubeToUV(sampleVec[i], texelSize.y), compare);\n}\navg /= 4.0;\nreturn avg;\n}\nfloat getShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord,\nfloat expBias, float distWorld) {\nfloat shadow = 1.0;\nshadowCoord.xyz /= shadowCoord.w;\nbvec4 inFrustumVec = bvec4 (shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0);\nbool inFrustum = all(inFrustumVec);\nbvec3 frustumTestVec = bvec3(inFrustum, shadowCoord.z <= 1.0, shadowCoord.z >= 0.0);\nbool frustumTest = all(frustumTestVec);\nif (frustumTest) {\n#if defined(SHADOWMAP_TYPE_BILINEAR)\nshadowCoord.z += shadowBias;\nshadow = texture2DShadowLerp(shadowMap, shadowMapSize,\nshadowCoord.xy, shadowCoord.z);\n#elif defined(SHADOWMAP_TYPE_PCF)\nshadowCoord.z += shadowBias;\nvec2 texelSize = vec2(1.0) / shadowMapSize;\nfloat dx0 = - texelSize.x * shadowRadius;\nfloat dy0 = - texelSize.y * shadowRadius;\nfloat dx1 = + texelSize.x * shadowRadius;\nfloat dy1 = + texelSize.y * shadowRadius;\nvec2 offsetVec[9];\noffsetVec[0] = vec2(dx0, dy0);\noffsetVec[1] = vec2(0.0, dy0);\noffsetVec[2] = vec2(dx1, dy0);\noffsetVec[3] = vec2(dx0, 0.0);\noffsetVec[4] = vec2(0.0);\noffsetVec[5] = vec2(dx1, 0.0);\noffsetVec[6] = vec2(dx0, dy1);\noffsetVec[7] = vec2(0.0, dy1);\noffsetVec[8] = vec2(dx1, dy1);\nshadow = 0.0;\nfor (int i = 0; i < 9; i++) {\nshadow += texture2DCompare(shadowMap, shadowCoord.xy + offsetVec[i], shadowCoord.z);\n}\nshadow /= 9.0;\n#elif defined(SHADOWMAP_TYPE_PCF_SOFT)\nshadowCoord.z += shadowBias;\nvec2 texelSize = vec2(1.0) / shadowMapSize;\nfloat dx0 = - texelSize.x * shadowRadius;\nfloat dy0 = - texelSize.y * shadowRadius;\nfloat dx1 = + texelSize.x * shadowRadius;\nfloat dy1 = + texelSize.y * shadowRadius;\nvec2 offsetVec[9];\noffsetVec[0] = vec2(dx0, dy0);\noffsetVec[1] = vec2(0.0, dy0);\noffsetVec[2] = vec2(dx1, dy0);\noffsetVec[3] = vec2(dx0, 0.0);\noffsetVec[4] = vec2(0.0);\noffsetVec[5] = vec2(dx1, 0.0);\noffsetVec[6] = vec2(dx0, dy1);\noffsetVec[7] = vec2(0.0, dy1);\noffsetVec[8] = vec2(dx1, dy1);\nshadow = 0.0;\nfor (int i = 0; i < 9; i++) {\nshadow += texture2DShadowLerp(shadowMap, shadowMapSize,\nshadowCoord.xy + offsetVec[i], shadowCoord.z);\n}\nshadow /= 9.0;\n#elif defined(SHADOWMAP_TYPE_PCF_POISSON_DISK)\nshadowCoord.z += shadowBias;\nvec2 texelSize = vec2(1.0) / shadowMapSize;\nfloat randAngle = rand(gl_FragCoord.xy) * PI2;\nfloat c = cos(randAngle), s = sin(randAngle);\nmat2 sampleMat = mat2(c, s, -s, c)\n* mat2(shadowRadius * texelSize.x, 0.0, 0.0, shadowRadius * texelSize.y);\nvec2 sampleVec[16];\nsampleVec[0] = POISSON_DISK_0[0].xy;\nsampleVec[1] = POISSON_DISK_0[0].zw;\nsampleVec[2] = POISSON_DISK_0[1].xy;\nsampleVec[3] = POISSON_DISK_0[1].zw;\nsampleVec[4] = POISSON_DISK_0[2].xy;\nsampleVec[5] = POISSON_DISK_0[2].zw;\nsampleVec[6] = POISSON_DISK_0[3].xy;\nsampleVec[7] = POISSON_DISK_0[3].zw;\nsampleVec[8] = POISSON_DISK_1[0].xy;\nsampleVec[9] = POISSON_DISK_1[0].zw;\nsampleVec[10] = POISSON_DISK_1[1].xy;\nsampleVec[11] = POISSON_DISK_1[1].zw;\nsampleVec[12] = POISSON_DISK_1[2].xy;\nsampleVec[13] = POISSON_DISK_1[2].zw;\nsampleVec[14] = POISSON_DISK_1[3].xy;\nsampleVec[15] = POISSON_DISK_1[3].zw;\nshadow = 0.0;\nfor (int i = 0; i < 16; i++) {\nshadow += texture2DCompare(shadowMap, shadowCoord.xy\n+ sampleMat * sampleVec[i], shadowCoord.z);\n}\nshadow /= 16.0;\n#elif defined(SHADOWMAP_TYPE_VSM)\nshadow = VSMShadow(shadowMap, shadowCoord.xy, shadowCoord.z);\n#elif defined(SHADOWMAP_TYPE_ESM)\nshadow = saturate(exp(expBias * (texture2D(shadowMap, shadowCoord.xy).x\n- length(distWorld) * ESM_DISTANCE_SCALE\n- ESM_BIAS_COEFF * shadowBias)));\n#else\nshadowCoord.z += shadowBias;\nshadow = texture2DCompare(shadowMap, shadowCoord.xy, shadowCoord.z);\n#endif\n}\nreturn shadow;\n}\nfloat getShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord) {\nreturn getShadow(shadowMap, shadowMapSize, shadowBias, shadowRadius, shadowCoord, 0.0, 0.0);\n}\nfloat getOmniShadow(sampler2D shadowMap, vec2 shadowMapSize, float shadowBias,\nfloat expBias, float shadowRadius, vec4 shadowCoord,\nfloat shadowCameraNear, float shadowCameraFar) {\nfloat shadow = 1.0;\nvec3 lightToPosition = shadowCoord.xyz;\nfloat dp = (length(lightToPosition) - shadowCameraNear)\n/ (shadowCameraFar - shadowCameraNear);\nbvec2 frustumTestVec = bvec2(dp <= 1.0, dp >= 0.0);\nbool frustumTest = all(frustumTestVec);\nif (frustumTest) {\nfloat biasScaleCoeff = BIAS_FRUSTUM_SCALE_COEFF\n/ (shadowCameraFar - shadowCameraNear);\ndp += shadowBias * biasScaleCoeff;\nvec3 bd3D = normalize(lightToPosition);\nvec2 texelSize = 1.0 / shadowMapSize;\n#if defined(SHADOWMAP_TYPE_BILINEAR)\nshadow = texture2DShadowAvgCube(shadowMap, shadowMapSize, bd3D, dp);\n#elif defined(SHADOWMAP_TYPE_ESM)\nshadow = saturate(exp(expBias * (texture2D(shadowMap,\ncubeVecToOctUV(bd3D, texelSize)).x\n- length(lightToPosition) * ESM_DISTANCE_SCALE\n- ESM_BIAS_COEFF * shadowBias)));\n#elif defined(SHADOWMAP_TYPE_PCF) || defined(SHADOWMAP_TYPE_PCF_SOFT)\nvec2 offset = vec2(-1, 1) * shadowRadius * texelSize.y;\nvec3 offsetVec[9];\noffsetVec[0] = offset.xyy;\noffsetVec[1] = offset.yyy;\noffsetVec[2] = offset.xyx;\noffsetVec[3] = offset.yyx;\noffsetVec[4] = vec3(0.0);\noffsetVec[5] = offset.xxy;\noffsetVec[6] = offset.yxy;\noffsetVec[7] = offset.xxx;\noffsetVec[8] = offset.yxx;\nshadow = 0.0;\nfor (int i = 0; i < 9; i++) {\nshadow += texture2DCompare(shadowMap, cubeToUV(bd3D + offsetVec[i], texelSize.y), dp);\n}\nshadow /= 9.0;\n#elif defined(SHADOWMAP_TYPE_PCF_POISSON_DISK)\nfloat randAngle = rand(gl_FragCoord.xy) * PI2;\nfloat c = cos(randAngle), s = sin(randAngle);\nmat2 sampleMat = mat2(c, s, -s, c)\n* mat2(shadowRadius * texelSize.y, 0.0, 0.0, shadowRadius * texelSize.y);\nvec3 absBd3D = abs(bd3D);\nabsBd3D /= max(absBd3D.x, max(absBd3D.y, absBd3D.z));\nbvec2 isPointingCubeFace = greaterThan(absBd3D.xy, vec2(0.999));\nmat3 permuteMat = mat3(\nisPointingCubeFace.x ? PERMUTE_DIR_Y : PERMUTE_DIR_X,\nisPointingCubeFace.x || isPointingCubeFace.y ? PERMUTE_DIR_Z : PERMUTE_DIR_Y,\nisPointingCubeFace.x ? PERMUTE_DIR_X : isPointingCubeFace.y ? PERMUTE_DIR_Y : PERMUTE_DIR_Z\n);\nvec2 sampleVec[16];\nsampleVec[0] = POISSON_DISK_0[0].xy;\nsampleVec[1] = POISSON_DISK_0[0].zw;\nsampleVec[2] = POISSON_DISK_0[1].xy;\nsampleVec[3] = POISSON_DISK_0[1].zw;\nsampleVec[4] = POISSON_DISK_0[2].xy;\nsampleVec[5] = POISSON_DISK_0[2].zw;\nsampleVec[6] = POISSON_DISK_0[3].xy;\nsampleVec[7] = POISSON_DISK_0[3].zw;\nsampleVec[8] = POISSON_DISK_1[0].xy;\nsampleVec[9] = POISSON_DISK_1[0].zw;\nsampleVec[10] = POISSON_DISK_1[1].xy;\nsampleVec[11] = POISSON_DISK_1[1].zw;\nsampleVec[12] = POISSON_DISK_1[2].xy;\nsampleVec[13] = POISSON_DISK_1[2].zw;\nsampleVec[14] = POISSON_DISK_1[3].xy;\nsampleVec[15] = POISSON_DISK_1[3].zw;\nshadow = 0.0;\nfor (int i = 0; i < 16; i++) {\nshadow += texture2DCompare(shadowMap, cubeToUV(bd3D + permuteMat * vec3(sampleMat * sampleVec[i], 0.0), texelSize.y), dp);\n}\nshadow /= 16.0;\n#else\nshadow = texture2DCompare(shadowMap, cubeToUV(bd3D, texelSize.y), dp);\n#endif\n}\nreturn shadow;\n}\n#if NUM_DIR_LIGHT_SHADOWS > 0\nfloat getDirShadow(DirectionalLightShadow light, sampler2D shadowMap,\nvec4 shadowCoord, float distWorld) {\nfloat shadowRadius = light.shadowRadius;\n#if defined(SHADOWMAP_TYPE_PCF) || defined(SHADOWMAP_TYPE_PCF_SOFT)\nshadowRadius *= PCF_PCF_SOFT_DIR_SPOT_BLUR_COEFF;\n#endif\nreturn getShadow(shadowMap, light.shadowMapSize, light.shadowBias, shadowRadius, shadowCoord, \nlight.expBias, distWorld);\n}\n#endif\n#if NUM_POINT_LIGHT_SHADOWS > 0\nfloat getPointShadow(PointLightShadow light, sampler2D shadowMap, vec4 shadowCoord) {\nfloat shadowRadius = light.shadowRadius;\nvec2 mapSize = light.shadowMapSize;\n#if defined(SHADOWMAP_TYPE_ESM)\nmapSize *= 2.0;\n#else\nmapSize *= vec2(4.0, 2.0);\n#if defined(SHADOWMAP_TYPE_PCF_POISSON_DISK)\nshadowRadius *= PCF_POISSON_POINT_BLUR_COEFF;\n#endif\n#endif\nreturn getOmniShadow(shadowMap, mapSize, light.shadowBias, light.expBias,\nshadowRadius, shadowCoord, light.shadowCameraNear,\nlight.shadowCameraFar);\n}\n#endif\n#if NUM_RECT_AREA_LIGHT_SHADOWS > 0\nfloat getRectAreaShadow(RectAreaLightShadow light, sampler2D shadowMap, vec4 shadowCoord) {\nfloat shadowRadius = light.shadowRadius;\nvec2 mapSize = light.shadowMapSize;\n#if defined(SHADOWMAP_TYPE_ESM)\nmapSize *= 2.0;\n#else\nmapSize *= vec2(4.0, 2.0);\n#if defined(SHADOWMAP_TYPE_PCF_POISSON_DISK)\nshadowRadius *= PCF_POISSON_POINT_BLUR_COEFF;\n#endif\n#endif\nreturn getOmniShadow(shadowMap, mapSize, light.shadowBias, light.expBias,\nshadowRadius, shadowCoord, light.shadowCameraNear,\nlight.shadowCameraFar);\n}\n#endif\n#if NUM_SPOT_LIGHT_SHADOWS > 0\nfloat getSpotOmniShadow(SpotLightShadow light, sampler2D shadowMap, vec4 shadowCoord) {\nfloat shadowRadius = light.shadowRadius;\nvec2 mapSize = light.shadowMapSize;\n#if defined(SHADOWMAP_TYPE_ESM)\n#else\nmapSize *= vec2(4.0, 2.0);\n#if defined(SHADOWMAP_TYPE_PCF_POISSON_DISK)\nshadowRadius *= PCF_POISSON_SPOT_OMNI_BLUR_COEFF;\n#endif\n#endif\nreturn getOmniShadow(shadowMap, mapSize, light.shadowBias, light.expBias,\nshadowRadius, shadowCoord, light.shadowCameraNear,\nlight.shadowCameraFar);\n}\nfloat biasLinearNormalizedToNonlinear(float bias, float near, float far,\nfloat projZ, float projW) {\nreturn (bias * (far + near) + 2.0 * projZ) / (bias * (far - near) + 2.0 * projW)\n- projZ / projW;\n}\nfloat getSpotShadow(SpotLightShadow light, sampler2D shadowMap, vec4 shadowCoord,\nfloat distWorld) {\nfloat shadowRadius = light.shadowRadius;\nfloat shadowBias = light.shadowBias;\n#if defined(SHADOWMAP_TYPE_PCF) || defined(SHADOWMAP_TYPE_PCF_SOFT)\nshadowRadius *= PCF_PCF_SOFT_DIR_SPOT_BLUR_COEFF;\n#elif defined(SHADOWMAP_TYPE_ESM)\nshadowRadius *= ESM_SPOT_SINGLE_BLUR_COEFF;\n#endif\nshadowBias *= BIAS_FRUSTUM_SCALE_COEFF\n/ (light.shadowCameraFar - light.shadowCameraNear);\n#if defined(SHADOWMAP_TYPE_BASIC) || defined(SHADOWMAP_TYPE_BILINEAR) || defined(SHADOWMAP_TYPE_PCF) || defined(SHADOWMAP_TYPE_PCF_SOFT) || defined(SHADOWMAP_TYPE_PCF_POISSON_DISK)\nshadowBias = biasLinearNormalizedToNonlinear(shadowBias,\nlight.shadowCameraNear, light.shadowCameraFar, shadowCoord.z,\nshadowCoord.w);\n#endif\nreturn getShadow(shadowMap, light.shadowMapSize, shadowBias, shadowRadius, shadowCoord,\nlight.expBias, distWorld);\n}\n#endif\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n#if NUM_DIR_LIGHT_SHADOWS > 0\nuniform mat4 directionalShadowMatrix[NUM_DIR_LIGHT_SHADOWS];\nvarying vec4 vDirectionalShadowCoord[NUM_DIR_LIGHT_SHADOWS];\nstruct DirectionalLightShadow {\nfloat shadowBias;\nfloat shadowNormalBias;\nfloat shadowRadius;\nvec2 shadowMapSize;\nvec3 position;\nfloat shadowCameraNear;\nfloat maxDistance;\nfloat expBias;\n};\nuniform DirectionalLightShadow directionalLightShadows[NUM_DIR_LIGHT_SHADOWS];\n#endif\n#if NUM_SPOT_LIGHT_SHADOWS > 0\nuniform mat4 spotShadowMatrix[NUM_SPOT_LIGHT_SHADOWS];\nvarying vec4 vSpotShadowCoord[NUM_SPOT_LIGHT_SHADOWS];\nstruct SpotLightShadow {\nfloat shadowBias;\nfloat shadowNormalBias;\nfloat shadowRadius;\nvec2 shadowMapSize;\nint shadow;\nfloat shadowCameraNear;\nfloat shadowCameraFar;\nfloat expBias;\n};\nuniform SpotLightShadow spotLightShadows[NUM_SPOT_LIGHT_SHADOWS];\n#endif\n#if NUM_POINT_LIGHT_SHADOWS > 0\nuniform mat4 pointShadowMatrix[NUM_POINT_LIGHT_SHADOWS];\nvarying vec4 vPointShadowCoord[NUM_POINT_LIGHT_SHADOWS];\nstruct PointLightShadow {\nfloat shadowBias;\nfloat shadowNormalBias;\nfloat shadowRadius;\nvec2 shadowMapSize;\nfloat shadowCameraNear;\nfloat shadowCameraFar;\nfloat expBias;\n};\nuniform PointLightShadow pointLightShadows[NUM_POINT_LIGHT_SHADOWS];\n#endif\n#if NUM_RECT_AREA_LIGHT_SHADOWS > 0\nuniform mat4 rectAreaShadowMatrix[NUM_RECT_AREA_LIGHT_SHADOWS];\nvarying vec4 vRectAreaShadowCoord[NUM_RECT_AREA_LIGHT_SHADOWS];\nstruct RectAreaLightShadow {\nfloat shadowBias;\nfloat shadowNormalBias;\nfloat shadowRadius;\nvec2 shadowMapSize;\nfloat shadowCameraNear;\nfloat shadowCameraFar;\nfloat expBias;\n};\nuniform RectAreaLightShadow rectAreaLightShadows[NUM_RECT_AREA_LIGHT_SHADOWS];\n#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 || NUM_RECT_AREA_LIGHT_SHADOWS > 0\nvec3 shadowWorldNormal = inverseTransformDirection(transformedNormal, viewMatrix);\nvec4 shadowWorldPosition;\n#endif\n#if NUM_DIR_LIGHT_SHADOWS > 0\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i++) {\nshadowWorldPosition = worldPosition + vec4(shadowWorldNormal * directionalLightShadows[i].shadowNormalBias, 0);\nvDirectionalShadowCoord[i] = directionalShadowMatrix[i] * shadowWorldPosition;\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHT_SHADOWS > 0\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i++) {\nshadowWorldPosition = worldPosition + vec4(shadowWorldNormal * spotLightShadows[i].shadowNormalBias, 0);\nvSpotShadowCoord[i] = spotShadowMatrix[i] * shadowWorldPosition;\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_POINT_LIGHT_SHADOWS > 0\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i++) {\nshadowWorldPosition = worldPosition + vec4(shadowWorldNormal * pointLightShadows[i].shadowNormalBias, 0);\nvPointShadowCoord[i] = pointShadowMatrix[i] * shadowWorldPosition;\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_RECT_AREA_LIGHT_SHADOWS > 0\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_RECT_AREA_LIGHT_SHADOWS; i++) {\nshadowWorldPosition = worldPosition + vec4(shadowWorldNormal * rectAreaLightShadows[i].shadowNormalBias, 0);\nvRectAreaShadowCoord[i] = rectAreaShadowMatrix[i] * shadowWorldPosition;\n}\n#pragma unroll_loop_end\n#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\nfloat shadow = 1.0;\n#ifdef USE_SHADOWMAP\n#if NUM_DIR_LIGHT_SHADOWS > 0\nDirectionalLightShadow directionalLight;\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i++) {\ndirectionalLight = directionalLightShadows[i];\nfloat distWorld = 0.0;\n#if defined(SHADOWMAP_TYPE_ESM)\ndistWorld = length((invViewMatrix * vec4(directionalLight.position\n- directionalLight.direction * directionalLight.shadowCameraNear\n+ vViewPosition, 0.0)).xyz);\n#endif\nshadow *= all(bvec2(vViewPosition.z < directionalLight.maxDistance,\nreceiveShadow)) ? getDirShadow(directionalLight,\ndirectionalShadowMap[i], vDirectionalShadowCoord[i], distWorld)\n: 1.0;\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHT_SHADOWS > 0\nSpotLightShadow spotLight;\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i++) {\nspotLight = spotLightShadows[i];\nif (receiveShadow) {\nif (spotLight.shadow == 1) {\nfloat distWorld = 0.0;\n#if defined(SHADOWMAP_TYPE_ESM)\ndistWorld = length((invViewMatrix * vec4(spotLight.position\n+ vViewPosition, 0.0)).xyz);\n#endif\nshadow *= getSpotShadow(spotLight, spotShadowMap[i], vSpotShadowCoord[i],\ndistWorld);\n} else if (spotLight.shadow == 2) {\nshadow *= getSpotOmniShadow(spotLight, spotShadowMap[i],\nvSpotShadowCoord[i]);\n}\n}\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_POINT_LIGHT_SHADOWS > 0\nPointLightShadow pointLight;\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i++) {\npointLight = pointLightShadows[i];\nshadow *= receiveShadow ? getPointShadow(pointLight, pointShadowMap[i], vPointShadowCoord[i]) : 1.0;\n}\n#pragma unroll_loop_end\n#endif\n#if NUM_RECT_AREA_LIGHT_SHADOWS > 0\nRectAreaLightShadow rectAreaLight;\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_RECT_AREA_LIGHT_SHADOWS; i++) {\nrectAreaLight = rectAreaLightShadows[i];\nshadow *= receiveShadow ? getRectAreaShadow(rectAreaLight, rectAreaShadowMap[i], vRectAreaShadowCoord[i]) : 1.0;\n}\n#pragma unroll_loop_end\n#endif\n#endif\nreturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\nmat4 boneMatX = getBoneMatrix(skinIndex.x);\nmat4 boneMatY = getBoneMatrix(skinIndex.y);\nmat4 boneMatZ = getBoneMatrix(skinIndex.z);\nmat4 boneMatW = getBoneMatrix(skinIndex.w);\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 bindMatrix;\nuniform mat4 bindMatrixInverse;\n#ifdef BONE_TEXTURE\nuniform highp sampler2D boneTexture;\nuniform int boneTextureSize;\nmat4 getBoneMatrix(const in float i) {\nfloat j = i * 4.0;\nfloat x = mod(j, float(boneTextureSize));\nfloat y = floor(j / float(boneTextureSize));\nfloat dx = 1.0 / float(boneTextureSize);\nfloat dy = 1.0 / float(boneTextureSize);\ny = dy * (y + 0.5);\nvec4 v1 = texture2D(boneTexture, vec2(dx * (x + 0.5), y));\nvec4 v2 = texture2D(boneTexture, vec2(dx * (x + 1.5), y));\nvec4 v3 = texture2D(boneTexture, vec2(dx * (x + 2.5), y));\nvec4 v4 = texture2D(boneTexture, vec2(dx * (x + 3.5), y));\nmat4 bone = mat4(v1, v2, v3, v4);\nreturn bone;\n}\n#else\nuniform mat4 boneMatrices[MAX_BONES];\nmat4 getBoneMatrix(const in float i) {\nmat4 bone = boneMatrices[int(i)];\nreturn bone;\n}\n#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\nvec4 skinVertex = bindMatrix * vec4(transformed, 1.0);\nvec4 skinned = vec4(0.0);\nskinned += boneMatX * skinVertex * skinWeight.x;\nskinned += boneMatY * skinVertex * skinWeight.y;\nskinned += boneMatZ * skinVertex * skinWeight.z;\nskinned += boneMatW * skinVertex * skinWeight.w;\ntransformed = (bindMatrixInverse * skinned).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\nmat4 skinMatrix = mat4(0.0);\nskinMatrix += skinWeight.x * boneMatX;\nskinMatrix += skinWeight.y * boneMatY;\nskinMatrix += skinWeight.z * boneMatZ;\nskinMatrix += skinWeight.w * boneMatW;\nskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\nobjectNormal = vec4(skinMatrix * vec4(objectNormal, 0.0)).xyz;\n#ifdef USE_TANGENT\nobjectTangent = vec4(skinMatrix * vec4(objectTangent, 0.0)).xyz;\n#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\nvec4 texelSpecular = texture2D(specularMap, vUv);\nspecularStrength = texelSpecular.r;\n#else\nspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\nuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined(TONE_MAPPING)\ngl_FragColor.rgb = toneMapping(gl_FragColor.rgb);\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp(a, 0.0, 1.0)\n#endif\n#ifndef PI\n#define PI 3.14159265359\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingMidTones;\nuniform float toneMappingPhysicalScale;\nuniform float toneMappingBrightness;\nuniform float toneMappingContrast;\nuniform bool toneMappingChromaticAdaptation;\nuniform vec3 toneMappingWhiteColor;\nuniform bool toneMappingColorDifferentiation;\nuniform bool toneMappingExteriorDaylight;\nuniform vec3 toneMappingWhiteBalance;\nuniform float toneMappingHighlights;\nuniform float toneMappingShadows;\nuniform float toneMappingSaturation;\nuniform float toneMappingAperture;\nuniform float toneMappingShutter;\nuniform float toneMappingISO;\nuniform float toneMappingVignetting;\nuniform vec2 toneMappingResolution;\nconst float FILMIC_BLENDER_LOG_MIN = -12.473931188;\nconst float FILMIC_BLENDER_LOG_MAX = 12.526068812;\nconst float FILMIC_BLENDER_EXPOSURE_LATITUDE_RATIO = 0.66;\nvec3 LinearToneMapping(vec3 color) {\nreturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping(vec3 color) {\ncolor *= toneMappingExposure;\nreturn saturate(color / (vec3(1.0) + color));\n}\nvec3 OptimizedCineonToneMapping(vec3 color) {\ncolor *= toneMappingExposure;\ncolor = max(vec3(0.0), color - 0.004);\nreturn pow((color * (6.2 * color + 0.5)) / (color * (6.2 * color + 1.7) + 0.06), vec3(2.2));\n}\nvec3 RRTAndODTFit(vec3 v) {\nvec3 a = v * (v + 0.0245786) - 0.000090537;\nvec3 b = v * (0.983729 * v + 0.4329510) + 0.238081;\nreturn a / b;\n}\nvec3 ACESFilmicToneMapping(vec3 color) {\nconst mat3 ACESInputMat = mat3(\nvec3(0.59719, 0.07600, 0.02840),\nvec3(0.35458, 0.90834, 0.13383),\nvec3(0.04823, 0.01566, 0.83777)\n);\nconst mat3 ACESOutputMat = mat3(\nvec3( 1.60475, -0.10208, -0.00327),\nvec3(-0.53108, 1.10813, -0.07276),\nvec3(-0.07367, -0.00605, 1.07602)\n);\ncolor *= toneMappingExposure / 0.6;\ncolor = ACESInputMat * color;\ncolor = RRTAndODTFit(color);\ncolor = ACESOutputMat * color;\nreturn saturate(color);\n}\nvec3 CustomToneMapping(vec3 color) { return color; }\n#define ORDERS_OF_MAG 5.0\nfloat toneCalcBrightness(in vec3 color)\n{\nreturn (abs(color.r) * 0.263 + abs(color.g) * 0.655 + abs(color.b) * 0.082);\n}\nfloat toneApproximateScotopicLuminance(vec3 color)\n{\nreturn (0.062 * color.r + 0.608 * color.g + 0.330 * color.b);\n}\nvec3 LogarithmicMaxToneMapping(vec3 color) {\nfloat inputScaleFactor = toneMappingPhysicalScale / PI;\nfloat brightness = (toneMappingBrightness < 0.0) ? 0.0 : (toneMappingBrightness * 0.7);\nfloat powerBot = toneMappingExteriorDaylight ? 4.0 : 2.0;\nfloat res = 100.0 / ORDERS_OF_MAG;\nfloat mag = floor((50.0 / res));\nfloat power = ((brightness / 20.0 - ORDERS_OF_MAG) - powerBot) + mag;\nfloat stepsize = 9.0 / res;\nfloat step = 50.0 - (mag * res);\nfloat param_c = (0.02 * toneMappingContrast) * 2.0;\nfloat param_b = pow(10.0, power) * (1.0 + (stepsize * step));\nfloat param_a = param_b * (1.0 + param_c);\nparam_c /= pow(2.0, toneMappingMidTones - 1.0);\nparam_b *= PI;\nvec3 whiteConstancyFactor = toneMappingWhiteColor;\nif (toneMappingChromaticAdaptation) {\nfloat luminance = toneCalcBrightness(whiteConstancyFactor);\nwhiteConstancyFactor.r = (whiteConstancyFactor.r > 0.001) ? luminance / whiteConstancyFactor.r : luminance / 0.001;\nwhiteConstancyFactor.g = (whiteConstancyFactor.g > 0.001) ? luminance / whiteConstancyFactor.g : luminance / 0.001;\nwhiteConstancyFactor.b = (whiteConstancyFactor.b > 0.001) ? luminance / whiteConstancyFactor.b : luminance / 0.001;\n}\nvec3 outColor = inputScaleFactor * color;\nif (toneMappingChromaticAdaptation) {\noutColor *= whiteConstancyFactor.rgb;\n}\nfloat luminance = toneCalcBrightness(outColor);\nif (toneMappingColorDifferentiation && (luminance < 5.62)) {\nfloat sLuminance = toneApproximateScotopicLuminance(outColor);\nif (luminance <= 5.62e-3) {\noutColor = vec3(sLuminance);\n} else {\nfloat w = (luminance - 5.62e-3) / 5.61438;\noutColor = outColor * w + sLuminance * (1.0 - w);\n}\n}\noutColor = outColor * (param_a / (param_b * outColor + param_c));\nreturn outColor;\n}\nfloat maxExposurePhotographic(in vec4 color1, in vec4 color2)\n{\nreturn ((color1.r * color2.r) + (color1.g * color2.g)) + (color1.b * color2.b);\n}\nvec3 PhysicalMaxToneMapping(vec3 color) {\nfloat vignettingInfluence = 1.0;\nif (toneMappingVignetting > 0.0) {\nvec3 vignettingCoords = vec3(0.0, 0.0, 0.0);\nfloat aspect = toneMappingResolution.x / toneMappingResolution.y;\nvignettingCoords.x = gl_FragCoord.x / toneMappingResolution.x - 0.5;\nvignettingCoords.y = (gl_FragCoord.y / toneMappingResolution.y - 0.5) / aspect;\nvignettingCoords.z = 1.0;\nvignettingCoords = normalize(vignettingCoords);\nvignettingInfluence = pow(vignettingCoords.z, toneMappingVignetting);\n}\nfloat inputScaleFactor = toneMappingPhysicalScale / PI;\nfloat filmISO = toneMappingISO;\nfloat camShutter = 1.0 / toneMappingShutter;\nfloat fNumber = toneMappingAperture;\nfloat cm2 = 1.0;\nfloat burnHighlights = toneMappingHighlights;\nfloat crushBlacks = toneMappingShadows;\nfloat saturation = toneMappingSaturation;\nvec3 whitePointInfluence = toneMappingWhiteBalance;\nif (whitePointInfluence.r > 0.0) {\nwhitePointInfluence.r = 1.0 / whitePointInfluence.r;\n} else {\nwhitePointInfluence.r = 1.0;\n}\nif (whitePointInfluence.g > 0.0) {\nwhitePointInfluence.g = 1.0 / whitePointInfluence.g;\n} else {\nwhitePointInfluence.g = 1.0;\n}\nif (whitePointInfluence.b > 0.0) {\nwhitePointInfluence.b = 1.0 / whitePointInfluence.b;\n} else {\nwhitePointInfluence.b = 1.0;\n}\nvec4 lumFactor = vec4(0.212671, 0.715160, 0.072169, 0.0);\nfloat whiteLumFactor = maxExposurePhotographic(lumFactor, vec4(whitePointInfluence, 0.0));\nwhitePointInfluence.r /= whiteLumFactor;\nwhitePointInfluence.g /= whiteLumFactor;\nwhitePointInfluence.b /= whiteLumFactor;\nfloat isoInfluence = 0.0;\nfloat camShutterInv = 1.0 / camShutter;\nif (filmISO > 0.0) {\nisoInfluence = ((cm2 * 0.169811) * (filmISO * camShutterInv)) / ((15.4 * fNumber) * fNumber);\n} else {\nisoInfluence = cm2;\n}\nvec3 outColor = inputScaleFactor * color;\noutColor.r = outColor.r * whitePointInfluence.r * isoInfluence * vignettingInfluence;\noutColor.g = outColor.g * whitePointInfluence.g * isoInfluence * vignettingInfluence;\noutColor.b = outColor.b * whitePointInfluence.b * isoInfluence * vignettingInfluence;\noutColor.r = (outColor.r * (1.0 + (outColor.r * burnHighlights))) / (1.0 + outColor.r);\noutColor.g = (outColor.g * (1.0 + (outColor.g * burnHighlights))) / (1.0 + outColor.g);\noutColor.b = (outColor.b * (1.0 + (outColor.b * burnHighlights))) / (1.0 + outColor.b);\nfloat lumFactor2 = maxExposurePhotographic(lumFactor, vec4(outColor, 0.0));\nfloat tmpFloat = 1.0 - saturation;\noutColor.r = outColor.r * saturation + lumFactor2 * tmpFloat;\noutColor.g = outColor.g * saturation + lumFactor2 * tmpFloat;\noutColor.b = outColor.b * saturation + lumFactor2 * tmpFloat;\noutColor = max(vec3(0.0), outColor);\nfloat crushBlacksFac = crushBlacks * 2.0 + 1.0;\nfloat crushBlacksFac2 = pow(maxExposurePhotographic(lumFactor, vec4(outColor, 0.0)), 0.5);\ntmpFloat = (1.0 - crushBlacksFac2);\nif (crushBlacksFac2 < 1.0) {\noutColor.r = outColor.r * crushBlacksFac2 + pow(outColor.r, crushBlacksFac) * tmpFloat;\noutColor.g = outColor.g * crushBlacksFac2 + pow(outColor.g, crushBlacksFac) * tmpFloat;\noutColor.b = outColor.b * crushBlacksFac2 + pow(outColor.b, crushBlacksFac) * tmpFloat;\n}\nreturn outColor;\n}\nfloat filmicBlenderDesaturationMinIntensity(vec3 color) {\nfloat maxChannel = max(color.r, max(color.g, color.b));\nfloat x = max(maxChannel, 0.6251);\nreturn (1.2192868 * x - 0.63221059)\n* ((x - 0.65069831) / (abs(x - 0.65069831) + 0.00952982) + 0.73015231);\n}\nvec3 filmicBlenderDesaturationTransform(vec3 color) {\nconst float CURVE_SMOOTHNESS = 0.03;\nfloat minIntensity = filmicBlenderDesaturationMinIntensity(color);\nvec4 x = vec4(color, 1.0) - minIntensity;\nx = pow(x, vec4(2.0)) / (abs(x) + CURVE_SMOOTHNESS);\nreturn (x.rgb - x.a + color + 1.0) / 2.0;\n}\nvec3 filmicBlenderDynamicRangeTransform(vec3 color) {\nreturn pow(\n(0.28882259 * color - 0.15880336)\n/ (pow(color - 0.6229693, vec3(2.0)) + 0.16965022)\n+ 0.20453365 * color + 0.37847142,\nvec3(3.0)\n);\n}\nvec3 FilmicBlenderToneMapping(vec3 color) {\ncolor *= toneMappingExposure;\ncolor = max(color, 0.000175);\ncolor = clamp((log2(color) - FILMIC_BLENDER_LOG_MIN)\n/ (FILMIC_BLENDER_LOG_MAX - FILMIC_BLENDER_LOG_MIN), 0.0, 1.0);\ncolor = filmicBlenderDesaturationTransform(color);\ncolor = clamp(color / FILMIC_BLENDER_EXPOSURE_LATITUDE_RATIO, 0.0, 1.0);\ncolor = filmicBlenderDynamicRangeTransform(color);\nreturn color;\n}",transmission_fragment:"#ifdef USE_TRANSMISSION\nfloat transmissionFactor = transmission;\nfloat thicknessFactor = thickness;\n#ifdef USE_TRANSMISSIONMAP\ntransmissionFactor *= texture2D(transmissionMap, vUv).r;\n#endif\n#ifdef USE_THICKNESSNMAP\nthicknessFactor *= texture2D(thicknessMap, vUv).g;\n#endif\nvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\nvec3 v = normalize(cameraPosition - pos);\nfloat ior = (1.0 + 0.4 * reflectivity) / (1.0 - 0.4 * reflectivity);\nvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\nnormal, v, roughnessFactor, material.diffuseColor, totalSpecular,\npos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\nattenuationColor, attenuationDistance);\ntotalDiffuse = mix(totalDiffuse, transmission, transmissionFactor);\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n#ifdef USE_TRANSMISSIONMAP\nuniform sampler2D transmissionMap;\n#endif\n#ifdef USE_THICKNESSMAP\nuniform sampler2D thicknessMap;\n#endif\nuniform vec2 transmissionSamplerSize;\nuniform sampler2D transmissionSamplerMap;\nuniform mat4 modelMatrix;\nuniform mat4 projectionMatrix;\nvarying vec4 vWorldPosition;\nvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {\nvec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);\nvec3 modelScale;\nmodelScale.x = length(vec3(modelMatrix[0].xyz));\nmodelScale.y = length(vec3(modelMatrix[1].xyz));\nmodelScale.z = length(vec3(modelMatrix[2].xyz));\nreturn normalize(refractionVector) * thickness * modelScale;\n}\nfloat applyIorToRoughness(float roughness, float ior) {\nreturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n}\nvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\nfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\nreturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n}\nvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\nif (attenuationDistance == 0.0) {\nreturn radiance;\n} else {\nvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\nvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\nreturn transmittance * radiance;\n}\n}\nvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\nvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\nvec3 attenuationColor, float attenuationDistance) {\nvec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);\nvec3 refractedRayExit = position + transmissionRay;\nvec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);\nvec2 refractionCoords = ndcPos.xy / ndcPos.w;\nrefractionCoords += 1.0;\nrefractionCoords /= 2.0;\nvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\nvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\nreturn (1.0 - specularColor) * attenuatedColor * baseColor;\n}\n#endif",uv_pars_fragment:"#if (defined(USE_UV) && !defined(UVS_VERTEX_ONLY))\nvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n#ifdef UVS_VERTEX_ONLY\nvec2 vUv;\n#else\nvarying vec2 vUv;\n#endif\nuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\nvUv = (uvTransform * vec3(uv, 1)).xy;\n#endif",uv2_pars_fragment:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\nvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\nattribute vec2 uv2;\nvarying vec2 vUv2;\nuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined(USE_LIGHTMAP) || defined(USE_AOMAP)\nvUv2 = (uv2Transform * vec3(uv2, 1)).xy;\n#endif",worldpos_vertex:"#if defined(USE_ENVMAP) || defined(DISTANCE) || defined (USE_SHADOWMAP) || defined (USE_TRANSMISSION) || defined(MASK) || defined(NODE)\nvec4 worldPosition = vec4(transformed, 1.0);\n#ifdef USE_INSTANCING\nworldPosition = instanceMatrix * worldPosition;\n#endif\nworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\nvec4 texColor = texture2D(t2D, vUv);\ngl_FragColor = mapTexelToLinear(texColor);\n#include \n#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\nvUv = (uvTransform * vec3(uv, 1)).xy;\ngl_Position = vec4(position.xy, 1.0, 1.0);\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\nvec3 vReflect = vWorldDirection;\n#include \ngl_FragColor = envColor;\ngl_FragColor.a *= opacity;\n#include \n#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\nvWorldDirection = transformDirection(position, modelMatrix);\n#include \n#include \ngl_Position.z = gl_Position.w;\n}",depth_frag:"#define DEPTH\nvarying vec3 vViewPosition;\nvarying vec2 vProjectedPosZW;\n#if DEPTH_PACKING == 3200\nuniform float opacity;\n#endif\n#ifdef USE_SLOPE_SCALED_BIAS\nuniform float slopeScaledBias;\nconst float ONE_MINUS_EPS = 0.9999999;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec4 diffuseColor = vec4(1.0);\n#if DEPTH_PACKING == 3200\ndiffuseColor.a = opacity;\n#endif\n#include \n#include \n#include \n#include \n#if DEPTH_PACKING != 3202\nfloat depth = vProjectedPosZW.x / vProjectedPosZW.y;\ndepth = (depth + 1.0) / 2.0;\n#ifdef USE_SLOPE_SCALED_BIAS\nvec2 dxdy = abs(vec2(dFdx(depth), dFdy(depth)));\nfloat bias = slopeScaledBias * max(dxdy.x, dxdy.y);\ndepth = clamp(depth + max(bias, 1e-6), 0.0, ONE_MINUS_EPS);\n#endif\n#if DEPTH_PACKING == 3200\ngl_FragColor = vec4(vec3(1.0 - depth), opacity);\n#elif DEPTH_PACKING == 3201\ngl_FragColor = packDepthToRGBA(depth);\n#endif\n#else\ngl_FragColor = vec4(vViewPosition.z);\n#endif\n}",depth_vert:"#define DEPTH\nvarying vec3 vViewPosition;\nvarying vec2 vProjectedPosZW;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#ifdef USE_DISPLACEMENTMAP\n#include \n#include \n#include \n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvViewPosition = mvPosition.xyz;\nvProjectedPosZW = mat2(\nprojectionMatrix[2][2], projectionMatrix[2][3],\nprojectionMatrix[3][2], projectionMatrix[3][3]\n) * mvPosition.zw;\n}",distanceRGBA_frag:"#define DISTANCE\n#ifdef USE_SLOPE_SCALED_BIAS\nuniform float slopeScaledBias;\nconst float ONE_MINUS_EPS = 0.9999999;\n#endif\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifndef DISTANCE_SCALE\n#define DISTANCE_SCALE 1.0\n#endif\nvoid main () {\n#include \nvec4 diffuseColor = vec4(1.0);\n#include \n#include \n#include \nfloat dist = length(vWorldPosition - referencePosition);\n#if DISTANCE_PACKING == 3301\ndist = (dist - nearDistance) / (farDistance - nearDistance);\ndist = saturate(dist);\n#ifdef USE_SLOPE_SCALED_BIAS\nvec2 dxdy = abs(vec2(dFdx(dist), dFdy(dist)));\nfloat bias = slopeScaledBias * max(dxdy.x, dxdy.y);\ndist = clamp(dist + bias, 0.0, ONE_MINUS_EPS);\n#endif\ngl_FragColor = packDepthToRGBA(dist);\n#elif DISTANCE_PACKING == 3302\n#ifdef USE_SLOPE_SCALED_BIAS\nvec2 dxdy = abs(vec2(dFdx(dist), dFdy(dist)));\ndist += slopeScaledBias * max(dxdy.x, dxdy.y);\n#endif\ngl_FragColor = vec4(dist * DISTANCE_SCALE, 0.0, 0.0, 1.0);\n#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#ifdef USE_DISPLACEMENTMAP\n#include \n#include \n#include \n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nuniform bool invertU;\nuniform float offsetU;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\nvec3 direction = normalize(vWorldDirection);\nvec2 sampleUV;\nsampleUV.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\nsampleUV.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n\nif (invertU) {\nsampleUV.x = 1.0 - sampleUV.x;\n}\n\nsampleUV.x += offsetU;\nvec4 texColor = texture2D(tEquirect, sampleUV);\ngl_FragColor = mapTexelToLinear(texColor);\n#include \n#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\nvWorldDirection = transformDirection(position, modelMatrix);\n#include \n#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nif (mod(vLineDistance, totalSize) > dashSize) {\ndiscard;\n}\nvec3 outgoingLight = vec3(0.0);\nvec4 diffuseColor = vec4(diffuse, opacity);\n#include \n#include \noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\nvLineDistance = scale * lineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec4 diffuseColor = vec4(diffuse, opacity);\n#include \n#include \n#include \n#include \n#include \n#include \nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#ifdef USE_LIGHTMAP\n\nvec4 lightMapTexel= texture2D(lightMap, vUv2);\nreflectedLight.indirectDiffuse += lightMapTexelToLinear(lightMapTexel).rgb * lightMapIntensity;\n#else\nreflectedLight.indirectDiffuse += vec3(1.0);\n#endif\n#include \nreflectedLight.indirectDiffuse *= diffuseColor.rgb;\nvec3 outgoingLight = reflectedLight.indirectDiffuse;\n#include \ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n#include \n#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \n#ifdef USE_ENVMAP\n#include \n#include \n#include \n#include \n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\nvarying vec3 vIndirectBack;\n#endif\nvarying vec3 vViewPosition;\n#ifdef SHADOWMAP_TYPE_ESM\nuniform mat4 invViewMatrix;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec4 diffuseColor = vec4(diffuse, opacity);\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\nvec3 totalEmissiveRadiance = emissive;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef DOUBLE_SIDED\nreflectedLight.indirectDiffuse += (gl_FrontFacing) ? vIndirectFront : vIndirectBack;\n#else\nreflectedLight.indirectDiffuse += vIndirectFront;\n#endif\n#include \nreflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert(diffuseColor.rgb);\n#ifdef DOUBLE_SIDED\nreflectedLight.directDiffuse = (gl_FrontFacing) ? vLightFront : vLightBack;\n#else\nreflectedLight.directDiffuse = vLightFront;\n#endif\nreflectedLight.directDiffuse *= BRDF_Diffuse_Lambert(diffuseColor.rgb) * getShadowMask();\n#include \nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n#include \ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n#include \n#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\nvarying vec3 vIndirectBack;\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvViewPosition = - mvPosition.xyz;\n#include \n#include \n#include \n#include \n#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec4 diffuseColor = vec4(diffuse, opacity);\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvec3 viewDir = normalize(vViewPosition);\nvec3 x = normalize(vec3(viewDir.z, 0.0, - viewDir.x));\nvec3 y = cross(viewDir, x);\nvec2 uv = vec2(dot(x, normal), dot(y, normal)) * 0.495 + 0.5;\n#ifdef USE_MATCAP\nvec4 matcapColor = texture2D(matcap, uv);\nmatcapColor = matcapTexelToLinear(matcapColor);\n#else\nvec4 matcapColor = vec4(1.0);\n#endif\nvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n#include \n#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#ifndef FLAT_SHADED\nvNormal = normalize(transformedNormal);\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec4 diffuseColor = vec4(diffuse, opacity);\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\nvec3 totalEmissiveRadiance = emissive;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n#include \n#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#ifndef FLAT_SHADED\nvNormal = normalize(transformedNormal);\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvViewPosition = - mvPosition.xyz;\n#include \n#include \n#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#ifdef SHADOWMAP_TYPE_ESM\nuniform mat4 invViewMatrix;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec4 diffuseColor = vec4(diffuse, opacity);\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\nvec3 totalEmissiveRadiance = emissive;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n#include \ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n#include \n#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#ifndef FLAT_SHADED\nvNormal = normalize(transformedNormal);\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvViewPosition = - mvPosition.xyz;\n#include \n#include \n#include \n#include \n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n#define REFLECTIVITY\n#define CLEARCOAT\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\nuniform float transmission;\nuniform float thickness;\nuniform vec3 attenuationColor;\nuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\nuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\nuniform float clearcoat;\nuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\nuniform vec3 sheen;\n#endif\n#if defined(SHADOWMAP_TYPE_ESM) || defined(USE_ENVMAP)\nuniform mat4 invViewMatrix;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#ifdef USE_TANGENT\nvarying vec3 vTangent;\nvarying vec3 vBitangent;\n#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec4 diffuseColor = vec4(diffuse, opacity);\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\nvec3 totalEmissiveRadiance = emissive;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\nvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n#include \nvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n#include \n#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#ifdef USE_TANGENT\nvarying vec3 vTangent;\nvarying vec3 vBitangent;\n#endif\n#endif\n#ifdef USE_TRANSMISSION\nvarying vec4 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#ifndef FLAT_SHADED\nvNormal = normalize(transformedNormal);\n#ifdef USE_TANGENT\nvTangent = normalize(transformedTangent);\nvBitangent = normalize(cross(vNormal, vTangent) * tangent.w);\n#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvViewPosition = - mvPosition.xyz;\n#include \n#include \n#include \n#ifdef USE_TRANSMISSION\nvWorldPosition = worldPosition;\n#endif\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || defined(TANGENTSPACE_NORMALMAP)\nvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#ifdef USE_TANGENT\nvarying vec3 vTangent;\nvarying vec3 vBitangent;\n#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \ngl_FragColor = vec4(packNormalToRGB(normal), opacity);\n}",normal_vert:"#define NORMAL\n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || defined(TANGENTSPACE_NORMALMAP)\nvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#ifdef USE_TANGENT\nvarying vec3 vTangent;\nvarying vec3 vBitangent;\n#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \n#include \n#include \n#ifndef FLAT_SHADED\nvNormal = normalize(transformedNormal);\n#ifdef USE_TANGENT\nvTangent = normalize(transformedTangent);\nvBitangent = normalize(cross(vNormal, vTangent) * tangent.w);\n#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#if defined(FLAT_SHADED) || defined(USE_BUMPMAP) || defined(TANGENTSPACE_NORMALMAP)\nvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec3 outgoingLight = vec3(0.0);\nvec4 diffuseColor = vec4(diffuse, opacity);\n#include \n#include \n#include \n#include \noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#include \ngl_PointSize = size;\n#ifdef USE_SIZEATTENUATION\nbool isPerspective = isPerspectiveMatrix(projectionMatrix);\nif (isPerspective) gl_PointSize *= (scale / - mvPosition.z);\n#endif\n#include \n#include \n#include \n#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#ifdef USE_SHADOWMAP\nvarying vec3 vViewPosition;\n#ifdef SHADOWMAP_TYPE_ESM\nuniform mat4 invViewMatrix;\n#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\ngl_FragColor = vec4(color, opacity * (1.0 - getShadowMask()));\n#include \n#include \n#include \n}",shadow_vert:"#include \n#ifdef USE_SHADOWMAP\nvarying vec3 vViewPosition;\n#endif\n#include \n#include \nvoid main() {\n#include \n#include \n#include \n#ifdef USE_SHADOWMAP\nvViewPosition = - mvPosition.xyz;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec3 outgoingLight = vec3(0.0);\nvec4 diffuseColor = vec4(diffuse, opacity);\n#include \n#include \n#include \n#include \noutgoingLight = diffuseColor.rgb;\ngl_FragColor = vec4(outgoingLight, diffuseColor.a);\n#include \n#include \n#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n#include \nvec4 mvPosition = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\nvec2 scale;\nscale.x = length(vec3(modelMatrix[0].x, modelMatrix[0].y, modelMatrix[0].z));\nscale.y = length(vec3(modelMatrix[1].x, modelMatrix[1].y, modelMatrix[1].z));\n#ifndef USE_SIZEATTENUATION\nbool isPerspective = isPerspectiveMatrix(projectionMatrix);\nif (isPerspective) scale *= - mvPosition.z;\n#endif\nvec2 alignedPosition = (position.xy - (center - vec2(0.5))) * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos(rotation) * alignedPosition.x - sin(rotation) * alignedPosition.y;\nrotatedPosition.y = sin(rotation) * alignedPosition.x + cos(rotation) * alignedPosition.y;\nmvPosition.xy += rotatedPosition;\ngl_Position = projectionMatrix * mvPosition;\n#include \n#include \n#include \n}",equicube_frag:"uniform sampler2D tEquirect;\nuniform int faceIndex;\nuniform bool invertU;\nuniform float offsetU;\nvarying vec2 vUv;\n#include \nvoid main() {\nvec3 direction;\nvec2 uv = vUv * 2.0 - 1.0;\nif (faceIndex==0) {\ndirection = vec3(1.0, -uv.y, -uv.x);\n} else if (faceIndex==1) {\ndirection = vec3(-1.0, -uv.y, uv.x);\n} else if (faceIndex==2) {\ndirection = vec3(uv.x, 1.0, uv.y);\n} else if (faceIndex==3) {\ndirection = vec3(uv.x, -1.0, -uv.y);\n} else if (faceIndex==4) {\ndirection = vec3(uv.x, -uv.y, 1.0);\n} else {\ndirection = vec3(-uv.x, -uv.y, -1.0);\n}\ndirection = normalize(direction);\nvec2 sampleUV;\nsampleUV.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\nsampleUV.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\nif (invertU) {\nsampleUV.x = 1.0 - sampleUV.x;\n}\n\nsampleUV.x += offsetU;\ngl_FragColor = texture2D(tEquirect, sampleUV);\n}",equicube_vert:"varying vec2 vUv;\n#include \nvoid main() {\nvUv = uv;\n#include \n#include \n}",mask_frag:"#define MASK\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nuniform mat4 projectionMatrix;\nuniform float opacity;\nuniform sampler2D depthTexture;\nuniform vec2 cameraNearFar;\nvarying vec3 vViewPosition;\nvarying vec4 projTexCoord;\nvoid main() {\n#include \nvec4 diffuseColor = vec4(1.0);\ndiffuseColor.a = opacity;\n#include \n#include \n#include \n#include \nfloat depth = unpackRGBAToDepth(texture2DProj(depthTexture, projTexCoord));\nfloat viewZ;\nif (isOrtho(projectionMatrix))\nviewZ = -orthographicDepthToViewZ(depth,\ncameraNearFar.x, cameraNearFar.y);\nelse\nviewZ = -perspectiveDepthToViewZ(depth,\ncameraNearFar.x, cameraNearFar.y);\nfloat depthTest = (vViewPosition.z > viewZ) ? 1.0 : 0.0;\ngl_FragColor = vec4(0.0, depthTest, 1.0, 0.0);\n}",mask_vert:"#define MASK\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nuniform mat4 textureMatrix;\nvarying vec3 vViewPosition;\nvarying vec4 projTexCoord;\nvoid main() {\n#include \n#include \n#ifdef USE_DISPLACEMENTMAP\n#include \n#include \n#include \n#endif\n#include \n#include \n#include \n#include \n#include \nvViewPosition = -mvPosition.xyz;\n#include \nprojTexCoord = textureMatrix * worldPosition;\n#include \n#include \n}",meshnode_frag:"#define NODE\n#include \n#include \n#include \n#include \n#include \n#include \n#if defined(NODE_NEW_GEOMETRY_BL) || defined(NODE_VECT_TRANSFORM_BL) || defined(NODE_TEX_COORD_BL) || defined(NODE_NORMAL_MAP_BL) || defined(NODE_LAYER_WEIGHT_BL) || defined(NODE_FRESNEL_BL) || defined(NODE_BUMP_BL) || defined(NODE_BSDF_GLASS_BL) || defined(NODE_BSDF_PRINCIPLED_BL) || defined(NODE_TANGENT_BL) || defined(NODE_BITMAP_MX) || defined(NODE_GRADIENT_RAMP_MX) || defined(NODE_NOISE_MX) || defined(NODE_SAMPLER_INFO_MY) || defined(NODE_INCIDENT) || defined(NODE_POSITION) || defined(NODE_NORMAL) || defined(USE_OSL) || defined(USE_ENVMAP) || defined(SHADOWMAP_TYPE_ESM) && (defined(NODE_BSDF_DIFFUSE_BL) || defined(NODE_EEVEE_SPECULAR_BL) || defined(NODE_BSDF_GLOSSY_BL) || defined(NODE_BSDF_REFRACTION_BL) || defined(NODE_MATERIAL_MX) || defined(NODE_PHYSICAL_MX) || defined(NODE_STANDARD_SURFACE_AR) || defined(NODE_SHADOW_MATTE_AR))\nuniform mat4 invViewMatrix;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#if defined(NODE_NEW_GEOMETRY_BL) || defined(NODE_LAYER_WEIGHT_BL) || defined(NODE_FRESNEL_BL) || defined(NODE_BSDF_GLASS_BL) || defined(NODE_BSDF_PRINCIPLED_BL) || defined(USE_SSR) || (defined(NODE_NORMAL) && defined(MT_BLENDER)) || defined(USE_OSL)\nuniform mat4 projectionMatrix;\n#endif\n#if defined(NODE_VECT_TRANSFORM_BL) || defined(NODE_TEX_COORD_BL) || defined(NODE_NEW_GEOMETRY_BL) || defined(NODE_TANGENT_BL) || defined(NODE_OBJECT_INFO_BL) || defined(NODE_BITMAP_MX) || defined(NODE_GRADIENT_RAMP_MX) || defined(NODE_NOISE_MX) || defined(NODE_SAMPLER_INFO_MY) || defined(NODE_TRANSFORM_MY) || defined(USE_OSL)\nuniform mat4 modelMatrix;\nuniform mat4 invModelMatrix;\n#endif\n#if defined(NODE_VECT_TRANSFORM_BL) || defined(NODE_NORMAL_MAP_BL) || defined(NODE_NORMAL_BUMP_MX) || defined(NODE_BUMP_2D_MY) || defined(NODE_SAMPLER_INFO_MY)\nuniform mat4 modelViewMatrix;\n#endif\n#if defined(NODE_TEX_IMAGE_BL)\nuniform mat3 normalMatrix;\n#endif\n#if defined(NODE_TEX_COORD_BL) || defined(NODE_NEW_GEOMETRY_BL) || defined(NODE_TANGENT_BL)\nuniform vec3 boundingBoxMin;\nuniform vec3 boundingBoxMax;\n#endif\n#if defined(NODE_REFLECT_REFRACT_MX) || defined(NODE_BITMAP_ENV_MX) || defined(NODE_BUMP_BL) || defined(NODE_PHY_SUN_SKY_ENV_MX) || defined(NODE_SKYDOME_LIGHT_AR) || defined(NODE_ENV_SPHERE_MY)\nvarying vec3 vWorldPosition;\n#endif\n#if defined(NODE_TEX_COORD_BL)\nuniform vec2 viewWidthHeight;\n#endif\n#include \n#include \n#include \n#include \nvoid main() {\nbool _frontFacingValue = gl_FrontFacing;\n#define FRONT_FACING_VALUE _frontFacingValue\n#include \n#include \n#include \nvec4 outgoingLight = vec4(0.0);\n#include \n#if WORLD_NODES == 1\noutgoingLight.a = 1.0;\n#endif\n#ifdef ALPHATEST\nif (outgoingLight.a < ALPHATEST)\ndiscard;\nelse\noutgoingLight.a = 1.0;\n#endif\ngl_FragColor = vec4(outgoingLight);\n#include \n#include \n#include \n#include \n#include \n#include \n}",meshnode_vert:"#define NODE\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#if defined(NODE_REFLECT_REFRACT_MX) || defined(NODE_BITMAP_ENV_MX) || defined(NODE_BUMP_BL) || defined(NODE_PHY_SUN_SKY_ENV_MX) || defined(NODE_SKYDOME_LIGHT_AR) || defined(NODE_ENV_SPHERE_MY)\nvarying vec3 vWorldPosition;\n#endif\n#include \nvoid main() {\n#include \n#include \n#include \n#include \n#include \n#ifndef FLAT_SHADED\nvNormal = normalize(transformedNormal);\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvViewPosition = - mvPosition.xyz;\n#include \n#include \n#include \n#if defined(NODE_REFLECT_REFRACT_MX) || defined(NODE_BITMAP_ENV_MX) || defined(NODE_BUMP_BL) || defined(NODE_PHY_SUN_SKY_ENV_MX) || defined(NODE_SKYDOME_LIGHT_AR) || defined(NODE_ENV_SPHERE_MY)\nvWorldPosition = worldPosition.xyz;\n#endif\n#include \n}",lights_node_pars_fragment:"\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\nstruct NodeMaterial {\nvec3 diffuseColor;\nvec3 specularColor;\nvec3 refractionColor;\nfloat refractionRoughness;\nfloat refractionIOR;\n#ifdef CLEARCOAT\nfloat clearcoat;\nfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\nvec3 sheenColor;\nfloat sheenRoughness;\n#endif\n#ifdef PHYSICAL\nvec3 fresnelRefl90;\nfloat specularRoughness;\n#else\nfloat diffuseIntensity;\nfloat specularIntensity;\nfloat specularHardness;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\n#define BLENDER_SPECULAR_COEFFICIENT 0.08\nfloat shadeSpecPhong(vec3 normal, vec3 lightDir, vec3 viewDir, float hard)\n{\nfloat specFac;\nvec3 h = normalize(lightDir + viewDir);\nfloat rslt = max(dot(h, normal), 0.0);\nspecFac = pow(rslt, hard);\nreturn specFac;\n}\nfloat clearcoatDHRApprox(const in float roughness, const in float dotNL) {\nreturn DEFAULT_SPECULAR_COEFFICIENT + (1.0 - DEFAULT_SPECULAR_COEFFICIENT) * (pow(1.0 - dotNL, 5.0) * pow(1.0 - roughness, 2.0));\n}\n#if NUM_RECT_AREA_LIGHTS > 0\nvoid RE_Direct_RectArea_Node(const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in NodeMaterial material, inout ReflectedLight reflectedLight) {\nvec3 normal = geometry.normal;\nvec3 viewDir = geometry.viewDir;\nvec3 position = geometry.position;\nvec3 lightPos = rectAreaLight.position;\nvec3 halfWidth = rectAreaLight.halfWidth;\nvec3 halfHeight = rectAreaLight.halfHeight;\nvec3 lightColor = rectAreaLight.color;\nfloat roughness = material.specularRoughness;\nvec3 rectCoords[4];\nrectCoords[0] = lightPos + halfWidth - halfHeight;\nrectCoords[1] = lightPos - halfWidth - halfHeight;\nrectCoords[2] = lightPos - halfWidth + halfHeight;\nrectCoords[3] = lightPos + halfWidth + halfHeight;\nvec2 uv = LTC_Uv(normal, viewDir, roughness);\nvec4 t1 = texture2D(ltc_1, uv);\nvec4 t2 = texture2D(ltc_2, uv);\nmat3 mInv = mat3(\nvec3(t1.x, 0, t1.y),\nvec3( 0, 1, 0),\nvec3(t1.z, 0, t1.w)\n);\nvec3 fresnel = (material.specularColor * t2.x + (vec3(1.0) - material.specularColor) * t2.y);\nreflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate(normal, viewDir, position, mInv, rectCoords);\nreflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate(normal, viewDir, position, mat3(1.0), rectCoords);\n}\n#endif\nvoid RE_DirectDiffuse_Node(const in IncidentLight directLight,\nconst in GeometricContext geometry, const in NodeMaterial material,\ninout ReflectedLight reflectedLight) {\nfloat dotNL = saturate(dot(geometry.normal, directLight.direction));\nvec3 irradiance = dotNL * directLight.color;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nirradiance *= PI;\n#endif\n#ifdef PHYSICAL\n#ifdef CLEARCOAT\nfloat ccDotNL = saturate(dot(geometry.clearcoatNormal, directLight.direction));\nfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox(material.clearcoatRoughness, ccDotNL);\n#else\nfloat clearcoatDHR = 0.0;\n#endif\nreflectedLight.directDiffuse += (1.0 - clearcoatDHR) * irradiance\n* BRDF_Diffuse_Lambert(material.diffuseColor);\n#else\nreflectedLight.directDiffuse += irradiance * material.diffuseIntensity\n* BRDF_Diffuse_Lambert(material.diffuseColor);\n#endif\n}\nvoid RE_DirectSpecular_Node(const in IncidentLight directLight,\nconst in GeometricContext geometry, const in NodeMaterial material,\ninout ReflectedLight reflectedLight) {\nfloat dotNL = saturate(dot(geometry.normal, directLight.direction));\nvec3 irradiance = dotNL * directLight.color;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nirradiance *= PI;\n#endif\n#ifdef PHYSICAL\n#ifdef CLEARCOAT\nfloat ccDotNL = saturate(dot(geometry.clearcoatNormal, directLight.direction));\nvec3 ccIrradiance = ccDotNL * directLight.color;\n#ifndef PHYSICALLY_CORRECT_LIGHTS\nccIrradiance *= PI;\n#endif\n#endif\n#ifdef CLEARCOAT\nfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox(material.clearcoatRoughness, ccDotNL);\n#else\nfloat clearcoatDHR = 0.0;\n#endif\nreflectedLight.directSpecular += (1.0 - clearcoatDHR) * irradiance\n* BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.normal,\nmaterial.specularColor, material.specularRoughness);\n#ifdef CLEARCOAT\nreflectedLight.directSpecular += ccIrradiance * material.clearcoat\n* BRDF_Specular_GGX(directLight, geometry.viewDir, geometry.clearcoatNormal,\nvec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearcoatRoughness);\n#endif\n#ifdef USE_SHEEN\nreflectedLight.directSpecular += (1.0 - clearcoatDHR) * irradiance * BRDF_Specular_Sheen(\nmaterial.sheenRoughness,\ndirectLight.direction,\ngeometry,\nmaterial.sheenColor\n);\n#endif\n#else\nreflectedLight.directSpecular += material.specularIntensity *\nshadeSpecPhong(geometry.normal, directLight.direction,\ngeometry.viewDir, material.specularHardness) *\ndirectLight.color * material.specularColor;\n#endif\n}\nvoid RE_IndirectDiffuse_Node(const in vec3 irradiance, const in vec3 iblIrradiance,\nconst in GeometricContext geometry, const in NodeMaterial material,\ninout ReflectedLight reflectedLight) {\nreflectedLight.indirectDiffuse += (irradiance + iblIrradiance)\n* BRDF_Diffuse_Lambert(material.diffuseColor);\n}\nvoid RE_IndirectSpecular_Node(const in vec3 radiance, const in vec3 irradiance,\nconst in vec3 clearcoatRadiance, const in GeometricContext geometry,\nconst in NodeMaterial material, inout ReflectedLight reflectedLight) {\n#ifdef PHYSICAL\n#ifdef CLEARCOAT\nfloat ccDotNL = saturate(dot(geometry.clearcoatNormal, geometry.viewDir));\nfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox(\nmaterial.clearcoatRoughness, ccDotNL);\n#else\nfloat clearcoatDHR = 0.0;\n#endif\n#ifdef MT_BLENDER\n#ifdef COMPAT_USE_SPEC_ENV_BLENDER_APPROX\nvec3 specEnv = BRDF_Specular_GGX_Environment_Blender_Approx(geometry,\nmaterial.specularColor, material.fresnelRefl90,\nmaterial.specularRoughness, 0);\n#else\nvec3 specEnv = BRDF_Specular_GGX_Environment(geometry.viewDir,\ngeometry.normal, material.specularColor,\nmaterial.specularRoughness);\n#endif\n#elif defined(MT_MAX)\nfloat alphaEnv = pow2(pow2(material.specularRoughness));\nvec3 specEnv = material.specularColor / (1.0 - alphaEnv + PI * alphaEnv);\n#elif defined(MT_MAYA)\nvec3 specEnv = BRDF_Specular_GGX_Environment(geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n#else\nvec3 specEnv = vec3(1.0);\n#endif\nreflectedLight.indirectSpecular += (1.0 - clearcoatDHR) * radiance * specEnv;\n#ifdef CLEARCOAT\n#ifdef MT_BLENDER\nvec3 specEnvCC = BRDF_Specular_GGX_Environment(geometry.viewDir, geometry.clearcoatNormal, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearcoatRoughness);\n#elif defined(MT_MAX) || defined(MT_MAYA)\nvec3 specEnvCC = BRDF_Specular_GGX_Environment(geometry.viewDir, geometry.clearcoatNormal, vec3(DEFAULT_SPECULAR_COEFFICIENT), material.clearcoatRoughness);\n#else\nvec3 specEnvCC = vec3(1.0);\n#endif\nreflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * specEnvCC;\n#endif\n#endif\n}\nvoid RE_Refraction_Node(const vec3 refraction, const NodeMaterial material,\ninout vec3 refractedLight) {\nrefractedLight += refraction * material.refractionColor;\n}\n#ifdef MT_BLENDER\n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n#define Material_Refraction_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.refractionRoughness)\n#elif defined(MT_MAX)\n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness * exp(0.35*(1.0-pow2(material.specularRoughness))))\n#define Material_Refraction_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.refractionRoughness * exp(0.35*(1.0-pow2(material.refractionRoughness))))\n#else\n#define Material_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.specularRoughness)\n#define Material_Refraction_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.refractionRoughness)\n#endif\n#define Material_ClearCoat_BlinnShininessExponent(material) GGXRoughnessToBlinnExponent(material.clearcoatRoughness)\nfloat computeSpecularOcclusion(const in float dotNV, const in float ambientOcclusion, const in float roughness) {\nreturn saturate(pow(abs(dotNV + ambientOcclusion), exp2(- 16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);\n}\n#define RE_Direct_RectArea RE_Direct_RectArea_Node",lights_node_gtao_pars_fragment:"#ifdef USE_GTAO\nuniform sampler2D gtaoMap;\nuniform vec2 currResolution;\nfloat calcGTAOVisibilityFix(vec3 viewDir, vec3 normal) {\nfloat slopeCoeff = saturate(dot(viewDir, normal));\nreturn pow(2.0 / (slopeCoeff + 1.0), log2(PI) - 1.0);\n}\nfloat calcSolidAngle(float radiusAngle) {\nreturn PI2 * (1.0 - cos(radiusAngle));\n}\nfloat calcSolidAnglesIntersectionApprox(float radiusAngle0, float radiusAngle1,\nfloat distanceAngle) {\nfloat rp = radiusAngle0, rl = radiusAngle1, d = distanceAngle;\nfloat rDiff = abs(rp - rl);\nreturn PI2 * (1.0 - cos(min(rp, rl))) * smoothstep(0.0, 1.0, 1.0 -\n(d - rDiff) / (rp + rl - rDiff));\n}\nfloat calcGTSOVisibility(float aoVisibility, vec3 bentNormal, vec3 viewDir, vec3 normal,\nfloat roughness) {\naoVisibility = saturate(aoVisibility * calcGTAOVisibilityFix(viewDir, normal));\nfloat radiusAngleVisCone = acos(clamp(sqrt(1.0 - aoVisibility), -1.0, 1.0));\nfloat radiusAngleSpecCone = acos(clamp(exp2(-3.32193 * pow2(roughness)), -1.0, 1.0));\nradiusAngleSpecCone = max(0.001, radiusAngleSpecCone);\nvec3 specularConeAxis = -reflect(viewDir, normal);\nfloat distanceAngle = acos(clamp(dot(bentNormal, specularConeAxis), -1.0, 1.0));\nfloat solidAngleIntersection = calcSolidAnglesIntersectionApprox(\nradiusAngleVisCone, radiusAngleSpecCone, distanceAngle);\nfloat solidAngleSpecular = calcSolidAngle(radiusAngleSpecCone);\nfloat specVisibility = solidAngleIntersection / solidAngleSpecular;\nreturn mix(specVisibility, 1.0, aoVisibility);\n}\n#endif",lights_fragment_gtso:"#ifdef USE_GTAO\nreflectedLight.indirectSpecular *= calcGTSOVisibility(gtaoVisibility,\ngtaoBentNormal, gtaoViewDir, gtaoNormal, gtaoRoughness);\n#endif",normal_output_fragment:"#if NORMAL_OUTPUT == 1\ngl_FragColor = vec4(packNormalToRGB(normal), gl_FragColor.a);\n#endif",ssr_pars_fragment:"#ifdef USE_SSR\nuniform sampler2D ssrSourceBuffer;\nuniform sampler2D ssrDepthBuffer;\nuniform sampler2D ssrBackfaceDepthBuffer;\nuniform mat4 invProjectionMatrix;\nuniform vec2 ssrResolution;\nuniform float ssrThickness;\nuniform float ssrStride;\nuniform float ssrJitter;\nuniform float ssrMaxDistance;\n#ifdef USE_SSR_REFRACT\n#define STEPS_FADE_AMOUNT 0.1\n#define SCREEN_FADE_THRESHOLD 0.6\n#else\n#define STEPS_FADE_AMOUNT 1.0\n#define SCREEN_FADE_THRESHOLD 0.4\n#endif\nvec3 deproject(vec3 p) {\nvec4 res = invProjectionMatrix * vec4(p, 1);\nreturn res.xyz / res.w;\n}\nbool doesIntersect(float rayzmax, float rayzmin, vec2 uv) {\nfloat sceneZMin = texture2D(ssrDepthBuffer, uv).r;\n#ifdef USE_SSR_REFRACT\nreturn rayzmin >= (sceneZMin-ssrThickness) && rayzmax <= sceneZMin;\n#else\nfloat sceneZMax = texture2D(ssrBackfaceDepthBuffer, uv).r;\nreturn rayzmin >= sceneZMax && rayzmax <= sceneZMin;\n#endif\n}\nfloat distanceSquared(vec2 a, vec2 b) { a -= b; return dot(a, a); }\nvoid swapIfBigger(inout float a, inout float b) {\nif (a > b) {\nfloat t = a;\na = b;\nb = t;\n}\n}\nbool isOutsideUvBounds(float x) { return x < 0.0 || x > 1.0; }\nbool isOutsideUvBounds(vec2 uv) { return isOutsideUvBounds(uv.x) || isOutsideUvBounds(uv.y); }\nvec3 computeSSR(vec3 color, vec3 normal, float ior) {\nvec2 uv = gl_FragCoord.xy / ssrResolution;\nvec2 screenCoord = uv * 2.0 - vec2(1, 1);\nfloat nearClip = deproject(vec3(0, 0, -1)).z;\nvec3 ray = deproject(vec3(screenCoord, -1));\nray /= ray.z;\nfloat depthSample = -vViewPosition.z;\nvec3 vpos = depthSample * ray;\n#ifdef USE_SSR_REFRACT\nvec3 dir = normalize(refract(normalize(vpos), normalize(normal), 1.0/ior));\n#else\nvec3 dir = normalize(reflect(normalize(vpos), normalize(normal)));\n#endif\nfloat maxDist = ssrMaxDistance;\nfloat rayLength = (vpos.z + dir.z * maxDist) > nearClip ? (nearClip - vpos.z) / dir.z : maxDist;\nvec3 csOrig = vpos;\nvec3 csEndPoint = csOrig + dir * rayLength;\nvec4 H0 = projectionMatrix * vec4(csOrig, 1.0);\nvec4 H1 = projectionMatrix * vec4(csEndPoint, 1.0);\nfloat k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\nvec3 Q0 = csOrig.xyz * k0, Q1 = csEndPoint.xyz * k1;\nvec2 P0 = H0.xy * k0, P1 = H1.xy * k1;\nP0 = P0 * 0.5 + vec2(0.5), P1 = P1 * 0.5 + vec2(0.5);\n#ifndef SSR_SIMPLE_REFRACT\nP0 *= ssrResolution, P1 *= ssrResolution;\nP1 += vec2((distanceSquared(P0, P1) < 0.0001) ? 0.01 : 0.0);\nvec2 delta = P1 - P0;\nbool permute = false;\nif (abs(delta.x) < abs(delta.y)) {\npermute = true; delta = delta.yx; P0 = P0.yx; P1 = P1.yx;\n}\nfloat stepDir = sign(delta.x);\nfloat invdx = stepDir / delta.x;\nvec3 dQ = (Q1 - Q0) * invdx;\nfloat dk = (k1 - k0) * invdx;\nvec2 dP = vec2(stepDir, delta.y * invdx);\nfloat pixelStride = ssrStride;\nfloat jitterMod = (gl_FragCoord.x + gl_FragCoord.y) * 0.25;\nvec4 PQK = vec4(P0, Q0.z, k0);\nvec4 dPQK = vec4(dP, dQ.z, dk);\ndPQK *= pixelStride;\nPQK += dPQK * mod(jitterMod, 1.0) * ssrJitter;\nfloat end = P1.x * stepDir;\nfloat prevZMaxEstimate = PQK.z / PQK.w;\nfloat rayZMin = prevZMaxEstimate, rayZMax = prevZMaxEstimate;\nfloat stepped = 0.0;\nvec2 hitUV;\nbool intersected = false;\nfor (float stepCount = 1.0; stepCount <= float(MAX_STEPS); stepCount ++) {\nPQK += dPQK;\nrayZMin = prevZMaxEstimate;\nrayZMax = (dPQK.z * 0.5 + PQK.z) / (dPQK.w * 0.5 + PQK.w);\nprevZMaxEstimate = rayZMax;\nswapIfBigger(rayZMax, rayZMin);\n\nstepped = stepCount;\nhitUV = (permute ? PQK.yx: PQK.xy) / ssrResolution;\nif (isOutsideUvBounds(hitUV)) break;\nintersected = doesIntersect(rayZMax, rayZMin, hitUV);\nif (intersected || (P0.x * stepDir) > end) break;\n}\nif (intersected && pixelStride > 1.0) {\nPQK -= dPQK;\ndPQK /= ssrStride;\nfloat ogStride = pixelStride * 0.5;\nfloat currStride = pixelStride;\nprevZMaxEstimate = PQK.z / PQK.w;\nrayZMin = prevZMaxEstimate, rayZMax = prevZMaxEstimate;\nfor(int j = 0; j < int(BINARY_SEARCH_ITERATIONS); j ++) {\nPQK += dPQK * currStride;\nrayZMin = prevZMaxEstimate;\nrayZMax = (dPQK.z * 0.5 + PQK.z) / (dPQK.w * 0.5 + PQK.w);\nprevZMaxEstimate = rayZMax;\nswapIfBigger(rayZMax, rayZMin);\nvec2 newUV = (permute ? PQK.yx: PQK.xy) / ssrResolution;\nogStride *= 0.5;\nif (doesIntersect(rayZMax, rayZMin, newUV)) {\nhitUV = newUV;\ncurrStride = -ogStride;\n} else {\ncurrStride = ogStride;\n}\n}\n}\nvec3 result = color;\n#ifdef USE_SSR_REFRACT\n#endif\nif (intersected) {\nvec4 col = sRGBToLinear(texture2D(ssrSourceBuffer, hitUV));\nvec2 ndc = abs(hitUV * 2.0 - 1.0);\nfloat maxndc = max(ndc.x, ndc.y);\nfloat fadeVal =\n(1.0 - (max(0.0, maxndc - SCREEN_FADE_THRESHOLD) / (1.0 - SCREEN_FADE_THRESHOLD))) *\n(1.0 - STEPS_FADE_AMOUNT * (stepped / float(MAX_STEPS)));\ncol.a = fadeVal;\nresult = mix(result, col.rgb, col.a);\n}\n#else\nvec3 result = sRGBToLinear(texture2D(ssrSourceBuffer, P1)).xyz;\n#endif\nreturn result;\n}\n#endif",plane_reflection_pars_vertex:"#ifdef USE_PLANE_REFLECTION\nuniform mat4 planeReflTextureMatrix;\nvarying vec4 vPlaneReflUv;\n#endif",plane_reflection_pars_fragment:"#ifdef USE_PLANE_REFLECTION\nuniform sampler2D planeReflTexture;\nuniform mat4 planeReflTextureMatrix;\nuniform vec3 planeReflDir;\nuniform vec3 planeReflBoundingBoxMin;\nuniform vec3 planeReflBoundingBoxMax;\nuniform mat4 planeReflInvModelMatrix;\nuniform float planeReflFalloff;\nvarying vec4 vPlaneReflUv;\nvec3 computePlaneReflection(vec3 radiance, float roughness, vec3 position, vec3 normal) {\nvec3 posRefl = (planeReflInvModelMatrix * invViewMatrix * vec4(position, 1.0)).xyz;\nif (any(lessThan(posRefl, planeReflBoundingBoxMin)) || any(greaterThan(posRefl, planeReflBoundingBoxMax)))\nreturn radiance;\nvec3 norWorld = transformDirection(normal, invViewMatrix);\nvec4 uvNormalOffset = planeReflTextureMatrix * vec4(norWorld - planeReflDir, 0.0);\nvec3 result = planeReflProbeTexelToLinear(texture2DProj(planeReflTexture, vPlaneReflUv + uvNormalOffset)).rgb;\nfloat falloffFactor;\nif (planeReflFalloff < EPSILON)\nfalloffFactor = 0.0;\nelse if (posRefl.y > 0.0)\nfalloffFactor = 1.0 - clamp((planeReflBoundingBoxMax.y - posRefl.y) / (planeReflBoundingBoxMax.y * (planeReflFalloff)), 0.0, 1.0);\nelse\nfalloffFactor = 1.0 - clamp((planeReflBoundingBoxMin.y - posRefl.y) / (planeReflBoundingBoxMin.y * (planeReflFalloff)), 0.0, 1.0);\nresult = mix(result, radiance, falloffFactor);\nresult = mix(result, radiance, (roughness < 0.0526) ? 0.0 : saturate(10.0*roughness));\nreturn result;\n}\n#endif",plane_reflection_vertex:"#ifdef USE_PLANE_REFLECTION\nvPlaneReflUv = planeReflTextureMatrix * modelMatrix * vec4(position, 1.0);\n#endif",node_common_frag:"\n#define LUM_WEIGHTS vec3(0.2126, 0.7152, 0.0722)\n#define LUM_WEIGHTS_MAYA vec3(0.3, 0.59, 0.11)\n#define LUMENS_PER_WATT 683.0\n#define MAX_ENV_COORDS_DIR 0\n#define MAX_ENV_COORDS_REFLECT 1\n#define MAX_ENV_COORDS_REFRACT 2\nvec4 nodeTexelToLinear(in vec4 color, in int sourceType) {\nif (sourceType == 1)\nreturn sRGBToLinear(color);\nelse if (sourceType == 2)\nreturn RGBEToLinear(color);\nelse\nreturn color;\n}\n#if defined(NODE_COLOR_CONVERT_AR) || defined(NODE_COLOR_CORRECT_AR) || defined(NODE_COMBHSV_BL) || defined(NODE_SEPHSV_BL) || defined(NODE_HUE_SAT_BL) || defined(NODE_COLOR_CORRECTION_MX) || defined(NODE_COMPOSITE_LAYER_MX) || defined(NODE_COLOR_CORRECT_MY) || defined(USE_OSL)\n#define HSV_NODES\n#endif\n#if defined HSV_NODES\nvoid hsvToRGB(vec4 hsv, out vec4 outCol)\n{\nfloat i, f, p, q, t, h, s, v;\nvec3 rgb;\nh = hsv[0];\ns = hsv[1];\nv = hsv[2];\nif (s == 0.0)\nrgb = vec3(v, v, v);\nelse {\nif (h == 1.0)\nh = 0.0;\nh *= 6.0;\ni = floor(h);\nf = h - i;\nrgb = vec3(f, f, f);\np = v * (1.0 - s);\nq = v * (1.0 - (s * f));\nt = v * (1.0 - (s * (1.0 - f)));\nif (i == 0.0)\nrgb = vec3(v, t, p);\nelse if (i == 1.0)\nrgb = vec3(q, v, p);\nelse if (i == 2.0)\nrgb = vec3(p, v, t);\nelse if (i == 3.0)\nrgb = vec3(p, q, v);\nelse if (i == 4.0)\nrgb = vec3(t, p, v);\nelse\nrgb = vec3(v, p, q);\n}\noutCol = vec4(rgb, hsv.w);\n}\nvoid rgbToHSV(vec4 rgb, out vec4 outCol)\n{\nfloat cmax, cmin, h, s, v, cdelta;\nvec3 c;\ncmax = max(rgb[0], max(rgb[1], rgb[2]));\ncmin = min(rgb[0], min(rgb[1], rgb[2]));\ncdelta = cmax - cmin;\nv = cmax;\nif (cmax != 0.0)\ns = cdelta / cmax;\nelse {\ns = 0.0;\nh = 0.0;\n}\nif (s == 0.0)\nh = 0.0;\nelse {\nc = (vec3(cmax, cmax, cmax) - rgb.xyz) / cdelta;\nif (rgb.x == cmax) h = c[2] - c[1];\nelse if (rgb.y == cmax) h = 2.0 + c[0] - c[2];\nelse h = 4.0 + c[1] - c[0];\nh /= 6.0;\nif (h < 0.0)\nh += 1.0;\n}\noutCol = vec4(h, s, v, rgb.w);\n}\n#endif\nbool isPerspective(const mat4 projMatrix)\n{\nreturn (projMatrix[3][3] == 0.0);\n}\n#if defined(NODE_REFLECT_REFRACT_MX) || defined(NODE_BITMAP_ENV_MX) || defined(NODE_SKYDOME_LIGHT_AR) || defined(NODE_ENV_SPHERE_MY)\nvec4 sampleEquirectangular(sampler2D map, vec3 reflectVec, mat3 uvTransform, int encoding)\n{\nreflectVec = normalize(reflectVec);\nvec2 sampleUV;\nsampleUV.y = asin(clamp(reflectVec.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\nsampleUV.x = atan(reflectVec.x, reflectVec.z) * RECIPROCAL_PI2 + 0.5;\nsampleUV.y *= -1.0;\nconst float seamWidth = 0.15;\nconst float seamBiasFactor = -10.0;\nfloat seam = max(0.0, 1.0 - abs (reflectVec.x) / seamWidth) *\nclamp (1.0 - reflectVec.z / seamWidth, 0.0, 1.0);\nsampleUV = (uvTransform * vec3(sampleUV, 1.0)).xy;\nvec4 color = texture2D(map, sampleUV, seamBiasFactor * seam);\ncolor = nodeTexelToLinear(color, encoding);\nreturn color;\n}\n#endif\n#if defined(NODE_FRESNEL_BL) || defined(NODE_LAYER_WEIGHT_BL) || defined(NODE_FALLOFF_MX) || defined(NODE_BSDF_GLASS_BL) || defined(NODE_BSDF_PRINCIPLED_BL)\nfloat fresnelReflection(const vec3 dir, const vec3 normal, const float ior) {\nfloat cosTheta = clamp(abs(dot(dir, normal)), -1.0, 1.0);\nfloat gSquared = pow2(ior) + pow2(cosTheta) - 1.0;\nif (gSquared < 0.0) return 1.0;\nfloat g = sqrt(gSquared);\nreturn 0.5 * pow2((g - cosTheta) / (g + cosTheta))\n* (1.0 + pow2(\n((g + cosTheta) * cosTheta - 1.0) /\n((g - cosTheta) * cosTheta + 1.0)\n));\n}\n#endif\n#if defined(NODE_BITMAP_MX) || defined(NODE_BITMAP_ENV_MX) || defined(NODE_GRADIENT_RAMP_MX)\n#define MAPPING_EXPLICIT_MAP_CHANNEL 1\n#define MAPPING_VERTEX_COLOR_CHANNEL 2\n#define MAPPING_PLANAR_OBJECT_XYZ 3\n#define MAPPING_PLANAR_WORLD_XYZ 4\n#define AXIS_XY 1\n#define AXIS_YZ 2\n#define AXIS_ZX 3\n#endif\n#if defined(NODE_BITMAP_MX) || defined(NODE_BITMAP_ENV_MX) || defined(NODE_BUMP_MX) || defined(NODE_GRADIENT_RAMP_MX) || defined(NODE_PLACE_2D_TEXTURE_MY)\nmat3 calcUvTransform(float uOffset, float vOffset, float uTiling, float vTiling, float wAngle)\n{\nif (abs(uOffset) < EPSILON && abs(vOffset) < EPSILON &&\n(abs(uTiling - 1.0)) < EPSILON && (abs(vTiling - 1.0)) < EPSILON &&\nabs(wAngle) < EPSILON)\nreturn mat3(1.0);\nfloat sx = uTiling;\nfloat sy = vTiling;\nfloat c = cos(-wAngle);\nfloat s = sin(-wAngle);\n#if defined(NODE_PLACE_2D_TEXTURE_MY)\nfloat tx = uOffset;\nfloat ty = vOffset;\nfloat cx = 0.5;\nfloat cy = 0.5;\nreturn mat3(c*sx, s*sx, 0.0,\n-s*sy, c*sy, 0.0,\ns*(ty+sy-cy)+c*(tx-cx)+cx, -c*(ty+sy-cy)+s*(tx-cx)-cy+1.0, 1.0);\n#else\nfloat tx = -uOffset;\nfloat ty = -vOffset;\nfloat cx = uOffset + 0.5;\nfloat cy = vOffset + 0.5;\nreturn mat3(sx * c, -sy * s, 0.0,\nsx * s, sy * c, 0.0,\n-sx * (c * cx + s * cy) + cx + tx, -sy * (- s * cx + c * cy) + cy + ty, 1.0);\n#endif\n}\n#endif\n#if defined(NODE_NOISE_MX)\nmat4 calcXYZTransform(vec3 offset, vec3 tiling, vec3 angle) {\nmat4 rot = mat4(\ncos(angle.y)*cos(angle.z), cos(angle.x)*sin(angle.z)+sin(angle.x)*sin(angle.y)*cos(angle.z), sin(angle.x)*sin(angle.z)-cos(angle.x)*sin(angle.y)*cos(angle.z), 0.0,\n-cos(angle.y)*sin(angle.z), cos(angle.x)*cos(angle.z)-sin(angle.x)*sin(angle.y)*sin(angle.z), cos(angle.x)*sin(angle.y)*sin(angle.z)+sin(angle.x)*cos(angle.z), 0.0,\nsin(angle.y), -sin(angle.x)*cos(angle.y), cos(angle.x)*cos(angle.y), 0.0,\n0.0, 0.0, 0.0, 1.0\n);\nmat4 til = mat4(\ntiling.x, 0.0, 0.0, 0.0,\n0.0, tiling.y, 0.0, 0.0,\n0.0, 0.0, tiling.z, 0.0,\n0.0, 0.0, 0.0, 1.0\n);\nmat4 off = mat4(\n1.0, 0.0, 0.0, 0.0,\n0.0, 1.0, 0.0, 0.0,\n0.0, 0.0, 1.0, 0.0,\noffset.x, offset.y, offset.z, 1.0\n);\nreturn (til * rot * off);\n}\n#endif\n#if defined(NODE_TEX_NOISE_BL) || defined(NODE_TEX_WAVE_BL) || defined(NODE_NOISE_MX) || defined(USE_OSL) || defined(NODE_NOISE_MY)\n#define NOISE_AMP_HACK 0.75\n#define NOISE_BLENDER_MEAN 0.78\n#define NOISE_SCALE_HACK 0.5\n#define noiseModulo(x) (x - floor(x * (1.0 / 289.0)) * 289.0)\nvec4 noisePermute(vec4 x) {\nreturn noiseModulo(((x * 34.0) + 1.0) * x);\n}\nvec4 taylorInvSqrt(vec4 r) {\nreturn 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat taylorInvSqrt(float r) {\nreturn 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat noisePerlin(vec3 v) {\nconst vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\nconst vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\nvec3 i = floor(v + dot(v, C.yyy));\nvec3 x0 = v - i + dot(i, C.xxx);\nvec3 g = step(x0.yzx, x0.xyz);\nvec3 l = 1.0 - g;\nvec3 i1 = min(g.xyz, l.zxy);\nvec3 i2 = max(g.xyz, l.zxy);\nvec3 x1 = x0 - i1 + C.xxx;\nvec3 x2 = x0 - i2 + C.yyy;\nvec3 x3 = x0 - D.yyy;\ni = noiseModulo(i);\nvec4 p = noisePermute(noisePermute(noisePermute(i.z + vec4(0.0, i1.z, i2.z, 1.0))\n+ i.y + vec4(0.0, i1.y, i2.y, 1.0)) + i.x + vec4(0.0, i1.x, i2.x, 1.0));\nfloat n_ = 0.142857142857;\nvec3 ns = n_ * D.wyz - D.xzx;\nvec4 j = p - 49.0 * floor(p * ns.z * ns.z);\nvec4 x_ = floor(j * ns.z);\nvec4 y_ = floor(j - 7.0 * x_);\nvec4 x = x_ * ns.x + ns.yyyy;\nvec4 y = y_ * ns.x + ns.yyyy;\nvec4 h = 1.0 - abs(x) - abs(y);\nvec4 b0 = vec4(x.xy, y.xy);\nvec4 b1 = vec4(x.zw, y.zw);\nvec4 s0 = floor(b0) * 2.0 + 1.0;\nvec4 s1 = floor(b1) * 2.0 + 1.0;\nvec4 sh = -step(h, vec4(0.0));\nvec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\nvec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\nvec3 p0 = vec3(a0.xy, h.x);\nvec3 p1 = vec3(a0.zw, h.y);\nvec3 p2 = vec3(a1.xy, h.z);\nvec3 p3 = vec3(a1.zw, h.w);\nvec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\np0 *= norm.x;\np1 *= norm.y;\np2 *= norm.z;\np3 *= norm.w;\nvec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\nm = m * m;\nreturn 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1),\ndot(p2, x2), dot(p3, x3)));\n}\nvec4 permute(vec4 x) {\nreturn mod(((x*34.0)+1.0)*x, 289.0);\n}\nfloat permute(float x) {\nreturn floor(mod(((x*34.0)+1.0)*x, 289.0));\n}\nvec4 grad4(float j, vec4 ip) {\nconst vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\nvec4 p,s;\np.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\np.w = 1.5 - dot(abs(p.xyz), ones.xyz);\ns = vec4(lessThan(p, vec4(0.0)));\np.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\nreturn p;\n}\nfloat snoise(vec4 v) {\nconst vec2 C = vec2(0.138196601125010504,\n0.309016994374947451);\nvec4 i = floor(v + dot(v, C.yyyy) );\nvec4 x0 = v - i + dot(i, C.xxxx);\nvec4 i0;\nvec3 isX = step( x0.yzw, x0.xxx );\nvec3 isYZ = step( x0.zww, x0.yyz );\ni0.x = isX.x + isX.y + isX.z;\ni0.yzw = 1.0 - isX;\ni0.y += isYZ.x + isYZ.y;\ni0.zw += 1.0 - isYZ.xy;\ni0.z += isYZ.z;\ni0.w += 1.0 - isYZ.z;\nvec4 i3 = clamp( i0, 0.0, 1.0 );\nvec4 i2 = clamp( i0-1.0, 0.0, 1.0 );\nvec4 i1 = clamp( i0-2.0, 0.0, 1.0 );\nvec4 x1 = x0 - i1 + 1.0 * C.xxxx;\nvec4 x2 = x0 - i2 + 2.0 * C.xxxx;\nvec4 x3 = x0 - i3 + 3.0 * C.xxxx;\nvec4 x4 = x0 - 1.0 + 4.0 * C.xxxx;\ni = mod(i, 289.0);\nfloat j0 = permute( permute( permute( permute(i.w) + i.z) + i.y) + i.x);\nvec4 j1 = permute( permute( permute( permute (\ni.w + vec4(i1.w, i2.w, i3.w, 1.0 ))\n+ i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))\n+ i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))\n+ i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));\nvec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\nvec4 p0 = grad4(j0, ip);\nvec4 p1 = grad4(j1.x, ip);\nvec4 p2 = grad4(j1.y, ip);\nvec4 p3 = grad4(j1.z, ip);\nvec4 p4 = grad4(j1.w, ip);\nvec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\np0 *= norm.x;\np1 *= norm.y;\np2 *= norm.z;\np3 *= norm.w;\np4 *= taylorInvSqrt(dot(p4,p4));\nvec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\nvec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0);\nm0 = m0 * m0;\nm1 = m1 * m1;\nreturn 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))\n+ dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;\n}\nfloat noiseBlender(vec3 p) {\nreturn 0.5 * NOISE_AMP_HACK * (noisePerlin(NOISE_SCALE_HACK * vec3(p.x, p.y, p.z))) + 0.5;\n}\nfloat noiseSmooth(vec3 p, float octaveLenPerPixel, float falloffFactor,\nfloat dispersionFactor) {\nfloat mixFac = mix(1.0, smoothstep(0.0, 1.0, octaveLenPerPixel) * falloffFactor,\ndispersionFactor);\nreturn mix(noiseBlender(p), NOISE_BLENDER_MEAN, mixFac);\n}\n#define MAX_OCTAVES_NUM 16\nfloat noiseTurbulence(vec3 p, float octaves, float octaveLenPerPixel,\nfloat falloffFactor, float dispersionFactor) {\nfloat fscale = 1.0;\nfloat amp = 1.0;\nfloat sum = 0.0;\noctaves = clamp(octaves, 0.0, 16.0);\nint octavesInt = int(octaves);\nfor (int i = 0; i <= MAX_OCTAVES_NUM; i++) {\n#if __VERSION__ == 300\nif (i <= octavesInt) {\nfloat t = noiseSmooth(fscale * p, octaveLenPerPixel, falloffFactor,\ndispersionFactor);\nsum += t * amp;\namp *= 0.5;\nfscale *= 2.0;\noctaveLenPerPixel *= 2.0;\n} else {\ni = MAX_OCTAVES_NUM;\n}\n#else\nif (i > octavesInt) break;\nfloat t = noiseSmooth(fscale * p, octaveLenPerPixel, falloffFactor,\ndispersionFactor);\nsum += t * amp;\namp *= 0.5;\nfscale *= 2.0;\noctaveLenPerPixel *= 2.0;\n#endif\n}\nfloat octavesFrac = fract(octaves);\nfloat octavesCoeff = pow(2.0, float(octavesInt));\nif (octavesFrac != 0.0) {\nfloat t = noiseSmooth(fscale * p, octaveLenPerPixel, falloffFactor,\ndispersionFactor);\nfloat sum2 = sum + t * amp;\nsum *= octavesCoeff / (2.0 * octavesCoeff - 1.0);\nsum2 *= 2.0 * octavesCoeff / (4.0 * octavesCoeff - 1.0);\nreturn mix(sum, sum2, octavesFrac);\n} else {\nreturn sum * octavesCoeff / (2.0 * octavesCoeff - 1.0);\n}\n}\n#endif\n#if (defined(USE_OSL) || defined(NODE_WAVELENGTH_BL)) && __VERSION__ == 300\nvec3 cieColorMatch[81] = vec3[](\nvec3(0.0014,0.0000,0.0065), vec3(0.0022,0.0001,0.0105), vec3(0.0042,0.0001,0.0201),\nvec3(0.0076,0.0002,0.0362), vec3(0.0143,0.0004,0.0679), vec3(0.0232,0.0006,0.1102),\nvec3(0.0435,0.0012,0.2074), vec3(0.0776,0.0022,0.3713), vec3(0.1344,0.0040,0.6456),\nvec3(0.2148,0.0073,1.0391), vec3(0.2839,0.0116,1.3856), vec3(0.3285,0.0168,1.6230),\nvec3(0.3483,0.0230,1.7471), vec3(0.3481,0.0298,1.7826), vec3(0.3362,0.0380,1.7721),\nvec3(0.3187,0.0480,1.7441), vec3(0.2908,0.0600,1.6692), vec3(0.2511,0.0739,1.5281),\nvec3(0.1954,0.0910,1.2876), vec3(0.1421,0.1126,1.0419), vec3(0.0956,0.1390,0.8130),\nvec3(0.0580,0.1693,0.6162), vec3(0.0320,0.2080,0.4652), vec3(0.0147,0.2586,0.3533),\nvec3(0.0049,0.3230,0.2720), vec3(0.0024,0.4073,0.2123), vec3(0.0093,0.5030,0.1582),\nvec3(0.0291,0.6082,0.1117), vec3(0.0633,0.7100,0.0782), vec3(0.1096,0.7932,0.0573),\nvec3(0.1655,0.8620,0.0422), vec3(0.2257,0.9149,0.0298), vec3(0.2904,0.9540,0.0203),\nvec3(0.3597,0.9803,0.0134), vec3(0.4334,0.9950,0.0087), vec3(0.5121,1.0000,0.0057),\nvec3(0.5945,0.9950,0.0039), vec3(0.6784,0.9786,0.0027), vec3(0.7621,0.9520,0.0021),\nvec3(0.8425,0.9154,0.0018), vec3(0.9163,0.8700,0.0017), vec3(0.9786,0.8163,0.0014),\nvec3(1.0263,0.7570,0.0011), vec3(1.0567,0.6949,0.0010), vec3(1.0622,0.6310,0.0008),\nvec3(1.0456,0.5668,0.0006), vec3(1.0026,0.5030,0.0003), vec3(0.9384,0.4412,0.0002),\nvec3(0.8544,0.3810,0.0002), vec3(0.7514,0.3210,0.0001), vec3(0.6424,0.2650,0.0000),\nvec3(0.5419,0.2170,0.0000), vec3(0.4479,0.1750,0.0000), vec3(0.3608,0.1382,0.0000),\nvec3(0.2835,0.1070,0.0000), vec3(0.2187,0.0816,0.0000), vec3(0.1649,0.0610,0.0000),\nvec3(0.1212,0.0446,0.0000), vec3(0.0874,0.0320,0.0000), vec3(0.0636,0.0232,0.0000),\nvec3(0.0468,0.0170,0.0000), vec3(0.0329,0.0119,0.0000), vec3(0.0227,0.0082,0.0000),\nvec3(0.0158,0.0057,0.0000), vec3(0.0114,0.0041,0.0000), vec3(0.0081,0.0029,0.0000),\nvec3(0.0058,0.0021,0.0000), vec3(0.0041,0.0015,0.0000), vec3(0.0029,0.0010,0.0000),\nvec3(0.0020,0.0007,0.0000), vec3(0.0014,0.0005,0.0000), vec3(0.0010,0.0004,0.0000),\nvec3(0.0007,0.0002,0.0000), vec3(0.0005,0.0002,0.0000), vec3(0.0003,0.0001,0.0000),\nvec3(0.0002,0.0001,0.0000), vec3(0.0002,0.0001,0.0000), vec3(0.0001,0.0000,0.0000),\nvec3(0.0001,0.0000,0.0000), vec3(0.0001,0.0000,0.0000), vec3(0.0000,0.0000,0.0000)\n);\n#endif\n#if defined(USE_OSL) || defined(NODE_BLACKBODY_BL)\nvec3 colorTempToRGB(float temp)\n{\nvec3 retColor;\ntemp = clamp(temp, 100.0, 40000.0) / 100.0;\nif (temp <= 66.0) {\nretColor.r = 1.0;\nretColor.g = saturate(0.390081578 * log(temp) - 0.631841443);\n} else {\nfloat t = temp - 60.0;\nretColor.r = saturate(1.292936186 * pow(t, -0.133204759));\nretColor.g = saturate(1.129890860 * pow(t, -0.075514849));\n}\nif (temp >= 66.0)\nretColor.b = 1.0;\nelse if (temp <= 19.0)\nretColor.b = 0.0;\nelse\nretColor.b = saturate(0.543206789 * log(temp - 10.0) - 1.196254089);\nreturn retColor;\n}\n#endif\n#ifdef USE_OSL\n#define M_PI PI\n#define M_PI_2 PI / 2.0\n#define M_PI_4 PI / 4.0\n#define M_2_PI 2.0 / PI\n#define M_2PI 2.0 * PI\n#define M_4PI 4.0 * PI\n#define M_2_SQRTPI 2.0 / sqrt(PI)\n#define M_E 2.718281828459\n#define M_LN2 0.69314718056\n#define M_LN10 2.30258509299\n#define M_LOG2E 1.4426950409\n#define M_LOG10E 0.43429448190\n#define M_SQRT2 sqrt(2.0)\n#define M_SQRT1_2 sqrt(0.5)\n#define OSL_ALPHA 33633\n#define OSL_ANISOTROPIC 40205\n#define OSL_AVERAGEALPHA 57701\n#define OSL_AVERAGECOLOR 46077\n#define OSL_BANDWIDTH 37485\n#define OSL_BEZIER 27645\n#define OSL_BLACK 62409\n#define OSL_BSPLINE 16959\n#define OSL_CAMERA 8198\n#define OSL_CAMERA_CLIP 34380\n#define OSL_CAMERA_CLIP_FAR 31933\n#define OSL_CAMERA_CLIP_NEAR 21485\n#define OSL_CAMERA_FOV 60706\n#define OSL_CAMERA_PIXELASPECT 4950\n#define OSL_CAMERA_PROJECTION 29369\n#define OSL_CAMERA_RESOLUTION 39679\n#define OSL_CAMERA_SCREEN_WINDOW 47009\n#define OSL_CAMERA_SHUTTER 7107\n#define OSL_CAMERA_SHUTTER_CLOSE 34406\n#define OSL_CAMERA_SHUTTER_OPEN 40085\n#define OSL_CATMULL_ROM 31642\n#define OSL_CELL 20984\n#define OSL_CHANNELS 8726\n#define OSL_CLAMP 20052\n#define OSL_COLOR 53753\n#define OSL_COMMON 49871\n#define OSL_CONSTANT 25144\n#define OSL_DATAWINDOW 54276\n#define OSL_DEFAULT 54870\n#define OSL_DIFFUSE 40389\n#define OSL_DIRECTION 42220\n#define OSL_DISPLAYWINDOW 30728\n#define OSL_DISTANCE 51337\n#define OSL_DO_FILTER 35765\n#define OSL_EMPTY 9314\n#define OSL_ERRORMESSAGE 38305\n#define OSL_EXISTS 41510\n#define OSL_FILL 39132\n#define OSL_FIRSTCHANNEL 48155\n#define OSL_GABOR 57764\n#define OSL_GEOM_NAME 63686\n#define OSL_GLOSSY 47998\n#define OSL_HASH 49390\n#define OSL_HERMITE 63643\n#define OSL_HIT 48491\n#define OSL_HITDIST 22029\n#define OSL_HSL 49898\n#define OSL_HSV 29073\n#define OSL_IMPULSES 56191\n#define OSL_INDEX 1731\n#define OSL_INTERP 10557\n#define OSL_LINEAR 2182\n#define OSL_MIRROR 64591\n#define OSL_MISSINGALPHA 39755\n#define OSL_MISSINGCOLOR 51667\n#define OSL_NDC 48899\n#define OSL_NORMAL 16520\n#define OSL_OBJECT 59084\n#define OSL_OSL_VERSION 47920\n#define OSL_PERIODIC 8749\n#define OSL_PERLIN 730\n#define OSL_POSITION 43041\n#define OSL_RASTER 2618\n#define OSL_REFLECTION 37621\n#define OSL_REFRACTION 37287\n#define OSL_RESOLUTION 48704\n#define OSL_RGB 26673\n#define OSL_RWRAP 47801\n#define OSL_SCREEN 55875\n#define OSL_SHADER 21066\n#define OSL_SHADER_GROUPNAME 62327\n#define OSL_SHADER_LAYERNAME 51796\n#define OSL_SHADER_SHADERNAME 65123\n#define OSL_SHADOW 60708\n#define OSL_SIMPLEX 61636\n#define OSL_SUBIMAGE 33526\n#define OSL_SUBIMAGES 2366\n#define OSL_SWRAP 4328\n#define OSL_TEXTUREFORMAT 17851\n#define OSL_TIME 52235\n#define OSL_TRACE 62908\n#define OSL_TWRAP 30524\n#define OSL_TYPE 64071\n#define OSL_UPERLIN 65308\n#define OSL_USIMPLEX 11314\n#define OSL_WIDTH 48751\n#define OSL_WORLD 9059\n#define OSL_WORLDTOCAMERA 32273\n#define OSL_WORLDTOSCREEN 33876\n#define OSL_WRAP 58300\n#define OSL_XYY 2228\n#define OSL_XYZ 47351\n#define OSL_YIQ 15839\nvec3 oslGetP(vec3 viewPos) {\n#if WORLD_NODES == 1\nreturn swizzleUpZ((invViewMatrix * vec4(-viewPos, 0.0)).xyz);\n#else\nreturn swizzleUpZ((invViewMatrix * vec4(-viewPos, 1.0)).xyz);\n#endif\n}\nvec3 oslGetI(vec3 viewPos) {\n#if WORLD_NODES == 1\nreturn swizzleUpZ((invViewMatrix * vec4(normalize(-viewPos), 0.0)).xyz);\n#else\nreturn swizzleUpZ((invViewMatrix * vec4(normalize(-viewPos), 0.0)).xyz);\n#endif\n}\nvec3 oslGetN(vec3 viewNorm) {\nreturn swizzleUpZ(normalize(invViewMatrix * vec4(viewNorm, 0.0)).xyz);\n}\nvec3 oslBlackbody(float temperatureK) {\nreturn sRGBToLinear(vec4(colorTempToRGB(temperatureK), 1.0)).rgb;\n}\nfloat oslDistance(vec3 p0, vec3 p1) {\nreturn distance(p0, p1);\n}\nfloat oslDistance(vec3 p0, vec3 p1, vec3 q) {\nvec3 d = p1 - p0;\nfloat dd = dot(d, d);\nif (dd == 0.0)\nreturn distance(q, p0);\nfloat t = dot(q - p0, d) / dd;\nreturn distance(q, p0 + clamp(t, 0.0, 1.0) * d);\n}\nint oslEndsWith(int name1, int name2) {\nreturn int(name1 == name2);\n}\nint oslFormat(int name1, int name2) {\nreturn name2;\n}\nint oslGetAttribute(int name, out int value) {\nvalue = 0;\nreturn 0;\n}\nint oslGetAttribute(int name, out float value) {\nvalue = 0.0;\nreturn 0;\n}\nint oslGetAttribute(int name, out vec3 vec) {\nvec = vec3(0.0, 0.0, 0.0);\nreturn 0;\n}\nvoid oslGetTextureInfo(int filename, int name, out int value) {\nvalue = 4;\n}\nvoid oslGetTextureInfo(int filename, int name, out int value[2]) {\nvalue[0] = 1024;\nvalue[1] = 1024;\n}\nvec3 oslHSV(float h, float s, float v) {\nvec4 outCol;\nhsvToRGB(vec4(h, s, v, 1.0), outCol);\nreturn outCol.rgb;\n}\nfloat oslHypot(float x, float y) {\nreturn sqrt(x*x + y*y);\n}\nfloat oslHypot(float x, float y, float z) {\nreturn sqrt(x*x + y*y + z*z);\n}\nfloat oslLog2(float x, float y) {\nreturn log(x) / log(y);\n}\nfloat oslLuminance(vec3 color) {\nreturn linearToRelativeLuminance(color);\n}\nfloat oslNoise(int type, vec3 vec, float phase) {\nfloat n = snoise(vec4(vec, phase));\nif (type == OSL_UPERLIN)\nn = n * 0.5 + 0.5;\nreturn n;\n}\nfloat oslNoise(int type, float value, float phase) {\nreturn oslNoise(type, vec3(value), phase);\n}\nfloat oslNoise(int type, vec3 vec) {\nreturn oslNoise(type, vec, 0.0);\n}\nfloat oslNoise(int type, float value) {\nreturn oslNoise(type, vec3(value), 0.0);\n}\nvec3 oslNoise3D(int type, vec3 vec, float phase) {\nfloat x = snoise(vec4(vec, phase));\nfloat y = snoise(vec4(vec.y, vec.x, vec.z, phase));\nfloat z = snoise(vec4(vec.y, vec.z, vec.x, phase));\nvec3 n = vec3(x, y, z);\nif (type == OSL_UPERLIN)\nn = n * 0.5 + 0.5;\nreturn n;\n}\nvec3 oslNoise3D(int type, float value, float phase) {\nreturn oslNoise3D(type, vec3(value), phase);\n}\nvec3 oslNoise3D(int type, vec3 vec) {\nreturn oslNoise3D(type, vec, 0.0);\n}\nvec3 oslNoise3D(int type, float value) {\nreturn oslNoise3D(type, vec3(value), 0.0);\n}\nfloat oslPow(float a, float b) {\nreturn pow(a, b);\n}\nvec3 oslPow(vec3 a, float b) {\nreturn pow(a, vec3(b));\n}\nint oslRayType(int name) {\nif (name == OSL_CAMERA)\n#if LIGHT_PATH_IS_CAM_RAY\nreturn 1;\n#else\nreturn 0;\n#endif\nelse\nreturn 0;\n}\nvec3 oslRotate(vec3 vec, float angle, vec3 p0, vec3 p1) {\nvec3 axis = normalize(p1 - p0);\nfloat c = cos(angle);\nfloat s = sin(angle);\nfloat x = axis[0];\nfloat y = axis[1];\nfloat z = axis[2];\nmat4 mat = mat4(\nx * x + (1.0 - x * x) * c, x * y * (1.0 - c) + z * s, x * z * (1.0 - c) - y * s, 0.0,\nx * y * (1.0 - c) - z * s, y * y + (1.0 - y * y) * c, y * z * (1.0 - c) + x * s, 0.0,\nx * z * (1.0 - c) + y * s, y * z * (1.0 - c) - x * s, z * z + (1.0 - z * z) * c, 0.0,\n0.0, 0.0, 0.0, 1.0\n);\nreturn (mat * vec4((vec - p0), 1.0) + vec4(p0, 1.0)).xyz;\n}\nvec3 oslRotate(vec3 vec, float angle, vec3 axis) {\nreturn oslRotate(vec, angle, vec3(0.0), axis);\n}\nint oslStartsWith(int name1, int name2) {\nreturn int(name1 == name2);\n}\nint oslStrLen(int name) {\nif (name == OSL_EMPTY)\nreturn 0;\nelse\nreturn 1;\n}\nint oslSubStr(int s, int start, int len) {\nreturn s;\n}\nint oslSubStr(int s, int start) {\nreturn s;\n}\nvec3 oslTexture(sampler2D image, float u, float v, int wrapModeFlag, int wrapMode, int alphaFlag, out float alpha) {\nif (wrapMode == OSL_DEFAULT || wrapMode == OSL_BLACK) {\nif (u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0)\nreturn vec3(0.0);\n} else if (wrapMode == OSL_CLAMP) {\nu = clamp(u, 0.0, 1.0);\nv = clamp(v, 0.0, 1.0);\n} else if (wrapMode == OSL_PERIODIC) {\nu = mod(u, 1.0);\nv = mod(v, 1.0);\n} else if (wrapMode == OSL_MIRROR) {\nif (mod(floor(u), 2.0) == 0.0)\nu = u - floor(u);\nelse\nu = 1.0 - (u - floor(u));\nif (mod(floor(v), 2.0) == 0.0)\nv = v - floor(v);\nelse\nv = 1.0 - (v - floor(v));\n}\nvec4 colAlpha = texture2D(image, vec2(u, v));\nalpha = colAlpha.a;\nreturn colAlpha.rgb;\n}\nvec3 oslTexture(sampler2D image, float u, float v, int alphaFlag, out float alpha, int wrapModeFlag, int wrapMode) {\nreturn oslTexture(image, u, v, wrapModeFlag, wrapMode, alphaFlag, alpha);\n}\nvec3 oslTexture(sampler2D image, float u, float v, int alphaFlag, out float alpha) {\nreturn oslTexture(image, u, v, OSL_WRAP, OSL_DEFAULT, alphaFlag, alpha);\n}\nvec3 oslTexture(sampler2D image, float u, float v, int wrapModeFlag, int wrapMode) {\nfloat alpha;\nreturn oslTexture(image, u, v, wrapModeFlag, wrapMode, OSL_ALPHA, alpha);\n}\nvec3 oslTexture(sampler2D image, float u, float v) {\nfloat alpha;\nreturn oslTexture(image, u, v, OSL_WRAP, OSL_DEFAULT, OSL_ALPHA, alpha);\n}\nvec3 oslTransform(int fromSpace, int toSpace, vec4 vec) {\nif (toSpace == OSL_WORLD || toSpace == OSL_SHADER || toSpace == OSL_COMMON) {\nreturn vec.xyz;\n} else if (toSpace == OSL_OBJECT) {\nvec = vec4(swizzleUpY(vec.xyz), vec.w);\nvec = invModelMatrix * vec;\nreturn swizzleUpZ(vec.xyz);\n} else if (toSpace == OSL_CAMERA) {\nvec = vec4(swizzleUpY(vec.xyz), vec.w);\nreturn (viewMatrix * vec).xyz;\n} else if (toSpace == OSL_SCREEN) {\nreturn vec.xyz;\n} else if (toSpace == OSL_RASTER) {\nreturn gl_FragCoord.xyz;\n} else if (toSpace == OSL_NDC) {\nreturn vec.xyz;\n} else {\nreturn vec.xyz;\n}\n}\nvec3 oslTransform(int fromSpace, int toSpace, vec3 vec) {\nreturn oslTransform(fromSpace, toSpace, vec4(vec, 1.0));\n}\nvec3 oslTransform(int toSpace, vec3 vec) {\nreturn oslTransform(OSL_COMMON, toSpace, vec4(vec, 1.0));\n}\nvec3 oslTransformDir(int fromSpace, int toSpace, vec3 vec) {\nreturn oslTransform(fromSpace, toSpace, vec4(vec, 0.0));\n}\nvec3 oslTransformDir(int toSpace, vec3 vec) {\nreturn oslTransform(OSL_COMMON, toSpace, vec4(vec, 0.0));\n}\nvec3 oslTransformC(int fromSpace, int toSpace, vec3 vec) {\nvec4 outVec = vec4(vec, 1.0);\nif (fromSpace == OSL_HSV && toSpace == OSL_RGB)\nhsvToRGB(vec4(vec, 1.0), outVec);\nelse if (fromSpace == OSL_RGB && toSpace == OSL_HSV)\nrgbToHSV(vec4(vec, 1.0), outVec);\nreturn outVec.rgb;\n}\nvec3 oslTransformC(int toSpace, vec3 vec) {\nreturn oslTransformC(OSL_RGB, toSpace, vec);\n}\nvoid oslError() {}\nvoid oslFPrintf() {}\nvoid oslPrintf() {}\nvoid oslWarning() {}\nvec3 oslWaveLengthColor(float lambdaNM) {\n#if __VERSION__ == 300\nvec3 xyz = vec3(0.0);\nfloat ii = (lambdaNM - 380.0) / 5.0;\nint i = int(ii);\nif (i < 0 || i >= 80)\nreturn xyz;\nii -= float(i);\nvec3 c1 = cieColorMatch[i];\nvec3 c2 = cieColorMatch[i+1];\nxyz = mix(c1, c2, ii);\nreturn xyz_to_sRGB(xyz);\n#else\nreturn vec3(0.0);\n#endif\n}\n#endif",node_incident_frag:"void node_incident(vec3 viewPos, out vec3 incident)\n{\n\nvec4 viewDir = vec4(normalize(viewPos), 0.0);\nincident = -swizzleUpZ(viewDir.xyz);\n}",node_normal_frag:"void node_normal(vec3 norParam, out vec3 norOut)\n{\n#ifdef MT_BLENDER\n#if WORLD_NODES == 1\nvec4 viewDir = isOrtho(projectionMatrix) ? vec4(0.0, 0.0, -1.0, 0.0) : vec4(normalize(-vViewPosition), 0.0);\nviewDir = invViewMatrix * viewDir;\nnorOut = -swizzleUpZ(viewDir.xyz);\n#else\nnorOut = normalize(invViewMatrix * vec4(norParam, 0.0)).xyz;\nnorOut = swizzleUpZ(norOut);\n#endif\n#else\nnorOut = norParam;\n#endif\n}",node_position_frag:"void node_position(vec3 posParam, out vec3 posOut)\n{\n#if defined(MT_BLENDER) || defined(MT_MAX)\nposOut = swizzleUpZ(-posParam);\n#else\nposOut = -posParam;\n#endif\n}",node_rgb_alpha_frag:"\nuniform vec4 nodeRGB[NODE_RGB_NUM];\nvoid node_rgb_alpha(vec4 color, out vec3 outColor, out float outAlpha)\n{\noutColor = color.rgb;\noutAlpha = color.a;\n}",node_value_frag:"uniform float nodeValue[NODE_VALUE_NUM];\nvoid node_value(float val, out float outVal)\n{\noutVal = val;\n}",node_u_float_frag:"void node_u_float(vec2 inUv, out float u)\n{\nu = inUv.x;\n}",node_abs_ar_frag:"void node_abs(\nvec3 inputVal,\nout vec3 outColor)\n{\noutColor = abs(inputVal);\n}",node_add_ar_frag:"void node_add(\nvec3 input1, vec3 input2,\nout vec3 outColor)\n{\noutColor = input1 + input2;\n}",node_atan_ar_frag:"void node_atan(\nint units,\nvec3 x, vec3 y,\nout vec3 outColor)\n{\noutColor = atan(y, x);\nif (units == 1)\noutColor = degrees(outColor);\n}",node_checkerboard_ar_frag:"void node_checkerboard(\nconst vec2 inUv, vec3 color1, vec3 color2, float uFrequency, float vFrequency, float uOffset, float vOffset, float contrast,\nout vec3 outColor) {\nvec2 uv = -1.0 + 2.0 * inUv;\nfloat fmodResult = mod(floor(uOffset * 2.0 + uFrequency * uv.x) + floor(vOffset * 2.0 + vFrequency * uv.y), 2.0);\nfloat final = max(sign(fmodResult), 0.0);\nvec3 col = vec3(final);\nif (final == 0.0)\ncol = color1;\nelse\ncol = color2;\noutColor = col * vec3(contrast) + vec3(1.0 - contrast);\n}",node_clamp_ar_frag:"void node_clamp(\nconst int mode,\nvec3 inputValue, float minValue, float maxValue, vec3 minColor, vec3 maxColor,\nout vec3 outColor, out vec3 outTransparency)\n{\nif (mode == 0)\noutColor = clamp(inputValue, vec3(minValue), vec3(maxValue));\nelse\noutColor = clamp(inputValue, minColor, maxColor);\noutTransparency = outColor;\n}",node_color_convert_ar_frag:"void node_color_convert(\nconst int from, const int to,\nvec3 inputValue,\nout vec3 outColor, out vec3 outTransparency)\n{\nvec4 c;\nif (from == to)\nc = vec4(inputValue, 1.0);\nelse if (from == 0) \nrgbToHSV(vec4(inputValue, 1.0), c);\nelse if (from == 1)\nhsvToRGB(vec4(inputValue, 1.0), c);\noutColor = c.rgb;\noutTransparency = outColor;\n}",node_color_correct_ar_frag:"void node_color_correct(\nvec3 inputValue, float mask, float gamma, float hueShift, float saturation, float contrast, float contrastPivot,\nfloat exposure, vec3 multiply, vec3 add, bool invert, bool alphaIsLuminance, float alphaMultiply, float alphaAdd, bool invertAlpha,\nout vec3 outColor, out float outAlpha)\n{ \noutColor = inputValue;\noutColor = invert ? 1.0 - outColor : outColor;\noutColor = vec3(pow(abs(outColor.r), gamma), pow(abs(outColor.g), gamma), pow(abs(outColor.b), gamma));\nvec4 hsv;\nrgbToHSV(vec4(outColor, 1.0), hsv);\nhsv[0] += hueShift / 360.0;\nif (hsv[0] > 1.0)\nhsv[0] -= 1.0;\nelse if (hsv[0] < 0.0)\nhsv[0] += 1.0;\n\nhsv[1] *= (saturation);\nhsv[1] = saturate(hsv[1]);\nhsv[2] += exposure * 2.0;\nvec4 c = hsv;\nhsvToRGB(hsv, c);\nc = ((c - contrastPivot) * contrast + contrastPivot) * vec4(multiply, 1.0) + vec4(add, 1.0);\noutColor = c.rgb;\noutAlpha = 1.0;\n}",node_color_to_float_ar_frag:"void node_color_to_float(\nconst int mode,\nvec3 inputValue,\nout float outValue)\n{\nif (mode == 0)\noutValue = min(min(inputValue.r, inputValue.g), inputValue.b);\nelse if (mode == 1)\noutValue = max(max(inputValue.r, inputValue.g), inputValue.b);\nelse if (mode == 2)\noutValue = (inputValue.r + inputValue.g + inputValue.b) / 3.0;\nelse if (mode == 3)\noutValue = inputValue.r + inputValue.g + inputValue.b;\nelse if (mode == 4) {\noutValue = dot(inputValue, LUM_WEIGHTS);\n}\nelse if (mode == 5)\noutValue = inputValue.r;\nelse if (mode == 6)\noutValue = inputValue.g;\nelse if (mode == 7)\noutValue = inputValue.b;\n}",node_compare_ar_frag:"void node_compare(\nint test,\nfloat input1, float input2,\nout bool outValue)\n{\nif (test == 0)\noutValue = input1 == input2;\nelse if (test == 1)\noutvalue = input1 != input2;\nelse if (test == 2)\noutValue = input1 < input2;\nelse if (test == 3)\noutValue = input1 > input2;\nelse if (test == 4)\noutValue = input1 <= input2;\nelse if (test == 5)\noutValue = input1 >= input2;\n}",node_complement_ar_frag:"void node_complement(\nvec3 inputValue,\nout vec3 outColor)\n{\noutColor = 1.0 - inputValue;\n}",node_composite_ar_frag:"void node_composite(\nconst int operation, const int alphaOperation,\nvec3 A, vec3 B, float AA, float BA,\nout float outAlpha, out vec3 outColor, out vec3 outTransparency)\n{\nvec4 A1 = vec4(A, AA);\nvec4 B1 = vec4(B, BA);\nvec4 color = vec4(0.0);\nif (operation == 0)\ncolor = A1;\nelse if (operation == 1)\ncolor = B1;\nelse if (operation == 2)\ncolor = A1 * B1.a + B1 * (1.0 - A1.a);\nelse if (operation == 3)\ncolor = (A1 + B1) / 2.0;\nelse if (operation == 4)\ncolor = A1.a > B1.a ? A1 : (A1 + B1 * (1.0 - A1.a) / B1.a);\nelse if (operation == 5)\ncolor = abs(A1 - B1);\nelse if (operation == 6)\ncolor = A1.a + B1.a < 1.0 ? A1 + B1 : A1 + B1 * (1.0 - A1.a) / B1.a;\nelse if (operation == 7)\nfor (int i = 0; i < 4; i++)\ncolor[i] = B1[i] == 0.0 ? 0.0 : (A1[i] / B1[i]);\nelse if (operation == 8)\ncolor = A1 + B1 - 2.0 * A1 * B1;\nelse if (operation == 9)\ncolor = B1 - A1;\nelse if (operation == 10)\ncolor = 2.0 * A1 * B1 / (A1 + B1);\nelse if (operation == 11)\nfor (int i = 0; i < 4; i++)\ncolor[i] = A1[i] < 0.5 ? (A1[i] * B1[i]) : (A1[i] >= 0.0 && A1[i] <= 1.0 && B1[i] >= 0.0 && B1[i] <= 1.0) ? (A1[i] + B1[i] - A1[i] * B1[i]) : max(A1[i], B1[i]);\nelse if (operation == 12)\ncolor = sqrt(A1 * A1 + B1 * B1);\nelse if (operation == 13)\ncolor = A1 * B1.a;\nelse if (operation == 14)\ncolor = B1 * A1.a;\nelse if (operation == 15)\ncolor = A1 * A1.a + B1 * (1.0 - A1.a);\nelse if (operation == 16)\ncolor = max(A1, B1);\nelse if (operation == 17)\ncolor = min(A1, B1);\nelse if (operation == 18)\ncolor = A1 - B1;\nelse if (operation == 19)\ncolor = A1 * B1;\nelse if (operation == 20)\ncolor = A1 * (1.0 - B1.a);\nelse if (operation == 21)\ncolor = A1 + B1 * (1.0 - A1.a);\nelse if (operation == 22)\nfor (int i = 0; i < 4; i++)\ncolor[i] = B1[i] < 0.5 ? (A1[i] * B1[i]) : (A1[i] >= 0.0 && A1[i] <= 1.0 && B1[i] >= 0.0 && B1[i] <= 1.0) ? (A1[i] + B1[i] - A1[i] * B1[i]) : max(A1[i], B1[i]);\nelse if (operation == 23)\ncolor = A1 + B1;\nelse if (operation == 24)\nfor (int i = 0; i < 4; i++)\ncolor[i] = (A1[i] >= 0.0 && A1[i] <= 1.0 && B1[i] >= 0.0 && B1[i] <= 1.0) ? (A1[i] + B1[i] - A1[i] * B1[i]) : max(A1[i], B1[i]);\n\nelse if (operation == 25)\nfor (int i = 0; i < 4; i++)\ncolor[i] = (A1[i] < .75) ? (A1[i] * B1[i]) : (A1[i] >= 0.0 && A1[i] <= 1.0 && B1[i] >= 0.0 && B1[i] <= 1.0) ? (A1[i] + B1[i] - A1[i] * B1[i]) : max(A1[i], B1[i]);\nelse if (operation == 26)\ncolor = B1 * (1.0 - A1.a);\nelse if (operation == 27)\ncolor = A1 * (1.0 - B1.a) + B1;\nelse if (operation == 28)\ncolor = A1 * (1.0 - B1.a) + B1 * (1.0 - A1.a);\nif (alphaOperation == 1)\ncolor.a = AA;\nelse if (alphaOperation ==2)\ncolor.a = BA;\noutColor = color.rgb;\noutAlpha = color.a;\noutTransparency = outColor;\n}",node_cross_ar_frag:"void node_cross(\nvec3 input1, vec3 input2,\nout vec3 outValue)\n{\noutValue = cross(input1, input2);\n}",node_divide_ar_frag:"void node_divide(\nvec3 input1, vec3 input2,\nout vec3 outColor)\n{\noutColor = input1 / input2;\n}",node_dot_ar_frag:"void node_dot(\nvec3 input1, vec3 input2,\nout vec3 outValue)\n{\noutValue = dot(input1, input2);\n}",node_exp_ar_frag:"void node_exp(\nvec3 inputVal,\nout vec3 outColor)\n{\noutColor = exp(inputVal);\n}",node_facing_ratio_ar_frag:"void node_facing_ratio(\nvec3 viewNorm,\nconst float bias, const float gain, const bool invert, const bool linear,\nout float outValue)\n{\noutValue = dot(normalize(viewNorm), normalize(vViewPosition));\n}",node_flat_ar_frag:"void node_flat(vec3 color, out vec3 outColor)\n{\noutColor = color;\n}",node_float_to_int_ar_frag:"void node_float_to_int(\nconst int mode, \nfloat inputValue,\nout int outValue)\n{\nif (mode == 0)\noutValue = round(inputValue);\nelse if (mode == 1)\noutValue = trunc(inputValue);\nelse if (mode == 2)\noutValue = floor(inputValue);\nelse if (mode == 3)\noutValue = ceil(inputValue);\n}",node_float_to_matrix_ar_frag:"void node_float_to_matrix(\nfloat input00, float input01, float input02, float input03, float input10, float input11, float input12, float input13, float input20, float input21, float input22, float input23, float input30, float input31, float input32, float input33,\nout mat4 outValue)\n{\noutValue = mat4(input00, input01, input02, input03,\ninput10, input11, input12, input13,\ninput20, input21, input22, input23,\ninput30, input31, input32, input33);\n}",node_float_to_rgba_ar_frag:"void node_float_to_rgba(\nfloat r, float g, float b, float a,\nout vec4 outColor, out float outAlpha, out vec3 outTransparency)\n{\noutAlpha = a;\noutColor = vec4(r, g, b, a);\noutTransparency = vec3(1.0 - a);\n}",node_float_to_rgb_ar_frag:"void node_float_to_rgb(\nfloat r, float g, float b,\nout vec3 outValue)\n{\noutValue = vec3(r, g, b);\n}",node_fraction_ar_frag:"void node_fraction(\nvec3 inputValue,\nout vec3 outColor)\n{\noutColor = fract(inputValue);\n}",node_is_finite_ar_frag:"void node_is_finite(\nvec3 inputValue,\nout bool outValue)\n{\noutValue = !any(isinf(inputValue));\n}",node_image_ar_frag:"float check(bool value) {\nif (value == true) return -1.0;\nreturn 1.0;\n}\nvoid node_image(sampler2D ima, const int encoding, \nvec3 multiply, vec3 offset, vec2 uvcoords, float soffset, float toffset, float sscale, float tscale, bool sflip, bool tflip, bool swapSt,\nout vec3 outColor, out float outAlpha, out vec3 outTransparency) {\n\nvec2 uv = vec2(uvcoords.x, uvcoords.y);\nif (swapSt == false) {\nif (sflip) uv.x = 1.0 - uv.x;\nif (tflip) uv.y = 1.0 - uv.y;\nuv = vec2(sscale, tscale) * (uv + vec2(soffset * check(sflip), toffset * check(tflip)));\n} else {\nif (sflip) uv.y = 1.0 - uv.y;\nif (tflip) uv.x = 1.0 - uv.x;\nuv = vec2(sscale, tscale) * (uv.yx + vec2(toffset * check(sflip), soffset * check(tflip)));\n}\nuv.y = 1.0 - uv.y;\nvec4 tex = texture2D(ima, uv);\noutColor = nodeTexelToLinear(tex, encoding).rgb * multiply + offset;\noutAlpha = tex.a;\noutTransparency = outColor.rgb;\n}\nvoid node_image(sampler2D ima, const int encoding, \nvec4 multiply, vec4 offset, vec2 uvcoords, float soffset, float toffset, float sscale, float tscale, bool sflip, bool tflip, bool swapSt,\nout vec4 outColor) {\nvec2 uv = vec2(uvcoords.x, uvcoords.y);\nif (swapSt == false) {\nif (sflip) uv.x = 1.0 - uv.x;\nif (tflip) uv.y = 1.0 - uv.y;\nuv = vec2(sscale, tscale) * (uv + vec2(soffset * check(sflip), toffset * check(tflip)));\n} else {\nif (sflip) uv.y = 1.0 - uv.y;\nif (tflip) uv.x = 1.0 - uv.x;\nuv = vec2(sscale, tscale) * (uv.yx + vec2(toffset * check(sflip), soffset * check(tflip)));\n}\nuv.y = 1.0 - uv.y;\nvec4 tex = texture2D(ima, uv);\noutColor = nodeTexelToLinear(tex, encoding).rgba * multiply + offset;\n}",node_lambert_ar_frag:"void node_lambert(\nvec3 geometryNormal,\nfloat Kd, vec3 KdColor, vec3 normalCamera, vec3 opacity,\nout vec4 outColor, out float outAlpha, out vec3 outTransparency)\n{\nNodeMaterial material;\nmaterial.diffuseColor = Kd * KdColor;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\nvec3 normal = normalCamera;\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_IndirectDiffuse\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\noutAlpha = average(opacity);\noutColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse, outAlpha);\noutTransparency = vec3(1.0) - opacity;\n}",node_length_ar_frag:"void node_length(\nint mode,\nvec3 inputVec,\nout float outValue)\n{\nif (mode == 0)\noutValue = length(inputVec);\nelse if (mode == 1)\noutValue = dot(inputVec, inputVec);\nelse\noutValue = abs(inputVec.x) + abs(inputVec.y) + abs(inputVec.z);\n}",node_log_ar_frag:"void node_log(\nvec3 inputVec, vec3 base,\nout vec3 outColor)\n{\noutColor = log(inputVec) / log(base);\n}",node_map_to_mtl_ar_frag:"\nvoid node_map_to_mtl(bool opaqueEnabled, vec4 color, out vec4 outColor)\n{\noutColor = vec4(color.rgb, opaqueEnabled ? color.a : 1.0);\n}",node_max_ar_frag:"void node_max(\nvec3 input1, vec3 input2,\nout vec3 outColor)\n{\noutColor = max(input1, input2);\n}",node_min_ar_frag:"void node_min(\nvec3 input1, vec3 input2,\nout vec3 outColor)\n{\noutColor = min(input1, input2);\n}",node_mix_shader_ar_frag:"void node_mix_shader(const int mode,\nconst float mixAmt, vec4 shader1, vec4 shader2,\nout vec4 color)\n{\nshader1.rgb *= shader1.a;\nshader2.rgb *= shader2.a;\nif (mode == 0)\ncolor = mix(shader1, shader2, clamp(mixAmt, 0.0, 1.0));\nelse\ncolor = vec4(shader1.rgb + shader2.rgb, min(shader1.a, shader2.a));\ncolor.rgb /= color.a;\n}",node_modulo_ar_frag:"void node_modulo(\nvec3 inputVec, vec3 divisor,\nout vec3 outColor)\n{\noutColor = mod(inputVec, divisor);\n}",node_multiply_ar_frag:"void node_multiply(\nvec3 input1, vec3 input2,\nout vec3 outColor)\n{\noutColor = input1 * input2;\n}",node_negate_ar_frag:"void node_negate(\nvec3 inputVec,\nout vec3 outColor)\n{\noutColor = -inputVec;\n}",node_normalize_ar_frag:"void node_normalize(\nvec3 inputVec,\nout vec3 outValue)\n{\noutValue = normalize(inputVec);\n}",node_normal_map_ar_frag:"void node_normal_map(\nvec4 tangentParam,\nvec3 inputVal, vec3 normal, float strength, vec3 tangent,\nout vec3 outValue) {\n#ifdef DOUBLE_SIDED\nnormal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n#endif\nvec3 normalTex = inputVal.xyz * 2.0 - 1.0;\nvec3 bitangent = tangentParam.w * cross(normal, tangent);\noutValue = normalize(normalTex.x * tangent + normalTex.y * bitangent + normalTex.z * normal);\n}",node_pow_ar_frag:"void node_pow(\nvec3 base, vec3 exponent,\nout vec3 outColor)\n{\noutColor = pow(base, exponent);\n}",node_random_ar_frag:"void node_abs(\nvec3 inputColor,\nout vec3 outColor)\n{\noutColor = inputColor;\n}",node_range_ar_frag:"void node_range(\nvec3 inputValue, float inputMin, float inputMax, \nfloat outputMin, float outputMax, bool smoothstep1, \nfloat contrast, float contrastPivot, float bias, float gain,\nout vec3 outColor, out vec3 outTransparency)\n{\n\noutColor = min(max(inputValue, vec3(inputMin)), vec3(inputMax));\noutColor = (outColor - contrastPivot) * contrast + contrastPivot;\nif (smoothstep1 == true) {\nfor (int i = 0; i < 3; i++)\noutColor[i] = smoothstep(outputMin, outputMax, outColor[i]);\n} else\noutColor = min(max(outColor, vec3(outputMin)), vec3(outputMax));\noutTransparency = outColor;\n}",node_ray_switch_ar_frag:"void node_ray_switch(vec3 camera, vec3 diffuseReflection, vec3 diffuseTransmission,\nvec3 shadow, vec3 specularReflection, vec3 specularTransmission,\nout vec3 outColor, out float outAlpha)\n{\n#if LIGHT_PATH_IS_CAM_RAY\noutColor = camera;\n#else\noutColor = diffuseReflection;\n#endif\noutAlpha = 1.0;\n}",node_reciprocal_ar_frag:"void node_reciprocal(\nvec3 inputVec,\nout vec3 outColor)\n{\noutColor = 1.0 / inputVec;\n}",node_rgba_to_float_ar_frag:"void node_rgba_to_float(\nconst int mode,\nvec3 inputValue, float inputA,\nout float outValue, out vec3 outTransparency)\n{\noutTransparency = inputValue + vec3(inputA / 4.0);\nif (mode == 0)\noutValue = min(min(min(inputValue.r, inputValue.g), inputValue.b), inputA);\nelse if (mode == 1)\noutValue = max(max(max(inputValue.r, inputValue.g), inputValue.b), inputA);\nelse if (mode == 2)\noutValue = (inputValue.r + inputValue.g + inputValue.b + inputA) / 4.0;\nelse if (mode == 3)\noutValue = inputValue.r + inputValue.g + inputValue.b + inputA;\nelse if (mode == 4) {\noutValue = dot(inputValue, LUM_WEIGHTS);\n}\nelse if (mode == 5)\noutValue = inputValue.r;\nelse if (mode == 6)\noutValue = inputValue.g;\nelse if (mode == 7)\noutValue = inputValue.b;\n}",node_rgb_to_float_ar_frag:"void node_rgb_to_float(\nconst int mode,\nvec3 inputValue,\nout float outValue)\n{\nif (mode == 0)\noutValue = min(min(inputValue.r, inputValue.g), inputValue.b);\nelse if (mode == 1)\noutValue = max(max(inputValue.r, inputValue.g), inputValue.b);\nelse if (mode == 2)\noutValue = (inputValue.r + inputValue.g + inputValue.b) / 3.0;\nelse if (mode == 3)\noutValue = inputValue.r + inputValue.g + inputValue.b;\nelse if (mode == 4) {\noutValue = dot(inputValue, LUM_WEIGHTS);\n}\nelse if (mode == 5)\noutValue = inputValue.r;\nelse if (mode == 6)\noutValue = inputValue.g;\nelse if (mode == 7)\noutValue = inputValue.b;\n}",node_rgb_to_vector_ar_frag:"void node_rgb_to_vector(\nconst int mode, \nvec3 inputValue,\nout vec3 outValue)\n{\n\noutValue = inputValue;\n}",node_shadow_matte_ar_frag:"#include \nvoid node_shadow_matte(\nvec3 normal,\nvec3 shadowColor, float backlighting, float shadowOpacity,\nout vec4 outColor, out float outAlpha) {\nfloat shadow = getShadowMask();\noutColor = vec4(shadowColor, shadowOpacity * (1.0 - shadow));\noutAlpha = outColor.a;\n}",node_shuffle_ar_frag:"\nvoid node_shuffle(const int channelR, const int channelG, const int channelB, const int channelA,\nvec3 color, float alpha, bool negateR, bool negateG, bool negateB, bool negateA,\nout vec3 outColor, out float outAlpha)\n{\noutColor = vec3(0.0);\nvec4 choose = vec4(color, alpha);\noutAlpha = 1.0;\noutColor.r = choose[channelR];\noutColor.g = choose[channelG];\noutColor.b = choose[channelB];\noutAlpha = choose[channelA];\nif (negateR)\noutColor.r = -outColor.r;\nif (negateG)\noutColor.g = -outColor.g;\nif (negateB)\noutColor.b = -outColor.b;\nif (negateA)\noutAlpha = -outAlpha;\n}\nvoid node_shuffle(const int channelR, const int channelG, const int channelB, const int channelA,\nvec4 color, float alpha, bool negateR, bool negateG, bool negateB, bool negateA,\nout vec4 outColor)\n{\noutColor = vec4(0.0);\nvec4 choose = vec4(color.rgb, alpha);\noutColor.r = choose[channelR];\noutColor.g = choose[channelG];\noutColor.b = choose[channelB];\noutColor.a = choose[channelA];\nif (negateR)\noutColor.r = -outColor.r;\nif (negateG)\noutColor.g = -outColor.g;\nif (negateB)\noutColor.b = -outColor.b;\nif (negateA)\noutColor.a = -outColor.a;\n}",node_sign_ar_frag:"void node_sign(\nvec3 inputVec,\nout vec3 outColor)\n{\noutColor = sign(inputVec);\n}",node_skydome_light_ar_frag:"void node_skydome_light(vec3 color, float intensity,\nout vec4 outgoingLight)\n{\noutgoingLight = vec4(color * intensity, 1.0);\n}\nvoid node_skydome_light(sampler2D envMap, int encoding, vec3 normal,\nfloat intensity,\nout vec4 outgoingLight)\n{\nvec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\nvec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\nvec3 reflectVec = normalize(cameraToVertex);\nmat3 uvTransform = mat3(1.0);\nvec4 color = sampleEquirectangular(envMap, reflectVec, uvTransform, encoding);\n#if LIGHT_PATH_IS_CAM_RAY\nintensity = 1.0;\n#endif\noutgoingLight = color * intensity;\n}",node_sqrt_ar_frag:"void node_sqrt(\nvec3 inputVec,\nout vec3 outColor)\n{\noutColor = sqrt(inputVec);\n}",node_standard_surface_ar_frag:"#define DEFAULT_REFLECTION_EDGE 1.0\n#define DEFAULT_REFLECTION_SLOPE 5.0\nvoid node_standard_surface(\nvec3 geometryNormal, const bool thinWalled,\nconst float base, const vec3 baseColor, const float diffuseRoughness,\nconst float metalness, const float specular, const vec3 specularColor,\nconst float specularRoughness, const float trans, const vec3 transColor,\nconst float transDepth, const vec3 transScatter, const float transExtraRoughness,\nconst float subsurface, const vec3 subsurfaceColor, const vec3 subsurfaceRadius,\nconst float coat, const vec3 coatColor, const float coatRoughness,\nconst float sheen, const vec3 sheenColor, const float sheenRoughness,\nconst float emission, const vec3 emissionColor, const vec3 opacity,\nconst vec3 normal, const vec3 clearcoatNormal, const float specularIOR,\nout vec4 outColor, out vec3 outTransparency)\n{\nNodeMaterial material;\nvec3 baseColorWeighted = base * baseColor.rgb;\nmaterial.diffuseColor = baseColorWeighted * (1.0 - metalness) * (1.0 - trans);\n#ifdef CLEARCOAT\nmaterial.clearcoat = saturate(coat);\nmaterial.clearcoatRoughness = clamp(coatRoughness, 0.0, 1.0);\n#endif\n#ifdef USE_SHEEN\nmaterial.sheenColor = saturate(sheen * sheenColor);\nmaterial.sheenRoughness = clamp(sheenRoughness, 0.0, 1.0);\n#endif\nvec3 dxy = max(abs(dFdx(geometryNormal)), abs(dFdy(geometryNormal)));\nfloat geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);\nmaterial.specularRoughness = max(specularRoughness, 0.0525);\nmaterial.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min(material.specularRoughness, 1.0);\nvec3 dielRefl = DEFAULT_SPECULAR_COEFFICIENT * specular * specularColor;\nmaterial.specularColor = mix(dielRefl, baseColorWeighted, metalness);\nmaterial.refractionColor = pow(trans * (1.0 - metalness) * transColor.rgb, vec3(2.0));\nmaterial.refractionIOR = specularIOR;\nmaterial.refractionRoughness = material.specularRoughness;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\nvec3 refractedLight = vec3(0.0);\n#ifdef USE_GTAO\nvec4 gtaoVisibilityBentNormal = texture2D(gtaoMap,\ngl_FragCoord.xy / currResolution);\nvec3 bentNormal = normalize(unpackRGBToNormal(gtaoVisibilityBentNormal.gba));\n#define PROBE_NORMAL bentNormal\n#endif\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#define RE_Refraction RE_Refraction_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_DirectSpecular\n#undef RE_IndirectDiffuse\n#undef RE_IndirectSpecular\n#undef RE_Refraction\n#ifdef PROBE_NORMAL\n#undef PROBE_NORMAL\n#endif\n#ifdef USE_GTAO\nreflectedLight.indirectDiffuse *= gtaoVisibilityBentNormal.r;\nfloat gtaoVisibility = gtaoVisibilityBentNormal.r;\nvec3 gtaoBentNormal = bentNormal;\nvec3 gtaoViewDir = geometry.viewDir;\nvec3 gtaoNormal = normal;\nfloat gtaoRoughness = material.specularRoughness;\n#endif\n#include \nvec3 totalEmissiveRadiance = emission * emissionColor;\nvec3 outSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\nvec3 outColor3 = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\noutSpecular + totalEmissiveRadiance;\nfloat alpha = 1.0;\nif (thinWalled) {\nalpha = average(opacity) * (1.0 - saturate(trans) + maxFromRGB(outSpecular) * saturate(trans));\n} else {\noutColor3 += refractedLight;\n}\noutColor = vec4(outColor3, saturate(alpha));\noutTransparency = outColor3;\n}\nvoid node_standard_surface(\nvec3 geometryNormal, const bool thinWalled,\nconst float base, const vec3 baseColor, const float diffuseRoughness,\nconst float metalness, const float specular, const vec3 specularColor,\nconst float specularRoughness, const float trans, const vec3 transColor,\nconst float transDepth, const vec3 transScatter, const float transExtraRoughness,\nconst float subsurface, const vec3 subsurfaceColor, const vec3 subsurfaceRadius,\nconst float coat, const vec3 coatColor, const float coatRoughness,\nconst float sheen, const vec3 sheenColor, const float sheenRoughness,\nconst float emission, const vec3 emissionColor, const vec3 opacity,\nconst vec3 normal, const vec3 clearcoatNormal,\nout vec4 outColor, out vec3 outTransparency)\n{\nnode_standard_surface(\ngeometryNormal, thinWalled,\nbase, baseColor, diffuseRoughness,\nmetalness, specular, specularColor,\nspecularRoughness, trans, transColor,\ntransDepth, transScatter, transExtraRoughness,\nsubsurface, subsurfaceColor, subsurfaceRadius,\ncoat, coatColor, coatRoughness,\nsheen, sheenColor, sheenRoughness,\nemission, emissionColor, opacity,\nnormal, clearcoatNormal, 1.5,\noutColor, outTransparency);\n}",node_subtract_ar_frag:"void node_subtract(\nvec3 input1, vec3 input2,\nout vec3 outColor)\n{\noutColor = input1 - input2;\n}",node_trigo_ar_frag:"void node_trigo(\nconst int function, const int units,\nvec3 inputVec, float frequency, float phase,\nout vec3 outColor)\n{\nif (units == 1 && function >= 0 && function <=2)\ninputVec = radians(inputVec);\nif (function == 0)\noutColor = cos(inputVec * frequency + phase);\nelse if (function == 1)\noutColor = sin(inputVec * frequency + phase);\nelse if (function == 2)\noutColor = tan(inputVec * frequency + phase);\nelse if (function == 3)\noutColor = acos(inputVec * frequency + phase);\nelse if (function == 4)\noutColor = asin(inputVec * frequency + phase);\nelse if (function == 5)\noutColor = atan(inputVec * frequency + phase);\nelse if (function == 6)\noutColor = cosh(inputVec * frequency + phase);\nelse if (function == 7)\noutColor = sinh(inputVec * frequency + phase);\nelse\noutColor = tanh(inputVec * frequency + phase);\nif (units == 1 && function >= 3 && function <=5)\noutColor = degrees(outColor);\n}",node_two_sided_ar_frag:"void node_two_sided(\nbool frontFacing, \nvec3 front, vec3 back,\nout vec3 outColor)\n{\noutColor = frontFacing ? front : back;\n}",node_vector_to_rgb_ar_frag:"void node_vector_to_rgb(\nconst int mode, \nvec3 inputValue,\nout vec3 outColor)\n{\nif (mode == 0)\noutColor = inputValue;\nelse if (mode == 1)\noutColor = normalize(inputValue);\nelse if (mode == 2)\noutColor = inputValue;\n}",node_add_shader_bl_frag:"void node_add_shader(vec4 color1, vec4 color2, out vec4 outColor) {\noutColor.rgb = color1.rgb + color2.rgb;\noutColor.a = clamp(color1.a + color2.a, 0.0, 1.0);\n}",node_ambient_occlusion_bl_frag:"void node_ambient_occlusion(vec4 color, float distance, vec3 normal,\nout vec4 outColor, out float outAO) {\noutColor = color;\noutAO = 1.0;\n}",node_attribute_bl_frag:"void node_attribute(\nvec4 paramAttr,\nout vec4 outColor, out vec3 outVector, out float outFac,\nout float outAlpha) {\noutColor = vec4(paramAttr.xyz, 1.0);\noutVector = paramAttr.xyz;\noutFac = average(paramAttr.xyz);\noutAlpha = paramAttr.w;\n}\nvoid node_attribute(\nvec4 paramAttr,\nout vec4 outColor, out vec3 outVector, out float outFac) {\nfloat outAlpha;\nnode_attribute(paramAttr, outColor, outVector, outFac, outAlpha);\n}",node_background_bl_frag:"void node_background(vec4 color, float strength, out vec4 outColor)\n{\noutColor = strength * color;\n}",node_bevel_bl_frag:"void node_bevel(float radius, vec3 normal, out vec3 outNormal) {\noutNormal = normal;\n}",node_blackbody_bl_frag:"void node_blackbody(float temp, out vec4 outColor)\n{\noutColor = sRGBToLinear(vec4(colorTempToRGB(temp), 1.0));\n}",node_brightcontrast_bl_frag:"\nvoid node_brightcontrast(vec4 color, float bright, float contrast, out vec4 outColor)\n{\nfloat bminc = bright - contrast * 0.5;\noutColor.r = max((1.0 + contrast) * color.r + bminc, 0.0);\noutColor.g = max((1.0 + contrast) * color.g + bminc, 0.0);\noutColor.b = max((1.0 + contrast) * color.b + bminc, 0.0);\noutColor.a = color.a;\n}",node_bsdf_anisotropic_bl_frag:"void node_bsdf_anisotropic(\nvec4 color, float roughness, float anisotropy, float rotation, vec3 normal, vec3 tangent,\nout vec4 outColor)\n{\noutColor = color;\n}",node_bsdf_diffuse_bl_frag:"\nvoid node_bsdf_diffuse(\nvec3 geometryNormal,\nvec4 color, float roughness, vec3 normal,\nout vec4 outColor) {\nnormal = vec3(normal[0], normal[2], -normal[1]);\nnormal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\nNodeMaterial material;\nmaterial.diffuseColor = color.rgb;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\n#ifdef USE_GTAO\nvec4 gtaoVisibilityBentNormal = texture2D(gtaoMap,\ngl_FragCoord.xy / currResolution);\nvec3 bentNormal = normalize(unpackRGBToNormal(gtaoVisibilityBentNormal.gba));\n#define PROBE_NORMAL bentNormal\n#endif\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_IndirectDiffuse\n#ifdef PROBE_NORMAL\n#undef PROBE_NORMAL\n#endif\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\n#ifdef USE_GTAO\nreflectedLight.indirectDiffuse *= gtaoVisibilityBentNormal.r;\n#endif\noutColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse, 1.0);\n}",node_bsdf_glass_bl_frag:"void node_bsdf_glass(\nvec3 geometryNormal,\nvec4 color, float roughness, float ior, vec3 normal,\nout vec4 outColor) {\nnormal = normalize(normal);\nnormal = swizzleUpY(normal);\nvec3 normalWorld = normal;\nnormal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\nNodeMaterial material;\nmaterial.specularColor = vec3(1.0);\nmaterial.fresnelRefl90 = vec3(1.0);\nmaterial.specularRoughness = clamp(roughness, 0.0, 1.0);\nmaterial.refractionColor = vec3(1.0);\nmaterial.refractionIOR = ior;\nmaterial.refractionRoughness = pow2(roughness);\n#if defined(ENVMAP_TYPE_CUBE) || defined(ENVMAP_TYPE_CUBE_UV)\nfloat geomRoughness = calcGeometryRoughness(geometryNormal);\nmaterial.specularRoughness = calcCubeUVAdjustedRoughness(\nmaterial.specularRoughness, geomRoughness);\nmaterial.refractionRoughness = calcCubeUVAdjustedRoughness(\nmaterial.refractionRoughness, geomRoughness);\n#endif\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0),\nvec3(0.0), vec3(0.0));\nvec3 refractedLight = vec3(0.0);\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\n#ifdef USE_GTAO\nvec4 gtaoVisibilityBentNormal = texture2D(gtaoMap,\ngl_FragCoord.xy / currResolution);\nvec3 bentNormal = normalize(unpackRGBToNormal(gtaoVisibilityBentNormal.gba));\n#define PROBE_NORMAL bentNormal\n#endif\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#define RE_Refraction RE_Refraction_Node\n#include \n#include \n#include \n#undef RE_DirectSpecular\n#undef RE_IndirectSpecular\n#undef RE_Refraction\n#ifdef PROBE_NORMAL\n#undef PROBE_NORMAL\n#endif\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\n#ifdef USE_GTAO\nfloat gtaoVisibility = gtaoVisibilityBentNormal.r;\nvec3 gtaoBentNormal = bentNormal;\nvec3 gtaoViewDir = geometry.viewDir;\nvec3 gtaoNormal = normal;\nfloat gtaoRoughness = material.specularRoughness;\n#endif\n#include \nvec3 viewWorld;\nif (isPerspective(projectionMatrix))\nviewWorld = (invViewMatrix * vec4(-vViewPosition, 0.0)).xyz;\nelse\nviewWorld = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\nviewWorld = normalize(viewWorld);\nfloat fresnel = fresnelReflection(viewWorld, normalWorld, ior);\noutColor = vec4(color.rgb * mix(refractedLight, reflectedLight.directSpecular\n+ reflectedLight.indirectSpecular, fresnel), 1.0);\n}",node_bsdf_glossy_bl_frag:"\nvoid node_bsdf_glossy(\nvec3 geometryNormal,\nvec4 color, float roughness, vec3 normal,\nout vec4 outColor) {\nnormal = vec3(normal[0], normal[2], -normal[1]);\nnormal = normalize((viewMatrix * vec4(normal.xyz, 0.0)).xyz);\nNodeMaterial material;\nmaterial.specularColor = vec3(1.0);\nmaterial.fresnelRefl90 = vec3(1.0);\nmaterial.specularRoughness = clamp(roughness, 0.0, 1.0);\n#if defined(ENVMAP_TYPE_CUBE) || defined(ENVMAP_TYPE_CUBE_UV)\nfloat geomRoughness = calcGeometryRoughness(geometryNormal);\nmaterial.specularRoughness = calcCubeUVAdjustedRoughness(\nmaterial.specularRoughness, geomRoughness);\n#endif\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\n#ifdef USE_GTAO\nvec4 gtaoVisibilityBentNormal = texture2D(gtaoMap,\ngl_FragCoord.xy / currResolution);\nvec3 bentNormal = normalize(unpackRGBToNormal(gtaoVisibilityBentNormal.gba));\n#define PROBE_NORMAL bentNormal\n#endif\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#include \n#include \n#include \n#undef RE_DirectSpecular\n#undef RE_IndirectSpecular\n#ifdef PROBE_NORMAL\n#undef PROBE_NORMAL\n#endif\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\n#ifdef USE_GTAO\nfloat gtaoVisibility = gtaoVisibilityBentNormal.r;\nvec3 gtaoBentNormal = bentNormal;\nvec3 gtaoViewDir = geometry.viewDir;\nvec3 gtaoNormal = normal;\nfloat gtaoRoughness = material.specularRoughness;\n#endif\n#include \noutColor = vec4(color.rgb * (reflectedLight.directSpecular\n+ reflectedLight.indirectSpecular), 1.0);\n}",node_bsdf_hair_bl_frag:"void node_bsdf_hair(vec4 color, float offset, float roughnessU, float roughnessV, vec3 tangent, out vec4 outColor)\n{\noutColor = color;\n}",node_bsdf_principled_bl_frag:"\nvec3 tintFromColor(vec3 color) {\nfloat lum = dot(color, vec3(0.3, 0.6, 0.1));\nreturn lum > 0.0 ? color / lum : vec3(1.0);\n}\nvec3 fresnelBlend(float ior, float fresnel, vec3 fresnelColor) {\nfloat fresnelFac = fresnelReflection(vec3(1.0, 0.0, 0.0), vec3(1.0, 0.0, 0.0), ior);\nfloat mixFac = saturate((fresnel - fresnelFac) / max(1e-8, 1.0 - fresnelFac));\nreturn mix(fresnelColor, vec3(1.0), mixFac);\n}\nvoid node_bsdf_principled(\nvec3 geometryNormal,\nvec4 baseColor, float subsurface, vec3 subsurfaceRadius, vec4 subsurfaceColor,\nfloat subsurfaceIOR, float subsurfaceAnisotropy,\nfloat metallic, float specular, float specularTint, float roughness,\nfloat anisotropic, float anisotropicRotation, float sheen, float sheenTint,\nfloat clearcoat, float clearcoatRoughness, float ior,\nfloat transmission, float transmissionRoughness, vec4 emission,\nfloat emissionStrength, float alpha, vec3 normal, vec3 clearcoatNormal,\nvec3 tangent,\nout vec4 outColor) {\nnormal = vec3(normal[0], normal[2], -normal[1]);\nvec3 normalWorld = normal;\nnormal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\nNodeMaterial material;\nmetallic = clamp(metallic, 0.0, 1.0);\nfloat dielectric = 1.0 - metallic;\ntransmission *= dielectric;\nmaterial.diffuseColor = baseColor.rgb * dielectric;\n#ifndef CLEARCOAT\nfloat dielReflCoeff = BLENDER_SPECULAR_COEFFICIENT;\n#else\nfloat dielReflCoeff = MAXIMUM_SPECULAR_COEFFICIENT;\nmaterial.clearcoat = saturate(clearcoat);\nmaterial.clearcoatRoughness = clamp(clearcoatRoughness, 0.0, 1.0);\n#endif\n#ifdef USE_SHEEN\nmaterial.sheenColor = sheen * mix(vec3(0.1), baseColor.rgb, sheenTint);\nmaterial.sheenRoughness = 0.1;\n#endif\nvec3 dielRefl = dielReflCoeff * specular\n* mix(vec3(1.0), tintFromColor(baseColor.rgb), specularTint);\nmaterial.specularColor = mix(dielRefl, baseColor.rgb, metallic);\nmaterial.specularRoughness = clamp(roughness, 0.0, 1.0);\nvec3 viewWorld;\nif (isPerspective(projectionMatrix))\nviewWorld = (invViewMatrix * vec4(-vViewPosition, 0.0)).xyz;\nelse\nviewWorld = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\nviewWorld = normalize(viewWorld);\nfloat fresnel = fresnelReflection(viewWorld, normalWorld, ior);\nvec3 fresnelColor = mix(vec3(1.0), baseColor.rgb, specularTint);\nmaterial.specularColor = mix(material.specularColor,\nfresnelBlend(ior, fresnel, fresnelColor) * fresnel, transmission);\nfloat isStrictDielectric = step(0.0, -length(vec4(subsurface, clearcoat,\ntransmission, float(metallic == 1.0))));\nmaterial.fresnelRefl90 = mix(vec3(1.0), material.specularColor,\n(1.0 - specular) * metallic * (1.0 - isStrictDielectric));\nmaterial.refractionColor = baseColor.rgb;\nmaterial.refractionIOR = ior;\nmaterial.refractionRoughness = pow2(roughness);\n#if defined(ENVMAP_TYPE_CUBE) || defined(ENVMAP_TYPE_CUBE_UV)\nfloat geomRoughness = calcGeometryRoughness(geometryNormal);\nmaterial.specularRoughness = calcCubeUVAdjustedRoughness(\nmaterial.specularRoughness, geomRoughness);\nmaterial.refractionRoughness = calcCubeUVAdjustedRoughness(\nmaterial.refractionRoughness, geomRoughness);\n#ifdef CLEARCOAT\nmaterial.clearcoatRoughness = calcCubeUVAdjustedRoughness(\nmaterial.clearcoatRoughness, geomRoughness);\nclearcoatNormal = normalize(vec3(clearcoatNormal[0], clearcoatNormal[2], -clearcoatNormal[1]));\nclearcoatNormal = (viewMatrix * vec4(clearcoatNormal.xyz, 0.0)).xyz;\n#endif\n#endif\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\nvec3 refractedLight = vec3(0.0);\n#ifdef USE_GTAO\nvec4 gtaoVisibilityBentNormal = texture2D(gtaoMap,\ngl_FragCoord.xy / currResolution);\nvec3 bentNormal = normalize(unpackRGBToNormal(gtaoVisibilityBentNormal.gba));\n#define PROBE_NORMAL bentNormal\n#endif\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#define RE_Refraction RE_Refraction_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_DirectSpecular\n#undef RE_IndirectDiffuse\n#undef RE_IndirectSpecular\n#undef RE_Refraction\n#ifdef PROBE_NORMAL\n#undef PROBE_NORMAL\n#endif\n#ifdef USE_GTAO\nreflectedLight.indirectDiffuse *= gtaoVisibilityBentNormal.r;\nfloat gtaoVisibility = gtaoVisibilityBentNormal.r;\nvec3 gtaoBentNormal = bentNormal;\nvec3 gtaoViewDir = geometry.viewDir;\nvec3 gtaoNormal = normal;\nfloat gtaoRoughness = material.specularRoughness;\n#endif\n#include \nvec3 outColor3 = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) * (1.0 - transmission)\n+ reflectedLight.directSpecular + reflectedLight.indirectSpecular\n+ refractedLight * transmission * (1.0 - fresnel)\n+ emission.rgb * emissionStrength;\noutColor = vec4(outColor3, alpha);\n}\nvoid node_bsdf_principled(\nvec3 geometryNormal,\nvec4 baseColor, float subsurface, vec3 subsurfaceRadius, vec4 subsurfaceColor,\nfloat metallic, float specular, float specularTint, float roughness,\nfloat anisotropic, float anisotropicRotation, float sheen, float sheenTint,\nfloat clearcoat, float clearcoatRoughness, float ior,\nfloat transmission, float transmissionRoughness, vec4 emission, float alpha,\nvec3 normal, vec3 clearcoatNormal, vec3 tangent,\nout vec4 outColor) {\nnode_bsdf_principled(geometryNormal, baseColor, subsurface, subsurfaceRadius,\nsubsurfaceColor, 0.0, 0.0, metallic, specular, specularTint, roughness,\nanisotropic, anisotropicRotation, sheen, sheenTint, clearcoat,\nclearcoatRoughness, ior, transmission, transmissionRoughness,\nemission, 1.0, alpha, normal, clearcoatNormal, tangent, outColor);\n}\nvoid node_bsdf_principled(\nvec3 geometryNormal,\nvec4 baseColor, float subsurface, vec3 subsurfaceRadius, vec4 subsurfaceColor,\nfloat metallic, float specular, float specularTint, float roughness,\nfloat anisotropic, float anisotropicRotation, float sheen, float sheenTint,\nfloat clearcoat, float clearcoatRoughness, float ior,\nfloat transmission, float transmissionRoughness, vec4 emission,\nfloat emissionStrength, float alpha, vec3 normal, vec3 clearcoatNormal,\nvec3 tangent,\nout vec4 outColor) {\nnode_bsdf_principled(geometryNormal, baseColor, subsurface, subsurfaceRadius,\nsubsurfaceColor, 0.0, 0.0, metallic, specular, specularTint, roughness,\nanisotropic, anisotropicRotation, sheen, sheenTint, clearcoat,\nclearcoatRoughness, ior, transmission, transmissionRoughness,\nemission, emissionStrength, alpha, normal, clearcoatNormal, tangent, outColor);\n}",node_bsdf_refraction_bl_frag:"#define BSDF_REFRACTION_GGX 0\n#define BSDF_REFRACTION_BECKMANN 1\n#define BSDF_REFRACTION_SHARP 2\nvoid node_bsdf_refraction(\nvec3 geometryNormal, const int distribution,\nvec4 color, float roughness, float ior, vec3 normal,\nout vec4 outColor) {\nnormal = swizzleUpY(normal);\nnormal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\nNodeMaterial material;\nmaterial.refractionColor = color.rgb;\nmaterial.refractionIOR = ior;\nif (distribution == BSDF_REFRACTION_SHARP) {\nmaterial.refractionRoughness = 0.0;\n} else {\nmaterial.refractionRoughness = pow2(roughness);\n}\n#if defined(ENVMAP_TYPE_CUBE) || defined(ENVMAP_TYPE_CUBE_UV)\nfloat geomRoughness = calcGeometryRoughness(geometryNormal);\nmaterial.refractionRoughness = calcCubeUVAdjustedRoughness(\nmaterial.refractionRoughness, geomRoughness);\n#endif\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\nvec3 refractedLight = vec3(0.0);\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\n#define RE_Refraction RE_Refraction_Node\n#include \n#include \n#include \n#undef RE_Refraction\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\noutColor = vec4(refractedLight, 1.0);\n}",node_bsdf_toon_bl_frag:"void node_bsdf_toon(\nvec4 color, float size, float smoothFac, vec3 normal,\nout vec4 outColor)\n{\noutColor = color;\n}",node_bsdf_translucent_bl_frag:"void node_bsdf_translucent(vec4 color, vec3 normal, out vec4 outColor) {\nnormal = -vec3(normal[0], normal[2], -normal[1]);\nnormal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\nNodeMaterial material;\nmaterial.diffuseColor = color.rgb;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_IndirectDiffuse\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\noutColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse, 1.0);\n}",node_bsdf_transparent_bl_frag:"\nvoid node_bsdf_transparent(vec4 color, out vec4 outColor)\n{\nfloat alpha = saturate(1.0 - dot(color.rgb, vec3(0.333333)));\noutColor = vec4(0.0, 0.0, 0.0, alpha);\n}",node_bsdf_velvet_bl_frag:"void node_bsdf_velvet(vec4 color, float sigma, vec3 normal, out vec4 outColor)\n{\noutColor = color;\n}",node_bump_bl_frag:"\nvoid node_bump(\nconst bool invert,\nfloat strength, float bumpDist, float height, float height_dx,\nfloat height_dy, vec3 normal,\nout vec3 outNormal) {\nvec3 position = swizzleUpZ(vWorldPosition);\nif (invert)\nbumpDist *= -1.0;\nvec3 dPdx = dFdx(position);\nvec3 dPdy = dFdy(position);\nfloat dHdx = dFdx(height);\nfloat dHdy = dFdy(height);\nvec3 tanX = cross(dPdy, normal);\nvec3 tanY = cross(normal, dPdx);\nvec3 surfaceGrad = dHdx * tanX + dHdy * tanY;\nfloat dotPosTanX = dot(dPdx, tanX);\noutNormal = normalize(normal * abs(dotPosTanX) - surfaceGrad * bumpDist * sign(dotPosTanX));\noutNormal = normalize(mix(normal, outNormal, max(0.0, strength)));\n}\nvoid node_bump(\nconst bool invert,\nfloat strength, float bumpDist, float height, vec3 normal,\nout vec3 outNormal) {\nnode_bump(invert, strength, bumpDist, height, 0.0, 0.0, normal, outNormal);\n}",node_camera_bl_frag:"\nvoid node_camera(\nvec3 viewPos, const bool invCamZ,\nout vec3 outViewVector, out float outViewZDepth, out float outViewDistance)\n{\nviewPos = -viewPos;\nif (invCamZ)\nviewPos.z = -viewPos.z;\noutViewVector = normalize(viewPos);\noutViewZDepth = abs(viewPos.z);\noutViewDistance = length(viewPos);\n}",node_clamp_bl_frag:"void node_clamp(float value, float minVal, float maxVal, out float result) {\nresult = max(min(value, maxVal), minVal);\n}",node_combhsv_bl_frag:"\nvoid node_combhsv(float h, float s, float v, out vec4 col)\n{\nhsvToRGB(vec4(h, s, v, 1.0), col);\n}",node_combrgb_bl_frag:"\nvoid node_combrgb(float r, float g, float b, out vec4 col)\n{\ncol = vec4(r, g, b, 1.0);\n}",node_combxyz_bl_frag:"void node_combxyz(float x, float y, float z, out vec3 outVector)\n{\noutVector = vec3(x, y, z);\n}",node_curve_rgb_bl_frag:"\nvoid node_curve_rgb(sampler2D curveData, float fac, vec4 col, out vec4 outCol)\n{\noutCol.r = texture2D(curveData, vec2(texture2D(curveData, vec2(col.r, 0.0)).a, 0.0)).r;\noutCol.g = texture2D(curveData, vec2(texture2D(curveData, vec2(col.g, 0.0)).a, 0.0)).g;\noutCol.b = texture2D(curveData, vec2(texture2D(curveData, vec2(col.b, 0.0)).a, 0.0)).b;\noutCol = mix(col, outCol, fac);\noutCol.a = col.a;\n}",node_curve_vec_bl_frag:"\nvoid node_curve_vec(sampler2D curveData, float fac, vec3 vec, out vec3 outVec)\n{\noutVec.x = texture2D(curveData, vec2((vec.x + 1.0) * 0.5, 0.0)).x;\noutVec.y = texture2D(curveData, vec2((vec.y + 1.0) * 0.5, 0.0)).y;\noutVec.z = texture2D(curveData, vec2((vec.z + 1.0) * 0.5, 0.0)).z;\noutVec = mix(vec, outVec * 2.0 - vec3(1.0), fac);\n}",node_displacement_bl_frag:"void node_displacement(float height, float midlevel, float scale, vec3 normal, out vec3 outDisplacement) {\noutDisplacement = vec3(0.0);\n}",node_eevee_specular_bl_frag:"void node_eevee_specular(\nvec3 geometryNormal,\nvec4 baseColor, vec4 specular, float roughness, vec4 emissiveColor,\nfloat transparency, vec3 normal, float clearcoat, float clearcoatRoughness,\nvec3 clearcoatNormal, float ambientOcclusion,\nout vec4 outColor) {\nnormal = vec3(normal[0], normal[2], -normal[1]);\nvec3 normalWorld = normal;\nnormal = (viewMatrix * vec4(normal.xyz, 0.0)).xyz;\nNodeMaterial material;\nmaterial.diffuseColor = baseColor.rgb;\nmaterial.specularColor = specular.rgb;\nmaterial.specularRoughness = clamp(roughness, 0.0, 1.0);\n#ifdef CLEARCOAT\nmaterial.clearcoat = saturate(clearcoat);\nmaterial.clearcoatRoughness = clamp(clearcoatRoughness, 0.0, 1.0);\n#endif\n#if defined(ENVMAP_TYPE_CUBE) || defined(ENVMAP_TYPE_CUBE_UV)\nfloat geomRoughness = calcGeometryRoughness(geometryNormal);\nmaterial.specularRoughness = calcCubeUVAdjustedRoughness(\nmaterial.specularRoughness, geomRoughness);\n#ifdef CLEARCOAT\nmaterial.clearcoatRoughness = calcCubeUVAdjustedRoughness(\nmaterial.clearcoatRoughness, geomRoughness);\nclearcoatNormal = normalize(vec3(clearcoatNormal[0], clearcoatNormal[2], -clearcoatNormal[1]));\nclearcoatNormal = (viewMatrix * vec4(clearcoatNormal.xyz, 0.0)).xyz;\n#endif\n#endif\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#ifdef USE_GTAO\nvec4 gtaoVisibilityBentNormal = texture2D(gtaoMap,\ngl_FragCoord.xy / currResolution);\nvec3 bentNormal = normalize(unpackRGBToNormal(gtaoVisibilityBentNormal.gba));\n#define PROBE_NORMAL bentNormal\n#endif\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_DirectSpecular\n#undef RE_IndirectDiffuse\n#undef RE_IndirectSpecular\n#ifdef PROBE_NORMAL\n#undef PROBE_NORMAL\n#endif\n#ifdef USE_GTAO\nreflectedLight.indirectDiffuse *= gtaoVisibilityBentNormal.r;\nfloat gtaoVisibility = gtaoVisibilityBentNormal.r;\nvec3 gtaoBentNormal = bentNormal;\nvec3 gtaoViewDir = geometry.viewDir;\nvec3 gtaoNormal = normal;\nfloat gtaoRoughness = material.specularRoughness;\n#endif\n#include \nvec3 outColor3 = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse\n+ reflectedLight.directSpecular + reflectedLight.indirectSpecular) * ambientOcclusion\n+ emissiveColor.rgb;\noutColor = vec4(outColor3, 1.0 - transparency);\n}",node_emission_bl_frag:"\nvoid node_emission(vec4 color, float strength, out vec4 outColor)\n{\noutColor = vec4(strength * color.rgb, 1.0);\n}",node_fresnel_bl_frag:"void node_fresnel(vec3 viewPos, float IOR, vec3 normal, out float fac)\n{\nvec3 worldDir;\nif (isPerspective(projectionMatrix))\nworldDir = (invViewMatrix * vec4(-viewPos, 0.0)).xyz;\nelse\nworldDir = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n\nworldDir = normalize(swizzleUpZ(worldDir));\nfloat eta = max(IOR, 0.00001);\nfac = fresnelReflection(worldDir, normal, (gl_FrontFacing) ? eta : 1.0 / eta);\n}",node_gamma_bl_frag:"\nvoid node_gamma(vec4 col, float gamma, out vec4 outCol)\n{\noutCol = col;\nif (col.r > 0.0)\noutCol.r = powCompat(col.r, gamma);\nif (col.g > 0.0)\noutCol.g = powCompat(col.g, gamma);\nif (col.b > 0.0)\noutCol.b = powCompat(col.b, gamma);\n}",node_hair_info_bl_frag:"void node_hair_info(out float isStrand, out float intercept, out float thickness,\nout vec3 tangentNormal, out float random) {\nisStrand = 0.0;\nintercept = 0.0;\nthickness = 0.0;\ntangentNormal = vec3(0.0);\nrandom = 0.0;\n}",node_holdout_bl_frag:"void node_holdout(out vec4 outColor)\n{\noutColor = vec4(0.0);\n}",node_hue_sat_bl_frag:"\nvoid node_hue_sat(float hue, float sat, float value, float fac, vec4 col, out vec4 outCol)\n{\nvec4 hsv;\nrgbToHSV(col, hsv);\nhsv[0] += (fract(hue) - 0.5);\nif (hsv[0] > 1.0) hsv[0] -= 1.0; else if (hsv[0] < 0.0) hsv[0] += 1.0;\nhsv[1] *= sat;\nif (hsv[1] > 1.0) hsv[1] = 1.0; else if (hsv[1] < 0.0) hsv[1] = 0.0;\nhsv[2] *= value;\nhsvToRGB(hsv, outCol);\noutCol = mix(col, outCol, fac);\n}",node_invert_bl_frag:"\nvoid node_invert(float fac, vec4 col, out vec4 outCol)\n{\noutCol.xyz = mix(col.xyz, vec3(1.0, 1.0, 1.0) - col.xyz, fac);\noutCol.w = col.w;\n}",node_layer_weight_bl_frag:"\nvoid node_layer_weight(vec3 viewPos, float blend, vec3 normal, out float fresnel, out float facing)\n{\nvec3 worldDir;\nif (isPerspective(projectionMatrix))\nworldDir = (invViewMatrix * vec4(-viewPos, 0.0)).xyz;\nelse\nworldDir = (invViewMatrix * vec4(0.0, 0.0, -1.0, 0.0)).xyz;\n\nworldDir = normalize(swizzleUpZ(worldDir));\nfloat eta = max(1.0 - blend, EPSILON);\nfresnel = fresnelReflection(worldDir, normal, (gl_FrontFacing) ? 1.0 / eta : eta);\nfacing = abs(dot(worldDir, normal));\nif (blend != 0.5) {\nblend = clamp(blend, 0.0, 1.0 - EPSILON);\nblend = (blend < 0.5) ? blend * 2.0 : 0.5 / (1.0 - blend);\nfacing = pow(facing, blend);\n}\nfacing = 1.0 - facing;\n}",node_light_falloff_bl_frag:"void node_light_falloff(\nfloat strength, float inSmooth,\nout float quadratic, out float linear, out float constant)\n{\nquadratic = 1.0;\nlinear = 1.0;\nconstant = 1.0;\n}",node_light_path_bl_frag:"void node_light_path(\nout float isCameraRay, out float isShadowRay, out float isDiffuseRay, \nout float isGlossyRay, out float isSingularRay, out float isReflectionRay,\nout float isTransmissionRay, out float rayLength, out float rayDepth, \nout float diffuseDepth, out float glossyDepth, out float transparentDepth, \nout float transmissionDepth)\n{\n#if LIGHT_PATH_IS_CAM_RAY\nisCameraRay = 1.0;\n#else\nisCameraRay = 0.0;\n#endif\nisShadowRay = 0.0;\nisDiffuseRay = 0.0;\nisGlossyRay = 0.0;\nisSingularRay = 0.0;\nisReflectionRay = 0.0;\nisTransmissionRay = 0.0;\nrayLength = 1.0;\nrayDepth = 1.0;\ndiffuseDepth = 1.0;\nglossyDepth = 1.0;\ntransparentDepth = 1.0; \ntransmissionDepth = 1.0;\n}",node_mapping_bl_frag:"\nvoid node_mapping(mat4 mat, vec3 minVec, vec3 maxVec, bool useMin, bool useMax, vec3 vec, out vec3 outVec)\n{\noutVec = (mat * vec4(vec, 1.0)).xyz;\nif (useMin)\noutVec = max(outVec, minVec);\nif (useMax)\noutVec = min(outVec, maxVec);\n}\nmat3 rotationMatrix(float angleX, float angleY, float angleZ) {\nfloat cx = cos(angleX);\nfloat sx = sin(angleX);\nfloat cy = cos(angleY);\nfloat sy = sin(angleY);\nfloat cz = cos(angleZ);\nfloat sz = sin(angleZ);\nmat3 mat;\nmat[0][0] = cy * cz;\nmat[0][1] = cy * sz;\nmat[0][2] = -sy;\nmat[1][0] = sy * sx * cz - cx * sz;\nmat[1][1] = sy * sx * sz + cx * cz;\nmat[1][2] = cy * sx;\nmat[2][0] = sy * cx * cz + sx * sz;\nmat[2][1] = sy * cx * sz - sx * cz;\nmat[2][2] = cy * cx;\nreturn mat;\n}\n#define NODE_MAPPING_POINT 1\n#define NODE_MAPPING_TEXTURE 2\n#define NODE_MAPPING_VECTOR 3\n#define NODE_MAPPING_NORMAL 4\nvoid node_mapping(int type, vec3 vec, vec3 loc, vec3 rot, vec3 scale, out vec3 outVec)\n{\nif (type == NODE_MAPPING_POINT)\noutVec = rotationMatrix(rot.x, rot.y, rot.z) * (vec * scale) + loc;\nelse if (type == NODE_MAPPING_TEXTURE)\noutVec = transposeMat3(rotationMatrix(rot.x, rot.y, rot.z)) * (vec - loc) / scale;\nelse if (type == NODE_MAPPING_VECTOR)\noutVec = rotationMatrix(rot.x, rot.y, rot.z) * (vec * scale);\nelse {\nmat3 rot = rotationMatrix(rot.x, rot.y, rot.z) * mat3(\nscale[0], 0.0, 0.0,\n0.0, scale[1], 0.0,\n0.0, 0.0, scale[2]\n);\noutVec = normalize(mat3GetInverseTransposed(rot) * vec);\n}\n}",node_map_range_bl_frag:"#define NODE_MAP_RANGE_INTERP_LINEAR 0\n#define NODE_MAP_RANGE_INTERP_STEPPED 1\n#define NODE_MAP_RANGE_INTERP_SMOOTHSTEP 2\n#define NODE_MAP_RANGE_INTERP_SMOOTHERSTEP 3\nvoid node_map_range(const int interpolation, bool inClamp, float value, float fromMin, float fromMax,\nfloat toMin, float toMax, float steps, out float result) {\nif (fromMax == fromMin) {\nresult = 0.0;\n} else if (interpolation == NODE_MAP_RANGE_INTERP_LINEAR) {\nresult = (value - fromMin) / (fromMax - fromMin) * (toMax - toMin) + toMin;\n} else if (interpolation == NODE_MAP_RANGE_INTERP_STEPPED) {\nfloat fac = (value - fromMin) / (fromMax - fromMin);\nfac = (steps > 0.0) ? floor(fac * (steps + 1.0)) / steps : 0.0;\nresult = fac * (toMax - toMin) + toMin;\n} else if (interpolation == NODE_MAP_RANGE_INTERP_SMOOTHSTEP) {\nfloat fac = (fromMin > fromMax) ?\n1.0 - smoothstep(fromMax, fromMin, value) :\nsmoothstep(fromMin, fromMax, value);\nresult = fac * (toMax - toMin) + toMin;\n} else {\nfloat fac = (fromMin > fromMax) ?\n1.0 - smootherstep(fromMax, fromMin, value) :\nsmootherstep(fromMin, fromMax, value);\nresult = fac * (toMax - toMin) + toMin;\n}\nif (inClamp && interpolation <= NODE_MAP_RANGE_INTERP_STEPPED) {\nresult = clamp(result, toMin, toMax);\n}\n}\nvoid node_map_range(const int interpolation, bool inClamp, float value,\nfloat fromMin, float fromMax, float toMin, float toMax, out float result) {\nnode_map_range(NODE_MAP_RANGE_INTERP_LINEAR, inClamp, value, fromMin,\nfromMax, toMin, toMax, 0.0, result);\n}",node_math_bl_frag:"\nvoid node_math_add(float val1, float val2, float val3, out float outVal)\n{\noutVal = val1 + val2;\n}\nvoid node_math_subtract(float val1, float val2, float val3, out float outVal)\n{\noutVal = val1 - val2;\n}\nvoid node_math_multiply(float val1, float val2, float val3, out float outVal)\n{\noutVal = val1 * val2;\n}\nvoid node_math_divide(float val1, float val2, float val3, out float outVal)\n{\nif (val2 == 0.0)\noutVal = 0.0;\nelse\noutVal = val1 / val2;\n}\nvoid node_math_sine(float val, float val2, float val3, out float outVal)\n{\noutVal = sin(val);\n}\nvoid node_math_cosine(float val, float val2, float val3, out float outVal)\n{\noutVal = cos(val);\n}\nvoid node_math_tangent(float val, float val2, float val3, out float outVal)\n{\noutVal = tan(val);\n}\nvoid node_math_arcsine(float val, float val2, float val3, out float outVal)\n{\nif (val <= 1.0 && val >= -1.0)\noutVal = asin(val);\nelse\noutVal = 0.0;\n}\nvoid node_math_arccosine(float val, float val2, float val3, out float outVal)\n{\nif (val <= 1.0 && val >= -1.0)\noutVal = acos(val);\nelse\noutVal = 0.0;\n}\nvoid node_math_arctangent(float val, float val2, float val3, out float outVal)\n{\noutVal = atan(val);\n}\nvoid node_math_arctan2(float val, float val2, float val3, out float outVal)\n{\noutVal = atan(val, val2);\n}\nvoid node_math_power(float val1, float val2, float val3, out float outVal)\n{\nif (val1 >= 0.0)\noutVal = powCompat(val1, val2);\nelse {\nfloat val2_mod_1 = mod(abs(val2), 1.0);\nif (val2_mod_1 > 0.999 || val2_mod_1 < 0.001)\noutVal = powCompat(val1, floor(val2 + 0.5));\nelse\noutVal = 0.0;\n}\n}\nvoid node_math_logarithm(float val1, float val2, float val3, out float outVal)\n{\nif (val1 > 0.0 && val2 > 0.0)\noutVal = log2(val1) / log2(val2);\nelse\noutVal = 0.0;\n}\nvoid node_math_sqrt(float val1, float val2, float val3, out float outVal)\n{\noutVal = sqrt(val1);\n}\nvoid node_math_maximum(float val1, float val2, float val3, out float outVal)\n{\noutVal = max(val1, val2);\n}\nvoid node_math_minimum(float val1, float val2, float val3, out float outVal)\n{\noutVal = min(val1, val2);\n}\nvoid node_math_round(float val1, float val2, float val3, out float outVal)\n{\noutVal = floor(val1 + 0.5);\n}\nvoid node_math_floor(float val1, float val2, float val3, out float outVal)\n{\noutVal = floor(val1);\n}\nvoid node_math_ceil(float val1, float val2, float val3, out float outVal)\n{\noutVal = ceil(val1);\n}\nvoid node_math_fract(float val1, float val2, float val3, out float outVal)\n{\noutVal = fract(val1);\n}\nvoid node_math_less_than(float val1, float val2, float val3, out float outVal)\n{\nif (val1 < val2)\noutVal = 1.0;\nelse\noutVal = 0.0;\n}\nvoid node_math_greater_than(float val1, float val2, float val3, out float outVal)\n{\nif (val1 > val2)\noutVal = 1.0;\nelse\noutVal = 0.0;\n}\nvoid node_math_modulo(float val1, float val2, float val3, out float outVal)\n{\nif (val2 == 0.0)\noutVal = 0.0;\nelse\noutVal = mod(val1, val2);\noutVal = (val1 > 0.0) ? outVal : outVal - val2;\n}\nvoid node_math_absolute(float val1, float val2, float val3, out float outVal)\n{\noutVal = abs(val1);\n}\nvoid node_math_compare(float val1, float val2, float val3, out float outVal) {\noutVal = step(abs(val1 - val2), val3);\n}\nvoid node_math_cosh(float val1, float val2, float val3, out float outVal) {\noutVal = cosh(val1);\n}\nvoid node_math_degrees(float val1, float val2, float val3, out float outVal) {\noutVal = val1 / PI * 180.0;\n}\nvoid node_math_exponent(float val1, float val2, float val3, out float outVal) {\noutVal = exp(val1);\n}\nvoid node_math_inverse_sqrt(float val1, float val2, float val3, out float outVal) {\nif (val1 >= 0.0) {\noutVal = 1.0 / sqrt(val1);\n} else {\noutVal = 0.0;\n}\n}\nvoid node_math_multiply_add(float val1, float val2, float val3, out float outVal) {\noutVal = val1 * val2 + val3;\n}\nvoid node_math_pingpong(float val1, float val2, float val3, out float outVal) {\nif (val2 == 0.0) {\noutVal = 0.0;\n} else {\nfloat absVal2 = abs(val2);\nfloat rem = mod(val1, absVal2);\noutVal = mix(rem, absVal2 - rem, mod(floor(val1 / absVal2), 2.0));\n}\n}\nvoid node_math_radians(float val1, float val2, float val3, out float outVal) {\noutVal = val1 / 180.0 * PI;\n}\nvoid node_math_sign(float val1, float val2, float val3, out float outVal) {\noutVal = sign(val1);\n}\nvoid node_math_sinh(float val1, float val2, float val3, out float outVal) {\noutVal = sinh(val1);\n}\nvoid node_math_smooth_max(float val1, float val2, float val3, out float outVal) {\noutVal = smoothMax(val1, val2, val3);\n}\nvoid node_math_smooth_min(float val1, float val2, float val3, out float outVal) {\noutVal = smoothMin(val1, val2, val3);\n}\nvoid node_math_snap(float val1, float val2, float val3, out float outVal) {\nval1 += 1e-5 * sign(val2);\nfloat quot = val1 / val2;\noutVal = floor(quot) * val2;\n}\nvoid node_math_tanh(float val1, float val2, float val3, out float outVal) {\noutVal = tanh(val1);\n}\nvoid node_math_trunc(float val1, float val2, float val3, out float outVal) {\nval1 += 1e-5;\noutVal = trunc(val1);\n}\nvoid node_math_wrap(float val1, float val2, float val3, out float outVal) {\nval1 += 1e-5;\noutVal = mod(val1 - val3, val2 - val3) + val3;\n}\nvoid node_math_add(float val1, float val2, out float outVal) {\nnode_math_add(val1, val2, 0.0, outVal);\n}\nvoid node_math_subtract(float val1, float val2, out float outVal) {\nnode_math_subtract(val1, val2, 0.0, outVal);\n}\nvoid node_math_multiply(float val1, float val2, out float outVal) {\nnode_math_multiply(val1, val2, 0.0, outVal);\n}\nvoid node_math_divide(float val1, float val2, out float outVal) {\nnode_math_divide(val1, val2, 0.0, outVal);\n}\nvoid node_math_sine(float val1, float val2, out float outVal) {\nnode_math_sine(val1, val2, 0.0, outVal);\n}\nvoid node_math_cosine(float val1, float val2, out float outVal) {\nnode_math_cosine(val1, val2, 0.0, outVal);\n}\nvoid node_math_tangent(float val1, float val2, out float outVal) {\nnode_math_tangent(val1, val2, 0.0, outVal);\n}\nvoid node_math_arcsine(float val1, float val2, out float outVal) {\nnode_math_arcsine(val1, val2, 0.0, outVal);\n}\nvoid node_math_arccosine(float val1, float val2, out float outVal) {\nnode_math_arccosine(val1, val2, 0.0, outVal);\n}\nvoid node_math_arctangent(float val1, float val2, out float outVal) {\nnode_math_arctangent(val1, val2, 0.0, outVal);\n}\nvoid node_math_arctan2(float val1, float val2, out float outVal) {\nnode_math_arctan2(val1, val2, 0.0, outVal);\n}\nvoid node_math_power(float val1, float val2, out float outVal) {\nnode_math_power(val1, val2, 0.0, outVal);\n}\nvoid node_math_logarithm(float val1, float val2, out float outVal) {\nnode_math_logarithm(val1, val2, 0.0, outVal);\n}\nvoid node_math_sqrt(float val1, float val2, out float outVal) {\nnode_math_sqrt(val1, val2, 0.0, outVal);\n}\nvoid node_math_maximum(float val1, float val2, out float outVal) {\nnode_math_maximum(val1, val2, 0.0, outVal);\n}\nvoid node_math_minimum(float val1, float val2, out float outVal) {\nnode_math_minimum(val1, val2, 0.0, outVal);\n}\nvoid node_math_round(float val1, float val2, out float outVal) {\nnode_math_round(val1, val2, 0.0, outVal);\n}\nvoid node_math_floor(float val1, float val2, out float outVal) {\nnode_math_floor(val1, val2, 0.0, outVal);\n}\nvoid node_math_ceil(float val1, float val2, out float outVal) {\nnode_math_ceil(val1, val2, 0.0, outVal);\n}\nvoid node_math_fract(float val1, float val2, out float outVal) {\nnode_math_fract(val1, val2, 0.0, outVal);\n}\nvoid node_math_less_than(float val1, float val2, out float outVal) {\nnode_math_less_than(val1, val2, 0.0, outVal);\n}\nvoid node_math_greater_than(float val1, float val2, out float outVal) {\nnode_math_greater_than(val1, val2, 0.0, outVal);\n}\nvoid node_math_modulo(float val1, float val2, out float outVal) {\nnode_math_modulo(val1, val2, 0.0, outVal);\n}\nvoid node_math_absolute(float val1, float val2, out float outVal) {\nnode_math_absolute(val1, val2, 0.0, outVal);\n}",node_mix_rgb_bl_frag:"\nvoid node_mix_rgb_mix(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol = mix(col1, col2, fac);\noutCol.a = col1.a;\n}\nvoid node_mix_rgb_add(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol = mix(col1, col1 + col2, fac);\noutCol.a = col1.a;\n}\nvoid node_mix_rgb_multiply(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol = mix(col1, col1 * col2, fac);\noutCol.a = col1.a;\n}\nvoid node_mix_rgb_screen(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat facm = 1.0 - fac;\noutCol = vec4(1.0) - (vec4(facm) + fac * (vec4(1.0) - col2)) * (vec4(1.0) - col1);\noutCol.a = col1.a;\n}\nvoid node_mix_rgb_overlay(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat facm = 1.0 - fac;\noutCol = col1;\nif (outCol.r < 0.5)\noutCol.r *= facm + 2.0 * fac * col2.r;\nelse\noutCol.r = 1.0 - (facm + 2.0 * fac * (1.0 - col2.r)) * (1.0 - outCol.r);\nif (outCol.g < 0.5)\noutCol.g *= facm + 2.0 * fac * col2.g;\nelse\noutCol.g = 1.0 - (facm + 2.0 * fac * (1.0 - col2.g)) * (1.0 - outCol.g);\nif (outCol.b < 0.5)\noutCol.b *= facm + 2.0 * fac * col2.b;\nelse\noutCol.b = 1.0 - (facm + 2.0 * fac * (1.0 - col2.b)) * (1.0 - outCol.b);\n}\nvoid node_mix_rgb_subtract(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol = mix(col1, col1 - col2, fac);\noutCol.a = col1.a;\n}\nvoid node_mix_rgb_divide(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat facm = 1.0 - fac;\noutCol = col1;\nif (col2.r != 0.0) outCol.r = facm * outCol.r + fac * outCol.r / col2.r;\nif (col2.g != 0.0) outCol.g = facm * outCol.g + fac * outCol.g / col2.g;\nif (col2.b != 0.0) outCol.b = facm * outCol.b + fac * outCol.b / col2.b;\n}\nvoid node_mix_rgb_difference(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol = mix(col1, abs(col1 - col2), fac);\noutCol.a = col1.a;\n}\nvoid node_mix_rgb_darken(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol.rgb = min(col1.rgb, col2.rgb * fac);\noutCol.a = col1.a;\n}\nvoid node_mix_rgb_lighten(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol.rgb = max(col1.rgb, col2.rgb * fac);\noutCol.a = col1.a;\n}\nvoid node_mix_rgb_dodge(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol = col1;\nif (outCol.r != 0.0) {\nfloat tmp = 1.0 - fac * col2.r;\nif (tmp <= 0.0)\noutCol.r = 1.0;\nelse if ((tmp = outCol.r / tmp) > 1.0)\noutCol.r = 1.0;\nelse\noutCol.r = tmp;\n}\nif (outCol.g != 0.0) {\nfloat tmp = 1.0 - fac * col2.g;\nif (tmp <= 0.0)\noutCol.g = 1.0;\nelse if ((tmp = outCol.g / tmp) > 1.0)\noutCol.g = 1.0;\nelse\noutCol.g = tmp;\n}\nif (outCol.b != 0.0) {\nfloat tmp = 1.0 - fac * col2.b;\nif (tmp <= 0.0)\noutCol.b = 1.0;\nelse if ((tmp = outCol.b / tmp) > 1.0)\noutCol.b = 1.0;\nelse\noutCol.b = tmp;\n}\n}\nvoid node_mix_rgb_burn(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat tmp, facm = 1.0 - fac;\noutCol = col1;\ntmp = facm + fac * col2.r;\nif (tmp <= 0.0)\noutCol.r = 0.0;\nelse if ((tmp = (1.0 - (1.0 - outCol.r) / tmp)) < 0.0)\noutCol.r = 0.0;\nelse if (tmp > 1.0)\noutCol.r = 1.0;\nelse\noutCol.r = tmp;\ntmp = facm + fac * col2.g;\nif (tmp <= 0.0)\noutCol.g = 0.0;\nelse if ((tmp = (1.0 - (1.0 - outCol.g) / tmp)) < 0.0)\noutCol.g = 0.0;\nelse if (tmp > 1.0)\noutCol.g = 1.0;\nelse\noutCol.g = tmp;\ntmp = facm + fac * col2.b;\nif (tmp <= 0.0)\noutCol.b = 0.0;\nelse if ((tmp = (1.0 - (1.0 - outCol.b) / tmp)) < 0.0)\noutCol.b = 0.0;\nelse if (tmp > 1.0)\noutCol.b = 1.0;\nelse\noutCol.b = tmp;\n}\n#ifdef HSV_NODES\nvoid node_mix_rgb_hue(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat facm = 1.0 - fac;\noutCol = col1;\nvec4 hsv, hsv2, tmp;\nrgbToHSV(col2, hsv2);\nif (hsv2.y != 0.0) {\nrgbToHSV(outCol, hsv);\nhsv.x = hsv2.x;\nhsvToRGB(hsv, tmp);\noutCol = mix(outCol, tmp, fac);\noutCol.a = col1.a;\n}\n}\nvoid node_mix_rgb_saturation(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat facm = 1.0 - fac;\noutCol = col1;\nvec4 hsv, hsv2;\nrgbToHSV(outCol, hsv);\nif (hsv.y != 0.0) {\nrgbToHSV(col2, hsv2);\nhsv.y = facm * hsv.y + fac * hsv2.y;\nhsvToRGB(hsv, outCol);\n}\n}\nvoid node_mix_rgb_value(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat facm = 1.0 - fac;\nvec4 hsv, hsv2;\nrgbToHSV(col1, hsv);\nrgbToHSV(col2, hsv2);\nhsv.z = facm * hsv.z + fac * hsv2.z;\nhsvToRGB(hsv, outCol);\n}\nvoid node_mix_rgb_color(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat facm = 1.0 - fac;\noutCol = col1;\nvec4 hsv, hsv2, tmp;\nrgbToHSV(col2, hsv2);\nif (hsv2.y != 0.0) {\nrgbToHSV(outCol, hsv);\nhsv.x = hsv2.x;\nhsv.y = hsv2.y;\nhsvToRGB(hsv, tmp);\noutCol = mix(outCol, tmp, fac);\noutCol.a = col1.a;\n}\n}\n#endif\nvoid node_mix_rgb_soft_light(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\nfloat facm = 1.0 - fac;\nvec4 one = vec4(1.0);\nvec4 scr = one - (one - col2) * (one - col1);\noutCol = facm * col1 + fac * ((one - col1) * col2 * col1 + col1 * scr);\n}\nvoid node_mix_rgb_linear_light(float fac, vec4 col1, vec4 col2, out vec4 outCol)\n{\nfac = clamp(fac, 0.0, 1.0);\noutCol = col1 + fac * (2.0 * (col2 - vec4(0.5)));\n}",node_mix_shader_bl_frag:"\nvoid node_mix_shader(int transpShaderNum,\nfloat fac, vec4 color1, vec4 color2, out vec4 outColor)\n{\nif (transpShaderNum == 0)\ncolor1.rgb = color2.rgb;\nelse if (transpShaderNum == 1)\ncolor2.rgb = color1.rgb;\noutColor = mix(color1, color2, fac);\n}",node_new_geometry_bl_frag:"void node_new_geometry(\nbool frontFacing, vec3 viewPos, vec3 viewNorm,\nout vec3 position, out vec3 normal, out vec3 tangent,\nout vec3 trueNormal, out vec3 incoming, out vec3 parametric,\nout float backfacing, out float pointiness, out float randomPerIsland)\n{\nvec4 posWorld = invViewMatrix * vec4(-viewPos, 1.0);\nposition = swizzleUpZ(posWorld.xyz);\nvec4 viewDir = isOrtho(projectionMatrix) ? vec4(0.0, 0.0, -1.0, 0.0) : vec4(normalize(-viewPos), 0.0);\nviewDir = invViewMatrix * viewDir;\nvec3 incomingVec = -swizzleUpZ(viewDir.xyz);\n#if WORLD_NODES == 1\nnormal = incomingVec;\ntangent = vec3(0.0);\n#else\nvec3 norWorld = normalize(invViewMatrix * vec4(viewNorm, 0.0)).xyz;\nnormal = swizzleUpZ(norWorld);\nvec4 posLocal = invModelMatrix * posWorld;\nvec3 posLocalDelta = posLocal.xyz - boundingBoxMin;\nvec3 bbDelta = boundingBoxMax - boundingBoxMin;\nvec3 posOrco = vec3(\nbbDelta.x < 1e-5 ? -sign(posLocal.y) : posLocalDelta.x / bbDelta.x,\n0.0,\nbbDelta.z < 1e-5 ? sign(posLocal.y) : posLocalDelta.z / bbDelta.z\n);\nposOrco -= 0.5;\nvec3 tangWorld = (modelMatrix * vec4(posOrco.z, 0.0, -posOrco.x, 0.0)).xyz;\ntangWorld = cross(norWorld, normalize(cross(tangWorld, norWorld)));\ntangent = swizzleUpZ(tangWorld);\n#endif\ntrueNormal = normal;\nincoming = incomingVec;\nparametric = vec3(0.0);\nbackfacing = (frontFacing) ? 0.0 : 1.0;\n#if WORLD_NODES == 1\npointiness = 0.0;\n#else\npointiness = 0.5;\n#endif\nrandomPerIsland = 0.0;\n}\nvoid node_new_geometry(\nbool frontFacing, vec3 viewPos, vec3 viewNorm,\nout vec3 position, out vec3 normal, out vec3 tangent,\nout vec3 trueNormal, out vec3 incoming, out vec3 parametric,\nout float backfacing, out float pointiness) {\nfloat randomPerIsland;\nnode_new_geometry(frontFacing, viewPos, viewNorm, position, normal, tangent,\ntrueNormal, incoming, parametric, backfacing, pointiness, randomPerIsland);\n}",node_normal_bl_frag:"\nvoid node_normal(vec3 norParam, vec3 norIn, out vec3 norOut, out float dotOut)\n{\nnorOut = norParam;\ndotOut = dot(normalize(norIn), norParam);\n}",node_normal_map_bl_frag:"\nvoid node_normal_map(vec4 tangent, vec3 normal, float strength, vec4 normalColor, out vec3 normalOut)\n{\n#ifdef DOUBLE_SIDED\nnormal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n#endif\nvec3 normalTex = (normalColor.xyz * 2.0 - 1.0);\nvec4 viewTangent = vec4(normalize((modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz), tangent.w);\nvec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\nnormalOut = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n+ normalTex.z * normal);\nnormalOut = mix(normal, normalOut, strength);\nnormalOut = normalize((invViewMatrix * vec4(normalOut, 0.0)).xyz);\nnormalOut = swizzleUpZ(normalOut);\n}",node_object_info_bl_frag:"uniform int objectIndex;\nuniform vec3 objectColor;\nuniform int materialIndex;\nuniform float objectRandom;\nvoid node_object_info(out vec3 location, out vec4 color, out float objIndex,\nout float matIndex, out float random) {\n#if WORLD_NODES == 1\nlocation = vec3(0.0);\ncolor = vec4(1.0);\nobjIndex = 0.0;\nmatIndex = 0.0;\nrandom = 0.0;\n#else\nlocation = swizzleUpZ(modelMatrix[3].xyz);\ncolor = vec4(objectColor, 1.0);\nobjIndex = float(objectIndex);\nmatIndex = float(materialIndex);\nrandom = float(objectRandom);\n#endif\n}\nvoid node_object_info(out vec3 location, out float objIndex, out float matIndex, out float random) {\n#if WORLD_NODES == 1\nlocation = vec3(0.0);\nobjIndex = 0.0;\nmatIndex = 0.0;\nrandom = 0.0;\n#else\nlocation = vec3(0.0);\nobjIndex = 0.0;\nmatIndex = 0.0;\nrandom = 0.5;\n#endif\n}",node_output_lamp_bl_frag:"void node_output_lamp(out vec4 outColor)\n{\noutColor = vec4(0.0);\n}",node_output_material_bl_frag:"\nvoid node_output_material(vec4 surface, vec4 volume, float displacement, out vec4 outgoingLight) {\noutgoingLight = surface + volume;\n}\nvoid node_output_material(vec4 surface, vec4 volume, vec3 displacement, out vec4 outgoingLight) {\noutgoingLight = surface + volume;\n}",node_output_world_bl_frag:"void node_output_world(vec4 surface, vec4 volume, out vec4 outgoingLight)\n{\noutgoingLight = surface;\n}",node_particle_info_bl_frag:"\nvoid node_particle_info(out float index, out float random, out float age,\nout float lifeTime, out vec3 location, out float size, out vec3 velocity,\nout vec3 angularVelocity) {\n#if WORLD_NODES == 1\nindex = 0.0;\nrandom = 0.0;\nage = 0.0;\nlifeTime = 0.0;\nlocation = vec3(0.0);\nsize = 0.0;\nvelocity = vec3(0.0);\nangularVelocity = vec3(0.0);\n#else\nindex = 0.0;\nrandom = 0.0;\nage = 0.0;\nlifeTime = 0.0;\nlocation = vec3(0.0);\nsize = 0.0;\nvelocity = vec3(0.0);\nangularVelocity = vec3(0.0);\n#endif\n}",node_principled_volume_bl_frag:"void node_principled_volume(vec4 color, float colorAttribute, float density,\nfloat densityAttribute, float anisotropy, vec4 absorptionColor,\nfloat emissionStrength, vec4 emissionColor, float blackbodyIntensity,\nvec4 blackbodyTint, float temperature, float temperatureAttribute,\nout vec4 volume) {\nvolume = vec4(0.0);\n}",node_rgb_bl_frag:"\nuniform vec4 nodeRGB[NODE_RGB_NUM];\nvoid node_rgb(vec4 color, out vec4 outColor)\n{\noutColor = color;\n}",node_rgbtobw_bl_frag:"\nvoid node_rgbtobw(vec4 color, out float outVal) {\noutVal = linearToRelativeLuminance(color.rgb);\n}",node_script_bl_frag:"void node_script(out vec4 outColor)\n{\noutColor = vec4(0.0);\n}",node_sephsv_bl_frag:"\nvoid node_sephsv(vec4 col, out float h, out float s, out float v)\n{\nvec4 hsv;\nrgbToHSV(col, hsv);\nh = hsv[0];\ns = hsv[1];\nv = hsv[2];\n}",node_seprgb_bl_frag:"\nvoid node_seprgb(vec4 col, out float r, out float g, out float b)\n{\nr = col.r;\ng = col.g;\nb = col.b;\n}",node_sepxyz_bl_frag:"void node_sepxyz(vec3 vector, out float x, out float y, out float z)\n{\nx = vector.x;\ny = vector.y;\nz = vector.z;\n}",node_shadertorgb_bl_frag:"void node_shadertorgb(vec4 shader, out vec4 color, out float alpha) {\ncolor = vec4(shader.rgb, 1.0);\nalpha = shader.a;\n}",node_squeeze_bl_frag:"\nvoid node_squeeze(float val, float width, float center, out float outVal)\n{\noutVal = 1.0 / (1.0 + pow(2.71828183, -((val - center) * width)));\n}",node_subsurface_scattering_bl_frag:"void node_subsurface_scattering(\nvec4 color, float scale, vec3 radius, float sharpen, float textureBlur, vec3 normal,\nout vec4 outColor)\n{\noutColor = color;\n}",node_tangent_bl_frag:"#define TANGENT_AXIS_X 0\n#define TANGENT_AXIS_Y 1\n#define TANGENT_AXIS_Z 2\nvoid node_tangent(int axis, vec3 viewPos, vec3 viewNorm, out vec3 outTangent) {\noutTangent = vec3(0.0);\n#if WORLD_NODES == 0\nvec4 posWorld = invViewMatrix * vec4(-viewPos, 1.0);\nvec3 norWorld = normalize(invViewMatrix * vec4(viewNorm, 0.0)).xyz;\nvec3 posLocal = (invModelMatrix * posWorld).xyz;\nvec3 posOrco = (posLocal - boundingBoxMin)\n/ (boundingBoxMax - boundingBoxMin) - 0.5;\nvec4 posOrcoPermuted;\nif (axis == TANGENT_AXIS_X) {\nposOrcoPermuted = vec4(0.0, -posOrco.z, posOrco.y, 0.0);\n} else if (axis == TANGENT_AXIS_Y) {\nposOrcoPermuted = vec4(-posOrco.y, posOrco.x, 0.0, 0.0);\n} else if (axis == TANGENT_AXIS_Z) {\nposOrcoPermuted = vec4(posOrco.z, 0.0, -posOrco.x, 0.0);\n}\nvec3 tangWorld = (modelMatrix * posOrcoPermuted).xyz;\ntangWorld = cross(norWorld, normalize(cross(tangWorld, norWorld)));\noutTangent = swizzleUpZ(tangWorld);\n#endif\n}\nvoid node_tangent(vec4 tangent, out vec3 outTangent) {\n#if WORLD_NODES == 0\noutTangent = normalize((modelMatrix * vec4(tangent.xyz, 0.0)).xyz);\noutTangent = swizzleUpZ(outTangent);\n#endif\n}",node_tex_brick_bl_frag:"float integer_noise(int rowCount, int brickCount)\n{\n#if __VERSION__ == 300\nint n = (rowCount << 16) + (brickCount & 0xFFFF);\nn = (n + 1013) & 0x7fffffff;\nn = (n >> 13) ^ n;\nint nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;\nreturn 0.5 * (float(nn) / 1073741824.0);\n#else\nconst int RAND_MAX = 32767;\nint next = ((123456 * rowCount) + brickCount) * 1103515245 + 12345;\nreturn (mod(float(next/65536), float(RAND_MAX + 1))) / float(RAND_MAX);\n#endif\n}\nvoid node_tex_brick(\nfloat offset, int offsetFrequency, float squash, int squashFrequency, \nvec3 vector, vec4 color1, vec4 color2, vec4 mortar, float scale,\nfloat mortarSize, float mortarSmooth, float bias, float brickWidth,\nfloat rowHeight,\nout vec4 outColor, out float outFac)\n{\nfloat x, y;\nvec3 p = vector * scale;\nfloat rowCount = floor(p.y / rowHeight);\nif (offsetFrequency != 0 && squashFrequency != 0) {\nbrickWidth *= mod(rowCount, float(squashFrequency)) > 0.5 ? 1.0 : squash;\noffset = mod(rowCount, float(offsetFrequency)) > 0.5 ? 0.0 : (brickWidth * offset);\n} \nint brickCount = int((p.x + offset) / brickWidth); \nfloat tint = clamp((integer_noise(int(rowCount), brickCount) + bias), 0.0, 1.0);\n\nx = (p.x + offset) - brickWidth * float(brickCount);\ny = p.y - rowHeight * rowCount;\nfloat min_dist = min(min(x, y), min(brickWidth - x, rowHeight - y));\n\nfloat f = step(min_dist, mortarSize);\nif (mortarSmooth > 0.0) {\nmin_dist = 1.0 - min_dist / mortarSize;\nf *= smoothstep(0.0, mortarSmooth, min_dist);\n}\noutColor = mix(mix(color1, color2, tint), mortar, f);\noutFac = f;\n}",node_tex_checker_bl_frag:"void node_tex_checker(vec3 vector, vec4 color1, vec4 color2, float scale, \nout vec4 outColor, out float outFac)\n{\nvec3 p = vector * scale;\np = (p + 0.00001) * 0.99999;\nfloat cx = floor(p.x);\nfloat cy = floor(p.y);\nfloat cz = floor(p.z);\nfloat result = sign(mod(cx + cy + cz, 2.0));\noutFac = max(result, 0.0);\noutColor = mix(color2, color1, outFac);\n}",node_tex_coord_bl_frag:"uniform mat4 nodeTexCoordObjectMatrices[NODE_TEX_COORD_NUM];\nvoid node_tex_coord(\nmat4 objectMat, vec3 viewPos, vec3 viewNorm, vec2 uv,\nout vec3 outGenerated, out vec3 outNormal, out vec3 outUV, out vec3 outObject,\nout vec3 outCamera, out vec3 outWindow, out vec3 outReflection)\n{\nvec4 view = vec4(-viewPos, 1.0);\nvec4 posWorld = invViewMatrix * view;\nvec3 loc = swizzleUpZ((invModelMatrix * posWorld).xyz);\n#if WORLD_NODES == 1\nloc = normalize(loc);\n#endif\n#if WORLD_NODES == 1\noutGenerated = loc;\n#else\nvec3 boxMin = vec3(boundingBoxMin.x, -boundingBoxMax.z, boundingBoxMin.y);\nvec3 boxMax = vec3(boundingBoxMax.x, -boundingBoxMin.z, boundingBoxMax.y);\nvec3 boxSize = boxMax - boxMin;\nif (abs(boxSize.x) < 0.001) {\noutGenerated.x = 0.5;\n} else {\noutGenerated.x = (loc.x - boxMin.x) / boxSize.x;\n}\nif (abs(boxSize.y) < 0.001) {\noutGenerated.y = 0.5;\n} else {\noutGenerated.y = (loc.y - boxMin.y) / boxSize.y;\n}\nif (abs(boxSize.z) < 0.001) {\noutGenerated.z = 0.5;\n} else {\noutGenerated.z = (loc.z - boxMin.z) / boxSize.z;\n}\n#endif\n#if WORLD_NODES == 1\noutNormal = -loc;\n#else\noutNormal = normalize(invModelMatrix * invViewMatrix * vec4(viewNorm, 0.0)).rgb;\noutNormal = swizzleUpZ(outNormal);\n#endif\n#if WORLD_NODES == 1\noutUV = vec3(0.0);\n#else\nuv.y = 1.0 - uv.y;\noutUV = vec3(uv, 0.0);\n#endif\n#if WORLD_NODES == 1\noutObject = loc;\n#else\noutObject = swizzleUpZ((objectMat * posWorld).xyz);\n#endif\noutCamera = vec3(view.xy, -view.z);\n#if WORLD_NODES == 1\noutWindow = vec3(0.0);\n#else\noutWindow = vec3(gl_FragCoord.xy / viewWidthHeight, 0.0);\n#endif\n#if WORLD_NODES == 1\noutReflection = -loc;\n#else\nvec4 reflection = (invViewMatrix * vec4(reflect(view.xyz, normalize(viewNorm)), 0.0));\noutReflection = normalize(swizzleUpZ(reflection.xyz));\n#endif\n}",node_tex_environment_bl_frag:"#define TEX_PROJ_EQUIRECTANGULAR 0\n#define TEX_PROJ_MIRROR_BALL 1\nvoid node_tex_environment(sampler2D tex, const int encoding, const int projection, vec3 vector, out vec4 outColor) {\nvec2 uv;\nfloat bias;\nif (projection == TEX_PROJ_EQUIRECTANGULAR) {\nvec3 direction = swizzleUpY(vector);\nif (length(direction) == 0.0) {\ndirection = vec3(0.0, 1.0, 0.0);\n} else {\ndirection = normalize(direction);\n}\nuv.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\nuv.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n#if WORLD_NODES == 1\nbias = -16.0;\n#else\nconst float seamWidth = 0.15;\nconst float seamBiasFactor = -10.0;\nfloat seam = max(0.0, 1.0 - abs (direction.z) / seamWidth) *\nclamp (1.0 - direction.x / seamWidth, 0.0, 1.0);\nbias = seamBiasFactor * seam;\n#endif\n} else {\nvec3 normal = normalize(vector);\nnormal.y -= 1.0;\nnormal /= (2.0 * sqrt(max(-0.5 * normal.y, 0.0)));\nuv = clamp(0.5 * normal.xz + 0.5, 0.0, 1.0);\nbias = 0.0;\n}\nuv.y = 1.0 - uv.y;\noutColor = texture2D(tex, uv, bias);\noutColor = nodeTexelToLinear(outColor, encoding);\n}",node_tex_environment_none_bl_frag:"void node_tex_environment_none(vec3 vector, out vec4 outColor) {\noutColor = vec4(1.0, 0.0, 1.0, 1.0);\n}",node_tex_gradient_bl_frag:"#define TEX_GRAD_LINEAR 0\n#define TEX_GRAD_QUADRATIC 1\n#define TEX_GRAD_EASING 2\n#define TEX_GRAD_DIAGONAL 3\n#define TEX_GRAD_SPHERICAL 4\n#define TEX_GRAD_QUADRATIC_SPHERE 5\n#define TEX_GRAD_RADIAL 6\nvoid node_tex_gradient(const int type, vec3 vector, out vec4 outColor, out float outFac)\n{\nfloat x, y, z, r;\nx = vector.x;\ny = vector.y;\nz = vector.z;\nif (type == TEX_GRAD_LINEAR) {\noutFac = x;\n} else if (type == TEX_GRAD_QUADRATIC) {\nr = max(x, 0.0);\noutFac = pow2(r);\n} else if (type == TEX_GRAD_EASING) {\nr = min(max(x, 0.0), 1.0);\noutFac = (3.0 * pow2(r) - 2.0 * pow3(r));\n} else if (type == TEX_GRAD_DIAGONAL) {\noutFac = (x + y) * 0.5;\n} else if (type == TEX_GRAD_RADIAL) {\noutFac = atan(y, x) / PI2 + 0.5;\n} else {\nr = max(0.99999 - sqrt(x * x + y * y + z * z), 0.0);\nif (type == TEX_GRAD_QUADRATIC_SPHERE) {\noutFac = pow2(r);\n} else if (type == TEX_GRAD_SPHERICAL) {\noutFac = r;\n}\n}\noutFac = clamp(outFac, 0.0, 1.0);\noutColor = vec4(outFac, outFac, outFac, 1.0);\n}",node_tex_ies_bl_frag:"void node_tex_ies(vec3 vector, float strength, out float fac) {\nfac = 0.0;\n}",node_tex_image_bl_frag:"#define TEX_PROJ_FLAT 0\n#define TEX_PROJ_BOX 1\n#define TEX_PROJ_SPHERE 2\n#define TEX_PROJ_TUBE 3\nvoid node_tex_image(sampler2D ima, const int encoding, vec3 viewNorm,\nconst int projection, const float projectionBlend, const bool clampToEdgeNoExtend,\nvec3 vector,\nout vec4 outColor, out float outAlpha) {\nif (projection == TEX_PROJ_FLAT) {\nvec2 uv = vector.xy;\nuv.y = 1.0 - uv.y;\nif (clampToEdgeNoExtend && (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0)) {\noutColor = vec4(0.0);\noutAlpha = 0.0;\n} else {\noutColor = texture2D(ima, uv);\noutAlpha = outColor.a;\n}\noutColor = nodeTexelToLinear(outColor, encoding);\n} else if (projection == TEX_PROJ_BOX) {\nvec3 norm = normalize(viewNorm * normalMatrix);\nvector = swizzleUpY(vector);\nvec2 uvX = vec2(-sign(norm.x) * vector.z, -vector.y);\nvec2 uvY = vec2(sign(norm.y) * vector.z, -vector.x);\nvec2 uvZ = vec2(sign(norm.z) * vector.x, -vector.y);\nvec4 colX = nodeTexelToLinear(texture2D(ima, uvX), encoding);\nvec4 colY = nodeTexelToLinear(texture2D(ima, uvY), encoding);\nvec4 colZ = nodeTexelToLinear(texture2D(ima, uvZ), encoding);\nvec3 barycentric = abs(norm);\nbarycentric /= barycentric.x + barycentric.y + barycentric.z;\nvec3 edgeShape = min(min(barycentric.yzx, barycentric.zxy),\n(projectionBlend - 1.0) / (projectionBlend - 3.0));\nvec3 edgeValue = (1.0 - projectionBlend) * (1.0 - edgeShape) / 2.0;\nvec3 weight = max((barycentric - edgeValue) / (1.0 - edgeValue), EPSILON);\nweight /= (weight.x + weight.y + weight.z);\noutColor = weight.x * colX + weight.y * colY + weight.z * colZ;\noutAlpha = outColor.a;\n} else if (projection == TEX_PROJ_SPHERE) {\nvector = normalize(vector * 2.0 - 1.0);\nvector = swizzleUpY(vector);\nvec2 uv = vec2(atan(vector.x, vector.z) / PI2, acos(vector.y) / PI);\nuv.x = mod(uv.x, 1.0);\noutColor = texture2D(ima, uv);\noutAlpha = outColor.a;\noutColor = nodeTexelToLinear(outColor, encoding);\n} else if (projection == TEX_PROJ_TUBE) {\nvector = vector * 2.0 - 1.0;\nvector = swizzleUpY(vector);\nvec2 uv = vec2(atan(vector.x, vector.z) / PI2, (1.0 - vector.y) / 2.0);\nuv.x = mod(uv.x, 1.0);\noutColor = texture2D(ima, uv);\noutAlpha = outColor.a;\noutColor = nodeTexelToLinear(outColor, encoding);\n}\n}",node_tex_image_none_bl_frag:"void node_tex_image_none(vec3 vector, out vec4 color, out float alpha)\n{\ncolor = vec4(1.0, 0.0, 1.0, 1.0);\nalpha = 1.0;\n}",node_tex_magic_bl_frag:"void node_tex_magic(vec3 vector, float scale, float distortion,\nout vec4 outColor, out float outFac)\n{\noutColor = vec4(0.0);\noutFac = 0.0;\n}",node_tex_musgrave_bl_frag:"void node_tex_musgrave(vec3 vector, float w, float scale, float detail,\nfloat dimension, float lacunarity, float offset, float gain,\nout float outFac) {\noutFac = 0.0;\n}\nvoid node_tex_musgrave(\nvec3 vector, float scale, float detail, float dimension, float lacunarity,\nfloat offset, float gain,\nout vec4 outColor, out float outFac)\n{\noutColor = vec4(0.0);\noutFac = 0.0;\n}",node_tex_noise_bl_frag:"\nvoid node_tex_noise(\nfloat falloffFactor, float dispersionFactor,\nvec3 vector, float w, float scale, float detail, float roughness,\nfloat distortion, out float outFac, out vec4 outColor) {\nvec3 p = vector * scale;\nvec3 dx = dFdx(p);\nvec3 dy = dFdy(p);\nfloat octaveLenPerPixel = (length(dx) + length(dy)) / 4.0;\nif (distortion != 0.0) {\nvec3 r, offset = vec3(13.5, 13.5, 13.5);\nr.x = noiseSmooth(p + offset, octaveLenPerPixel, falloffFactor,\ndispersionFactor) * distortion;\nr.y = noiseSmooth(p, octaveLenPerPixel, falloffFactor,\ndispersionFactor) * distortion;\nr.z = noiseSmooth(p - offset, octaveLenPerPixel, falloffFactor,\ndispersionFactor) * distortion;\np += r;\n}\noutFac = noiseTurbulence(p, detail, octaveLenPerPixel, falloffFactor,\ndispersionFactor);\nvec3 color = vec3(outFac,\nnoiseTurbulence(vec3(p.y, p.x, p.z), detail, octaveLenPerPixel,\nfalloffFactor, dispersionFactor),\nnoiseTurbulence(vec3(p.y, p.z, p.x), detail, octaveLenPerPixel,\nfalloffFactor, dispersionFactor)\n);\noutColor = vec4(color, 1.0);\n}\nvoid node_tex_noise(\nfloat falloffFactor, float dispersionFactor,\nvec3 vector, float w, float scale, float detail, float distortion,\nout float outFac, out vec4 outColor) {\nnode_tex_noise(falloffFactor, dispersionFactor, vector, w, scale, detail,\n0.5, distortion, outFac, outColor);\n}\nvoid node_tex_noise(\nfloat falloffFactor, float dispersionFactor,\nvec3 vector, float scale, float detail, float distortion,\nout vec4 outColor, out float outFac) {\nnode_tex_noise(falloffFactor, dispersionFactor, vector, 0.0, scale, detail,\ndistortion, outFac, outColor);\n}",node_tex_pointdensity_bl_frag:"void node_tex_pointdensity(\nvec3 vector,\nout vec4 outColor, out float outDensity)\n{\noutColor = vec4(0.0);\noutDensity = 0.0;\n}",node_tex_sky_bl_frag:"\n#define TEX_SKY_PREETHAM 0\n#define TEX_SKY_HOSEK_WILKIE 1\n#define TEX_SKY_NISHITA 2\n#define Km 683.0\nvoid node_tex_sky(const int skyType, vec3 param0, vec3 param1, vec3 param2,\nvec3 param3, vec3 param4, vec3 param5, vec3 param6, vec3 param7,\nvec3 param8, vec3 radiance, vec3 sunDirection, vec3 vectorIn,\nout vec4 outColor) {\nif (length(vectorIn) == 0.0) {\nvectorIn = vec3(0.0, 1.0, 0.0);\n} else {\nvectorIn = normalize(vectorIn);\n}\nvectorIn = swizzleUpY(vectorIn);\nsunDirection = swizzleUpY(sunDirection);\nfloat cosGamma = clamp(dot(vectorIn, sunDirection), -1.0, 1.0);\nfloat cosTheta = clamp(vectorIn.y, 0.0, 1.0);\nif (skyType == TEX_SKY_PREETHAM) {\nvec3 radInternal = (1.0 + param0 * exp(param1 / cosTheta)) * (\n1.0 + param2 * exp(param3 * acos(cosGamma))\n+ param4 * pow(cosGamma, 2.0)\n);\nvec3 XYZ = xyY_to_XYZ(radInternal.y * radiance.y,\nradInternal.z * radiance.z, radInternal.x * radiance.x);\noutColor = vec4(max(xyz_to_sRGB(XYZ), 0.0), 1.0);\n} else if (skyType == TEX_SKY_HOSEK_WILKIE) {\nfloat cosGammaSq = pow(cosGamma, 2.0);\nvec3 chi = (1.0 + cosGammaSq) / pow(1.0 + pow(param8, vec3(2.0))\n- 2.0 * param8 * cosGamma, vec3(1.5));\nvec3 radInternal = (1.0 + param0 * exp(param1 / (cosTheta + 0.01))) * (\nparam2 + param3 * exp(param4 * acos(cosGamma))\n+ param5 * cosGammaSq + param6 * chi + param7 * sqrt(cosTheta)\n);\noutColor = vec4(max(xyz_to_sRGB(radInternal * radiance), 0.0) * PI2/Km, 1.0);\n} else {\noutColor = vec4(0.0, 0.0, 0.0, 1.0);\n}\n}",node_tex_voronoi_bl_frag:"#define DISTANCE_EUCLIDEAN 0\n#define DISTANCE_MANHATTAN 1\n#define DISTANCE_CHEBYCHEV 2\n#define DISTANCE_MINKOWSKI 3\n#define FEATURE_F1 0\n#define FEATURE_F2 1\n#define FEATURE_SMOOTH_F1 2\n#define FEATURE_DISTANCE_TO_EDGE 3\n#define FEATURE_N_SPHERE_RADIUS 4\nstruct VoronoiGridData {\nvec3 point;\nvec3 randVec;\nvec3 toClosest;\nfloat dist;\n};\nfloat worleyLength(vec3 vec, int distance, float exponent) {\nif (distance == DISTANCE_EUCLIDEAN) {\nreturn length(vec);\n} else if (distance == DISTANCE_MANHATTAN) {\nreturn abs(vec.x) + abs(vec.y) + abs(vec.z);\n} else if (distance == DISTANCE_CHEBYCHEV) {\nreturn max(max(abs(vec.x), abs(vec.y)), abs(vec.z));\n} else if (distance == DISTANCE_MINKOWSKI) {\nreturn pow(pow(abs(vec.x), exponent)\n+ pow(abs(vec.y), exponent)\n+ pow(abs(vec.z), exponent), 1.0 / exponent);\n}\nreturn 0.0;\n}\nvoid worleyNoise(vec3 pos, int distance, float exponent, int feature,\nfloat smoothness, float randomness, out float outDist, out vec4 outColor,\nout vec3 outPosition, out float outW, out float outRadius) {\nconst highp float RAND_FIX_ZERO = 0.125;\nvec3 posI = floor(pos);\nvec3 posF = fract(pos);\nVoronoiGridData vgd[27];\n#pragma unroll_loop_start\nfor (int i = 0; i <= 2; i++) {\n#pragma unroll_loop_start\nfor (int j = 0; j <= 2; j++) {\n#pragma unroll_loop_start\nfor (int k = 0; k <= 2; k++) {\nvec3 point = vec3((i), (j), (k)) - 1.0;\nvec3 randVec = rand3(posI + point + RAND_FIX_ZERO);\nvec3 toClosest = point + randomness * randVec - posF;\nconst int counter = (i) + (j) * 3 + (k) * 9;\nvgd[counter].point = point;\nvgd[counter].randVec = randVec;\nvgd[counter].toClosest = toClosest;\nvgd[counter].dist = worleyLength(toClosest, distance, exponent);\n}\n#pragma unroll_loop_end\n}\n#pragma unroll_loop_end\n}\n#pragma unroll_loop_end\nfloat f1 = 1e10;\nfloat f2 = 1e10;\nvec3 edgeToClosest = vec3(0.0);\nfloat distToEdge = 1e10;\nvec3 randColF1 = vec3(0.0);\nvec3 randColF2 = vec3(0.0);\nvec3 toClosestF1 = vec3(0.0);\nvec3 toClosestF2 = vec3(0.0);\nvec3 radPoint = vec3(0.0);\nvec3 radToClosest = vec3(0.0);\n#pragma unroll_loop_start\nfor (int i = 0; i < 27; i++) {\nif (feature == FEATURE_F1) {\nif (vgd[i].dist < f1) {\nf1 = vgd[i].dist;\nrandColF1 = vgd[i].randVec;\ntoClosestF1 = vgd[i].toClosest;\n}\n} else if (feature == FEATURE_F2) {\nif (vgd[i].dist < f1) {\nf2 = f1;\nf1 = vgd[i].dist;\nrandColF2 = randColF1;\nrandColF1 = vgd[i].randVec;\ntoClosestF2 = toClosestF1;\ntoClosestF1 = vgd[i].toClosest;\n} else if (vgd[i].dist < f2) {\nf2 = vgd[i].dist;\nrandColF2 = vgd[i].randVec;\ntoClosestF2 = vgd[i].toClosest;\n}\n} else if (feature == FEATURE_SMOOTH_F1) {\nf1 = smoothMin(f1, vgd[i].dist, smoothness);\n} else if (feature == FEATURE_DISTANCE_TO_EDGE) {\nfloat dist = worleyLength(vgd[i].toClosest, DISTANCE_EUCLIDEAN, exponent);\nif (dist < f1) {\nf1 = dist;\nedgeToClosest = vgd[i].toClosest;\n}\n} else if (feature == FEATURE_N_SPHERE_RADIUS) {\nfloat dist = worleyLength(vgd[i].toClosest, DISTANCE_EUCLIDEAN, exponent);\nif (dist < f1) {\nf1 = dist;\nradPoint = vgd[i].point;\nradToClosest = vgd[i].toClosest;\n}\n}\n}\n#pragma unroll_loop_end\nif (feature == FEATURE_F1) {\noutDist = f1;\noutColor = vec4(randColF1, 1.0);\noutPosition = pos + toClosestF1;\n} else if (feature == FEATURE_F2) {\noutDist = f2;\noutColor = vec4(randColF2, 1.0);\noutPosition = pos + toClosestF2;\n} else if (feature == FEATURE_SMOOTH_F1) {\noutDist = f1;\nvec3 avgCol = vec3(0.0);\nvec3 avgOff = vec3(0.0);\nfloat sumWeightsCol = 0.0;\nfloat sumWeightsOff = 0.0;\n#pragma unroll_loop_start\nfor (int i = 0; i < 27; i++) {\nfloat smoothFac = getSmoothFactor(f1, vgd[i].dist, smoothness);\nfloat weightOff = smoothFac * smoothFac * smoothFac;\nfloat weightCol = weightOff * smoothFac;\navgCol += vgd[i].randVec * weightCol;\navgOff += vgd[i].toClosest * weightOff;\nsumWeightsCol += weightCol;\nsumWeightsOff += weightOff;\n}\n#pragma unroll_loop_end\noutColor = vec4(avgCol / sumWeightsCol, 1.0);\noutPosition = pos + avgOff / sumWeightsOff;\n} else if (feature == FEATURE_DISTANCE_TO_EDGE) {\n#pragma unroll_loop_start\nfor (int i = 0; i < 27; i++) {\nif (vgd[i].toClosest != edgeToClosest) {\nfloat dist = dot(0.5 * (edgeToClosest + vgd[i].toClosest),\nnormalize(vgd[i].toClosest - edgeToClosest));\ndistToEdge = min(distToEdge, dist);\n}\n}\n#pragma unroll_loop_end\noutDist = distToEdge;\n} else if (feature == FEATURE_N_SPHERE_RADIUS) {\nfloat diam = 1e10;\n#pragma unroll_loop_start\nfor (int i = 0; i <= 2; i++) {\n#pragma unroll_loop_start\nfor (int j = 0; j <= 2; j++) {\n#pragma unroll_loop_start\nfor (int k = 0; k <= 2; k++) {\nvec3 localPoint = vec3((i), (j), (k)) - 1.0;\nif (length(localPoint) > 0.0) {\nvec3 point = localPoint + radPoint;\nvec3 randVec = rand3(posI + point + RAND_FIX_ZERO);\nvec3 toClosest = point + randomness * randVec - posF;\ndiam = min(diam, length(toClosest - radToClosest));\n}\n}\n#pragma unroll_loop_end\n}\n#pragma unroll_loop_end\n}\n#pragma unroll_loop_end\noutRadius = diam / 2.0;\n}\n}\n#define VORONOI_SMOOTH_COEFF 0.74\nvoid node_tex_voronoi(\nint distance, int feature,\nvec3 vector, float w, float scale, float smoothness, float exponent,\nfloat randomness,\nout float outDistance, out vec4 outColor, out vec3 outPosition,\nout float outW, out float outRadius) {\nvector = scale * (vector - 0.0001);\nsmoothness = clamp(smoothness, 1e-3, 1.0);\nsmoothness *= VORONOI_SMOOTH_COEFF;\nworleyNoise(vector, distance, exponent, feature, smoothness, randomness,\noutDistance, outColor, outPosition, outW, outRadius);\noutPosition /= scale;\n}\n#define DISTANCE_DISTANCE DISTANCE_EUCLIDEAN\n#define FEATURE_F3 5\n#define FEATURE_F4 6\n#define FEATURE_F2F1 7\n#define COLORING_INTENSITY 0\n#define COLORING_CELLS 1\nstruct VoronoiClosest {\nvec4 closestDists;\nvec4 closestInds;\n};\nvoid updateVoronoiClosest(inout VoronoiClosest vf, vec3 newDistances,\nvec3 newIndices) {\n#pragma unroll_loop_start\nfor (int i = 0; i < 3; i++) {\nfloat currDist = newDistances[i];\nfloat currIdx = newIndices[i];\n#pragma unroll_loop_start\nfor (int j = 0; j < 4; j++) {\nif (currDist < vf.closestDists[j]) {\nfloat tmp = vf.closestDists[j];\nvf.closestDists[j] = currDist;\ncurrDist = tmp;\ntmp = vf.closestInds[j];\nvf.closestInds[j] = currIdx;\ncurrIdx = tmp;\n}\n}\n#pragma unroll_loop_end\n}\n#pragma unroll_loop_end\n}\nvec3 worleyPermute(vec3 x) {\nreturn mod((34.0 * x + 1.0) * x, 289.0);\n}\nvec3 worleyDist(vec3 x, vec3 y, vec3 z, int distance, float exponent) {\nif (distance == DISTANCE_EUCLIDEAN) {\nreturn x * x + y * y + z * z;\n} else if (distance == DISTANCE_MANHATTAN) {\nreturn abs(x) + abs(y) + abs(z);\n} else if (distance == DISTANCE_CHEBYCHEV) {\nreturn max(max(abs(x), abs(y)), abs(z));\n} else if (distance == DISTANCE_MINKOWSKI) {\nvec3 expVec = vec3(exponent);\nreturn pow(pow(abs(x), expVec)\n+ pow(abs(y), expVec)\n+ pow(abs(z), expVec), 1.0 / expVec);\n}\nreturn vec3(0.0);\n}\nVoronoiClosest worleyClosest(vec3 P, float jitter, int distance, float exponent) {\nfloat K = 0.142857142857;\nfloat Ko = 0.428571428571;\nfloat K2 = 0.020408163265306;\nfloat Kz = 0.166666666667;\nfloat Kzo = 0.416666666667;\nvec3 Pi = mod(floor(P), 289.0);\nvec3 Pf = fract(P) - 0.5;\nvec3 Pfx = Pf.x + vec3(1.0, 0.0, -1.0);\nvec3 Pfy = Pf.y + vec3(1.0, 0.0, -1.0);\nvec3 Pfz = Pf.z + vec3(1.0, 0.0, -1.0);\nvec3 p = worleyPermute(Pi.x + vec3(-1.0, 0.0, 1.0));\nvec3 p1 = worleyPermute(p + Pi.y - 1.0);\nvec3 p2 = worleyPermute(p + Pi.y);\nvec3 p3 = worleyPermute(p + Pi.y + 1.0);\nvec3 p11 = worleyPermute(p1 + Pi.z - 1.0);\nvec3 p12 = worleyPermute(p1 + Pi.z);\nvec3 p13 = worleyPermute(p1 + Pi.z + 1.0);\nvec3 p21 = worleyPermute(p2 + Pi.z - 1.0);\nvec3 p22 = worleyPermute(p2 + Pi.z);\nvec3 p23 = worleyPermute(p2 + Pi.z + 1.0);\nvec3 p31 = worleyPermute(p3 + Pi.z - 1.0);\nvec3 p32 = worleyPermute(p3 + Pi.z);\nvec3 p33 = worleyPermute(p3 + Pi.z + 1.0);\nvec3 ox11 = fract(p11*K) - Ko;\nvec3 oy11 = mod(floor(p11*K), 7.0)*K - Ko;\nvec3 oz11 = floor(p11*K2)*Kz - Kzo;\nvec3 ox12 = fract(p12*K) - Ko;\nvec3 oy12 = mod(floor(p12*K), 7.0)*K - Ko;\nvec3 oz12 = floor(p12*K2)*Kz - Kzo;\nvec3 ox13 = fract(p13*K) - Ko;\nvec3 oy13 = mod(floor(p13*K), 7.0)*K - Ko;\nvec3 oz13 = floor(p13*K2)*Kz - Kzo;\nvec3 ox21 = fract(p21*K) - Ko;\nvec3 oy21 = mod(floor(p21*K), 7.0)*K - Ko;\nvec3 oz21 = floor(p21*K2)*Kz - Kzo;\nvec3 ox22 = fract(p22*K) - Ko;\nvec3 oy22 = mod(floor(p22*K), 7.0)*K - Ko;\nvec3 oz22 = floor(p22*K2)*Kz - Kzo;\nvec3 ox23 = fract(p23*K) - Ko;\nvec3 oy23 = mod(floor(p23*K), 7.0)*K - Ko;\nvec3 oz23 = floor(p23*K2)*Kz - Kzo;\nvec3 ox31 = fract(p31*K) - Ko;\nvec3 oy31 = mod(floor(p31*K), 7.0)*K - Ko;\nvec3 oz31 = floor(p31*K2)*Kz - Kzo;\nvec3 ox32 = fract(p32*K) - Ko;\nvec3 oy32 = mod(floor(p32*K), 7.0)*K - Ko;\nvec3 oz32 = floor(p32*K2)*Kz - Kzo;\nvec3 ox33 = fract(p33*K) - Ko;\nvec3 oy33 = mod(floor(p33*K), 7.0)*K - Ko;\nvec3 oz33 = floor(p33*K2)*Kz - Kzo;\nvec3 dx11 = Pfx + jitter*ox11;\nvec3 dy11 = Pfy.x + jitter*oy11;\nvec3 dz11 = Pfz.x + jitter*oz11;\nvec3 dx12 = Pfx + jitter*ox12;\nvec3 dy12 = Pfy.x + jitter*oy12;\nvec3 dz12 = Pfz.y + jitter*oz12;\nvec3 dx13 = Pfx + jitter*ox13;\nvec3 dy13 = Pfy.x + jitter*oy13;\nvec3 dz13 = Pfz.z + jitter*oz13;\nvec3 dx21 = Pfx + jitter*ox21;\nvec3 dy21 = Pfy.y + jitter*oy21;\nvec3 dz21 = Pfz.x + jitter*oz21;\nvec3 dx22 = Pfx + jitter*ox22;\nvec3 dy22 = Pfy.y + jitter*oy22;\nvec3 dz22 = Pfz.y + jitter*oz22;\nvec3 dx23 = Pfx + jitter*ox23;\nvec3 dy23 = Pfy.y + jitter*oy23;\nvec3 dz23 = Pfz.z + jitter*oz23;\nvec3 dx31 = Pfx + jitter*ox31;\nvec3 dy31 = Pfy.z + jitter*oy31;\nvec3 dz31 = Pfz.x + jitter*oz31;\nvec3 dx32 = Pfx + jitter*ox32;\nvec3 dy32 = Pfy.z + jitter*oy32;\nvec3 dz32 = Pfz.y + jitter*oz32;\nvec3 dx33 = Pfx + jitter*ox33;\nvec3 dy33 = Pfy.z + jitter*oy33;\nvec3 dz33 = Pfz.z + jitter*oz33;\nvec3 d11 = worleyDist(dx11, dy11, dz11, distance, exponent);\nvec3 d12 = worleyDist(dx12, dy12, dz12, distance, exponent);\nvec3 d13 = worleyDist(dx13, dy13, dz13, distance, exponent);\nvec3 d21 = worleyDist(dx21, dy21, dz21, distance, exponent);\nvec3 d22 = worleyDist(dx22, dy22, dz22, distance, exponent);\nvec3 d23 = worleyDist(dx23, dy23, dz23, distance, exponent);\nvec3 d31 = worleyDist(dx31, dy31, dz31, distance, exponent);\nvec3 d32 = worleyDist(dx32, dy32, dz32, distance, exponent);\nvec3 d33 = worleyDist(dx33, dy33, dz33, distance, exponent);\nVoronoiClosest vf = VoronoiClosest(vec4(1e10), vec4(0.0));\nupdateVoronoiClosest(vf, d11, p11);\nupdateVoronoiClosest(vf, d12, p12);\nupdateVoronoiClosest(vf, d13, p13);\nupdateVoronoiClosest(vf, d21, p21);\nupdateVoronoiClosest(vf, d22, p22);\nupdateVoronoiClosest(vf, d23, p23);\nupdateVoronoiClosest(vf, d31, p31);\nupdateVoronoiClosest(vf, d32, p32);\nupdateVoronoiClosest(vf, d33, p33);\nreturn vf;\n}\nvoid node_tex_voronoi(int coloring, int distance, int feature, vec3 vector,\nfloat scale, float exponent, out vec4 outColor, out float outFac) {\nvector = scale * (vector - 0.0001);\nVoronoiClosest vf = worleyClosest(vector, 1.0, distance, exponent);\nvec4 vorColorData;\nif (coloring == COLORING_INTENSITY) {\nvorColorData = vf.closestDists;\n} else if (coloring == COLORING_CELLS) {\nvorColorData = vf.closestInds;\n}\nfloat vorColorFac;\nif (feature == FEATURE_F1) {\nvorColorFac = vorColorData.x;\n} else if (feature == FEATURE_F2) {\nvorColorFac = vorColorData.y;\n} else if (feature == FEATURE_F3) {\nvorColorFac = vorColorData.z;\n} else if (feature == FEATURE_F4) {\nvorColorFac = vorColorData.w;\n} else if (feature == FEATURE_F2F1) {\nvorColorFac = vorColorData.y - vorColorData.x;\n}\nif (coloring == COLORING_INTENSITY) {\noutFac = vorColorFac;\noutColor = vec4(vec3(outFac), 1.0);\n} else if (coloring == COLORING_CELLS) {\nvorColorFac += 1e-3;\nfloat r = rand(vec2(vorColorFac / 289.0));\nfloat g = rand(vec2(vorColorFac / 23535.0));\nfloat b = rand(vec2(vorColorFac / 4353.0));\noutFac = (r + g + b) / 3.0;\noutColor = vec4(r, g, b, 1.0);\n}\n}",node_tex_wave_bl_frag:"#define TEX_WAVE_TYPE_BANDS 0\n#define TEX_WAVE_TYPE_RINGS 1\n#define TEX_WAVE_PROFILE_SIN 0\n#define TEX_WAVE_PROFILE_SAW 1\n#define TEX_WAVE_PROFILE_TRI 2\n#define TEX_WAVE_BANDS_DIR_X 0\n#define TEX_WAVE_BANDS_DIR_Y 1\n#define TEX_WAVE_BANDS_DIR_Z 2\n#define TEX_WAVE_BANDS_DIR_DIAGONAL 3\n#define TEX_WAVE_RINGS_DIR_X 0\n#define TEX_WAVE_RINGS_DIR_Y 1\n#define TEX_WAVE_RINGS_DIR_Z 2\n#define TEX_WAVE_RINGS_DIR_SPHERICAL 3\nvoid node_tex_wave(\nint waveType, int waveProfile, int bandsDirection, int ringsDirection,\nvec3 vector, float scale, float distortion, float detail, float detailScale,\nfloat detailRoughness, float phaseOffset,\nout vec4 outColor, out float outFac) {\nvec3 coScaled = vector * scale;\nfloat waveFac;\nvec3 waveVec = coScaled;\nif (waveType == TEX_WAVE_TYPE_BANDS) {\nconst float BANDS_AXIS_SCALE = 2.0 / 3.0;\nif (bandsDirection == TEX_WAVE_BANDS_DIR_X) {\nwaveVec = waveVec.xxx * BANDS_AXIS_SCALE;\n} else if (bandsDirection == TEX_WAVE_BANDS_DIR_Y) {\nwaveVec = waveVec.yyy * BANDS_AXIS_SCALE;\n} else if (bandsDirection == TEX_WAVE_BANDS_DIR_Z) {\nwaveVec = waveVec.zzz * BANDS_AXIS_SCALE;\n} else if (bandsDirection == TEX_WAVE_BANDS_DIR_DIAGONAL) {\n}\nwaveFac = (waveVec.x + waveVec.y + waveVec.z) * 10.0;\n} else {\nif (ringsDirection == TEX_WAVE_RINGS_DIR_X) {\nwaveVec.x = 0.0;\n} else if (ringsDirection == TEX_WAVE_RINGS_DIR_Y) {\nwaveVec.y = 0.0;\n} else if (ringsDirection == TEX_WAVE_RINGS_DIR_Z) {\nwaveVec.z = 0.0;\n} else if (ringsDirection == TEX_WAVE_RINGS_DIR_SPHERICAL) {\n}\nwaveFac = length(waveVec) * 20.0;\n}\nif (distortion != 0.0) {\nwaveFac += distortion * noiseTurbulence(coScaled * detailScale, detail,\n0.0, 0.0, 1.0);\n}\nif (waveProfile == TEX_WAVE_PROFILE_SIN) {\nwaveFac = 0.5 + 0.5 * sin(waveFac - PI_HALF + phaseOffset);\n} else if (waveProfile == TEX_WAVE_PROFILE_SAW) {\nwaveFac = fract((waveFac + phaseOffset + 1e-4) / PI2);\n} else if (waveProfile == TEX_WAVE_PROFILE_TRI) {\nwaveFac = abs(2.0 * fract((waveFac + PI + phaseOffset) / PI2) - 1.0);\n}\noutColor = vec4(waveFac, waveFac, waveFac, 1.0);\noutFac = waveFac;\n}\nvoid node_tex_wave(int waveType, int waveProfile, int bandsDirection,\nint ringsDirection, vec3 vector, float scale, float distortion,\nfloat detail, float detailScale, out vec4 outColor, out float outFac) {\nfloat legacyOffset = 0.0;\nif (waveProfile == TEX_WAVE_PROFILE_SIN) {\nlegacyOffset = PI_HALF;\n}\nnode_tex_wave(waveType, waveProfile, bandsDirection, ringsDirection, vector,\nscale, distortion, detail, detailScale, 0.5, legacyOffset, outColor,\noutFac);\n}",node_tex_white_noise_bl_frag:"void node_tex_white_noise(vec3 vector, float w, out float outValue,\nout vec4 outColor) {\noutValue = 0.0;\noutColor = vec4(0.0);\n}\nvoid node_tex_white_noise(vec3 vector, float w, out float outValue) {\noutValue = 0.0;\n}",node_uvmap_bl_frag:"void node_uvmap(vec2 uv, out vec3 outUV) {\n#if WORLD_NODES == 1\noutUV = vec3(0.0);\n#else\nuv.y = 1.0 - uv.y;\noutUV = vec3(uv, 0.0);\n#endif\n}",node_valtorgb_bl_frag:"\nvoid node_valtorgb(sampler2D colormap, float fac, out vec4 colOut, out float alphaOut)\n{\ncolOut = texture2D(colormap, vec2(fac, 0.0));\nalphaOut = colOut.a;\n}",node_value_bl_frag:"\nuniform float nodeValue[NODE_VALUE_NUM];\nvoid node_value(float val, out float outVal)\n{\noutVal = val;\n}",node_vect_math_bl_frag:"void node_vect_math_add(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = v1 + v2;\n}\nvoid node_vect_math_subtract(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = v1 - v2;\n}\nvoid node_vect_math_multiply(vec3 v1, vec3 v2, vec3 v3, float val,\nout vec3 outVec, out float outVal) {\noutVec = v1 * v2;\n}\nvoid node_vect_math_divide(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec.x = v2.x == 0.0 ? 0.0 : v1.x / v2.x;\noutVec.y = v2.y == 0.0 ? 0.0 : v1.y / v2.y;\noutVec.z = v2.z == 0.0 ? 0.0 : v1.z / v2.z;\n}\nvoid node_vect_math_cross_product(vec3 v1, vec3 v2, vec3 v3, float val,\nout vec3 outVec, out float outVal) {\noutVec = cross(v1, v2);\n}\nvoid node_vect_math_project(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\nfloat d = dot(v2, v2);\noutVec = (d != 0.0) ? (dot(v1, v2) / d) * v2 : vec3(0.0);\n}\nvoid node_vect_math_reflect(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\nif (v2 != vec3(0.0)) {\nv2 = normalize(v2);\n}\noutVec = reflect(v1, v2);\n}\nvoid node_vect_math_dot_product(vec3 v1, vec3 v2, vec3 v3, float val,\nout vec3 outVec, out float outVal) {\noutVal = dot(v1, v2);\n}\nvoid node_vect_math_distance(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVal = distance(v1, v2);\n}\nvoid node_vect_math_length(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVal = length(v1);\n}\nvoid node_vect_math_scale(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = v1 * val;\n}\nvoid node_vect_math_normalize(vec3 v1, vec3 v2, vec3 v3, float val,\nout vec3 outVec, out float outVal) {\nif (v1 != vec3(0.0)) {\nv1 = normalize(v1);\n}\noutVec = v1;\n}\nvoid node_vect_math_snap(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec.x = v2.x == 0.0 ? 0.0 : floor(v1.x / v2.x) * v2.x;\noutVec.y = v2.y == 0.0 ? 0.0 : floor(v1.y / v2.y) * v2.y;\noutVec.z = v2.z == 0.0 ? 0.0 : floor(v1.z / v2.z) * v2.z;\n}\nvoid node_vect_math_floor(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = floor(v1);\n}\nvoid node_vect_math_ceil(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = ceil(v1);\n}\nvoid node_vect_math_modulo(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\nvec3 signProduct = sign(v1) * sign(v2);\nv1 += 1e-5 * signProduct;\noutVec.x = signProduct.x > 0.0 ? mod(v1.x, abs(v2.x)) : 0.0;\noutVec.y = signProduct.y > 0.0 ? mod(v1.y, abs(v2.y)) : 0.0;\noutVec.z = signProduct.z > 0.0 ? mod(v1.z, abs(v2.z)) : 0.0;\n}\nvoid node_vect_math_fraction(vec3 v1, vec3 v2, vec3 v3, float val,\nout vec3 outVec, out float outVal) {\noutVec = fract(v1);\n}\nvoid node_vect_math_absolute(vec3 v1, vec3 v2, vec3 v3, float val,\nout vec3 outVec, out float outVal) {\noutVec = abs(v1);\n}\nvoid node_vect_math_minimum(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = min(v1, v2);\n}\nvoid node_vect_math_maximum(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = max(v1, v2);\n}\nvoid node_vect_math_cosine(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = cos(v1);\n}\nvoid node_vect_math_sine(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = sin(v1);\n}\nvoid node_vect_math_tangent(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\noutVec = tan(v1);\n}\nvoid node_vect_math_wrap(vec3 v1, vec3 v2, vec3 v3, float val, out vec3 outVec,\nout float outVal) {\nv1 += 1e-5;\noutVec.x = v2.x == v3.x ? v2.x : mod(v1.x - v3.x, v2.x - v3.x) + v3.x;\noutVec.y = v2.y == v3.y ? v2.y : mod(v1.y - v3.y, v2.y - v3.y) + v3.y;\noutVec.z = v2.z == v3.z ? v2.z : mod(v1.z - v3.z, v2.z - v3.z) + v3.z;\n}\nvoid node_vect_math_absolute(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_absolute(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_add(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_add(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_ceil(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_ceil(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_cross_product(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_cross_product(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_distance(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_distance(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_divide(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_divide(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_dot_product(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_dot_product(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_floor(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_floor(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_fraction(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_fraction(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_maximum(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_maximum(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_length(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_length(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_minimum(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_minimum(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_modulo(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_modulo(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_project(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_project(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_normalize(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_normalize(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_multiply(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_multiply(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_scale(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_scale(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_reflect(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_reflect(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_subtract(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_subtract(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_snap(vec3 v1, vec3 v2, float val, out vec3 outVec,\nout float outVal) {\nnode_vect_math_snap(v1, v2, vec3(0.0), val, outVec, outVal);\n}\nvoid node_vect_math_add(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\noutVec = v1 + v2;\noutVal = (abs(outVec[0]) + abs(outVec[1]) + abs(outVec[2])) * RECIPROCAL_3;\n}\nvoid node_vect_math_subtract(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\noutVec = v1 - v2;\noutVal = (abs(outVec[0]) + abs(outVec[1]) + abs(outVec[2])) * RECIPROCAL_3;\n}\nvoid node_vect_math_average(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\noutVec = v1 + v2;\noutVal = length(outVec);\noutVec = normalize(outVec);\n}\nvoid node_vect_math_dot_product(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\noutVec = vec3(0, 0, 0);\noutVal = dot(v1, v2);\n}\nvoid node_vect_math_cross_product(vec3 v1, vec3 v2, out vec3 outVec, out float outVal)\n{\noutVec = cross(v1, v2);\noutVal = length(outVec);\noutVec /= outVal;\n}\nvoid node_vect_math_normalize(vec3 v, vec3 v2, out vec3 outVec, out float outVal)\n{\noutVal = length(v);\noutVec = normalize(v);\n}",node_vect_transform_bl_frag:"\n#define VEC_TRANS_NONE 0\n#define VEC_TRANS_W_O 1\n#define VEC_TRANS_W_C 2\n#define VEC_TRANS_O_W 3\n#define VEC_TRANS_O_C 4\n#define VEC_TRANS_C_W 5\n#define VEC_TRANS_C_O 6\n#define VEC_TRANS_W_O_DIR 7\n#define VEC_TRANS_W_C_DIR 8\n#define VEC_TRANS_O_W_DIR 9\n#define VEC_TRANS_O_C_DIR 10\n#define VEC_TRANS_C_W_DIR 11\n#define VEC_TRANS_C_O_DIR 12\nvoid node_vect_transform(const int vecTransType, const bool invCamZ, vec3 vIn, out vec3 vOut)\n{\nif (vecTransType == VEC_TRANS_NONE)\nvOut = vIn;\nelse {\nvec4 vec;\nif (vecTransType < VEC_TRANS_W_O_DIR)\nvec = vec4(vIn.xyz, 1.0);\nelse\nvec = vec4(vIn.xyz, 0.0);\nif (vecTransType == VEC_TRANS_W_O || vecTransType == VEC_TRANS_W_O_DIR) {\nvec = vec4(vec.x, vec.z, -vec.y, vec.w);\nvec = invModelMatrix * vec;\nvec = vec4(vec.x, -vec.z, vec.y, vec.w);\n} else if (vecTransType == VEC_TRANS_W_C || vecTransType == VEC_TRANS_W_C_DIR) {\nvec = vec4(vec.x, vec.z, -vec.y, vec.w);\nvec = viewMatrix * vec;\nif (invCamZ)\nvec[2] = -vec[2];\n} else if (vecTransType == VEC_TRANS_O_W || vecTransType == VEC_TRANS_O_W_DIR) {\nvec = vec4(vec.x, vec.z, -vec.y, vec.w);\nvec = modelMatrix * vec;\nvec = vec4(vec.x, -vec.z, vec.y, vec.w);\n} else if (vecTransType == VEC_TRANS_O_C || vecTransType == VEC_TRANS_O_C_DIR) {\nvec = vec4(vec.x, vec.z, -vec.y, vec.w);\nvec = modelViewMatrix * vec;\nif (invCamZ)\nvec[2] = -vec[2];\n} else if (vecTransType == VEC_TRANS_C_W || vecTransType == VEC_TRANS_C_W_DIR) {\nif (invCamZ)\nvec[2] = -vec[2];\nvec = invViewMatrix * vec;\nvec = vec4(vec.x, -vec.z, vec.y, vec.w);\n} else if (vecTransType == VEC_TRANS_C_O || vecTransType == VEC_TRANS_C_O_DIR) {\nif (invCamZ)\nvec[2] = -vec[2];\nvec = invModelMatrix * invViewMatrix * vec;\nvec = vec4(vec.x, -vec.z, vec.y, vec.w);\n}\nvOut = vec.xyz;\n}\n}",node_vector_displacement_bl_frag:"void node_vector_displacement(vec4 vector, float midLevel, float scale,\nout vec3 displacement) {\ndisplacement = vec3(0.0);\n}",node_vector_rotate_bl_frag:"void node_vector_rotate_axis_angle(float invert, vec3 vector, vec3 center,\nvec3 axis, float angle, vec3 rotation, out vec3 outVector) {\nif (length(axis) > 0.0) {\nvector -= center;\noutVector = vec3RotateAxisAngle(vector, axis, invert * angle);\noutVector += center;\n} else {\noutVector = vector;\n}\n}\nvoid node_vector_rotate_euler_xyz(float invert, vec3 vector, vec3 center,\nvec3 axis, float angle, vec3 rotation, out vec3 outVector) {\nvec4 axisAngle = eulerToAxisAngle(rotation);\nvector -= center;\noutVector = vec3RotateAxisAngle(vector, axisAngle.xyz, invert * axisAngle.w);\noutVector += center;\n}\nvoid node_vector_rotate_x_axis(float invert, vec3 vector, vec3 center,\nvec3 axis, float angle, vec3 rotation, out vec3 outVector) {\nvector -= center;\noutVector = vec3RotateXAngle(vector, invert * angle);\noutVector += center;\n}\nvoid node_vector_rotate_y_axis(float invert, vec3 vector, vec3 center,\nvec3 axis, float angle, vec3 rotation, out vec3 outVector) {\nvector -= center;\noutVector = vec3RotateYAngle(vector, invert * angle);\noutVector += center;\n}\nvoid node_vector_rotate_z_axis(float invert, vec3 vector, vec3 center,\nvec3 axis, float angle, vec3 rotation, out vec3 outVector) {\nvector -= center;\noutVector = vec3RotateZAngle(vector, invert * angle);\noutVector += center;\n}",node_vertex_color_bl_frag:"void node_vertex_color(vec4 color, out vec4 outColor, out float outAlpha) {\noutColor = color;\noutAlpha = color.a;\n}",node_volume_absorption_bl_frag:"void node_volume_absorption(vec4 color, float density, out vec4 outColor)\n{\noutColor = color;\n}",node_volume_info_bl_frag:"void node_volume_info(out vec4 color, out float density, out float flame,\nout float temperature) {\ncolor = vec4(vec3(0.0), 1.0);\ndensity = 0.0;\nflame = 0.0;\ntemperature = 0.0;\n}",node_volume_scatter_bl_frag:"void node_volume_scatter(vec4 color, float density, float anisotropy, out vec4 outColor)\n{\noutColor = vec4(color);\n}",node_wavelength_bl_frag:"void node_wavelength(float wavelength, out vec4 outColor)\n{\noutColor = vec4(0.0, 0.0, 0.0, 1.0);\n#if __VERSION__ == 300\nvec3 xyz = vec3(0.0);\nfloat ii = (wavelength - 380.0) / 5.0;\nint i = int(ii);\nif (i < 0 || i >= 80) {\nreturn;\n}\nii -= float(i);\nvec3 c1 = cieColorMatch[i];\nvec3 c2 = cieColorMatch[i+1];\nxyz = mix(c1, c2, ii);\noutColor = vec4(xyz_to_sRGB(xyz), 1.0);\n#endif\n}",node_wireframe_bl_frag:"void node_wireframe(float size, out float outFac)\n{\noutFac = 0.0;\n}",node_bitmap_none_mx_frag:"void node_bitmap_none(out vec4 color)\n{\ncolor = vec4(1.0);\n}",node_bitmap_env_mx_frag:"void node_bitmap_env(sampler2D envMap, int reflectMode, float IOR,\nconst int encoding, const bool alphaAsMono, const bool alphaAsRGB,\nfloat uOffset, float vOffset, float uTiling, float vTiling, float wAngle, vec3 normal,\nout vec4 color, out float value)\n{\nvec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\nvec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\nvec3 reflectVec;\n#if WORLD_NODES\nreflectVec = normalize(cameraToVertex);\n#else\nif (reflectMode == MAX_ENV_COORDS_REFLECT)\nreflectVec = reflect(cameraToVertex, worldNormal);\nelse {\nfloat refrRatio = 1.0 / IOR;\nreflectVec = refract(cameraToVertex, worldNormal, refrRatio);\n}\n#endif\nmat3 uvTransform = calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle);\ncolor = sampleEquirectangular(envMap, reflectVec, uvTransform, encoding);\nif (alphaAsMono)\nvalue = color.a;\nelse\nvalue = average(color.rgb);\nif (alphaAsRGB)\ncolor = vec4(color.a);\n}",node_bitmap_mx_frag:"void node_bitmap(sampler2D map, const vec2 uvIn, const int mapping, const int axis,\nconst ivec2 clampToEdgeNoExtend,\nconst int encoding, const bool alphaAsMono, const bool alphaAsRGB,\nfloat uOffset, float vOffset, float uTiling, float vTiling, float wAngle,\nout vec4 color, out float value)\n{\nvec3 coordsIn;\nif (mapping == MAPPING_EXPLICIT_MAP_CHANNEL) {\ncoordsIn = vec3(uvIn.x, 1.0 - uvIn.y, 0.0);\n} else if (mapping == MAPPING_VERTEX_COLOR_CHANNEL) {\ncoordsIn = vec3(0.0);\n} else if (mapping == MAPPING_PLANAR_OBJECT_XYZ) {\ncoordsIn = swizzleUpZ((invModelMatrix * invViewMatrix * vec4(-vViewPosition, 1.0)).xyz);\n} else {\ncoordsIn = swizzleUpZ((invViewMatrix * vec4(-vViewPosition, 1.0)).xyz);\n}\nif (axis == AXIS_XY)\ncoordsIn = vec3(coordsIn.x, coordsIn.y, 1.0);\nelse if (axis == AXIS_YZ)\ncoordsIn = vec3(coordsIn.y, coordsIn.z, 1.0);\nelse if (axis == AXIS_ZX)\ncoordsIn = vec3(coordsIn.z, coordsIn.x, 1.0);\nvec3 coordsOut = calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle) * coordsIn;\nvec2 uv = vec2(coordsOut.x, 1.0 - coordsOut.y);\nif ((clampToEdgeNoExtend[0] == 1 && (uvIn.x < 0.0 || uvIn.x > 1.0)) ||\n(clampToEdgeNoExtend[1] == 1 && (uvIn.y < 0.0 || uvIn.y > 1.0))) {\ncolor = vec4(0.0, 0.0, 0.0, 1.0);\n} else {\ncolor = texture2D(map, uv);\ncolor = nodeTexelToLinear(color, encoding);\n}\nif (alphaAsMono)\nvalue = color.a;\nelse\nvalue = average(color.rgb);\nif (alphaAsRGB)\ncolor = vec4(color.a);\n}",node_bump_mx_frag:"void node_bump(sampler2D bumpMap, const vec3 eyePos, const vec3 normal, const vec2 uvIn,\nfloat uOffset, float vOffset, float uTiling, float vTiling, float wAngle,\nout vec3 normalOut)\n{\nvec3 coordsIn;\ncoordsIn = vec3(uvIn.x, 1.0 - uvIn.y, 1.0);\nvec3 coordsOut = calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle) * coordsIn;\nvec2 uv = vec2(coordsOut.x, 1.0 - coordsOut.y);\nvec2 dSTdx = dFdx(uv);\nvec2 dSTdy = dFdy(uv);\nif (any(equal(dSTdx, vec2(0.0))) || any(equal(dSTdy, vec2(0.0)))) {\nnormalOut = normal;\n} else {\nconst float bumpScale = 1.0;\nvec3 vSigmaX = vec3(dFdx(eyePos.x), dFdx(eyePos.y), dFdx(eyePos.z));\nvec3 vSigmaY = vec3(dFdy(eyePos.x), dFdy(eyePos.y), dFdy(eyePos.z));\nvec3 vN = normal;\nvec3 R1 = cross(vSigmaY, vN);\nvec3 R2 = cross(vN, vSigmaX);\nfloat fDet = dot(vSigmaX, R1);\nfloat Hll = bumpScale * texture2D(bumpMap, uv).x;\nfloat dBx = bumpScale * texture2D(bumpMap, uv + dSTdx).x - Hll;\nfloat dBy = bumpScale * texture2D(bumpMap, uv + dSTdy).x - Hll;\nvec2 dHdxy = vec2(dBx, dBy);\nvec3 vGrad = sign(fDet) * (dHdxy.x * R1 + dHdxy.y * R2);\nnormalOut = normalize(abs(fDet) * normal - vGrad);\n}\n}",node_blend_mx_frag:"void node_blend(\nconst bool useCurve, const float curveLower, const float curveUpper,\nconst vec4 color1, const vec4 color2, float mask,\nout vec4 color)\n{\nif (useCurve)\nmask = smoothstep(curveLower, curveUpper, mask);\nelse\nmask = clamp(mask, 0.0, 1.0);\ncolor = mix(color1, color2, mask);\n}",node_color_correction_mx_frag:"#define REWIRE_RED 0\n#define REWIRE_GREEN 1\n#define REWIRE_BLUE 2\n#define REWIRE_ALPHA 3\n#define REWIRE_RED_INV 4\n#define REWIRE_GREEN_INV 5\n#define REWIRE_BLUE_INV 6\n#define REWIRE_ALPHA_INV 7\n#define REWIRE_MONOCHROME 8\n#define REWIRE_ONE 9\n#define REWIRE_ZERO 10\nfloat rewireChannel(int type, vec4 color)\n{\nif (type == REWIRE_RED)\nreturn color.r;\nelse if (type == REWIRE_GREEN)\nreturn color.g;\nelse if (type == REWIRE_BLUE)\nreturn color.b;\nelse if (type == REWIRE_ALPHA)\nreturn color.a;\nelse if (type == REWIRE_RED_INV)\nreturn 1.0-color.r;\nelse if (type == REWIRE_GREEN_INV)\nreturn 1.0-color.g;\nelse if (type == REWIRE_BLUE_INV)\nreturn 1.0-color.b;\nelse if (type == REWIRE_ALPHA_INV)\nreturn 1.0-color.a;\nelse if (type == REWIRE_MONOCHROME)\nreturn average(color.rgb);\nelse if (type == REWIRE_ONE)\nreturn 1.0;\nelse\nreturn 0.0;\n}\nvoid node_color_correction(const ivec4 rewire,\nconst vec4 color, const float hueShift, const float saturation,\nconst vec4 tint, const float tintStrength,\nconst float brightness, const float contrast,\nout vec4 outColor)\n{\nif (all(equal(rewire, ivec4(REWIRE_RED, REWIRE_GREEN, REWIRE_BLUE, REWIRE_ALPHA)))) {\noutColor = color;\n} else {\noutColor.r = rewireChannel(rewire.x, color);\noutColor.g = rewireChannel(rewire.y, color);\noutColor.b = rewireChannel(rewire.z, color);\noutColor.a = rewireChannel(rewire.w, color);\n}\nvec4 hsv;\nrgbToHSV(outColor, hsv);\nhsv[0] += hueShift / 360.0;\nif (hsv[0] > 1.0)\nhsv[0] -= 1.0;\nelse if (hsv[0] < 0.0)\nhsv[0] += 1.0;\nhsv[1] *= (saturation / 100.0 + 1.0);\nhsv[1] = saturate(hsv[1]);\nif (tintStrength > 0.0) {\nvec4 hsvTint;\nrgbToHSV(tint, hsvTint);\nhsv[0] = hsv[0] + (hsvTint[0] - hsv[0]) * tintStrength / 100.0;\n}\nhsvToRGB(hsv, outColor);\noutColor = (outColor - 0.5) * (contrast / 100.0 + 1.0) + 0.5 + brightness / 100.0;\noutColor = max(outColor, 0.0);\n}",node_color_map_mx_frag:"void node_color_map(const bool reverseGamma,\nconst vec4 color, const float gamma, const float gain,\nout vec4 outColor)\n{\nfloat p = reverseGamma ? gamma : 1.0 / gamma;\nfloat g = reverseGamma ? (gain > EPSILON ? 1.0 / gain : 1.0) : gain;\noutColor = vec4(g * pow(abs(color.rgb), vec3(p)), color.a);\n}",node_composite_layer_mx_frag:"#define COMP_BLEND_NORMAL 0\n#define COMP_BLEND_AVERAGE 1\n#define COMP_BLEND_ADD 2\n#define COMP_BLEND_SUBTRACT 3\n#define COMP_BLEND_DARKEN 4\n#define COMP_BLEND_MULTIPLY 5\n#define COMP_BLEND_COLORBURN 6\n#define COMP_BLEND_LINEARBURN 7\n#define COMP_BLEND_LIGHTEN 8\n#define COMP_BLEND_SCREEN 9\n#define COMP_BLEND_COLORDODGE 10\n#define COMP_BLEND_LINEARDODGE 11\n#define COMP_BLEND_SPOT 12\n#define COMP_BLEND_SPOTBLEND 13\n#define COMP_BLEND_OVERLAY 14\n#define COMP_BLEND_SOFTLIGHT 15\n#define COMP_BLEND_HARDLIGHT 16\n#define COMP_BLEND_PINLIGHT 17\n#define COMP_BLEND_HARDMIX 18\n#define COMP_BLEND_DIFFERENCE 19\n#define COMP_BLEND_EXCLUSION 20\n#define COMP_BLEND_HUE 21\n#define COMP_BLEND_SATURATION 22\n#define COMP_BLEND_COLOR 23\n#define COMP_BLEND_VALUE 24\nvec4 calcBlending(const vec4 colorBG, const vec4 colorFG, const int blendMode) {\nif (blendMode == COMP_BLEND_NORMAL)\nreturn colorFG;\nelse if (blendMode == COMP_BLEND_AVERAGE)\nreturn (colorFG + colorBG) / 2.0;\nelse if (blendMode == COMP_BLEND_ADD)\nreturn colorBG + colorFG;\nelse if (blendMode == COMP_BLEND_SUBTRACT)\nreturn colorBG - colorFG;\nelse if (blendMode == COMP_BLEND_DARKEN)\nreturn min(colorFG, colorBG);\nelse if (blendMode == COMP_BLEND_MULTIPLY)\nreturn colorBG * colorFG;\nelse if (blendMode == COMP_BLEND_COLORBURN) {\nif (colorFG.r == 0.0 && colorFG.g == 0.0 && colorFG.b == 0.0)\nreturn vec4(0.0, 0.0, 0.0, 1.0);\nelse\nreturn max(1.0 - (1.0 - colorBG) / colorFG, 0.0);\n} else if (blendMode == COMP_BLEND_LINEARBURN)\nreturn max(colorFG + colorBG - 1.0, 0.0);\nelse if (blendMode == COMP_BLEND_LIGHTEN)\nreturn max(colorFG, colorBG);\nelse if (blendMode == COMP_BLEND_SCREEN)\nreturn colorFG + colorBG - colorFG * colorBG;\nelse if (blendMode == COMP_BLEND_COLORDODGE) {\nif (colorFG.r == 1.0 && colorFG.g == 1.0 && colorFG.b == 1.0)\nreturn vec4(1.0);\nelse\nreturn min(colorBG / (1.0 - colorFG), 1.0);\n} else if (blendMode == COMP_BLEND_LINEARDODGE)\nreturn min(colorFG + colorBG, 1.0);\nelse if (blendMode == COMP_BLEND_SPOT)\nreturn min(2.0 * colorFG * colorBG, 1.0);\nelse if (blendMode == COMP_BLEND_SPOTBLEND)\nreturn min(colorFG * colorBG + colorBG, 1.0);\nelse if (blendMode == COMP_BLEND_OVERLAY) {\nif (colorBG.r <= 0.5 && colorBG.g <= 0.5 && colorBG.b <= 0.5)\nreturn saturate(2.0 * colorFG * colorBG);\nelse\nreturn saturate(1.0 - 2.0 * (1.0-colorFG) * (1.0-colorBG));\n} else if (blendMode == COMP_BLEND_SOFTLIGHT) {\nif (colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5)\nreturn saturate(colorBG * (colorBG + 2.0 * colorFG * (1.0 - colorBG)));\nelse\nreturn saturate(colorBG + (2.0 * colorFG - 1.0) * (sqrt(colorBG) - colorBG));\n} else if (blendMode == COMP_BLEND_HARDLIGHT) {\nif (colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5)\nreturn saturate(2.0 * colorFG * colorBG);\nelse\nreturn saturate(1.0 - 2.0*(1.0 - colorFG)*(1.0 - colorBG));\n} else if (blendMode == COMP_BLEND_PINLIGHT) {\nif (((colorFG.r > 0.5 && colorFG.g > 0.5 && colorFG.b > 0.5) && all(greaterThan(colorFG, colorBG))) ||\n((colorFG.r <= 0.5 && colorFG.g <= 0.5 && colorFG.b <= 0.5) && all(lessThan(colorFG, colorBG))))\nreturn colorFG;\nelse\nreturn colorBG;\n} else if (blendMode == COMP_BLEND_HARDMIX) {\nif (colorFG.r + colorBG.r <= 1.0 && colorFG.g + colorBG.g <= 1.0 && colorFG.b + colorBG.b <= 1.0)\nreturn vec4(0.0, 0.0, 0.0, 1.0);\nelse\nreturn vec4(1.0);\n} else if (blendMode == COMP_BLEND_DIFFERENCE)\nreturn abs(colorFG - colorBG);\nelse if (blendMode == COMP_BLEND_EXCLUSION)\nreturn colorFG + colorBG - 2.0 * colorFG * colorBG;\n}\nvec4 calcBlendingHSV(const vec4 colorBG, const vec4 colorFG, const int blendMode)\n{\nvec4 hsvBG, hsvFG;\nvec4 outColor;\nif (blendMode == COMP_BLEND_HUE) {\nrgbToHSV(colorBG, hsvBG);\nrgbToHSV(colorFG, hsvFG);\nhsvToRGB(vec4(hsvFG[0], hsvBG[1], hsvBG[2], 1.0), outColor);\n} else if (blendMode == COMP_BLEND_SATURATION) {\nrgbToHSV(colorBG, hsvBG);\nrgbToHSV(colorFG, hsvFG);\nhsvToRGB(vec4(hsvBG[0], hsvFG[1], hsvBG[2], 1.0), outColor);\n} else if (blendMode == COMP_BLEND_COLOR) {\nrgbToHSV(colorBG, hsvBG);\nrgbToHSV(colorFG, hsvFG);\nhsvToRGB(vec4(hsvFG[0], hsvFG[1], hsvBG[2], 1.0), outColor);\n} else if (blendMode == COMP_BLEND_VALUE) {\nrgbToHSV(colorBG, hsvBG);\nrgbToHSV(colorFG, hsvFG);\nhsvToRGB(vec4(hsvBG[0], hsvBG[1], hsvFG[2], 1.0), outColor);\n}\nreturn outColor;\n}\nvoid node_composite_layer(const int blendMode, const float opacity, \nconst vec4 colorBG, const vec4 colorFG, const vec4 mask,\nout vec4 outColor)\n{\nfloat fac = saturate(opacity * average(mask.rgb));\nif (blendMode < COMP_BLEND_HUE)\noutColor = calcBlending(colorBG, colorFG, blendMode);\nelse\noutColor = calcBlendingHSV(colorBG, colorFG, blendMode);\noutColor = mix(colorBG, outColor, fac);\n}",node_falloff_mx_frag:"void node_falloff(vec3 viewPos, float IOR,\nconst vec4 color1, const vec4 color2, vec3 normal, out vec4 color)\n{\nfloat fac;\n\nvec3 dir = normalize(viewPos);\nfloat eta = max(IOR, 0.00001);\nfac = fresnelReflection(dir, normal, (gl_FrontFacing) ? eta : 1.0 / eta);\ncolor = mix(color1, color2, fac);\n}",node_gradient_ramp_mx_frag:"#define GRAD_TYPE_4_CORNER 0\n#define GRAD_TYPE_BOX 1\n#define GRAD_TYPE_DIAGONAL 2\n#define GRAD_TYPE_LIGHTING 3\n#define GRAD_TYPE_LINEAR 4\n#define GRAD_TYPE_MAPPED 5\n#define GRAD_TYPE_NORMAL 6\n#define GRAD_TYPE_PONG 7\n#define GRAD_TYPE_RADIAL 8\n#define GRAD_TYPE_SPIRAL 9\n#define GRAD_TYPE_SWEEP 10\n#define GRAD_TYPE_TARTAN 11\nvoid node_gradient_ramp(\nsampler2D gradientData, int gradientType, vec2 uvIn, vec3 geometryNormal,\nvec3 viewPos, int mapping, int axis, ivec2 clampToEdgeNoExtend,\nvec4 sourceMap, float uOffset, float vOffset, float uTiling, float vTiling, float wAngle,\nout vec4 outCol)\n{\nvec3 coordsIn;\nif (mapping == MAPPING_EXPLICIT_MAP_CHANNEL) {\ncoordsIn = vec3(uvIn.x, 1.0 - uvIn.y, 0.0);\n} else if (mapping == MAPPING_VERTEX_COLOR_CHANNEL) {\ncoordsIn = vec3(0.0);\n} else if (mapping == MAPPING_PLANAR_OBJECT_XYZ) {\ncoordsIn = swizzleUpZ((invModelMatrix * invViewMatrix * vec4(-viewPos, 1.0)).xyz);\n} else {\ncoordsIn = swizzleUpZ((invViewMatrix * vec4(-vViewPosition, 1.0)).xyz);\n}\nif (axis == AXIS_XY)\ncoordsIn = vec3(coordsIn.x, coordsIn.y, 1.0);\nelse if (axis == AXIS_YZ)\ncoordsIn = vec3(coordsIn.y, coordsIn.z, 1.0);\nelse if (axis == AXIS_ZX)\ncoordsIn = vec3(coordsIn.z, coordsIn.x, 1.0);\nvec3 coordsOut = calcUvTransform(uOffset, vOffset, uTiling, vTiling, wAngle) * coordsIn;\nfloat coord = uvIn.x;\nuvIn = coordsOut.xy;\nif ((clampToEdgeNoExtend[0] == 1 && (uvIn.x < 0.0 || uvIn.x > 1.0)) ||\n(clampToEdgeNoExtend[1] == 1 && (uvIn.y < 0.0 || uvIn.y > 1.0))) {\noutCol = vec4(0.0, 0.0, 0.0, 1.0);\nreturn;\n}\nuvIn = fract(uvIn);\nif (gradientType == GRAD_TYPE_4_CORNER) {\ncoord = pow(uvIn.x, 2.0);\n} else if (gradientType == GRAD_TYPE_BOX) {\nvec2 boxUv = abs(uvIn - vec2(0.5)) * 2.0;\ncoord = max(boxUv.x, boxUv.y);\n} else if (gradientType == GRAD_TYPE_DIAGONAL) {\ncoord = abs(uvIn.x - uvIn.y) * sqrt(2.0);\n} else if (gradientType == GRAD_TYPE_LIGHTING) {\nIncidentLight directLight;\nGeometricContext geometry;\ngeometry.position = -viewPos;\nvec3 irr = vec3(0.0);\n#if (NUM_POINT_LIGHTS > 0)\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_POINT_LIGHTS; i++) {\ngetPointDirectLightIrradiance(pointLights[i], geometry, directLight);\nfloat dotNL = saturate(dot(geometryNormal, directLight.direction));\nirr += dotNL * directLight.color;\n}\n#pragma unroll_loop_end\n#endif\n#if (NUM_SPOT_LIGHTS > 0)\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_SPOT_LIGHTS; i++) {\ngetSpotDirectLightIrradiance(spotLights[i], geometry, directLight);\nfloat dotNL = saturate(dot(geometryNormal, directLight.direction));\nirr += dotNL * directLight.color;\n}\n#pragma unroll_loop_end\n#endif\n#if (NUM_DIR_LIGHTS > 0)\n#pragma unroll_loop_start\nfor (int i = 0; i < NUM_DIR_LIGHTS; i++) {\ngetDirectionalDirectLightIrradiance(directionalLights[i], geometry, directLight);\nfloat dotNL = saturate(dot(geometryNormal, directLight.direction));\nirr += dotNL * directLight.color;\n}\n#pragma unroll_loop_end\n#endif\n#if defined(PHYSICALLY_CORRECT_LIGHTS)\nirr /= PI;\n#endif\nvec3 ambIrr = getAmbientLightIrradiance(ambientLightColor);\n#if !defined(PHYSICALLY_CORRECT_LIGHTS)\nambIrr /= PI;\n#endif\nirr += ambIrr;\ncoord = (irr.x + irr.y + irr.z) / 3.0;\n} else if (gradientType == GRAD_TYPE_LINEAR) {\ncoord = uvIn.x;\n} else if (gradientType == GRAD_TYPE_MAPPED) {\ncoord = (sourceMap.x + sourceMap.y + sourceMap.z) / 3.0;\n} else if (gradientType == GRAD_TYPE_NORMAL) {\nfloat angle = acos(clamp(dot(geometryNormal, normalize(viewPos)), -1.0, 1.0));\nfloat k = 100.0;\ncoord = 1.0 - sin(pow2(k) - k * sqrt(pow2(k) - pow2(angle)));\n} else if (gradientType == GRAD_TYPE_PONG) {\nfloat y = min(uvIn.y, uvIn.x);\nfloat x = max(uvIn.y, uvIn.x);\ncoord = y / x;\n} else if (gradientType == GRAD_TYPE_RADIAL) {\ncoord = length(uvIn - vec2(0.5)) * 2.0;\n} else if (gradientType == GRAD_TYPE_SPIRAL) {\nvec2 uvSpiral = mat2(0.0, 1.0, -1.0, 0.0) * (uvIn - vec2(0.5));\ncoord = atan(uvSpiral.y, uvSpiral.x) / PI2 + 0.5;\n} else if (gradientType == GRAD_TYPE_SWEEP) {\ncoord = atan(uvIn.x, uvIn.y) / PI_HALF;\n} else if (gradientType == GRAD_TYPE_TARTAN) {\nvec2 uvTartan = abs(uvIn - vec2(0.5));\ncoord = 1.0 - min(uvTartan.x, uvTartan.y) * 2.0;\n}\noutCol = texture2D(gradientData, vec2(coord, 0.0));\n}",node_map_mx_frag:"\nvoid node_map(const vec4 colorIn, out vec4 color)\n{\ncolor = colorIn;\n}",node_mask_mx_frag:"void node_mask(const bool maskInverted,\nconst vec4 color, vec4 mask,\nout vec4 outColor)\n{\nmask = maskInverted ? vec4(vec3(1.0) - mask.rgb, mask.a) : mask;\noutColor = color * mask;\n}",node_material_mx_frag:"\nvoid node_material(\nfloat reflectionRatio, const float refractionRatio,\nconst bool selfIllumColorOn,\nconst vec4 ambientColor, const vec4 diffuseColor, const vec4 specularColor,\nconst float glossiness, const float specularLevel, const vec4 selfIllum,\nconst float opacity, const vec4 filterColor, const vec3 normal,\nconst vec4 reflection, const vec4 refraction, const float displacement,\nout vec4 outColor)\n{\nvec3 diffuse, specular;\nNodeMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specularColor.rgb;\nmaterial.diffuseIntensity = 1.0;\nmaterial.specularHardness = 4.0 * exp2(glossiness * 10.0);\nmaterial.specularIntensity = specularLevel;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_DirectSpecular\n#undef RE_IndirectDiffuse\n#undef RE_IndirectSpecular\ndiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\nif (selfIllumColorOn) {\ndiffuse += selfIllum.rgb;\n} else {\ndiffuse = mix(diffuse, material.diffuseColor, selfIllum[0]);\n}\nspecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\nfloat specularStrength = maxFromRGB(specular);\noutColor = vec4(saturate(diffuse + specular), 1.0);\nfloat alpha = opacity - saturate(maxFromRGB(specular)) * (opacity - 1.0);\noutColor += reflection * specularColor * reflectionRatio;\noutColor += refraction * refractionRatio;\nalpha += saturate(maxFromRGB(reflection.rgb) * maxFromRGB(specularColor.rgb)) * reflectionRatio;\nalpha += saturate(maxFromRGB(refraction.rgb)) * refractionRatio;\noutColor.a = alpha;\n}",node_matte_shadow_mx_frag:"#include \nvoid node_matte_shadow(\nvec3 normal, bool receiveShadow, float shadowBrightness, vec3 color,\nout vec4 outColor) {\nfloat shadow = getShadowMask();\noutColor = vec4(color, 1.0 - (shadowBrightness + (1.0 - shadowBrightness) * shadow));\n}",node_mix_mx_frag:"void node_mix(const vec4 color1, const vec4 color2, const float amount, out vec4 color)\n{\ncolor = mix(color1, color2, clamp(amount, 0.0, 1.0));\n}",node_noise_mx_frag:"#define NOISE_REGULAR 0\n#define NOISE_FRACTAL 1\n#define NOISE_TURBULENCE 2\nfloat noise(vec3 vec, const int noiseType, const float size, const float thresholdLow, const float thresholdHigh, const float levels, float phase) {\nvec /= size;\nfloat n = 0.0;\nif (noiseType == NOISE_REGULAR) {\nn = (1.0 + snoise(vec4(vec, phase))) * 0.5;\n} else if (noiseType == NOISE_FRACTAL) {\nfloat l, f = 1.0;\nfor (l = levels; l >= 1.0; l-=1.0) { \nn += snoise(vec4(vec * f, phase)) / f;\nf *= 2.0;\n}\nif (l > 0.0) \nn += l * snoise(vec4(vec * f, phase)) / f; \nn = 0.5 * (n + 1.0);\n} else {\nfloat l, f = 1.0;\nfloat ml = levels;\nfor (l = levels; l >= 1.0; l-=1.0, ml-=1.0) {\nn += abs(snoise(vec4(vec * f, phase))) / f;\nf *= 2.0f;\n}\nif (l > 0.0)\nn += l * abs(snoise(vec4(vec * f, phase))) / f;\n}\nreturn clamp(smoothstep(thresholdLow, thresholdHigh, n), 0.0, 1.0);\n}\nvoid node_noise(const vec2 uv, const int noiseType, const int coordType, \nconst vec3 color1, const vec3 color2, const float size,\nconst float thresholdLow, const float thresholdHigh, const float levels,\nconst float phase, const vec3 offset, const vec3 tiling, const vec3 angle,\nout vec4 color) {\nvec3 vec = (calcXYZTransform(offset, tiling, angle) * vec4(uv.x, 1.0 - uv.y, 1.0, 1.0)).xyz;\ncolor = vec4(mix(color1, color2, noise(vec, noiseType, size, thresholdLow, thresholdHigh, levels, phase)), 1.0);\n}\nvoid node_noise(const vec3 viewPos, const int noiseType, const int coordType,\nconst vec3 color1, const vec3 color2, const float size,\nconst float thresholdLow, const float thresholdHigh, const float levels,\nconst float phase, const vec3 offset, const vec3 tiling, const vec3 angle,\nout vec4 color) {\nvec4 posWorld = invViewMatrix * vec4(-viewPos, 1.0);\nvec3 vec;\nif (coordType == 0)\nvec = (invModelMatrix * posWorld).xyz;\nelse\nvec = posWorld.xyz;\nvec = (calcXYZTransform(offset, tiling, angle) * vec4(swizzleUpZ(vec), 1.0)).xyz;\ncolor = vec4(mix(color1, color2, noise(vec, noiseType, size, thresholdLow, thresholdHigh, levels, phase)), 1.0);\n}",node_normal_bump_mx_frag:"void node_normal_bump(const vec4 tangent, const vec3 normal, ivec2 flip,\nvec4 normalColor, vec3 additionalBump, float normalMult, float addBumpMult,\nout vec3 normalOut)\n{\nif (flip[0] == 1)\nnormalColor.x = 1.0 - normalColor.x;\nif (flip[1] == 0)\nnormalColor.y = 1.0 - normalColor.y;\nvec3 normalTex = (normalColor.xyz * 2.0 - 1.0);\nvec4 viewTangent = vec4(normalize(modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz, tangent.w);\nvec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\nnormalOut = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n+ normalTex.z * normal);\nnormalOut = mix(normal, normalOut, normalMult);\nadditionalBump = mix(normal, additionalBump, addBumpMult);\nnormalOut = normalize(normalOut + additionalBump);\n}",node_output_map_mx_frag:"vec4 processOutputColor(vec4 color, const bool invert, const bool clampColor, const bool alphaFromRGB,\nconst float rgbLevel, const float rgbOffset, const float outputAmount)\n{\nvec3 color3 = color.rgb;\ncolor3 = clampColor ? saturate(color3) : color3;\ncolor3 = color3 * rgbLevel + vec3(rgbOffset);\ncolor3 = invert ? (vec3(1.0) - color3) : color3;\ncolor = outputAmount * vec4(color3, color.a);\ncolor.a = alphaFromRGB ? average(color.rgb) : color.a;\nreturn color;\n}\nvoid node_output_map(\nconst bool invert, const bool clampColor, const bool alphaFromRGB,\nconst vec4 color, const float rgbLevel, const float rgbOffset,\nconst float outputAmount, const float bumpAmount,\nout vec4 outColor)\n{\noutColor = processOutputColor(color, invert, clampColor, alphaFromRGB, rgbLevel, rgbOffset, outputAmount);\n}\nvoid node_output_map(\nconst bool invert, const bool clampColor, const bool alphaFromRGB, sampler2D colormap,\nvec4 color, const float rgbLevel, const float rgbOffset,\nconst float outputAmount, const float bumpAmount,\nout vec4 outColor)\n{\nfloat r = texture2D(colormap, vec2(color.r, 0.0)).r;\nfloat g = texture2D(colormap, vec2(color.g, 0.0)).g;\nfloat b = texture2D(colormap, vec2(color.b, 0.0)).b;\noutColor = processOutputColor(vec4(r, g, b, color.a),\ninvert, clampColor, alphaFromRGB, rgbLevel, rgbOffset, outputAmount);\n}",node_output_mx_frag:"void node_output(vec4 color, out vec4 outgoingLight)\n{\noutgoingLight = color;\n}",node_physical_mx_frag:"#define DEFAULT_REFLECTION_EDGE 1.0\n#define DEFAULT_REFLECTION_SLOPE 5.0\nvoid node_physical(\nvec3 geometryNormal, const float emitLuminance, const bool useCustomReflCurve,\nconst float reflFacing, const float reflEdge, const float reflSlope,\nconst bool roughnessInv, const bool transRoughnessLock, const bool transRoughnessInv,\nconst bool thinWalled,\nconst float baseWeight, const vec4 baseColor, const float reflectivity,\nconst vec4 reflColor, const float roughness, const float metalness,\nconst float diffRoughness, const float anisotropy, const float anisoangle,\nconst float transparency, const vec4 transColor, const float transRoughness,\nconst float ior, const float scattering, const vec4 sssColor,\nconst float sssScale, const float emission, const vec4 emitColor,\nconst float coating, const vec4 coatColor, const float coatRoughness,\nconst vec3 normal, const vec3 clearcoatNormal, const float displacement,\nconst float cutout,\nout vec4 outColor)\n{\nNodeMaterial material;\nvec3 baseColorWeighted = baseWeight * baseColor.rgb;\nmaterial.diffuseColor = baseColorWeighted * (1.0 - transparency);\n#ifdef CLEARCOAT\nmaterial.clearcoat = saturate(coating);\nmaterial.clearcoatRoughness = clamp(coatRoughness, 0.0, 1.0);\n#endif\nfloat facing, edge, slope;\nif (useCustomReflCurve) {\nfacing = reflFacing;\nedge = reflEdge;\nslope = reflSlope;\n} else {\nfacing = pow2((1.0 - ior) / (1.0 + ior));\nedge = DEFAULT_REFLECTION_EDGE;\nslope = DEFAULT_REFLECTION_SLOPE;\n}\nfloat cosTheta = saturate(dot(normal, normalize(vViewPosition)));\nfloat fresnelRefl = (facing + (edge - facing) * pow(1.0 - cosTheta, slope))\n* saturate(reflectivity + metalness);\nfloat kd = 1.0 - (metalness * (1.0 - fresnelRefl) + fresnelRefl);\nmaterial.specularColor = mix(metalness * baseColorWeighted, reflColor.rgb, fresnelRefl);\nmaterial.diffuseColor *= kd;\nmaterial.specularRoughness = clamp(roughnessInv ? (1.0 - roughness) : roughness, 0.0, 1.0);\nmaterial.refractionColor = pow(transparency * (1.0 - metalness) * transColor.rgb, vec3(2.0));\nmaterial.refractionIOR = ior;\nfloat tRough;\nif (transRoughnessLock) {\ntRough = roughnessInv ? 1.0 - roughness : roughness;\n} else {\ntRough = transRoughnessInv ? 1.0 - transRoughness : transRoughness;\n}\nmaterial.refractionRoughness = pow2(tRough);\n#if defined(ENVMAP_TYPE_CUBE) || defined(ENVMAP_TYPE_CUBE_UV)\nfloat geomRoughness = calcGeometryRoughness(geometryNormal);\nmaterial.specularRoughness = calcCubeUVAdjustedRoughness(\nmaterial.specularRoughness, geomRoughness);\nmaterial.refractionRoughness = calcCubeUVAdjustedRoughness(\nmaterial.refractionRoughness, geomRoughness);\n#ifdef CLEARCOAT\nmaterial.clearcoatRoughness = calcCubeUVAdjustedRoughness(\nmaterial.clearcoatRoughness, geomRoughness);\n#endif\n#endif\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\nvec3 refractedLight = vec3(0.0);\n#ifdef USE_GTAO\nvec4 gtaoVisibilityBentNormal = texture2D(gtaoMap,\ngl_FragCoord.xy / currResolution);\nvec3 bentNormal = normalize(unpackRGBToNormal(gtaoVisibilityBentNormal.gba));\n#define PROBE_NORMAL bentNormal\n#endif\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#define RE_Refraction RE_Refraction_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_DirectSpecular\n#undef RE_IndirectDiffuse\n#undef RE_IndirectSpecular\n#undef RE_Refraction\n#ifdef PROBE_NORMAL\n#undef PROBE_NORMAL\n#endif\n#ifdef USE_GTAO\nreflectedLight.indirectDiffuse *= gtaoVisibilityBentNormal.r;\nfloat gtaoVisibility = gtaoVisibilityBentNormal.r;\nvec3 gtaoBentNormal = bentNormal;\nvec3 gtaoViewDir = geometry.viewDir;\nvec3 gtaoNormal = normal;\nfloat gtaoRoughness = material.specularRoughness;\n#endif\n#include \nvec3 totalEmissiveRadiance = emitLuminance / LUMENS_PER_WATT * emission * emitColor.rgb;\nvec3 specular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\nvec3 outColor3 = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\nspecular + totalEmissiveRadiance;\nfloat alpha = 1.0;\nif (thinWalled) {\nalpha = 1.0 - saturate(transparency) + maxFromRGB(specular) * saturate(transparency);\n} else {\noutColor3 += refractedLight;\n}\noutColor = vec4(outColor3, saturate(alpha));\n}",node_phy_sun_sky_env_mx_frag:"vec3 perezSky(vec3 paramA, vec3 paramB, vec3 paramC, vec3 paramD, vec3 paramE,\nvec3 radiance, vec3 sunDirection, vec3 direction)\n{\nfloat cosGamma = clamp(dot(direction, sunDirection), -1.0, 1.0);\nfloat cosTheta = clamp(direction.y, 0.0, 1.0);\nvec3 radInternal = (1.0 + paramA * exp(paramB / cosTheta)) * (\n1.0 + paramC * exp(paramD * acos(cosGamma))\n+ paramE * pow(cosGamma, 2.0)\n);\nfloat ciex = radInternal.y * radiance.y;\nfloat ciey = radInternal.z * radiance.z;\nfloat cieY = clamp(radInternal.x * radiance.x, 0.0, 1000000.0);\nvec3 XYZ = xyY_to_XYZ(ciex, ciey, cieY);\nreturn max(xyz_to_sRGB(XYZ), 0.0);\n}\n#define GROUND_SKY_SAMPLES 16\nvec3 groundSky(vec3 paramA, vec3 paramB, vec3 paramC, vec3 paramD, vec3 paramE, vec3 radiance, vec3 sunDirection, vec3 sunIlluminance)\n{\nconst int horizSamples = GROUND_SKY_SAMPLES;\nconst int vertSamples = GROUND_SKY_SAMPLES / 2;\nvec3 result = vec3(0.0);\nfor (int horizSampleIdx = 0; horizSampleIdx < horizSamples; horizSampleIdx++) {\nfloat horizSample = float(horizSampleIdx) / float(horizSamples);\nfloat horizAngle = PI2 * horizSample;\nfor (int vertSampleIdx = 0; vertSampleIdx < vertSamples; vertSampleIdx++) {\nfloat vertSample = float(vertSampleIdx) / float(vertSamples);\nfloat y = 1.0 - vertSample;\nfloat x = sqrt(1.0 - y*y) * cos(horizAngle);\nfloat z = -sqrt(1.0 - y*y) * sin(horizAngle);\nvec3 direction = vec3(x, y, z);\nvec3 sampleColor = perezSky(paramA, paramB, paramC, paramD, paramE,\nradiance, sunDirection, direction);\n\nresult += direction.y * sampleColor;\n}\n}\nresult /= float(horizSamples * vertSamples);\nresult += (sunIlluminance * sunDirection.y) / PI;\nreturn result;\n}\nvoid node_phy_sun_sky_env(vec3 paramA, vec3 paramB, vec3 paramC, vec3 paramD, vec3 paramE,\nvec3 radiance, vec3 sunDirection, vec3 sunIlluminance, vec3 sunLuminance, \nfloat globalIntensity, vec4 groundColor,\nout vec4 outColor) \n{\nvec3 dir = vWorldPosition;\nif (length(dir) == 0.0) {\ndir = vec3(0.0, 0.0, -1.0);\n} else {\ndir = normalize(dir);\n}\nif (dir.y < 0.0) {\noutColor = groundColor * vec4(groundSky(paramA, paramB, paramC, paramD, paramE, radiance, sunDirection, sunIlluminance), 1.0);\n} else {\noutColor = vec4(perezSky(paramA, paramB, paramC, paramD, paramE,\nradiance, sunDirection, dir), 1.0);\n}\noutColor = globalIntensity * outColor;\n}",node_reflect_refract_mx_frag:"void node_reflect_refract(sampler2D envMap,\nint reflectMode, const float IOR, const int encoding,\nvec3 normal, out vec4 color)\n{\nvec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\nvec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\nvec3 reflectVec;\nif (reflectMode == MAX_ENV_COORDS_REFLECT)\nreflectVec = reflect(cameraToVertex, worldNormal);\nelse {\nfloat refrRatio = 1.0 / IOR;\nreflectVec = refract(cameraToVertex, worldNormal, refrRatio);\n}\nreflectVec = normalize(reflectVec);\ncolor = sampleEquirectangular(envMap, reflectVec, mat3(1.0), encoding);\n}",node_reflect_refract_color_mx_frag:"void node_reflect_refract_color(const vec4 colorIn, out vec4 color)\n{\ncolor = vec4(colorIn);\n}",node_rgb_multiply_mx_frag:"void node_rgb_multiply(const vec4 color1, const vec4 color2, out vec4 color)\n{\ncolor = color1 * color2;\n}",node_rgb_tint_mx_frag:"void node_rgb_tint(const vec4 color, const vec4 red, const vec4 green, const vec4 blue,\nout vec4 outColor)\n{\nmat3 tintMatrix = mat3(red.rgb, green.rgb, blue.rgb);\noutColor = vec4(tintMatrix * color.rgb, color.a);\n}",node_rgb_mx_frag:"uniform vec4 nodeRGB[NODE_RGB_NUM];\nvoid node_rgb(vec4 color, out vec4 outColor)\n{\noutColor = color;\n}",node_shellac_mx_frag:"void node_shellac(const vec4 color1, const vec4 color2, const float amount,\nout vec4 color)\n{\ncolor = mix(color1, color2, clamp(amount, 0.0, 1.0));\n}",node_tex_environment_mx_frag:"\nvoid node_tex_environment(sampler2D tex, const int encoding, vec3 vector, out vec4 outColor) {\n\nvec3 direction = swizzleUpY(vector);\nif (length(direction) == 0.0) {\ndirection = vec3(0.0, 1.0, 0.0);\n} else {\ndirection = normalize(direction);\n}\nvec2 uv;\nuv.y = asin(clamp(direction.y, - 1.0, 1.0)) * RECIPROCAL_PI + 0.5;\nuv.x = atan(direction.x, direction.z) * RECIPROCAL_PI2 + 0.5;\nuv.y *= -1.0;\nconst float seamWidth = 0.15;\nconst float seamBiasFactor = -10.0;\nfloat seam = max(0.0, 1.0 - abs (direction.x) / seamWidth) *\nclamp (1.0 - direction.z / seamWidth, 0.0, 1.0);\noutColor = texture2D(tex, uv, seamBiasFactor * seam);\noutColor = nodeTexelToLinear(outColor, encoding);\n}",node_value_mx_frag:"uniform float nodeValue[NODE_VALUE_NUM];\nvoid node_value(float val, out float outVal)\n{\noutVal = val;\n}",node_vertex_color_mx_frag:"void node_vertex_color(vec3 color, out vec4 outColor)\n{\noutColor = vec4(color, 1.0);\n}",node_add_double_linear_my_frag:"void node_add_double_linear(\nfloat input1, float input2,\nout float outValue) {\noutValue = input1 + input2;\n}",node_add_matrix_my_frag:"void node_add_matrix(\nmat4 matrixIn1,\nout mat4 matrixSum)\n{\nmatrixSum = matrixIn1;\n}\nvoid node_add_matrix(\nmat4 matrixIn1, mat4 matrixIn2,\nout mat4 matrixSum)\n{\nmatrixSum = matrixIn1 + matrixIn2;\n}\nvoid node_add_matrix(\nmat4 matrixIn1, mat4 matrixIn2, mat4 matrixIn3,\nout mat4 matrixSum)\n{\nmatrixSum = matrixIn1 + matrixIn2 + matrixIn3;\n}",node_anim_curve_ta_my_frag:"uniform float nodeValue[NODE_VALUE_NUM];\nvoid node_anim_curve_ta(float val, out float outVal)\n{\noutVal = val;\n}",node_anim_curve_tu_my_frag:"uniform float nodeValue[NODE_VALUE_NUM];\nvoid node_anim_curve_tu(float val, out float outVal)\n{\noutVal = val;\n}",node_blend_colors_my_frag:"void node_blend_colors(float blender, vec3 color1, vec3 color2, out vec3 outColor)\n{\nblender = clamp(blender, 0.0, 1.0);\noutColor = mix(color1, color2, 1.0 - blender);\n}\nvoid node_blend_colors(float blender, vec4 color1, vec4 color2, out vec4 outColor)\n{\nblender = clamp(blender, 0.0, 1.0);\noutColor = mix(color1, color2, 1.0 - blender);\n}",node_bulge_my_frag:"void node_bulge(\nfloat uWidth, float vWidth, vec2 uvCoord,\nout float outAlpha, out vec3 outColor) {\nuvCoord = 2.0 * fract(uvCoord); \nfloat bulge = 0.0;\nif (uvCoord.x > uWidth && uvCoord.x < 2.0 - uWidth &&\nuvCoord.y > vWidth && uvCoord.y < 2.0 - vWidth) {\nuvCoord.x = (uvCoord.x - uWidth) / (1.0 - uWidth);\nuvCoord.y = (uvCoord.y - vWidth) / (1.0 - vWidth);\nbulge = uvCoord.x * (2.0 - uvCoord.x) * uvCoord.y * (2.0 - uvCoord.y);\n}\noutAlpha = bulge; \noutColor = vec3(bulge, bulge, bulge); \n}",node_blinn_my_frag:"void node_blinn(\nvec3 geometryNormal,\nvec3 color, vec3 ambientColor, vec3 incandescence, float matteOpacity,\nfloat diffuse, vec3 normal, float reflectivity, vec3 reflectedColor,\nfloat eccentricity, vec3 specularColor, float specularRollOff, float translucence,\nvec3 transparency,\nout vec4 outColor) {\nNodeMaterial material;\nmaterial.diffuseColor = diffuse * color;\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\nvec3 dxy = max(abs(dFdx(geometryNormal)), abs(dFdy(geometryNormal)));\nfloat geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);\nmaterial.specularRoughness = max(eccentricity, 0.0525);\nmaterial.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min(material.specularRoughness, 1.0);\nmaterial.specularColor = specularColor;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_DirectSpecular\n#undef RE_IndirectDiffuse\n#undef RE_IndirectSpecular\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\nfloat alpha = 1.0 - average(transparency);\noutColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\nreflectedLight.directSpecular + reflectedLight.indirectSpecular + incandescence, alpha);\n}",node_bump_2d_my_frag:"void node_bump_2d(\nvec3 normal,\nfloat bumpDepth, float bumpValue,\nout vec3 outNormal) {\nvec3 position = vViewPosition;\nvec3 dPdx = dFdx(position);\nvec3 dPdy = dFdy(position);\nfloat dHdx = dFdx(bumpValue);\nfloat dHdy = dFdy(bumpValue);\nvec3 tanX = cross(dPdy, normal);\nvec3 tanY = cross(normal, dPdx);\nvec3 surfaceGrad = dHdx * tanX + dHdy * tanY;\nfloat dotPosTanX = dot(dPdx, tanX);\noutNormal = normalize(normal * abs(dotPosTanX) - surfaceGrad * sign(dotPosTanX));\noutNormal = normalize(mix(normal, outNormal, max(0.0, bumpDepth)));\n}\nvoid node_bump_2d(\nvec3 normal, vec4 tangent,\nfloat bumpDepth, vec3 bumpValue,\nout vec3 outNormal) {\n#ifdef DOUBLE_SIDED\nnormal = normal * (float(gl_FrontFacing) * 2.0 - 1.0);\n#endif\nvec3 normalTex = (bumpValue.xyz * 2.0 - 1.0);\nvec4 viewTangent = vec4(normalize((modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz), tangent.w);\nvec3 bitangent = viewTangent.w * cross(normal, viewTangent.xyz);\noutNormal = normalize(normalTex.x * viewTangent.xyz + normalTex.y * bitangent \n+ normalTex.z * normal);\noutNormal = mix(normal, outNormal, bumpDepth);\n}",node_channels_my_frag:"void node_channels(\nint channelR, int channelG, int channelB, int channelA,\nfloat inAlpha, vec3 inColor,\nout float outAlpha, out vec3 outColor) {\noutAlpha = 1.0;\noutColor = vec3(1.0);\nif (channelR == 0)\noutColor.r = inColor.r;\nelse if (channelR == 1)\noutColor.r = inColor.g;\nelse if (channelR == 2)\noutColor.r = inColor.b;\nelse\noutColor.r = inAlpha;\nif (channelG == 0)\noutColor.g = inColor.r;\nelse if (channelG == 1)\noutColor.g = inColor.g;\nelse if (channelG == 2)\noutColor.g = inColor.b;\nelse\noutColor.g = inAlpha;\nif (channelB == 0)\noutColor.b = inColor.r;\nelse if (channelB == 1)\noutColor.b = inColor.g;\nelse if (channelB == 2)\noutColor.b = inColor.b;\nelse\noutColor.b = inAlpha;\nif (channelA == 0)\noutAlpha = inColor.r;\nelse if (channelA == 1)\noutAlpha = inColor.g;\nelse if (channelA == 2)\noutAlpha = inColor.b;\nelse\noutAlpha = inAlpha;\n}",node_checker_my_frag:"void node_checker(\nvec3 color1, vec3 color2, float contrast, vec2 uvCoord,\nout float outAlpha, out vec3 outColor) {\nuvCoord -= floor(uvCoord); \nvec3 deltaColor = color2 - color1;\ncolor1 += (1.0 - contrast) * 0.5 * deltaColor;\ncolor2 -= (1.0 - contrast) * 0.5 * deltaColor;\nif ((uvCoord.x < 0.5 && uvCoord.y >= 0.5) || (uvCoord.x >= 0.5 && uvCoord.y < 0.5)) { \noutColor = color2; \noutAlpha = 1.0; \n} else {\noutColor = color1; \noutAlpha = 0.0; \n}\n}",node_clamp_my_frag:"void node_clamp(\nvec3 inputValue, vec3 maxValue, vec3 minValue,\nout vec3 outputValue) {\noutputValue = clamp(inputValue, minValue, maxValue);\n}",node_cloth_my_frag:"void node_cloth(\nfloat brightSpread, vec3 gapColor, float randomness, vec3 uColor, float uWave, float uWidth,\nvec3 vColor, float vWave, float vWidth, float widthSpread, vec2 uvCoord,\nout float outAlpha, out vec3 outColor) {\nif (abs(uWave) > -EPSILON || abs(vWave) > -EPSILON) {\nuvCoord.x += - uWave * sin(PI2 * uvCoord.y);\nuvCoord.y += vWave * sin(PI2 * uvCoord.x);\n}\nuvCoord = fract(uvCoord);\nint thread = 0;\nif ((uvCoord.x >= 0.5 && uvCoord.y < 0.5) || (uvCoord.x < 0.5 && uvCoord.y >= 0.5)) {\nfloat flippedCoord;\nflippedCoord = uvCoord.x;\nuvCoord.x = uvCoord.y;\nuvCoord.y = flippedCoord;\nflippedCoord = uWidth;\nuWidth = vWidth;\nvWidth = flippedCoord;\nthread = 1;\n}\nuvCoord = fract(2.0 * uvCoord);\nfloat cloth = 1.0;\nif (uvCoord.y <= vWidth) {\nfloat clothU = uvCoord.x - 0.5 * uWidth;\nfloat clothV = 2.0 * uvCoord.y / vWidth - 1.0;\ncloth = 0.75 * (clothU * clothU + clothV * clothV);\n} else if (uvCoord.x <= uWidth) {\nfloat clothU = 2.0 * uvCoord.x / uWidth - 1.0;\nfloat clothV = uvCoord.y - 0.5 * vWidth - 1.0;\ncloth = 0.75 * (clothU * clothU + clothV * clothV);\nthread = 1 - thread;\n}\noutColor = gapColor;\nif (cloth < 1.0) {\ncloth = 1.0 - cloth;\ncloth = min(cloth, 1.0);\noutColor *= (1.0 - cloth);\nvec3 threadColor = uColor;\nif (thread == 0)\nthreadColor = vColor;\noutColor += threadColor * cloth;\n}\noutAlpha = dot(outColor, LUM_WEIGHTS_MAYA);\n}",node_color_condition_my_frag:"void node_color_condition(\nfloat alphaA, float alphaB, vec3 colorA, vec3 colorB, bool condition,\nout float outAlpha, out vec3 outColor) {\noutAlpha = condition ? alphaA : alphaB;\noutColor = condition ? colorA : colorB;\n}",node_color_composite_my_frag:"void node_color_composite(int operation,\nvec3 colorA, float alphaA, vec3 colorB, float alphaB, float factor,\nout vec3 outColor, out float outAlpha)\n{\nif (factor <= 0.0) {\noutColor = colorA;\noutAlpha = alphaA;\nreturn;\n}\nif (operation == 0) {\noutColor[0] = colorA[0] + (colorB[0] * factor);\noutColor[1] = colorA[1] + (colorB[1] * factor);\noutColor[2] = colorA[2] + (colorB[2] * factor);\noutAlpha = alphaA + (alphaB * factor);\n} else if (operation == 1) {\noutColor[0] = colorA[0] + ((colorB[0] - 1.0) * factor);\noutColor[1] = colorA[1] + ((colorB[1] - 1.0) * factor);\noutColor[2] = colorA[2] + ((colorB[2] - 1.0) * factor);\noutAlpha = alphaA + ((alphaB - 1.0) * factor);\n} else if (operation == 2) {\nif (factor >= 1.0) {\noutColor = colorB;\noutAlpha = alphaB;\nreturn;\n}\noutColor[0] = mix(colorA[0], colorB[0], factor);\noutColor[1] = mix(colorA[1], colorB[1], factor);\noutColor[2] = mix(colorA[2], colorB[2], factor);\noutAlpha = mix(alphaA, alphaB, factor);\n} else if (operation == 3) {\noutColor[0] = colorA[0] * (colorB[0] * factor + (1.0 - factor));\noutColor[1] = colorA[1] * (colorB[1] * factor + (1.0 - factor));\noutColor[2] = colorA[2] * (colorB[2] * factor + (1.0 - factor));\noutAlpha = alphaA * (alphaB * factor + (1.0 - factor));\n} else if (operation == 4) {\noutColor[0] = 1.0 - ((1.0 - colorA[0]) * (1.0 - colorB[0] * factor));\noutColor[1] = 1.0 - ((1.0 - colorA[1]) * (1.0 - colorB[1] * factor));\noutColor[2] = 1.0 - ((1.0 - colorA[2]) * (1.0 - colorB[2] * factor));\noutAlpha = 1.0 - ((1.0 - alphaA) * (1.0 - alphaB * factor));\n} else if (operation == 5) {\noutColor[0] = colorB[0] > 0.5 ? (2.0 * colorA[0] * colorB[0] * factor) + colorA[0] * (1.0 - factor) :\n1.0 - ((1.0 - colorA[0]) * (1.0 - colorB[0] * factor)) * (2.0 - (1.0 - factor));\noutColor[1] = colorB[1] > 0.5 ? (2.0 * colorA[1] * colorB[1] * factor) + colorA[1] * (1.0 - factor) :\n1.0 - ((1.0 - colorA[1]) * (1.0 - colorB[1] * factor)) * (2.0 - (1.0 - factor));\noutColor[2] = colorB[2] > 0.5 ? (2.0 * colorA[2] * colorB[2] * factor) + colorA[2] * (1.0 - factor) :\n1.0 - ((1.0 - colorA[2]) * (1.0 - colorB[2] * factor)) * (2.0 - (1.0 - factor));\noutAlpha = alphaB > 0.5 ? (2.0 * alphaA * alphaB * factor) + alphaA * (1.0 - factor) :\n1.0 - ((1.0 - alphaA) * (1.0 - alphaB * factor)) * (2.0 - (1.0 - factor));\n} else if (operation == 6) {\noutColor[0] = abs(colorA[0] - (colorB[0] * factor));\noutColor[1] = abs(colorA[1] - (colorB[1] * factor));\noutColor[2] = abs(colorA[2] - (colorB[2] * factor));\noutAlpha = abs(alphaA - (alphaB * factor));\n} else if (operation == 7) {\noutColor[0] = clamp(mix(colorA[0], colorA[0] / max(1.0 - colorB[0], 0.00001), factor), colorA[0], colorB[0]);\noutColor[1] = clamp(mix(colorA[1], colorA[1] / max(1.0 - colorB[1], 0.00001), factor), colorA[1], colorB[1]);\noutColor[2] = clamp(mix(colorA[2], colorA[2] / max(1.0 - colorB[2], 0.00001), factor), colorA[2], colorB[2]);\noutAlpha = clamp(mix(alphaA, alphaA / max(1.0 - alphaB, 0.00001), factor), alphaA, alphaB);\n} else if (operation == 8) {\noutColor[0] = clamp(mix(colorA[0], 1.0 - (colorA[0] / max(1.0 - colorB[0], 0.00001)), factor), colorA[0], colorB[0]);\noutColor[1] = clamp(mix(colorA[1], 1.0 - (colorA[1] / max(1.0 - colorB[1], 0.00001)), factor), colorA[1], colorB[1]);\noutColor[2] = clamp(mix(colorA[2], 1.0 - (colorA[2] / max(1.0 - colorB[2], 0.00001)), factor), colorA[2], colorB[2]);\noutAlpha = clamp(mix(alphaA, 1.0 - (alphaA / max(1.0 - alphaB, 0.00001)), factor), alphaA, alphaB);\n}\n}",node_color_constant_my_frag:"void node_color_constant(vec3 inColor, float inAlpha, out vec3 outColor, out float outAlpha)\n{\noutColor = inColor;\noutAlpha = inAlpha;\n}",node_color_correct_my_frag:"void node_color_correct(\nbool colClamp, vec3 colClampMin, vec3 colClampMax,\nbool alphaClamp, float alphaClampMin, float alphaClampMax,\nbool unpremultInput, bool premultResult,\nfloat alphaGain, float alphaGamma, float alphaOffset,\nvec3 colGain, vec3 colGamma, vec3 colOffset, float hueShift,\nfloat inAlpha, vec3 inColor, float satGain, float valGain,\nout float outAlpha, out vec3 outColor)\n{\noutColor = unpremultInput ? inColor/inAlpha : inColor;\nif (hueShift != 0.0 || satGain != 1.0 || valGain != 1.0) {\nvec4 color = vec4(outColor, 1.0);\nrgbToHSV(vec4(inColor, 1.0), color);\ncolor.r += hueShift / 360.0;\nif (color.r > 1.0)\ncolor.r -= 1.0;\nelse if (color.r < 0.0)\ncolor.r += 1.0;\ncolor.g *= satGain;\ncolor.b *= valGain;\nhsvToRGB(color, color);\noutColor = color.rgb;\n}\noutColor *= colGain;\noutColor += colOffset;\nif (any(notEqual(colGamma, vec3(1.0))))\noutColor = pow(outColor, 1.0 / colGamma);\nif (colClamp)\noutColor = clamp(outColor, colClampMin, colClampMax);\noutAlpha = inAlpha * alphaGain;\noutAlpha += alphaOffset;\nif (alphaGamma != 1.0)\noutAlpha = pow(outAlpha, 1.0 / alphaGamma);\nif (alphaClamp)\noutAlpha = clamp(outAlpha, alphaClampMin, alphaClampMax);\nif (premultResult)\noutColor *= outAlpha;\n}",node_color_logic_my_frag:"void node_color_logic(\nint operation,\nvec3 colorA, vec3 colorB,\nout bool outBool) {\nif (operation == 0) {\noutBool = all(equal(colorA, colorB));\n} else if (operation == 1) {\noutBool = any(notEqual(colorA, colorB));\n} else if (operation == 2) {\noutBool = ((colorA.x + colorA.y + colorA.z) < (colorB.x + colorB.y + colorB.z));\n} else if (operation == 3) {\noutBool = ((colorA.x + colorA.y + colorA.z) > (colorB.x + colorB.y + colorB.z));\n} else if (operation == 4) {\noutBool = ((colorA.x + colorA.y + colorA.z) <= (colorB.x + colorB.y + colorB.z));\n} else {\noutBool = ((colorA.x + colorA.y + colorA.z) >= (colorB.x + colorB.y + colorB.z));\n}\n}",node_color_mask_my_frag:"void node_color_mask(\nbool maskAlphaIsLuminance,\nfloat inAlpha, vec3 inColor, vec3 mask, float maskAlpha,\nout float outAlpha, out vec3 outColor) {\nif (maskAlphaIsLuminance)\nmaskAlpha = 1.0 - dot(mask, LUM_WEIGHTS_MAYA);\noutColor = inColor * (1.0 - maskAlpha);\n}",node_color_math_my_frag:"void node_color_math(\nint operation,\nfloat alphaA, float alphaB, vec3 colorA, vec3 colorB,\nout float outAlpha, out vec3 outColor) {\nif (operation == 0) {\noutColor = colorA + colorB;\noutAlpha = alphaA + alphaB;\n} else if (operation == 1) {\noutColor = colorA - colorB;\noutAlpha = alphaA - alphaB;\n} else if (operation == 2) {\noutColor = colorA * colorB;\noutAlpha = alphaA * alphaB;\n} else if (operation == 3) {\noutColor = colorA / colorB;\noutAlpha = alphaA / alphaB;\n} else if (operation == 4) {\noutColor = min(colorA, colorB);\noutAlpha = min(alphaA, alphaB);\n} else {\noutColor = max(colorA, colorB);\noutAlpha = max(alphaA, alphaB);\n}\n}",node_compose_matrix_my_frag:"mat3 quatToMat3(vec4 quat) {\nfloat x = quat.x,\ny = quat.y,\nz = quat.z,\nw = quat.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\n\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\n\nmat3 mat;\n\nmat[0][0] = 1.0 - yy - zz;\nmat[1][0] = yx - wz;\nmat[2][0] = zx + wy;\n\nmat[0][1] = yx + wz;\nmat[1][1] = 1.0 - xx - zz;\nmat[2][1] = zy - wx;\n\nmat[0][2] = zx - wy;\nmat[1][2] = zy + wx;\nmat[2][2] = 1.0 - xx - yy;\nreturn mat;\n}\nvoid node_compose_matrix(\nbool useEulerRotation, int inputRotateOrder,\nvec4 inputQuat, vec3 inputRotate, vec3 inputScale, vec3 inputShear, vec3 inputTranslate,\nout mat4 outputMatrix)\n{\nmat4 rotateMatrix;\ninputRotate = radians(inputRotate);\nif (useEulerRotation)\nrotateMatrix = toMat4(mat3RotateX(inputRotate.x) * mat3RotateY(inputRotate.y) * mat3RotateZ(inputRotate.z));\nelse\nrotateMatrix = toMat4(quatToMat3(normalize(inputQuat)));\nmat4 scaleMatrix = mat4(inputScale.x, 0.0, 0.0, 0.0,\n0.0, inputScale.y, 0.0, 0.0,\n0.0, 0.0, inputScale.z, 0.0,\n0.0, 0.0, 0.0, 1.0);\nmat4 shearMatrix = mat4(1.0, 0.0, 0.0, 0.0,\ninputShear.x, 1.0, 0.0, 0.0,\ninputShear.y, inputShear.z, 1.0, 0.0,\n0.0, 0.0, 0.0, 1.0);\nmat4 transMatrix = mat4(1.0, 0.0, 0.0, 0.0,\n0.0, 1.0, 0.0, 0.0,\n0.0, 0.0, 1.0, 0.0,\ninputTranslate.x, inputTranslate.y, inputTranslate.z, 1.0);\noutputMatrix = scaleMatrix * shearMatrix * rotateMatrix * transMatrix;\n}",node_condition_my_frag:"void node_condition(\nint operation,\nvec3 colorIfFalse, vec3 colorIfTrue, float firstTerm, float secondTerm,\nout vec3 outColor) {\nif (operation == 0) {\nif (firstTerm == secondTerm)\noutColor = colorIfTrue;\nelse\noutColor = colorIfFalse;\n} else if (operation == 1) {\nif (firstTerm != secondTerm)\noutColor = colorIfTrue;\nelse\noutColor = colorIfFalse;\n} else if (operation == 2) {\nif (firstTerm > secondTerm)\noutColor = colorIfTrue;\nelse\noutColor = colorIfFalse;\n} else if (operation == 3) {\nif (firstTerm >= secondTerm)\noutColor = colorIfTrue;\nelse\noutColor = colorIfFalse;\n} else if (operation == 4) {\nif (firstTerm < secondTerm)\noutColor = colorIfTrue;\nelse\noutColor = colorIfFalse;\n} else if (operation == 5) {\nif (firstTerm <= secondTerm)\noutColor = colorIfTrue;\nelse\noutColor = colorIfFalse;\n}\n}",node_decompose_matrix_my_frag:"vec4 mat3ToQuat(mat3 m) {\nfloat trace = m[0][0] + m[1][1] + m[2][2];\nvec4 q = vec4(0.0, 0.0, 0.0, 0.0);\nif (trace > 0.0) {\nfloat s = sqrt(trace + 1.0) * 2.0;\nq.w = 0.25 * s;\nq.x = (m[2][1] - m[1][2]) / s;\nq.y = (m[0][2] - m[2][0]) / s;\nq.z = (m[1][0] - m[0][1]) / s;\n} else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) {\nfloat s = sqrt(1.0 + m[0][0] - m[1][1] - m[2][2]) * 2.0;\nq.w = (m[2][1] - m[1][2]) / s;\nq.x = 0.25 * s;\nq.y = (m[0][1] + m[1][0]) / s;\nq.z = (m[0][2] + m[2][0]) / s;\n} else if (m[1][1] > m[2][2]) {\nfloat s = sqrt(1.0 + m[1][1] - m[0][0] - m[2][2]) * 2.0;\nq.w = (m[0][2] - m[2][0]) / s;\nq.x = (m[0][1] + m[1][0]) / s;\nq.y = 0.25 * s;\nq.z = (m[1][2] + m[2][1]) / s;\n} else {\nfloat s = sqrt(1.0 + m[2][2] - m[0][0] - m[1][1]) * 2.0;\nq.w = (m[1][0] - m[0][1]) / s;\nq.x = (m[0][2] + m[2][0]) / s;\nq.y = (m[1][2] + m[2][1]) / s;\nq.z = 0.25 * s;\n}\nreturn q;\n}\nvec3 mat3ToEuler(mat3 m) {\nfloat m11 = m[0][0], m12 = m[1][0], m13 = m[2][0];\nfloat m21 = m[0][1], m22 = m[1][1], m23 = m[2][1];\nfloat m31 = m[0][2], m32 = m[1][2], m33 = m[2][2];\nvec3 euler;\neuler.y = asin(clamp(m13, -1.0, 1.0));\nif (abs(m13) < 0.9999999) {\neuler.x = atan(-m23, m33);\neuler.z = atan(-m12, m11);\n} else {\neuler.x = atan(m32, m22);\neuler.z = 0.0;\n}\nreturn euler;\n}\nvoid decomposeMat4(mat4 m, out vec3 position, out vec4 quat, out vec3 euler, out vec3 scale) {\nfloat sx = length(vec3(m[0][0], m[0][1], m[0][2]));\nfloat sy = length(vec3(m[1][0], m[1][1], m[1][2]));\nfloat sz = length(vec3(m[2][0], m[2][1], m[2][2]));\nfloat det = mat3GetDeterminant(toMat3(m));\nif (det < 0.0)\nsx = -sx;\nposition.x = m[3][0];\nposition.y = m[3][1];\nposition.z = m[3][2];\nfloat invSX = 1.0 / sx;\nfloat invSY = 1.0 / sy;\nfloat invSZ = 1.0 / sz;\nm[0][0] *= invSX;\nm[0][1] *= invSX;\nm[0][2] *= invSX;\nm[1][0] *= invSY;\nm[1][1] *= invSY;\nm[1][2] *= invSY;\nm[2][0] *= invSZ;\nm[2][1] *= invSZ;\nm[2][2] *= invSZ;\nquat = mat3ToQuat(toMat3(m));\neuler = mat3ToEuler(toMat3(m));\nscale.x = sx;\nscale.y = sy;\nscale.z = sz;\n}\nvoid node_decompose_matrix(\nmat4 inputMatrix,\nout vec4 outputQuat, out vec3 outputRotate, out vec3 outputScale, out vec3 outputShear, out vec3 outputTranslate)\n{\ndecomposeMat4(inputMatrix, outputTranslate, outputQuat, outputRotate, outputScale);\noutputShear = vec3(0.0, 0.0, 0.0);\n}",node_env_sphere_my_frag:"void node_env_sphere(sampler2D envMap, int encoding, vec3 normal,\nmat4 placementMatrix,\nout float outAlpha, out vec3 outColor)\n{\nvec3 cameraToVertex = normalize(vWorldPosition - cameraPosition);\nvec3 reflectVec;\n#if WORLD_NODES\nreflectVec = normalize(cameraToVertex);\n#else\nvec3 worldNormal = inverseTransformDirection(normal, viewMatrix);\nreflectVec = reflect(cameraToVertex, worldNormal);\n#endif\nmat3 uvTransform = mat3(1.0);\nreflectVec = toMat3(placementMatrix) * reflectVec;\nvec4 tex = sampleEquirectangular(envMap, reflectVec, uvTransform, encoding);\noutAlpha = tex.a;\noutColor = tex.rgb;\n}",node_file_my_frag:"void node_file(sampler2D ima, const int encoding, const bool rgbToAlpha,\nvec2 uvCoord,\nout float outAlpha, out vec3 outColor, out vec2 outSize, out vec3 outTransparency) {\nvec2 uv = vec2(uvCoord.x, 1.0 - uvCoord.y);\nvec4 tex = texture2D(ima, uv);\noutColor = nodeTexelToLinear(tex, encoding).rgb;\nif (rgbToAlpha)\noutAlpha = dot(tex.rgb, LUM_WEIGHTS_MAYA);\nelse\noutAlpha = tex.a;\noutSize = vec2(0.0);\noutTransparency = vec3(1.0 - outAlpha, 1.0 - outAlpha, 1.0 - outAlpha);\n}",node_float_condition_my_frag:"void node_float_condition(\nbool condition, float floatA, float floatB, \nout float outFloat) {\noutFloat = condition ? floatA : floatB;\n}",node_float_composite_my_frag:"void node_float_composite(int operation,\nfloat floatA, float floatB, float factor,\nout float outFloat)\n{\nif (factor <= 0.0) {\noutFloat = floatA;\nreturn;\n}\nif (operation == 0) {\noutFloat = floatA + (floatB * factor);\n} else if (operation == 1) {\noutFloat = floatA + ((floatB - 1.0) * factor);\n} else if (operation == 2) {\nif (factor >= 1.0) {\noutFloat = floatB;\nreturn;\n}\noutFloat = mix(floatA, floatB, factor);\n} else if (operation == 3) {\noutFloat = floatA * (floatB * factor + (1.0 - factor));\n} else if (operation == 4) {\noutFloat = 1.0 - ((1.0 - floatA) * (1.0 - floatB * factor));\n} else if (operation == 5) {\noutFloat = floatB > 0.5 ? (2.0 * floatA * floatB * factor) + floatA * (1.0 - factor) :\n1.0 - ((1.0 - floatA) * (1.0 - floatB * factor)) * (2.0 - (1.0 - factor));\n} else if (operation == 6) {\noutFloat = abs(floatA - (floatB * factor));\n} else if (operation == 7) {\noutFloat = clamp(mix(floatA, floatA / max(1.0 - floatB, 0.00001), factor), floatA, floatB);\n} else if (operation == 8) {\noutFloat = clamp(mix(floatA, 1.0 - (floatA / max(1.0 - floatB, 0.00001)), factor), floatA, floatB);\n}\n}",node_float_constant_my_frag:"void node_float_constant(float inFloat, out float outFloat)\n{\noutFloat = inFloat;\n}",node_float_logic_my_frag:"void node_float_logic(\nint operation,\nfloat floatA, float floatB,\nout bool outBool) {\nif (operation == 0) {\noutBool = (floatA == floatB);\n} else if (operation == 1) {\noutBool = (floatA != floatB);\n} else if (operation == 2) {\noutBool = (floatA < floatB);\n} else if (operation == 3) {\noutBool = (floatA > floatB);\n} else if (operation == 4) {\noutBool = (floatA <= floatB);\n} else {\noutBool = (floatA >= floatB);\n}\n}",node_float_mask_my_frag:"void node_float_mask(\nfloat inFloat, float mask,\nout float outFloat) {\noutFloat = inFloat - mask;\n}",node_float_math_my_frag:"void node_float_math(\nint operation,\nfloat floatA, float floatB,\nout float outFloat) {\nif (operation == 0) {\noutFloat = floatA + floatB;\n} else if (operation == 1) {\noutFloat = floatA - floatB;\n} else if (operation == 2) {\noutFloat = floatA * floatB;\n} else if (operation == 3) {\noutFloat = floatA / floatB;\n} else if (operation == 4) {\noutFloat = min(floatA, floatB);\n} else if (operation == 5) {\noutFloat = max(floatA, floatB);\n} else {\noutFloat = pow(floatA, floatB);\n}\n}",node_four_by_four_matrix_my_frag:"void node_four_by_four_matrix(\nfloat in00, float in01, float in02, float in03,\nfloat in10, float in11, float in12, float in13,\nfloat in20, float in21, float in22, float in23,\nfloat in30, float in31, float in32, float in33,\nout mat4 outMatrix)\n{\noutMatrix = mat4(in00, in01, in02, in03,\nin10, in11, in12, in13,\nin20, in21, in22, in23,\nin30, in31, in32, in33);\n}",node_gamma_correct_my_frag:"void node_gamma_correct(\nvec3 gamma, vec3 value,\nout vec3 outValue) {\noutValue = pow(value, 1.0 / gamma);\n}",node_grid_my_frag:"void node_grid(\nfloat contrast, vec3 fillerColor, vec3 lineColor, float uWidth, float vWidth, vec2 uvCoord,\nout float outAlpha, out vec3 outColor) {\nuvCoord = fract(uvCoord); \nfloat v0 = max(uvCoord.y, 0.5 * vWidth);\nfloat v1 = min(uvCoord.y, 1.0 - 0.5 * vWidth);\nfloat u0 = max(uvCoord.x, 0.5 * uWidth);\nfloat u1 = min(uvCoord.x, 1.0 - 0.5 * uWidth);\nfloat gridFactor = (v0 <= v1 && u0 <= u1) ? 1.0 : 0.0;\ngridFactor = 0.5 - contrast * (gridFactor - 0.5);\ngridFactor = max(gridFactor, 0.0);\nvec3 gridColor = mix(fillerColor, lineColor, gridFactor); \ngridColor.r = max(gridColor.r, 0.0);\ngridColor.g = max(gridColor.g, 0.0);\ngridColor.b = max(gridColor.b, 0.0);\noutAlpha = saturate(gridFactor); \noutColor = gridColor; \n}",node_inverse_matrix_my_frag:"\nmat4 inverseMat4(mat4 m) {\nfloat a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\na10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\na20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\na30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3];\nfloat b00 = a00 * a11 - a01 * a10,\nb01 = a00 * a12 - a02 * a10,\nb02 = a00 * a13 - a03 * a10,\nb03 = a01 * a12 - a02 * a11,\nb04 = a01 * a13 - a03 * a11,\nb05 = a02 * a13 - a03 * a12,\nb06 = a20 * a31 - a21 * a30,\nb07 = a20 * a32 - a22 * a30,\nb08 = a20 * a33 - a23 * a30,\nb09 = a21 * a32 - a22 * a31,\nb10 = a21 * a33 - a23 * a31,\nb11 = a22 * a33 - a23 * a32;\nfloat det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\nreturn mat4(a11 * b11 - a12 * b10 + a13 * b09,\na02 * b10 - a01 * b11 - a03 * b09,\na31 * b05 - a32 * b04 + a33 * b03,\na22 * b04 - a21 * b05 - a23 * b03,\na12 * b08 - a10 * b11 - a13 * b07,\na00 * b11 - a02 * b08 + a03 * b07,\na32 * b02 - a30 * b05 - a33 * b01,\na20 * b05 - a22 * b02 + a23 * b01,\na10 * b10 - a11 * b08 + a13 * b06,\na01 * b08 - a00 * b10 - a03 * b06,\na30 * b04 - a31 * b02 + a33 * b00,\na21 * b02 - a20 * b04 - a23 * b00,\na11 * b07 - a10 * b09 - a12 * b06,\na00 * b09 - a01 * b07 + a02 * b06,\na31 * b01 - a30 * b03 - a32 * b00,\na20 * b03 - a21 * b01 + a22 * b00) / det;\n}\nvoid node_inverse_matrix(\nmat4 inputMatrix,\nout mat4 outputMatrix)\n{\noutputMatrix = inverseMat4(inputMatrix);\n}",node_lambert_my_frag:"\nvoid node_lambert(\nvec3 geometryNormal,\nvec3 color, vec3 ambientColor, vec3 incandescence, float matteOpacity,\nfloat diffuse, vec3 normal, float translucence, vec3 transparency,\nout vec4 outColor) {\nNodeMaterial material;\nmaterial.diffuseColor = diffuse * color.rgb;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_IndirectDiffuse\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\nfloat alpha = 1.0 - average(transparency);\noutColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + incandescence, alpha);\n}",node_layered_texture_layer_my_frag:"#define LAYER_BLEND_MODE_NONE 0.0\n#define LAYER_BLEND_MODE_OVER 1.0\n#define LAYER_BLEND_MODE_IN 2.0\n#define LAYER_BLEND_MODE_OUT 3.0\n#define LAYER_BLEND_MODE_ADD 4.0\n#define LAYER_BLEND_MODE_SUBTRACT 5.0\n#define LAYER_BLEND_MODE_MULTIPLY 6.0\n#define LAYER_BLEND_MODE_DIFFERENCE 7.0\n#define LAYER_BLEND_MODE_LIGHTEN 8.0\n#define LAYER_BLEND_MODE_DARKEN 9.0\n#define LAYER_BLEND_MODE_SATURATE 10.0\n#define LAYER_BLEND_MODE_DESATURATE 11.0\n#define LAYER_BLEND_MODE_ILLUMINATE 12.0\nvoid node_layered_texture_layer(\nconst float alphaBG, const vec3 colorBG, \nconst vec3 color, const float alpha, const float blendMode, const bool isVisible,\nout float outAlpha, out vec3 outColor)\n{\noutAlpha = alphaBG;\noutColor = colorBG;\nif (!isVisible)\nreturn;\nif (blendMode == LAYER_BLEND_MODE_NONE) {\noutColor = color;\n} else if (blendMode == LAYER_BLEND_MODE_OVER) {\noutColor = mix(colorBG, color, alpha);\n} else if (blendMode == LAYER_BLEND_MODE_IN) {\noutColor = alpha * colorBG;\n} else if (blendMode == LAYER_BLEND_MODE_OUT) {\noutColor = (1.0 - alpha) * colorBG;\n} else if (blendMode == LAYER_BLEND_MODE_ADD) {\noutColor = mix(colorBG, colorBG + color, alpha);\n} else if (blendMode == LAYER_BLEND_MODE_SUBTRACT) {\noutColor = mix(colorBG, colorBG - color, alpha);\n} else if (blendMode == LAYER_BLEND_MODE_MULTIPLY) {\noutColor = mix(colorBG, colorBG * color, alpha);\n} else {\noutColor = mix(colorBG, color, alpha);\n}\n}",node_light_path_my_frag:"void node_light_path(out float isCameraRay)\n{\n#if LIGHT_PATH_IS_CAM_RAY\nisCameraRay = 1.0;\n#else\nisCameraRay = 0.0;\n#endif\n}",node_luminance_my_frag:"void node_luminance(\nvec3 value,\nout float outValue) {\noutValue = dot(value, LUM_WEIGHTS_MAYA);\n}",node_multiply_divide_my_frag:"void node_multiply_divide(\nint operation,\nvec3 input1, vec3 input2,\nout vec3 outValue) {\nif (operation == 0) {\noutValue = input1;\n} else if (operation == 1) {\noutValue = input1 * input2;\n} else if (operation == 2) {\n\noutValue = input1 / input2;\n} else {\noutValue = pow(input1, input2);\n}\n}",node_mult_double_linear_my_frag:"void node_mult_double_linear(\nfloat input1, float input2,\nout float outValue) {\noutValue = input1 * input2;\n}",node_mult_matrix_my_frag:"\nvoid node_mult_matrix(\nmat4 matrixIn1,\nout mat4 matrixSum)\n{\nmatrixSum = matrixIn1;\n}\nvoid node_mult_matrix(\nmat4 matrixIn1, mat4 matrixIn2,\nout mat4 matrixSum)\n{\nmatrixSum = matrixIn2 * matrixIn1;\n}\nvoid node_mult_matrix(\nmat4 matrixIn1, mat4 matrixIn2, mat4 matrixIn3,\nout mat4 matrixSum)\n{\nmatrixSum = matrixIn3 * matrixIn2 * matrixIn1;\n}",node_noise_my_frag:"vec2 calcNoiseImplode(float implode, vec2 implodeCenter, vec2 uv) {\nif (abs(implode) >= EPSILON) {\nuv -= implodeCenter;\nfloat len = length(uv);\nif (len > EPSILON) {\nfloat factor = pow(len, 1.0-implode) / len;\nuv *= factor;\n}\nuv += implodeCenter;\n}\nreturn uv;\n}\nvoid node_noise(\nfloat amplitude, int depthMax, float frequency, float frequencyRatio, float implode,\nvec2 implodeCenter, bool inflection, float ratio, float threshold, float time, vec2 uvCoord,\nout float outAlpha, out vec3 outColor) {\nuvCoord = calcNoiseImplode(implode, implodeCenter, uvCoord);\nfrequency *= 0.6;\namplitude *= 0.9;\nuvCoord *= frequency;\nfloat noiseAccum = 0.0;\nvec2 freqOffset = vec2(0.02, 0.3);\nint depthId = 0;\nwhile (depthId < depthMax) {\nint stepVal = depthId;\nfloat noise = noisePerlin(vec3(uvCoord + freqOffset, time + 0.5 * float(stepVal)));\nif (inflection)\nnoise = abs(noise);\nnoiseAccum += amplitude * noise;\nuvCoord *= frequencyRatio;\ntime *= sqrt(frequencyRatio);\namplitude *= ratio;\nfreqOffset += vec2(0.02, 0.3);\ndepthId++;\n}\nif (!inflection)\nnoiseAccum = 0.5 * noiseAccum + 0.5;\nnoiseAccum += threshold;\noutAlpha = min(1.0, noiseAccum);\noutColor = vec3(outAlpha, outAlpha, outAlpha);\n}",node_output_my_frag:"void node_output(vec4 rgb, out vec4 outgoingLight)\n{\noutgoingLight = rgb;\n}",node_place_2d_texture_my_frag:"void node_place_2d_texture(const vec2 inUv,\nvec2 offset, vec2 repeatUv, float rotateUv,\nout vec2 outUv)\n{\noutUv = (calcUvTransform(offset.x, offset.y, repeatUv.x, repeatUv.y, rotateUv) * vec3(inUv, 1.0)).xy;\noutUv.y = 1.0 - outUv.y;\n}",node_phong_my_frag:"void node_phong(\nvec3 geometryNormal,\nvec3 color, vec3 ambientColor, vec3 incandescence, float matteOpacity,\nfloat diffuse, vec3 normal, float reflectivity, vec3 reflectedColor,\nfloat cosinePower, vec3 specularColor, float translucence, vec3 transparency,\nout vec4 outColor) {\nNodeMaterial material;\nmaterial.diffuseColor = diffuse * color;\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\nvec3 dxy = max(abs(dFdx(geometryNormal)), abs(dFdy(geometryNormal)));\nfloat geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);\nfloat roughness = sqrt(1.0 / (0.454 * cosinePower + 3.357));\nmaterial.specularRoughness = max(roughness, 0.0525);\nmaterial.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min(material.specularRoughness, 1.0);\nmaterial.specularColor = specularColor;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_DirectSpecular\n#undef RE_IndirectDiffuse\n#undef RE_IndirectSpecular\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\nfloat alpha = 1.0 - average(transparency);\noutColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\nreflectedLight.directSpecular + reflectedLight.indirectSpecular + incandescence, alpha);\n}",node_phong_e_my_frag:"void node_phong_e(\nvec3 geometryNormal,\nvec3 color, vec3 ambientColor, vec3 incandescence, float matteOpacity,\nfloat diffuse, vec3 normal, float reflectivity, vec3 reflectedColor,\nfloat highlightSize, float roughness, vec3 specularColor, float translucence, vec3 transparency,\nout vec4 outColor) {\nNodeMaterial material;\nmaterial.diffuseColor = diffuse * color;\n#ifdef CLEARCOAT\n#undef CLEARCOAT\n#define _CLEARCOAT_RESTORE\n#endif\nvec3 dxy = max(abs(dFdx(geometryNormal)), abs(dFdy(geometryNormal)));\nfloat geometryRoughness = max(max(dxy.x, dxy.y), dxy.z);\nmaterial.specularRoughness = max(roughness, 0.0525);\nmaterial.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min(material.specularRoughness, 1.0);\nmaterial.specularColor = specularColor;\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n#define RE_DirectDiffuse RE_DirectDiffuse_Node\n#define RE_DirectSpecular RE_DirectSpecular_Node\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Node\n#define RE_IndirectSpecular RE_IndirectSpecular_Node\n#include \n#include \n#include \n#undef RE_DirectDiffuse\n#undef RE_DirectSpecular\n#undef RE_IndirectDiffuse\n#undef RE_IndirectSpecular\n#ifdef _CLEARCOAT_RESTORE\n#undef _CLEARCOAT_RESTORE\n#define CLEARCOAT\n#endif\nfloat alpha = 1.0 - average(transparency);\noutColor = vec4(reflectedLight.directDiffuse + reflectedLight.indirectDiffuse +\nreflectedLight.directSpecular + reflectedLight.indirectSpecular + incandescence, alpha);\n}",node_premultiply_my_frag:"void node_premultiply(\nfloat inAlpha, vec3 inColor,\nout float outAlpha, out vec3 outColor) {\noutColor = inColor * inAlpha;\noutAlpha = inAlpha;\n}",node_ramp_my_frag:"void node_ramp(\nsampler2D rampData, int rampType,\nvec2 uvCoord,\nout float outAlpha, out vec3 outColor)\n{\nfloat coord;\nif (rampType == 0) {\ncoord = uvCoord.y;\n} else if (rampType == 1) {\ncoord = uvCoord.x;\n} else if (rampType == 2) {\ncoord = abs(uvCoord.x + uvCoord.y) / 2.0;\n} else if (rampType == 3) {\nvec2 uvSpiral = mat2(0.0, 1.0, 1.0, 0.0) * (uvCoord - vec2(0.5));\ncoord = atan(uvSpiral.y, uvSpiral.x) / PI2 + 0.5;\n} else if (rampType == 4) {\ncoord = length(uvCoord - vec2(0.5)) * sqrt(2.0);\n} else if (rampType == 5) {\nvec2 boxUv = abs(uvCoord - vec2(0.5)) * 2.0;\ncoord = max(boxUv.x, boxUv.y);\n} else if (rampType == 6) {\nuvCoord = abs((uvCoord - vec2(0.5)) * 2.0);\ncoord = uvCoord.y;\n} else if (rampType == 7) {\ncoord = uvCoord.y;\n} else {\ncoord = uvCoord.y;\n}\nvec4 tex = texture2D(rampData, vec2(coord, 0.0));\noutAlpha = average(tex.xyz);\noutColor = tex.xyz;\n}",node_remap_hsv_my_frag:"void node_remap_hsv(vec3 color, out vec3 outColor)\n{\noutColor = color;\n}",node_reverse_my_frag:"void node_reverse(\nvec3 inValue,\nout vec3 outValue) {\noutValue = 1.0 - inValue;\n}",node_sampler_info_my_frag:"void node_sampler_info(\nbool frontFacing, vec4 tangent, vec2 uv,\nvec3 viewNorm,\nout float facingRatio, out bool flippedNormal, out mat4 matrixEyeToWorld,\nout vec3 normalCamera, out vec2 pixelCenter, out vec3 pointCamera,\nout vec3 pointObj, out vec3 pointWorld,\nout vec3 tangentUCamera, out vec3 tangentVCamera, out vec2 uvCoord)\n{\nvec4 worldPos = invViewMatrix * vec4(-vViewPosition, 1.0);\nfacingRatio = dot(normalize(viewNorm), normalize(vViewPosition));\nflippedNormal = frontFacing;\nmatrixEyeToWorld = invViewMatrix;\nnormalCamera = viewNorm;\npixelCenter = vec2(1.0);\npointCamera = -vViewPosition;\npointObj = (invModelMatrix * worldPos).xyz;\npointWorld = worldPos.xyz;\ntangentUCamera = normalize((modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz);\ntangentVCamera = tangent.w * cross(viewNorm, tangentUCamera);\nuvCoord = vec2(uv.x, 1.0-uv.y);\n}",node_set_range_my_frag:"void node_set_range(\nvec3 maxValue, vec3 minValue, vec3 oldMax, vec3 oldMin, vec3 value,\nout vec3 outValue) {\noutValue = minValue + (((value - oldMin) / (oldMax - oldMin)) * (maxValue - minValue));\n}",node_shading_engine_my_frag:"void node_shading_engine(vec4 surface, vec4 volume, vec3 displacement, out vec4 outgoingLight) {\noutgoingLight = surface + volume;\n}",node_surface_shader_my_frag:"void node_surface_shader(\nvec3 color, vec3 glowColor, vec3 matteOpacity, vec3 transparency,\nout vec3 outColor, out vec3 outGlowColor, out vec3 outMatteOpacity, out vec3 outTransparency)\n{\noutColor = color;\noutGlowColor = glowColor;\noutMatteOpacity = matteOpacity;\noutTransparency = transparency;\n}",node_transform_my_frag:"void node_transform(\nout vec3 center, out mat4 inverseMatrix, out mat4 matrix,\nout mat4 parentInverseMatrix, out mat4 parentMatrix, out mat4 worldInverseMatrix,\nout mat4 worldMatrix, out mat4 xformMatrix)\n{\ncenter = modelMatrix[3].xyz;\ninverseMatrix = invModelMatrix;\nmatrix = modelMatrix;\nparentInverseMatrix = mat4(1.0);\nparentMatrix = mat4(1.0);\nworldInverseMatrix = invModelMatrix;\nworldMatrix = modelMatrix;\nxformMatrix = matrix;\n}",node_transpose_matrix_my_frag:"mat4 transposeMat4(mat4 m) {\nreturn mat4(vec4(m[0].x, m[1].x, m[2].x, m[3].x),\nvec4(m[0].y, m[1].y, m[2].y, m[3].y),\nvec4(m[0].z, m[1].z, m[2].z, m[3].z),\nvec4(m[0].w, m[1].w, m[2].w, m[3].w));\n}\nvoid node_transpose_matrix(\nmat4 inputMatrix,\nout mat4 outputMatrix)\n{\noutputMatrix = transposeMat4(inputMatrix);\n}",node_unit_conversion_my_frag:"void node_unit_conversion(float conversionFactor, float inInput, out float outOutput)\n{\noutOutput = conversionFactor * inInput;\n}\nvoid node_unit_conversion(float conversionFactor, vec3 inInput, out vec3 outOutput)\n{\noutOutput = conversionFactor * inInput;\n}",node_unpremultiply_my_frag:"void node_unpremultiply(\nfloat inAlpha, vec3 inColor,\nout float outAlpha, out vec3 outColor) {\noutColor = inColor / inAlpha;\noutAlpha = inAlpha;\n}",node_vector_product_my_frag:"void node_vector_product(\nconst int operation, const bool normalizeOutput,\nvec3 input1, vec3 input2, mat4 matrix,\nout vec3 outVector) {\nif (operation == 0) {\noutVector = input1;\n} else if (operation == 1) {\nif (normalizeOutput) {\ninput1 = normalize(input1);\ninput2 = normalize(input2);\n}\noutVector = vec3(dot(input1, input2));\n} else if (operation == 2) {\noutVector = cross(input1, input2);\n} else if (operation == 3) {\noutVector = (matrix * vec4(input1, 0.0)).xyz;\n} else {\noutVector = (matrix * vec4(input1, 1.0)).xyz;\n}\n\nif (operation > 1 && normalizeOutput)\noutVector = normalize(outVector);\n}",node_wt_add_matrix_my_frag:"void node_wt_add_matrix(\nmat4 matrixIn1, float weightIn1,\nout mat4 matrixSum)\n{\nmatrixSum = weightIn1 * matrixIn1;\n}\nvoid node_wt_add_matrix(\nmat4 matrixIn1, float weightIn1, mat4 matrixIn2, float weightIn2,\nout mat4 matrixSum)\n{\nmatrixSum = weightIn1 * matrixIn1 + weightIn2 * matrixIn2;\n}\nvoid node_wt_add_matrix(\nmat4 matrixIn1, float weightIn1, mat4 matrixIn2, float weightIn2, mat4 matrixIn3, float weightIn3,\nout mat4 matrixSum)\n{\nmatrixSum = weightIn1 * matrixIn1 + weightIn2 * matrixIn2 + weightIn3 * matrixIn3;\n}",pp_plane_vert:"varying vec2 vUv;\nvoid main() {\nvUv = uv;\ngl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}",pp_afterimage_frag:"uniform float damp;\nuniform sampler2D tOld;\nuniform sampler2D tNew;\nvarying vec2 vUv;\nvec4 when_gt(vec4 x, float y) {\nreturn max(sign(x - y), 0.0);\n}\nvoid main() {\nvec4 texelOld = texture2D(tOld, vUv);\nvec4 texelNew = texture2D(tNew, vUv);\n\ntexelOld *= damp * when_gt(texelOld, 0.1);\ngl_FragColor = max(texelNew, texelOld);\n}",pp_bloom_composite_frag:"varying vec2 vUv;\nuniform sampler2D blurTexture1;\nuniform sampler2D blurTexture2;\nuniform sampler2D blurTexture3;\nuniform sampler2D blurTexture4;\nuniform sampler2D blurTexture5;\nuniform sampler2D dirtTexture;\nuniform float bloomStrength;\nuniform float bloomRadius;\nuniform float bloomFactors[NUM_MIPS];\nuniform vec3 bloomTintColors[NUM_MIPS];\nfloat lerpBloomFactor(const in float factor) {\nfloat mirrorFactor = 1.2 - factor;\nreturn mix(factor, mirrorFactor, bloomRadius);\n}\nvoid main() {\ngl_FragColor = bloomStrength * (\nlerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\nlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\nlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\nlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\nlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv)\n);\n}",pp_bloom_lum_high_pass_frag:"uniform sampler2D tDiffuse;\nuniform vec3 defaultColor;\nuniform float defaultOpacity;\nuniform float luminosityThreshold;\nuniform float smoothWidth;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D(tDiffuse, vUv);\nvec3 luma = vec3(0.299, 0.587, 0.114);\nfloat v = dot(texel.xyz, luma);\nvec4 outputColor = vec4(defaultColor.rgb, defaultOpacity);\nfloat alpha = smoothstep(luminosityThreshold, luminosityThreshold + smoothWidth, v);\ngl_FragColor = mix(outputColor, texel, alpha);\ngl_FragColor = clamp(gl_FragColor, 0.0, 10.0);\n}",pp_bloom_separable_blur_frag:"#include \nvarying vec2 vUv;\nuniform sampler2D colorTexture;\nuniform vec2 texSize;\nuniform vec2 direction;\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x/(sigma * sigma)) / sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / texSize;\nfloat fSigma = float(SIGMA);\nfloat weightSum = gaussianPdf(0.0, fSigma);\nvec3 diffuseSum = texture2D(colorTexture, vUv).rgb * weightSum;\nfor (int i = 1; i < KERNEL_RADIUS; i++) {\nfloat x = float(i);\nfloat w = gaussianPdf(x, fSigma);\nvec2 uvOffset = direction * invSize * x;\nvec3 sample1 = texture2D(colorTexture, vUv + uvOffset).rgb;\nvec3 sample2 = texture2D(colorTexture, vUv - uvOffset).rgb;\ndiffuseSum += (sample1 + sample2) * w;\nweightSum += 2.0 * w;\n}\ngl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n}",pp_blur_frag:"#include \nvarying vec2 vUv;\nuniform sampler2D colorTexture;\nuniform vec2 texSize;\nuniform vec2 direction;\nuniform float kernelRadius;\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x/(sigma * sigma))/sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / texSize;\nfloat weightSum = gaussianPdf(0.0, kernelRadius);\n#if LOG_SPACE == 1\nvec3 origDiffuse = texture2D(colorTexture, vUv).rgb;\nvec3 diffuseSum = vec3(weightSum);\n#else\nvec3 diffuseSum = texture2D(colorTexture, vUv).rgb * weightSum;\n#endif\nvec2 delta = direction * invSize * kernelRadius/float(MAX_SAMPLE_RADIUS);\nvec2 uvOffset = delta;\n#if OCTAHEDRAL_MAP == 1\nvec3 cubeDir = normalize(octUVToCubeVec(vUv, invSize));\nvec3 dirX = normalize(abs(cubeDir.y) < 0.99999 ? vec3(cubeDir.z, 0.0, -cubeDir.x)\n: vec3(0.0, -cubeDir.z, cubeDir.y));\nvec3 dirY = cross(cubeDir, dirX);\n#endif\n#pragma unroll_loop_start\nfor (int i = 1; i <= MAX_SAMPLE_RADIUS; i++) {\nfloat w = gaussianPdf(uvOffset.x, kernelRadius);\n#if OCTAHEDRAL_MAP == 1\nvec3 cubeOffset = uvOffset.x * dirX + uvOffset.y * dirY;\nvec2 uv1 = cubeVecToOctUV(cubeDir + cubeOffset, invSize);\nvec2 uv2 = cubeVecToOctUV(cubeDir - cubeOffset, invSize);\n#else\nvec2 uv1 = vUv + uvOffset;\nvec2 uv2 = vUv - uvOffset;\n#endif\nvec3 sample1 = texture2D(colorTexture, uv1).rgb;\nvec3 sample2 = texture2D(colorTexture, uv2).rgb;\n#if LOG_SPACE == 1\ndiffuseSum += (\nclamp(exp(sample1 - origDiffuse), 0.0, 1e38) +\nclamp(exp(sample2 - origDiffuse), 0.0, 1e38)\n) * w;\n#else\ndiffuseSum += ((sample1 + sample2) * w);\n#endif\nweightSum += 2.0 * w;\nuvOffset += delta;\n}\n#pragma unroll_loop_end\n#if LOG_SPACE == 1\ngl_FragColor = vec4(origDiffuse + log(diffuseSum/weightSum), 1.0);\n#else\ngl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n#endif\n}",pp_brightness_contrast_frag:"\nuniform sampler2D tDiffuse;\nuniform float brightness;\nuniform float contrast;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D(tDiffuse, vUv);\ntexel.rgb += brightness;\nif (contrast > 0.0)\ntexel.rgb = (texel.rgb - 0.5) / (1.0 - contrast) + 0.5;\nelse\ntexel.rgb = (texel.rgb - 0.5) * (1.0 + contrast) + 0.5;\ngl_FragColor = texel;\n}",pp_bokeh_frag:"#include \nvarying vec2 vUv;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform float maxblur;\nuniform float aperture;\nuniform float nearClip;\nuniform float farClip;\nuniform float focus;\nuniform float aspect;\nuniform float depthLeakThreshold;\n#include \nfloat getDepth(const in vec2 screenPosition) {\n#if DEPTH_PACKING == 1\nreturn unpackRGBAToDepth(texture2D(tDepth, screenPosition));\n#else\nreturn texture2D(tDepth, screenPosition).x;\n#endif\n}\nfloat getViewZ(const in float depth) {\n#if PERSPECTIVE_CAMERA == 1\nreturn perspectiveDepthToViewZ(depth, nearClip, farClip);\n#else\nreturn orthoDepthToViewZ(depth, nearClip, farClip);\n#endif\n}\nvec4 blurSample(vec2 uvOffset, vec4 centerCol, float viewZCenter) {\nfloat viewZ = -getViewZ(getDepth(vUv + uvOffset));\nfloat blurFactor = (viewZ >= viewZCenter) ? 1.0 : \nmin(depthLeakThreshold * abs((focus - viewZ) / aperture), 1.0);\nreturn mix(centerCol, texture2D(tColor, vUv + uvOffset), blurFactor);\n}\nvoid main() {\nvec2 aspectcorrect = vec2(1.0, aspect);\nfloat viewZ = -getViewZ(getDepth(vUv));\nfloat factor = abs(focus - viewZ);\n\nfloat dofblur = maxblur * min(factor / aperture, 1.0);\nfloat dofblur9 = dofblur * 0.9;\nfloat dofblur7 = dofblur * 0.7;\nfloat dofblur4 = dofblur * 0.4;\nvec4 centerCol = texture2D(tColor, vUv);\nvec4 col = centerCol;\ncol += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2( 0.15, 0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2(-0.37, 0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2( 0.40, 0.0 ) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2( 0.37, -0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2(-0.15, -0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2(-0.15, 0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2( 0.37, 0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2(-0.37, -0.15) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur, centerCol, viewZ);\ncol += blurSample((vec2( 0.15, -0.37) * aspectcorrect) * dofblur, centerCol, viewZ);\n\ncol += blurSample((vec2( 0.15, 0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\ncol += blurSample((vec2(-0.37, 0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\ncol += blurSample((vec2( 0.37, -0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\ncol += blurSample((vec2(-0.15, -0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\ncol += blurSample((vec2(-0.15, 0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\ncol += blurSample((vec2( 0.37, 0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\ncol += blurSample((vec2(-0.37, -0.15) * aspectcorrect) * dofblur9, centerCol, viewZ);\ncol += blurSample((vec2( 0.15, -0.37) * aspectcorrect) * dofblur9, centerCol, viewZ);\n\ncol += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\ncol += blurSample((vec2( 0.40, 0.0 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\ncol += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\ncol += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\ncol += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\ncol += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\ncol += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur7, centerCol, viewZ);\ncol += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur7, centerCol, viewZ);\n\ncol += blurSample((vec2( 0.29, 0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\ncol += blurSample((vec2( 0.4, 0.0 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\ncol += blurSample((vec2( 0.29, -0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\ncol += blurSample((vec2( 0.0, -0.4 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\ncol += blurSample((vec2(-0.29, 0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\ncol += blurSample((vec2(-0.4, 0.0 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\ncol += blurSample((vec2(-0.29, -0.29) * aspectcorrect) * dofblur4, centerCol, viewZ);\ncol += blurSample((vec2( 0.0, 0.4 ) * aspectcorrect) * dofblur4, centerCol, viewZ);\ngl_FragColor = col / 41.0;\ngl_FragColor.a = centerCol.a;\n}",pp_copy_frag:"uniform sampler2D tDiffuse;\nuniform float opacity;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = (texture2D(tDiffuse, vUv));\n#if MAP_TEXELS == 1\ntexel = mapTexelToLinear(texel);\n#endif\ngl_FragColor = opacity * texel;\n#if MAP_TEXELS == 1\n#include \n#include \n#endif\n}",pp_cube_octahedral_proj_frag:"#include \nuniform samplerCube tCube;\nuniform vec2 texelSize;\nvarying vec2 vUv;\nvoid main() {\ngl_FragColor = textureCube(tCube, octUVToCubeVec(gl_FragCoord.xy * texelSize,\ntexelSize));\n}",pp_fxaa_frag:"precision highp float;\nuniform sampler2D tDiffuse;\nuniform vec2 resolution;\nvarying vec2 vUv;\n#ifndef FXAA_GLSL_120\n#define FXAA_GLSL_120 0\n#endif\n#ifndef FXAA_GLSL_130\n#define FXAA_GLSL_130 0\n#endif\n#ifndef FXAA_GREEN_AS_LUMA\n#define FXAA_GREEN_AS_LUMA 0\n#endif\n#ifndef FXAA_EARLY_EXIT\n#define FXAA_EARLY_EXIT 1\n#endif\n#ifndef FXAA_DISCARD\n#define FXAA_DISCARD 1\n#endif\n#ifndef FXAA_FAST_PIXEL_OFFSET\n#ifdef GL_EXT_gpu_shader4\n#define FXAA_FAST_PIXEL_OFFSET 1\n#endif\n#ifdef GL_NV_gpu_shader5\n#define FXAA_FAST_PIXEL_OFFSET 1\n#endif\n#ifdef GL_ARB_gpu_shader5\n#define FXAA_FAST_PIXEL_OFFSET 1\n#endif\n#ifndef FXAA_FAST_PIXEL_OFFSET\n#define FXAA_FAST_PIXEL_OFFSET 0\n#endif\n#endif\n#ifndef FXAA_QUALITY_PRESET\n#define FXAA_QUALITY_PRESET 12\n#endif\n#if (FXAA_QUALITY_PRESET == 10)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 3.0\n#define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 3.0\n#define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 4.0\n#define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 4.0\n#define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 4.0\n#define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n#define FXAA_QUALITY_PS 3\n#define FXAA_QUALITY_P0 1.5\n#define FXAA_QUALITY_P1 2.0\n#define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n#define FXAA_QUALITY_PS 4\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n#define FXAA_QUALITY_PS 5\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n#define FXAA_QUALITY_PS 6\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n#define FXAA_QUALITY_PS 7\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 3.0\n#define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n#define FXAA_QUALITY_PS 8\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 4.0\n#define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n#define FXAA_QUALITY_PS 9\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 4.0\n#define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n#define FXAA_QUALITY_PS 10\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 4.0\n#define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n#define FXAA_QUALITY_PS 11\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 4.0\n#define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.5\n#define FXAA_QUALITY_P2 2.0\n#define FXAA_QUALITY_P3 2.0\n#define FXAA_QUALITY_P4 2.0\n#define FXAA_QUALITY_P5 2.0\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n#define FXAA_QUALITY_PS 12\n#define FXAA_QUALITY_P0 1.0\n#define FXAA_QUALITY_P1 1.0\n#define FXAA_QUALITY_P2 1.0\n#define FXAA_QUALITY_P3 1.0\n#define FXAA_QUALITY_P4 1.0\n#define FXAA_QUALITY_P5 1.5\n#define FXAA_QUALITY_P6 2.0\n#define FXAA_QUALITY_P7 2.0\n#define FXAA_QUALITY_P8 2.0\n#define FXAA_QUALITY_P9 2.0\n#define FXAA_QUALITY_P10 4.0\n#define FXAA_QUALITY_P11 8.0\n#endif\n#if 1\n#define FxaaBool bool\n#define FxaaDiscard discard\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 ivec2\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTex sampler2D\n#endif\n#if (FXAA_GLSL_100 == 1)\n#define FxaaTexTop(t, p) texture2D(t, p, 0.0)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)\n#endif\n#if (FXAA_GLSL_120 == 1)\n#define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n#if (FXAA_FAST_PIXEL_OFFSET == 1)\n#define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)\n#else\n#define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n#endif\n#endif\n#if (FXAA_GLSL_130 == 1)\n#define FxaaTexTop(t, p) textureLod(t, p, 0.0)\n#define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)\n#endif\n#if (FXAA_GREEN_AS_LUMA == 0)\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }\n#else\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\n#endif\nFxaaFloat4 FxaaPixelShader(\nFxaaFloat2 pos,\nFxaaFloat4 fxaaConsolePosPos,\nFxaaTex tex,\nFxaaTex fxaaConsole360TexExpBiasNegOne,\nFxaaTex fxaaConsole360TexExpBiasNegTwo,\nFxaaFloat2 fxaaQualityRcpFrame,\nFxaaFloat4 fxaaConsoleRcpFrameOpt,\nFxaaFloat4 fxaaConsoleRcpFrameOpt2,\nFxaaFloat4 fxaaConsole360RcpFrameOpt2,\nFxaaFloat fxaaQualitySubpix,\nFxaaFloat fxaaQualityEdgeThreshold,\nFxaaFloat fxaaQualityEdgeThresholdMin\n) {\nFxaaFloat2 posM;\nposM.x = pos.x;\nposM.y = pos.y;\n#if 1\nFxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n#if (FXAA_GREEN_AS_LUMA == 0)\n#define lumaM rgbyM.w\n#else\n#define lumaM rgbyM.y\n#endif\n#if (FXAA_GLSL_100 == 1)\nFxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(0.0, 1.0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0, 0.0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(0.0,-1.0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));\n#else\nFxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(0, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, 0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(0,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n#endif\n#endif\nFxaaFloat maxSM = max(lumaS, lumaM);\nFxaaFloat minSM = min(lumaS, lumaM);\nFxaaFloat maxESM = max(lumaE, maxSM);\nFxaaFloat minESM = min(lumaE, minSM);\nFxaaFloat maxWN = max(lumaN, lumaW);\nFxaaFloat minWN = min(lumaN, lumaW);\nFxaaFloat rangeMax = max(maxWN, maxESM);\nFxaaFloat rangeMin = min(minWN, minESM);\nFxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\nFxaaFloat range = rangeMax - rangeMin;\nFxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\nFxaaBool earlyExit = range < rangeMaxClamped;\nif(earlyExit)\n#if (FXAA_DISCARD == 1)\nreturn rgbyM;\n#else\nreturn rgbyM;\n#endif\n#if 1\n#if (FXAA_GLSL_100 == 1)\nFxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0, 1.0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(1.0,-1.0), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));\n#else\nFxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, 1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1,-1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n#endif\n#else\nFxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));\nFxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n#endif\nFxaaFloat lumaNS = lumaN + lumaS;\nFxaaFloat lumaWE = lumaW + lumaE;\nFxaaFloat subpixRcpRange = 1.0/range;\nFxaaFloat subpixNSWE = lumaNS + lumaWE;\nFxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\nFxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\nFxaaFloat lumaNESE = lumaNE + lumaSE;\nFxaaFloat lumaNWNE = lumaNW + lumaNE;\nFxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\nFxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\nFxaaFloat lumaNWSW = lumaNW + lumaSW;\nFxaaFloat lumaSWSE = lumaSW + lumaSE;\nFxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\nFxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\nFxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\nFxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\nFxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\nFxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\nFxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\nFxaaFloat lengthSign = fxaaQualityRcpFrame.x;\nFxaaBool horzSpan = edgeHorz >= edgeVert;\nFxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\nif(!horzSpan) lumaN = lumaW;\nif(!horzSpan) lumaS = lumaE;\nif(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\nFxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\nFxaaFloat gradientN = lumaN - lumaM;\nFxaaFloat gradientS = lumaS - lumaM;\nFxaaFloat lumaNN = lumaN + lumaM;\nFxaaFloat lumaSS = lumaS + lumaM;\nFxaaBool pairN = abs(gradientN) >= abs(gradientS);\nFxaaFloat gradient = max(abs(gradientN), abs(gradientS));\nif(pairN) lengthSign = -lengthSign;\nFxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\nFxaaFloat2 posB;\nposB.x = posM.x;\nposB.y = posM.y;\nFxaaFloat2 offNP;\noffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\noffNP.y = (horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\nif(!horzSpan) posB.x += lengthSign * 0.5;\nif(horzSpan) posB.y += lengthSign * 0.5;\nFxaaFloat2 posN;\nposN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\nposN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\nFxaaFloat2 posP;\nposP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\nposP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\nFxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\nFxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\nFxaaFloat subpixE = subpixC * subpixC;\nFxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\nif(!pairN) lumaNN = lumaSS;\nFxaaFloat gradientScaled = gradient * 1.0/4.0;\nFxaaFloat lumaMM = lumaM - lumaNN * 0.5;\nFxaaFloat subpixF = subpixD * subpixE;\nFxaaBool lumaMLTZero = lumaMM < 0.0;\nlumaEndN -= lumaNN * 0.5;\nlumaEndP -= lumaNN * 0.5;\nFxaaBool doneN = abs(lumaEndN) >= gradientScaled;\nFxaaBool doneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\nFxaaBool doneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n#if (FXAA_QUALITY_PS > 3)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n#if (FXAA_QUALITY_PS > 4)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n#if (FXAA_QUALITY_PS > 5)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n#if (FXAA_QUALITY_PS > 6)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n#if (FXAA_QUALITY_PS > 7)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n#if (FXAA_QUALITY_PS > 8)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n#if (FXAA_QUALITY_PS > 9)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n#if (FXAA_QUALITY_PS > 10)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n#if (FXAA_QUALITY_PS > 11)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n#if (FXAA_QUALITY_PS > 12)\nif(doneNP) {\nif(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\nif(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\nif(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\nif(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\ndoneN = abs(lumaEndN) >= gradientScaled;\ndoneP = abs(lumaEndP) >= gradientScaled;\nif(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\nif(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\ndoneNP = (!doneN) || (!doneP);\nif(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\nif(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\n#endif\n}\nFxaaFloat dstN = posM.x - posN.x;\nFxaaFloat dstP = posP.x - posM.x;\nif(!horzSpan) dstN = posM.y - posN.y;\nif(!horzSpan) dstP = posP.y - posM.y;\nFxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\nFxaaFloat spanLength = (dstP + dstN);\nFxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\nFxaaFloat spanLengthRcp = 1.0/spanLength;\nFxaaBool directionN = dstN < dstP;\nFxaaFloat dst = min(dstN, dstP);\nFxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\nFxaaFloat subpixG = subpixF * subpixF;\nFxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\nFxaaFloat subpixH = subpixG * fxaaQualitySubpix;\nFxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\nFxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\nif(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\nif(horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n#if (FXAA_DISCARD == 1)\nreturn FxaaTexTop(tex, posM);\n#else\nreturn FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n#endif\n}\nvoid main() {\ngl_FragColor = FxaaPixelShader(\nvUv,\nvec4(0.0),\ntDiffuse,\ntDiffuse,\ntDiffuse,\nresolution,\nvec4(0.0),\nvec4(0.0),\nvec4(0.0),\n0.75,\n0.166,\n0.0833\n);\n}",pp_grayscale_frag:"uniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D(tDiffuse, vUv);\nfloat bw = texel.r * 0.35 + texel.g * 0.45 + texel.b * 0.2;\ntexel = vec4(bw, bw, bw, texel.a);\ngl_FragColor = texel;\n}",pp_gtao_blur_frag:"uniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform vec2 direction;\nuniform vec2 resolution;\nvarying vec2 vUv;\n#include \nconst float SIGMA_SPATIAL = 1.5;\nconst float SIGMA_INTENSITY = 0.01;\nfloat gaussianPdf(float x, float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x/(sigma * sigma))/sigma;\n}\nvoid main() {\nfloat weightSum = gaussianPdf(0.0, SIGMA_SPATIAL)\n* gaussianPdf(0.0, SIGMA_INTENSITY);\nvec4 diffSample = texture2D(tDiffuse, vUv);\nvec4 gtaoDataSum = vec4(diffSample.r, unpackRGBToNormal(diffSample.gba)) * weightSum;\nvec3 normCenter = unpackRGBToNormal(texture2D(tNormal, vUv).xyz);\nvec2 delta = direction / resolution;\nvec2 offset = delta;\n#pragma unroll_loop_start\nfor (int i = 1; i <= BLUR_RADIUS_PX; i++) {\nvec2 uvCoords0 = vUv + offset;\nvec2 uvCoords1 = vUv - offset;\nvec4 diffSample0 = texture2D(tDiffuse, uvCoords0);\nvec4 diffSample1 = texture2D(tDiffuse, uvCoords1);\nvec4 gtaoData0 = vec4(diffSample0.r, unpackRGBToNormal(diffSample0.gba));\nvec4 gtaoData1 = vec4(diffSample1.r, unpackRGBToNormal(diffSample1.gba));\nvec3 normSample0 = unpackRGBToNormal(texture2D(tNormal, uvCoords0).xyz);\nvec3 normSample1 = unpackRGBToNormal(texture2D(tNormal, uvCoords1).xyz);\nfloat weightSpatial = gaussianPdf(float(i), SIGMA_SPATIAL);\nfloat weight0 = weightSpatial * gaussianPdf(1.0 - max(0.0,\ndot(normCenter, normSample0)), SIGMA_INTENSITY);\nfloat weight1 = weightSpatial * gaussianPdf(1.0 - max(0.0,\ndot(normCenter, normSample1)), SIGMA_INTENSITY);\nweightSum += weight0 + weight1;\ngtaoDataSum += weight0 * gtaoData0 + weight1 * gtaoData1;\noffset += delta;\n}\n#pragma unroll_loop_end\nfloat visibility = gtaoDataSum.r / weightSum;\nvec3 bentNormal = normalize(gtaoDataSum.gba);\ngl_FragColor = vec4(visibility, packNormalToRGB(bentNormal));\n}",pp_gtao_frag:"uniform sampler2D tNormal;\nuniform sampler2D tDepth;\nuniform sampler2D tNoise;\nuniform float occlDistance;\nuniform float factor;\nuniform float occlPrecision;\nuniform bool bounceApprox;\nuniform mat4 mainCameraProjMat;\nuniform vec2 resolution;\nvarying vec2 vUv;\n#include \n#include \nconst vec3 AXIS_Z = vec3(0.0, 0.0, 1.0);\nconst float NUM_SAMPLES_HALF_MIN = 4.0;\nconst float NUM_SAMPLES_HALF_MAX = 8.0;\nconst float NOISE_TEX_SIZE = 64.0;\nconst float NEAR_FIELD_COEFF = 0.5;\nconst float SELF_OCCL_BIAS = -1e-5;\nconst float NORMAL_RENDER_GEOM_MAX_DIFF_ANGLE = 0.85 * PI_HALF;\nfloat integrateArc(vec2 horizonAngles, float normalAngle) {\nvec2 visCoeffs = (-cos(2.0 * horizonAngles - normalAngle) + cos(normalAngle)\n+ 2.0 * horizonAngles * sin(normalAngle)) / 4.0;\nreturn visCoeffs.x + visCoeffs.y;\n}\nvec3 calcViewFromUVDepth(vec2 uv, float depth, float zBias) {\nvec3 ndcCo = 2.0 * vec3(uv, depth) - 1.0;\n#if ORTHO_CAMERA == 1\nfloat viewZ = (ndcCo.z - mainCameraProjMat[3][2]) / mainCameraProjMat[2][2] + zBias;\nvec2 _00_11 = vec2(mainCameraProjMat[0][0], mainCameraProjMat[1][1]);\nvec2 _30_31 = vec2(mainCameraProjMat[3][0], mainCameraProjMat[3][1]);\nreturn vec3((ndcCo.xy - _30_31) / _00_11, viewZ);\n#else\nfloat viewZ = -mainCameraProjMat[3][2] / (mainCameraProjMat[2][2] + ndcCo.z) + zBias;\nvec2 _00_11 = vec2(mainCameraProjMat[0][0], mainCameraProjMat[1][1]);\nvec2 _20_21 = vec2(mainCameraProjMat[2][0], mainCameraProjMat[2][1]);\nreturn vec3(-viewZ * (ndcCo.xy + _20_21) / _00_11, viewZ);\n#endif\n}\nvec2 calcSliceRadiusUV(float viewZ) {\nvec4 distView = vec4(occlDistance, occlDistance, viewZ, 1.0);\nvec4 distClip = mainCameraProjMat * distView;\nvec2 xyNDC = distClip.xy / distClip.w;\nreturn clamp(0.5 * xyNDC, 0.0, 0.5);\n}\nvec2 calcHorizonAngles(vec3 viewPos, vec3 viewVec, vec2 sliceDir) {\nvec2 maxHorizonCos = vec2(-1.0);\nvec2 sliceRadius = calcSliceRadiusUV(viewPos.z);\nvec2 pxSize = 1.0 / resolution;\nint NUM_SAMPLES_HALF = int(occlPrecision\n* (NUM_SAMPLES_HALF_MAX - NUM_SAMPLES_HALF_MIN) + NUM_SAMPLES_HALF_MIN);\n#if __VERSION__ == 300\nfor (int i = 0; i < NUM_SAMPLES_HALF; i++) {\n#else\nfor (int i = 0; i < int(NUM_SAMPLES_HALF_MAX); i++) {\nif (i >= NUM_SAMPLES_HALF) continue;\n#endif\nvec2 offset = sliceDir * (pxSize * (1.0 + float(i))\n+ sliceRadius * pow(float(i) / float(NUM_SAMPLES_HALF), 2.0));\nvec2 uvs = vUv - offset;\nvec3 ps = calcViewFromUVDepth(uvs, texture2D(tDepth, uvs).x, SELF_OCCL_BIAS);\nvec3 ds = normalize(ps - viewPos);\nvec2 uvt = vUv + offset;\nvec3 pt = calcViewFromUVDepth(uvt, texture2D(tDepth, uvt).x, SELF_OCCL_BIAS);\nvec3 dt = normalize(pt - viewPos);\nvec2 sampleLen = vec2(length(ps - viewPos), length(pt - viewPos));\nvec2 blendWeight = (sampleLen / occlDistance - 1.0) / (NEAR_FIELD_COEFF - 1.0);\nblendWeight = clamp(blendWeight, 0.0, 1.0);\nvec2 maxHorizonCosNoBlending = max(maxHorizonCos, vec2(dot(ds, viewVec),\ndot(dt, viewVec)));\nmaxHorizonCos = mix(maxHorizonCos, maxHorizonCosNoBlending, blendWeight);\n}\nvec2 horizons = acos(maxHorizonCos);\nreturn vec2(-horizons.x, horizons.y);\n}\nvec2 calcNormalAngleAndProjLen(vec3 viewVec, vec3 normal, vec2 sliceDir) {\nvec3 sliceVec = vec3(sliceDir, 0.0);\nsliceVec = sliceVec - dot(sliceVec, viewVec) * viewVec;\nvec3 sliceOrthoVec = cross(sliceVec, viewVec);\nvec3 normalProj = normal - dot(normal, sliceOrthoVec) * sliceOrthoVec;\nfloat normalProjLen = length(normalProj);\nfloat normalAngle = acos(clamp(dot(normalProj / normalProjLen, viewVec), 0.0, 1.0));\nnormalAngle *= sign(dot(normalProj, sliceVec));\nreturn vec2(normalAngle, normalProjLen);\n}\n#if CALC_BENT_NORMALS == 1\nvec3 calcSliceBentNormal(vec2 sliceDir, vec2 h, float n) {\nvec2 t = vec2(\n6.0 * sin(h[0] - n) - sin(3.0 * h[0] - n) + 6.0 * sin(h[1] - n)\n- sin(3.0 * h[1] - n) + 16.0 * sin(n) - 3.0 * (sin(h[0] + n) + sin(h[1] + n)),\n-cos(3.0 * h[0] - n) - cos(3.0 * h[1] - n) + 8.0 * cos(n)\n- 3.0 * (cos(h[0] + n) + cos(h[1] + n))\n) / 12.0;\nreturn vec3(sliceDir * t[0], t[1]);\n}\n#endif\nvec2 clampHorizonAnglesAroundNormal(vec2 horizonAngles, float normalAngle,\nfloat geomNormalAngle) {\nhorizonAngles = normalAngle + clamp(horizonAngles - normalAngle, -PI_HALF, PI_HALF);\nif (abs(normalAngle - geomNormalAngle) < NORMAL_RENDER_GEOM_MAX_DIFF_ANGLE) {\nhorizonAngles = geomNormalAngle + clamp(horizonAngles - geomNormalAngle, -PI_HALF, PI_HALF);\n}\nreturn horizonAngles;\n}\nvoid main() {\nfloat depth = texture2D(tDepth, vUv).x;\n#ifndef GTAO_DISABLE_BKG_FIX\nif (depth == 1.0) {\ngl_FragColor = vec4(vec3(1.0), 1.0);\n} else {\n#endif\nvec3 viewPos = calcViewFromUVDepth(vUv, depth, 0.0);\n#if ORTHO_CAMERA == 1\nvec3 viewVec = vec3(0.0, 0.0, 1.0);\n#else\nvec3 viewVec = normalize(-viewPos);\n#endif\nvec3 viewNormal = unpackRGBToNormal(texture2D(tNormal, vUv).xyz);\nvec3 geomViewNormal = normalize(cross(dFdx(viewPos), dFdy(viewPos)));\nvec2 noiseScale = resolution / NOISE_TEX_SIZE;\nfloat randAngle = texture2D(tNoise, vUv * noiseScale).r * PI_HALF;\nfloat visibility = 0.0;\nvec3 bentNormalAvg = viewNormal;\nfloat normalAngle, normalProjLen, geomNormalAngle;\nvec2 horizonAngles, _vec2Tmp;\nvec3 sliceBentNormal;\n#if CALC_BENT_NORMALS == 1\nbentNormalAvg = vec3(0.0);\n#if ORTHO_CAMERA == 0\nvec3 bentRotAxis = cross(AXIS_Z, viewVec);\nfloat bentRotAngle = acos(clamp(dot(AXIS_Z, viewVec), -1.0, 1.0));\n#endif\n#endif\nvec2 sliceDir = vec2(cos(randAngle), sin(randAngle));\n#pragma unroll_loop_start\nfor (int i = 0; i < 2; i++) {\n_vec2Tmp = calcNormalAngleAndProjLen(viewVec, viewNormal, sliceDir);\nnormalAngle = _vec2Tmp[0], normalProjLen = _vec2Tmp[1];\n_vec2Tmp = calcNormalAngleAndProjLen(viewVec, geomViewNormal, sliceDir);\ngeomNormalAngle = _vec2Tmp[0];\nhorizonAngles = calcHorizonAngles(viewPos, viewVec, sliceDir);\nhorizonAngles = clampHorizonAnglesAroundNormal(horizonAngles,\nnormalAngle, geomNormalAngle);\nvisibility += normalProjLen * integrateArc(horizonAngles, normalAngle);\n#if CALC_BENT_NORMALS == 1\nsliceBentNormal = calcSliceBentNormal(sliceDir, horizonAngles, normalAngle);\n#if ORTHO_CAMERA == 0\nsliceBentNormal = vec3RotateAxisAngle(sliceBentNormal,\nbentRotAxis, bentRotAngle);\n#endif\nbentNormalAvg += sliceBentNormal * normalProjLen;\n#endif\nsliceDir = vec2(-sliceDir.y, sliceDir.x);\n}\n#pragma unroll_loop_end\nvisibility /= 2.0;\n#if CALC_BENT_NORMALS == 1\nfloat mixFactor = clamp((1.0 - 2.0 * visibility) / (3.0 * visibility - 4.0), 0.0, 1.0);\nbentNormalAvg = normalize(mix(bentNormalAvg, viewNormal, mixFactor));\n#endif\ngl_FragColor = vec4(pow(visibility, factor), packNormalToRGB(bentNormalAvg));\n#ifndef GTAO_DISABLE_BKG_FIX\n}\n#endif\n}",pp_outline_edge_frag:"varying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform vec2 texSize;\nuniform vec4 visibleEdgeColor;\nuniform vec4 hiddenEdgeColor;\nvoid main() {\nvec2 invSize = 1.0 / texSize;\nvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\nvec4 c1 = texture2D(maskTexture, vUv + uvOffset.xy);\nvec4 c2 = texture2D(maskTexture, vUv - uvOffset.xy);\nvec4 c3 = texture2D(maskTexture, vUv + uvOffset.yw);\nvec4 c4 = texture2D(maskTexture, vUv - uvOffset.yw);\nfloat diff1 = (c1.r - c2.r) * 0.5;\nfloat diff2 = (c3.r - c4.r) * 0.5;\nfloat d = length(vec2(diff1, diff2));\nfloat a1 = min(c1.g, c2.g);\nfloat a2 = min(c3.g, c4.g);\nfloat visibilityFactor = min(a1, a2);\nvec4 edgeColor = (1.0 - visibilityFactor > 0.001) ? visibleEdgeColor : hiddenEdgeColor;\ngl_FragColor = edgeColor * vec4(d);\n}",pp_outline_blur_frag:"#include \nvarying vec2 vUv;\nuniform sampler2D colorTexture;\nuniform vec2 texSize;\nuniform vec2 direction;\nuniform float kernelRadius;\nfloat gaussianPdf(in float x, in float sigma) {\nreturn 0.39894 * exp(-0.5 * x * x/(sigma * sigma))/sigma;\n}\nvoid main() {\nvec2 invSize = 1.0 / texSize;\nfloat weightSum = gaussianPdf(0.0, kernelRadius);\nvec4 diffuseSum = texture2D(colorTexture, vUv);\n#if defined(LOG_SPACE)\ndiffuseSum = exp(diffuseSum);\n#endif\ndiffuseSum *= weightSum;\nvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\nvec2 uvOffset = delta;\nfor (int i = 1; i <= MAX_RADIUS; i++) {\nfloat w = gaussianPdf(uvOffset.x, kernelRadius);\nvec4 sample1 = texture2D(colorTexture, vUv + uvOffset);\nvec4 sample2 = texture2D(colorTexture, vUv - uvOffset);\n#if defined(LOG_SPACE)\nsample1 = exp(sample1);\nsample2 = exp(sample2);\n#endif\ndiffuseSum += ((sample1 + sample2) * w);\nweightSum += (2.0 * w);\nuvOffset += delta;\n}\nvec4 finalCol = diffuseSum / weightSum;\n#if defined(LOG_SPACE)\nfinalCol = log(finalCol);\n#endif\ngl_FragColor = finalCol;\n}",pp_outline_overlay_frag:"varying vec2 vUv;\nuniform sampler2D maskTexture;\nuniform sampler2D edgeTexture1;\nuniform sampler2D edgeTexture2;\nuniform sampler2D patternTexture;\nuniform float edgeStrength;\nuniform float edgeGlow;\nuniform bool usePatternTexture;\nvoid main() {\nvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\nvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\nvec4 maskColor = texture2D(maskTexture, vUv);\nvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\nfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\nvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\nvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\nif (usePatternTexture)\nfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\nfloat maxChannel = max(finalColor.r, max(finalColor.g, finalColor.b));\nif (maxChannel != 0.0) {\nfinalColor.rgb /= maxChannel;\n}\ngl_FragColor = finalColor;\n}",pp_tonemap_frag:"#include \nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D(tDiffuse, vUv);\nfloat alpha = clamp(texel.a, 0.0, 1.0);\ngl_FragColor = texel;\ngl_FragColor.rgb /= alpha;\n#include \ngl_FragColor = LinearTosRGB(gl_FragColor);\ngl_FragColor.rgb *= alpha;\n#if ALPHA_AS_LUMA == 1\ngl_FragColor.a = linearToRelativeLuminance(gl_FragColor.rgb);\n#endif\n}",raw_meshline_frag:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D alphaMap;\nuniform float useMap;\nuniform float useAlphaMap;\nuniform float visibility;\nuniform float alphaTest;\nuniform vec2 repeat;\nuniform vec3 color;\nuniform float opacity;\nvarying vec2 vUV;\nvarying float vCounters;\n#include \nvoid main() {\nvec4 c = vec4(color, opacity);\nif (useMap == 1.0) {\nc *= texture2D(map, vUV * repeat);\n}\nif (useAlphaMap == 1.0) {\nc.a *= texture2D(alphaMap, vUV * repeat).a;\n}\nif (c.a < alphaTest) {\ndiscard;\n}\ngl_FragColor = c;\ngl_FragColor.a *= step(vCounters, visibility);\ngl_FragColor = LinearTosRGB(gl_FragColor);\n}",raw_meshline_vert:"precision highp float;\nattribute vec3 position;\nattribute vec3 previous;\nattribute vec3 next;\nattribute float side;\nattribute float width;\nattribute vec2 uv;\nattribute float counters;\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\nuniform vec2 resolution;\nuniform float lineWidth;\nuniform float sizeAttenuation;\nvarying float vCounters;\nvarying vec2 vUV;\nconst float EQ_EPS = 0.000001;\nvec2 fix(vec4 i, float aspect) {\nvec2 res = i.xy / i.w;\nres.x *= aspect;\nreturn res;\n}\nbool posEqual(vec2 pos0, vec2 pos1) {\nreturn length(pos0 - pos1) < EQ_EPS;\n}\nvoid main() {\nfloat aspect = resolution.x / resolution.y;\nvCounters = counters;\nvUV = uv;\nmat4 m = projectionMatrix * modelViewMatrix;\nvec4 finalPosition = m * vec4(position, 1.0);\nvec4 prevPos = m * vec4(previous, 1.0);\nvec4 nextPos = m * vec4(next, 1.0);\nvec2 currentP = fix(finalPosition, aspect);\nvec2 prevP = fix(prevPos, aspect);\nvec2 nextP = fix(nextPos, aspect);\nfloat w = lineWidth * width;\nif (sizeAttenuation == 0.0) {\nw *= finalPosition.w / resolution.x;\n}\nvec2 dir;\nif (posEqual(nextP, currentP)) {\ndir = normalize(currentP - prevP);\n} else if (posEqual(prevP, currentP)) {\ndir = normalize(nextP - currentP);\n} else {\nvec2 dir1 = normalize(currentP - prevP);\nvec2 dir2 = normalize(nextP - currentP);\ndir = normalize(dir1 + dir2);\n}\nvec2 offset = vec2(-dir.y, dir.x);\noffset.y *= aspect;\noffset *= w;\nfinalPosition.xy += offset * side;\ngl_Position = finalPosition;\n}"},O={common:{diffuse:{value:new _t(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Un},uv2Transform:{value:new Un},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Be(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new _t(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},maxDistance:{},shadowCameraNear:{},expBias:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadow:{},shadowCameraNear:{},shadowCameraFar:{},expBias:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{},expBias:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},rectAreaLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{},expBias:{}}},rectAreaShadowMap:{value:[]},rectAreaShadowMatrix:{value:[]},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new _t(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Un}},sprite:{diffuse:{value:new _t(16777215)},opacity:{value:1},center:{value:new Be(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Un}},mask:{depthTexture:{value:null},cameraNearFar:{value:new Be(.5,.5)},textureMatrix:{value:new gt}},node:{nodeRGB:{value:[]},nodeValue:{value:[]},flipCubeMap:{value:-1},materialIndex:{value:0}},nodeGTAO:{gtaoMap:{value:null}},ssr:{invProjectionMatrix:{value:new gt},ssrSourceBuffer:{value:null},ssrDepthBuffer:{value:null},ssrBackfaceDepthBuffer:{value:null},ssrStride:{value:20},ssrResolution:{value:new Be},ssrThickness:{value:.01},ssrJitter:{value:1},ssrMaxDistance:{value:100}},planeReflectionProbe:{planeReflTexture:{value:null},planeReflTextureMatrix:{value:new gt},planeReflDir:{value:new vt},planeReflBoundingBoxMin:{value:new vt},planeReflBoundingBoxMax:{value:new vt},planeReflInvModelMatrix:{value:new gt},planeReflFalloff:{value:0}}},E={basic:{uniforms:la([O.common,O.specularmap,O.envmap,O.aomap,O.lightmap,O.fog]),vertexShader:yt.meshbasic_vert,fragmentShader:yt.meshbasic_frag},lambert:{uniforms:la([O.common,O.specularmap,O.envmap,O.aomap,O.lightmap,O.emissivemap,O.fog,O.lights,{emissive:{value:new _t(0)}}]),vertexShader:yt.meshlambert_vert,fragmentShader:yt.meshlambert_frag},phong:{uniforms:la([O.common,O.specularmap,O.envmap,O.aomap,O.lightmap,O.emissivemap,O.bumpmap,O.normalmap,O.displacementmap,O.fog,O.lights,{emissive:{value:new _t(0)},specular:{value:new _t(1118481)},shininess:{value:30}}]),vertexShader:yt.meshphong_vert,fragmentShader:yt.meshphong_frag},standard:{uniforms:la([O.common,O.envmap,O.aomap,O.lightmap,O.emissivemap,O.bumpmap,O.normalmap,O.displacementmap,O.roughnessmap,O.metalnessmap,O.fog,O.lights,O.planeReflectionProbe,{emissive:{value:new _t(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1},envMapParallaxType:{value:0},envMapParallaxMatrix:{value:new gt},envMapParallaxMatrixInv:{value:new gt}}]),vertexShader:yt.meshphysical_vert,fragmentShader:yt.meshphysical_frag},toon:{uniforms:la([O.common,O.aomap,O.lightmap,O.emissivemap,O.bumpmap,O.normalmap,O.displacementmap,O.gradientmap,O.fog,O.lights,{emissive:{value:new _t(0)}}]),vertexShader:yt.meshtoon_vert,fragmentShader:yt.meshtoon_frag},matcap:{uniforms:la([O.common,O.bumpmap,O.normalmap,O.displacementmap,O.fog,{matcap:{value:null}}]),vertexShader:yt.meshmatcap_vert,fragmentShader:yt.meshmatcap_frag},points:{uniforms:la([O.points,O.fog]),vertexShader:yt.points_vert,fragmentShader:yt.points_frag},dashed:{uniforms:la([O.common,O.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:yt.linedashed_vert,fragmentShader:yt.linedashed_frag},depth:{uniforms:la([O.common,O.displacementmap,{slopeScaledBias:{value:0}}]),vertexShader:yt.depth_vert,fragmentShader:yt.depth_frag},normal:{uniforms:la([O.common,O.bumpmap,O.normalmap,O.displacementmap,{opacity:{value:1}}]),vertexShader:yt.normal_vert,fragmentShader:yt.normal_frag},sprite:{uniforms:la([O.sprite,O.fog]),vertexShader:yt.sprite_vert,fragmentShader:yt.sprite_frag},background:{uniforms:{uvTransform:{value:new Un},t2D:{value:null}},vertexShader:yt.background_vert,fragmentShader:yt.background_frag},cube:{uniforms:la([O.envmap,{opacity:{value:1}}]),vertexShader:yt.cube_vert,fragmentShader:yt.cube_frag},equirect:{uniforms:{tEquirect:{value:null},invertU:{value:!1},offsetU:{value:0}},vertexShader:yt.equirect_vert,fragmentShader:yt.equirect_frag},distanceRGBA:{uniforms:la([O.common,O.displacementmap,{referencePosition:{value:new vt},nearDistance:{value:1},farDistance:{value:1e3},slopeScaledBias:{value:0}}]),vertexShader:yt.distanceRGBA_vert,fragmentShader:yt.distanceRGBA_frag},shadow:{uniforms:la([O.lights,O.fog,{color:{value:new _t(0)},opacity:{value:1}}]),vertexShader:yt.shadow_vert,fragmentShader:yt.shadow_frag},mask:{uniforms:la([O.common,O.displacementmap,O.mask]),vertexShader:yt.mask_vert,fragmentShader:yt.mask_frag},equicube:{uniforms:{tEquirect:{value:null},faceIndex:{value:0},invertU:{value:!1},offsetU:{value:0}},vertexShader:yt.equicube_vert,fragmentShader:yt.equicube_frag},node:{uniforms:la([O.common,O.displacementmap,O.envmap,O.fog,O.lights,O.ssr,O.planeReflectionProbe,O.node,O.nodeGTAO,{envMapIntensity:{value:1},envMapParallaxType:{value:0},envMapParallaxMatrix:{value:new gt},envMapParallaxMatrixInv:{value:new gt}}]),vertexShader:yt.meshnode_vert,fragmentShader:yt.meshnode_frag},cubeOctahedral:{uniforms:{tCube:{value:null},texelSize:{value:new Be(.5,.5)}},vertexShader:yt.pp_plane_vert,fragmentShader:yt.pp_cube_octahedral_proj_frag}};function Ta(s,l,n,c,r){const u=new _t(0);let d=0,h,p,f=null,m=0,v=null;function g(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,r)}return{getClearColor:function(){return u},setClearColor:function(e,t=1){u.set(e),d=t,g(u,d)},getClearAlpha:function(){return d},setClearAlpha:function(e){d=e,g(u,d)},dispose:function(){h&&(h.geometry.dispose(),h.material.dispose()),h=void 0,p&&(p.geometry.dispose(),p.material.dispose()),p=void 0},render:function(e,t){let n=!1;var r=t.background&&t.background.isSceneBackground;let i=r?t.background.data:t.background;i&&i.isTexture&&(i=l.get(i));const a=s.xr;var o=a.getSession&&a.getSession(),o=(null===(i=o&&"additive"===o.environmentBlendMode?null:i)?g(u,d):i&&i.isColor&&(g(i,1),n=!0),(s.autoClear||n)&&s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil),!!r&&t.background.useHDR);i&&(i.isCubeTexture||i.isWebGLCubeRenderTarget||i.mapping===N)?(void 0===p&&((p=new ee(new oa(1,1,1),new T({name:"BackgroundCubeMaterial",uniforms:sa(E.cube.uniforms),vertexShader:E.cube.vertexShader,fragmentShader:E.cube.fragmentShader,side:Fe,depthTest:!1,depthWrite:!1,fog:!1,useHDR:o}))).geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(e,t,n){var r=n.far;this.matrixWorld.makeScale(r,r,r),this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),c.update(p)),i.isWebGLCubeRenderTarget&&(i=i.texture),p.material.uniforms.envMap.value=i,p.material.uniforms.flipEnvMap.value=i.isCubeTexture&&i._needsFlipEnvMap?-1:1,f===i&&m===i.version&&v===s.toneMapping||(p.material.needsUpdate=!0,f=i,m=i.version,v=s.toneMapping),e.unshift(p,p.geometry,p.material,0,0,null)):i&&i.isTexture&&(void 0===h&&((h=new ee(new Sa(2,2),new T({name:"BackgroundMaterial",uniforms:sa(E.background.uniforms),vertexShader:E.background.vertexShader,fragmentShader:E.background.fragmentShader,side:Ve,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),c.update(h)),!0===(h.material.uniforms.t2D.value=i).matrixAutoUpdate&&i.updateMatrix(),h.material.uniforms.uvTransform.value.copy(i.matrix),f===i&&m===i.version&&v===s.toneMapping||(h.material.needsUpdate=!0,f=i,m=i.version,v=s.toneMapping),e.unshift(h,h.geometry,h.material,0,0,null))}}}function Ca(x,y,b,M){const i=x.getParameter(34921),h=M.isWebGL2?null:y.get("OES_vertex_array_object"),p=M.isWebGL2||null!==h,f={},e=g(null);let m=e;function v(e){if(M.isWebGL2)return x.bindVertexArray(e);h.bindVertexArrayOES(e)}function a(e){if(M.isWebGL2)return x.deleteVertexArray(e);h.deleteVertexArrayOES(e)}function g(e){const t=[],n=[],r=[];for(let e=0;e",t[n]);return e}const $o=/^[ \t]*#include +<([\w\d./]+)>/gm;function es(e){return e.replace($o,ts)}function ts(e,t){var n=yt[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return es(n)}function ns(i){var a;const e=new RegExp("#pragma unroll_loop_start[\\s]+?for \\(int (\\w+) \\= (\\d+)\\; (\\w+) <(=?) (\\w+)\\; (\\w+)\\+\\+\\) \\{"),o=new RegExp("\\{|\\}","g");for(;a=e.exec(i);){let e,n;e=n=o.lastIndex=a.index+a[0].length;let t,r=1;for(;(t=o.exec(i))&&("{"==t[0]?r++:"}"==t[0]&&r--,n=t.index),t&&0 0 + attribute vec3 morphTarget0; + #endif + #if NUM_MORPH_TARGETS > 1 + attribute vec3 morphTarget1; + #endif + #if NUM_MORPH_TARGETS > 2 + attribute vec3 morphTarget2; + #endif + #if NUM_MORPH_TARGETS > 3 + attribute vec3 morphTarget3; + #endif + #if NUM_MORPH_TARGETS > 4 + attribute vec3 morphTarget4; + #endif + #if NUM_MORPH_TARGETS > 5 + attribute vec3 morphTarget5; + #endif + + #ifdef USE_MORPHNORMALS + #if NUM_MORPH_TARGETS > 0 + attribute vec3 morphNormal0; + #endif + #if NUM_MORPH_TARGETS > 1 + attribute vec3 morphNormal1; + #endif + #if NUM_MORPH_TARGETS > 2 + attribute vec3 morphNormal2; + #endif + #if NUM_MORPH_TARGETS > 3 + attribute vec3 morphNormal3; + #endif + #if NUM_MORPH_TARGETS > 4 + attribute vec3 morphNormal4; + #endif + #if NUM_MORPH_TARGETS > 5 + attribute vec3 morphNormal5; + #endif + #else + #if NUM_MORPH_TARGETS > 6 + attribute vec3 morphTarget6; + #endif + #if NUM_MORPH_TARGETS > 7 + attribute vec3 morphTarget7; + #endif + #if NUM_MORPH_TARGETS > 8 + attribute vec3 morphTarget8; + #endif + #if NUM_MORPH_TARGETS > 9 + attribute vec3 morphTarget9; + #endif + #if NUM_MORPH_TARGETS > 10 + attribute vec3 morphTarget10; + #endif + #if NUM_MORPH_TARGETS > 11 + attribute vec3 morphTarget11; + #endif + #endif + #endif + + #ifdef USE_SKINNING + attribute vec4 skinIndex; + attribute vec4 skinWeight; + #endif + `].filter(Zo).join("\n"),x=[f,rs(n),"#define SHADER_NAME "+n.shaderName,m,function(e){switch(e){case"blender":return"#define MT_BLENDER";case"max":return"#define MT_MAX";case"maya":return"#define MT_MAYA";default:return""}}(n.materialProfile),e.compatSettings.saturateSpecEnvBlenderApprox?"#define COMPAT_SATURATE_SPEC_ENV_BLENDER_APPROX":"",e.compatSettings.useSpecEnvBlenderApprox?"#define COMPAT_USE_SPEC_ENV_BLENDER_APPROX":"",e.compatSettings.simplifiedSRGB?"#define COMPAT_SIMPLIFIED_SRGB":"",n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+h,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+d:"",0!==n.envMapCubeUVTileSize?"#define cubeUV_maxTileSize "+Ri(n.envMapCubeUVTileSize):"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"",n.physicallyCorrectLights?"#define UNITS_SCALE_FACTOR "+p:"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping===ke||n.useHDR?"":"#define TONE_MAPPING",n.toneMapping===ke||n.useHDR?"":yt.tonemapping_pars_fragment,n.toneMapping===ke||n.useHDR?"":function(e,t){let n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 6:n="LogarithmicMax";break;case 7:n="PhysicalMax";break;case 8:n="FilmicBlender";break;default:console.warn("v3d.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"(vec3 color) { return "+n+"ToneMapping(color); }"}("toneMapping",n.toneMapping),n.dithering?"#define DITHERING":"",yt.encodings_pars_fragment,n.map?Yo("mapTexelToLinear",n.mapEncoding):"",n.matcap?Yo("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Yo("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Yo("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Yo("lightMapTexelToLinear",n.lightMapEncoding):"",(i="linearToOutputTexel",h=Xo(h=n.outputEncoding),"vec4 "+i+"(vec4 value) { return LinearTo"+h[0]+h[1]+"; }"),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",n.distancePacking?"#define DISTANCE_PACKING "+n.distancePacking:"",n.useSlopeScaledBias?"#define USE_SLOPE_SCALED_BIAS":"","#define ESM_DISTANCE_SCALE "+Ri(n.esmDistanceScale),n.planeReflProbe?"#define USE_PLANE_REFLECTION":"",n.planeReflProbe?Yo("planeReflProbeTexelToLinear",n.planeReflProbeEncoding):"",n.useGTAO?"#define USE_GTAO":"",e.compatSettings.gtaoDisableBkgFix?"#define GTAO_DISABLE_BKG_FIX":"","\n"].filter(Zo).join("\n")),n.isMeshNodeMaterial&&(a=Jo(a,n.nodeChunks),o=Jo(o,n.nodeChunks)),a=Qo(a=qo(a=es(a),n),n),n.customPrepTokens&&(a=Ko(a,n.customPrepTokens)),o=Qo(o=qo(o=es(o),n),n),n.customPrepTokens&&(o=Ko(o,n.customPrepTokens)),a=ns(a),o=ns(o),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",_=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+_,x=["#define varying in",n.glslVersion===gn?"":"out highp vec4 pc_fragColor;",n.glslVersion===gn?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+x),y+_+a),M=y+x+o;e.debug.disableCompiledShaderCache&&(b+="\nconst float ANTI_CACHE = "+Math.random()+";",M+="\nconst float ANTI_CACHE = "+Math.random()+";");const A=Wo(s,35633,b),w=Wo(s,35632,M);s.attachShader(v,A),s.attachShader(v,w),void 0!==n.index0AttributeName?s.bindAttribLocation(v,0,n.index0AttributeName):!0===n.morphTargets&&s.bindAttribLocation(v,0,"position"),s.linkProgram(v);let S=!0;function T(){if(S=!1,e.debug.checkShaderErrors){var n,r,i=s.getProgramInfoLog(v).trim(),a=s.getShaderInfoLog(A).trim(),o=s.getShaderInfoLog(w).trim();let e=!0,t=!0;!1===s.getProgramParameter(v,35714)?(e=!1,n=jo(s,A,"vertex"),r=jo(s,w,"fragment"),console.error("v3d.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(v,35715),"gl.getProgramInfoLog",i,n,r)):""!==i?console.warn("v3d.WebGLProgram: gl.getProgramInfoLog()",i):""!==a&&""!==o||(t=!1),t&&(g.diagnostics={runnable:e,programLog:i,vertexShader:{log:a,prefix:_},fragmentShader:{log:o,prefix:x}})}s.deleteShader(A),s.deleteShader(w)}let C;this.getUniforms=function(){return void 0===C&&(S&&T(),C=new ko(s,v)),C};let E;return this.getAttributes=function(){return void 0===E&&(S&&T(),E=function(t,n){const r={};var i=t.getProgramParameter(n,35721);for(let e=0;e=i.get(e).length?(n=new cs(r),i.get(e).push(n)):n=i.get(e)[t],n},dispose:function(){i=new WeakMap}}}function ds(){const n={};return{get:function(e){if(void 0!==n[e.id])return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new vt,color:new _t};break;case"SpotLight":t={position:new vt,direction:new vt,color:new _t,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new vt,color:new _t,distance:0,decay:0};break;case"HemisphereLight":t={direction:new vt,skyColor:new _t,groundColor:new _t};break;case"RectAreaLight":t={color:new _t,position:new vt,halfWidth:new vt,halfHeight:new vt}}return n[e.id]=t}}}let hs=0;function ps(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function fs(t,P){const I=new ds,N=function(){const n={};return{get:function(e){if(void 0!==n[e.id])return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,position:new vt,shadowCameraNear:1,maxDistance:0,expBias:1};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,shadow:0,shadowCameraNear:1,shadowCameraFar:1e3,expBias:1};break;case"PointLight":case"RectAreaLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Be,shadowCameraNear:1,shadowCameraFar:1e3,expBias:1}}return n[e.id]=t}}}(),D={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numRectAreaShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],rectAreaShadow:[],rectAreaShadowMap:[],rectAreaShadowMatrix:[]};for(let e=0;e<9;e++)D.probe.push(new vt);const _=new vt,x=new gt,y=new gt;return{setup:function(n){let r=0,i=0,a=0;for(let e=0;e<9;e++)D.probe[e].set(0,0,0);let o=0,s=0,l=0,c=0,u=0,d=0,h=0,p=0,f=0;n.sort(ps);for(let e=0,t=n.length;ee.influenceDistance-t.influenceDistance)},pushPlaneReflProbe:function(e){o.push(e)}}}function vs(r,i){let a=new WeakMap;return{get:function(e,t=0){let n;return!1===a.has(e)?(n=new ms(r,i),a.set(e,[n])):t>=a.get(e).length?(n=new ms(r,i),a.get(e).push(n)):n=a.get(e)[t],n},dispose:function(){a=new WeakMap}}}class gs extends pi{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.useSlopeScaledBias=!1,this.slopeScaledBias=0,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.useSlopeScaledBias=e.useSlopeScaledBias,this.slopeScaledBias=e.slopeScaledBias,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}gs.prototype.isMeshDepthMaterial=!0;class _s extends pi{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new vt,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.defines={DISTANCE_SCALE:"1.0"},this.distancePacking=cn,this.useSlopeScaledBias=!1,this.slopeScaledBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.distancePacking=e.distancePacking,this.useSlopeScaledBias=e.useSlopeScaledBias,this.slopeScaledBias=e.slopeScaledBias,this}}_s.prototype.isMeshDistanceMaterial=!0;var xs="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\nfloat mean = 0.0;\nfloat squared_mean = 0.0;\nfloat depth = unpackRGBAToDepth(texture2D(shadow_pass, (gl_FragCoord.xy) / resolution));\nfor (float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n#ifdef HORIZONTAL_PASS\nvec2 distribution = unpackRGBATo2Half(texture2D(shadow_pass, (gl_FragCoord.xy + vec2(i, 0.0) * radius) / resolution));\nmean += distribution.x;\nsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n#else\nfloat depth = unpackRGBAToDepth(texture2D(shadow_pass, (gl_FragCoord.xy + vec2(0.0, i) * radius) / resolution));\nmean += depth;\nsquared_mean += depth * depth;\n#endif\n}\nmean = mean * HALF_SAMPLE_RATE;\nsquared_mean = squared_mean * HALF_SAMPLE_RATE;\nfloat std_dev = sqrt(squared_mean - mean * mean);\ngl_FragColor = pack2HalfToRGBA(vec2(mean, std_dev));\n}",ys="void main() {\ngl_Position = vec4(position, 1.0);\n}";const bs=new gt,Ms=new vt,As=new vt;class ws{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new Be(512,512),this.map=null,this.mapPass=null,this.matrix=new gt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ma,this._frameExtents=new Be(1,1),this._viewportCount=1,this._viewports=[new mt(0,0,1,1)],this.expBias=1,this.slopeScaledBias=0,this._additionalMap2D=null,this._additionalMapCube=null}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Ms.setFromMatrixPosition(e.matrixWorld),t.position.copy(Ms),As.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(As),t.updateMatrixWorld(),bs.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bs),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose(),null!==this._additionalMap2D&&this._additionalMap2D.dispose(),null!==this._additionalMapCube&&this._additionalMapCube.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this.expBias=e.expBias,this.slopeScaledBias=e.slopeScaledBias,this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}ws.prototype.isLightShadow=!0;const Ss=Math.PI/4,Ts=new gt,Cs=new vt,Es=new vt;class Ls extends ws{constructor(){super(new da(50,1,.5,500)),this.focus=1,this.useOmniMaps=!1,this.useMinFov90=!1,this._frameExtentsOmni=new Be(4,2),this._viewportCountOmni=6,this._viewportsOmni=[new mt(2,1,1,1),new mt(0,1,1,1),new mt(3,1,1,1),new mt(1,1,1,1),new mt(3,0,1,1),new mt(1,0,1,1)],this._cubeDirections=[new vt(1,0,0),new vt(-1,0,0),new vt(0,0,1),new vt(0,0,-1),new vt(0,1,0),new vt(0,-1,0)],this._cubeUps=[new vt(0,1,0),new vt(0,1,0),new vt(0,1,0),new vt(0,1,0),new vt(0,0,1),new vt(0,0,-1)]}updateMatrices(e,t=0){if(this.useOmniMaps){const i=this.camera,a=this.matrix;Cs.setFromMatrixPosition(e.matrixWorld),i.position.copy(Cs),Es.copy(i.position),Es.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Es),i.updateMatrixWorld(),a.makeTranslation(-Cs.x,-Cs.y,-Cs.z),Ts.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ts)}else{const o=this.camera;var t=2*An*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=e.distance||o.far;t===o.fov&&n===o.aspect&&r===o.far||(o.fov=t,o.aspect=n,o.far=r,o.updateProjectionMatrix()),super.updateMatrices(e)}}getViewportCount(){return this.useOmniMaps?this._viewportCountOmni:super.getViewportCount()}getViewport(e){return this.useOmniMaps?this._viewportsOmni[e]:super.getViewport(e)}getFrameExtents(){return this.useOmniMaps?this._frameExtentsOmni:super.getFrameExtents()}calcUseOmniMaps(e){return e>Ss?this.useOmniMaps=!0:this.useOmniMaps=!1,this.useOmniMaps}copy(e){return super.copy(e),this.focus=e.focus,this.useOmniMaps=e.useOmniMaps,this.useMinFov90=e.useMinFov90,this}}Ls.prototype.isSpotLightShadow=!0;class Rs extends ua{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let i=n-e,a=n+e,o=r+t,s=r-t;null!==this.view&&this.view.enabled&&(n=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom,i+=n*this.view.offsetX,a=i+n*this.view.width,o-=e*this.view.offsetY,s=o-e*this.view.height),this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}Rs.prototype.isOrthographicCamera=!0;const Ps=.8,Is=.2,Ns=.8,Ds=50;function Os(L,f,e){let R=new Ma;const P=new Be,h=new Be,p=new mt,r=[],i=[],m={},v=e.maxTextureSize,I=e.isWebGL2,b={0:Fe,1:Ve,2:Ue},g=new T({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Be},radius:{value:4}},vertexShader:ys,fragmentShader:xs}),_=g.clone(),t=(_.defines.HORIZONTAL_PASS=1,new S),x=(t.setAttribute("position",new re(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3)),new ee(t,g)),N=new gt,c=new gt,D=new Be(v,v),O=new vt,F=new vt,B=new vt,Z=[new vt(1,0,0),new vt(-1,0,0),new vt(0,1,0),new vt(0,-1,0),new vt(0,0,1),new vt(0,0,-1)],q=[new vt(0,1,0),new vt(0,1,0),new vt(0,0,1),new vt(0,0,-1),new vt(0,1,0),new vt(0,1,0)],z=new fr,u=[new vt,new vt,new vt,new vt,new vt,new vt,new vt,new vt],d=new ee(new Sa(1,1,1,1)),V=(d.name="esmFarPlane",d.castShadow=!0,d.material.shadowSide=Ve,0),U=1,G=0,k=1,W=new Rs(-1,1,1,-1,0,10),H=new ee(new Sa(2,2)),Q=new T({type:"ShadowCubeOctahedral",defines:Object.assign({},E.cubeOctahedral.defines),uniforms:ca.clone(E.cubeOctahedral.uniforms),vertexShader:E.cubeOctahedral.vertexShader,fragmentShader:E.cubeOctahedral.fragmentShader}),l={},y={},X=this;function M(e){var t=e<<0;let n=r[t];return void 0===n&&(n=new gs({depthPacking:ln,morphTargets:e}),r[t]=n),n}function A(e){var t=e<<0;let n=i[t];return void 0===n&&(n=new _s({morphTargets:e}),i[t]=n),n}function w(n,r,i,e,t,a,o,s,l){let c=null,u=M,d=n.customDepthMaterial,h=(!s&&o!==oe||(u=A,d=n.customDistanceMaterial),!1);if(c=void 0===d?(!0===i.morphTargets&&(h=r.morphAttributes&&r.morphAttributes.position&&0v||P.y>v)&&(P.x>v&&(h.x=Math.floor(v/l.x),P.x=h.x*l.x,a.mapSize.x=h.x),P.y>v&&(h.y=Math.floor(v/l.y),P.y=h.y*l.y,a.mapSize.y=h.y)),r.isSpotLight&&a.map&&a.map.width/a.map.height!=2&&(l=a.map,a.map=a._additionalMap2D,a._additionalMap2D=l),r.isPointLight||r.isRectAreaLight||r.isSpotLight&&a.useOmniMaps),u=(c?r.isSpotLight&&(e.fov=90,e.updateProjectionMatrix()):r.isDirectionalLight?(r.shadow.isDirectionalLightShadowCSM&&(l=J(n,a,P,z),e.left=l.center.x-l.radius,e.right=l.center.x+l.radius,e.top=l.center.y+l.radius,e.bottom=l.center.y-l.radius,e.near=-l.center.z-l.radius,e.far=-l.center.z+l.radius,e.updateProjectionMatrix()),l=r.getWorldDirection(B),F.addScaledVector(l,e.near)):r.isSpotLight&&a.useMinFov90&&(e.fov=90,e.updateProjectionMatrix()),null!==a.map||c||i!==ae||(l={minFilter:ht,magFilter:ht,format:pt},a.map=new ze(P.x,P.y,l),a.map.texture.name=r.name+".shadowMap",a.mapPass=new ze(P.x,P.y,l),e.updateProjectionMatrix()),null===a.map&&(l={minFilter:dt,magFilter:dt,format:pt},a.map=new ze(P.x,P.y,l),a.map.texture.name=r.name+".shadowMap",e.updateProjectionMatrix()),L.state.buffers.color.setClear(1,1,1,1),L.setRenderTarget(a.map),L.clear(),a.getViewportCount());for(let e=0;e>2&1,e>>1&1,a).multiplyScalar(2).subScalar(1).applyMatrix4(t.projectionMatrixInverse),1==a&&l.multiplyScalar(i)}r.setFromPoints(u),c.multiplyMatrices(e.camera.matrixWorldInverse,t.matrixWorld);const o=r.center.applyMatrix4(c);var e=r.radius*=c.getMaxScaleOnAxis(),s=n.x/2/e,n=n.y/2/e;return o.x=Math.round(o.x*s)/s,o.y=Math.round(o.y*n)/n,r}function $(e,t,n,r){let i,a,o,s,l,c;t.isPerspectiveCamera?(i=a=0,o=-.999*t.far,s=l=2*-o*Math.tan(En(t.fov)/2),c=1):t.isOrthographicCamera&&(i=(t.right+t.left)/2,a=(t.top+t.bottom)/2,o=-.999*t.far,s=t.right-t.left,l=t.top-t.bottom,c=1),t.add(d),d.scale.set(s,l,c),d.position.set(i,a,o),d.updateMatrixWorld(),j(d,e,t,n,r,!0)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ne,this.esmDistanceScale=1,this.render=function(n,r,i){if(!1!==X.enabled&&(!1!==X.autoUpdate||!1!==X.needsUpdate)&&0!==n.length){var e=L.getRenderTarget(),t=L.getActiveCubeFace(),a=L.getActiveMipmapLevel();const _=L.state;_.setBlending(ce),_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);for(let e=0,t=n.length;er||e.height>r?r/Math.max(e.width,e.height):i)<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const a=t?In:Math.floor;r=a(i*e.width),t=a(i*e.height);void 0===l&&(l=c(r,t));const o=n?c(r,t):l,s=(o.width=r,o.height=t,o.getContext("2d"));return s.drawImage(e,0,0,r,t),console.warn("v3d.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+r+"x"+t+")."),o}return"data"in e&&console.warn("v3d.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function w(e){return Rn(e.width)&&Rn(e.height)}function S(e,t){return e.generateMipmaps&&t&&e.minFilter!==dt&&e.minFilter!==ht}function T(e,t,n,r){m.generateMipmap(e);const i=g.get(t);i.__maxMipLevel=Math.log(Math.max(n,r))*Math.LOG2E}function C(e,t,n){if(!1===b)return t;if(null!==e){if(void 0!==m[e])return m[e];console.warn("v3d.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}let r=t;return 6403===t&&(5126===n&&(r=33326),5131===n&&(r=33325),5121===n&&(r=33321)),6407===t&&(5126===n&&(r=34837),5131===n&&(r=34843),5121===n&&(r=32849)),6408===t&&(5126===n&&(r=34836),5131===n&&(r=34842),5121===n&&(r=32856)),33325!==r&&33326!==r&&34842!==r&&34836!==r||i.get("EXT_color_buffer_float"),r}function r(e){return e===dt||e===W||e===H?9728:9729}function o(e){const t=e.target;var n;t.removeEventListener("dispose",o),e=t,void 0!==(n=g.get(e)).__webglInit&&(m.deleteTexture(n.__webglTexture),g.remove(e)),t.isVideoTexture&&a.delete(t),y.memory.textures--,y.removeTextureSpec(t)}function E(e){const t=e.target;t.removeEventListener("dispose",E);var e=t,n=e.texture,r=g.get(e),i=g.get(n);if(e){if(void 0!==i.__webglTexture&&(m.deleteTexture(i.__webglTexture),y.memory.textures--),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)m.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&m.deleteRenderbuffer(r.__webglDepthbuffer[e]);else m.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&m.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&m.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&m.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&m.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,t=n.length;e=t&&console.warn("v3d.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+t),s+=1,e},this.resetTextureUnits=function(){s=0},this.setTexture2D=d,this.setTexture2DArray=function(e,t){var n=g.get(e);0{e.isLight?(n.pushLight(e),e.castShadow&&n.pushShadow(e)):e.isCubeReflectionProbe?n.pushEnvMapProbe(e):e.isPlaneReflectionProbe&&n.pushPlaneReflProbe(e)}),n.setupLights(t),n.sortEnvMapProbes();let r=null;return null!==e.worldEnvMapProbe&&null!==e.worldEnvMapProbe.renderTarget&&(r=e.worldEnvMapProbe.renderTarget.texture),e.traverse(t=>{if(t.material){const e=Array.isArray(t.material)?t.material:[t.material];e.forEach(e=>{(e.isMeshStandardMaterial||e.isMeshPhysicalMaterial||e.isMeshNodeMaterial)&&(t.material.envMap=r,t.material.needsUpdate=!0)})}}),n},this.compile=function(i,e){const a=ve.get(i,d.length),o=(this._compilePrepareRenderState(i,e,a),{});i.traverse(function(t){var n=t.material;if(n)if(Array.isArray(n))for(let e=0;ee.intersectsMesh(t))||null}function De(e,t,r,n){!0!==t.isScene&&(t=ie),G.resetTextureUnits();var i=t.fog,a=r.isMeshStandardMaterial?t.environment:null,o=null===E?C.outputEncoding:E.texture.encoding,s=(r.envMapAutoAssign&&(r.isMeshStandardMaterial||r.isMeshPhysicalMaterial||r.isMeshNodeMaterial)&&((l=T.state.envMapProbeArray.find(e=>{return null===e.influenceGroup?e.intersectsMesh(n):n.groupNames.includes(e.influenceGroup)^e.influenceGroupInv})||t.worldEnvMapProbe)&&(r.envMap=(null==(s=l.renderTarget)?void 0:s.texture)||null,s=l.parallaxDistance,r.envMapParallaxMatrix.copy(l.matrixWorldInverse).premultiply(le.makeScale(1/s,1/s,1/s)),r.envMapParallaxMatrixInv.copy(l.matrixWorld).multiply(le.makeScale(s,s,s)),r.envMapParallaxType=l.parallaxType)),k.get(r.envMap||a)),l=!0===r.vertexColors&&n.geometry&&n.geometry.attributes.color&&4===n.geometry.attributes.color.itemSize,a=r.side===Fe;const c=U.get(r);var u=T.state.lights,d=(!0!==te||!0!==ne&&e===R||(d=e===R&&r.id===L,W.setState(r,e,d)),Ne(n,r,T)),h=r.isMeshNodeMaterial&&r.canUseGTAO()&&C.gtaoMap;let p=!1,f=!1;if(r.version===c.__version)(!c.needsLights||c.lightsStateVersion===u.state.version)&&c.outputEncoding===o&&(!n.isInstancedMesh||!1!==c.instancing)&&(n.isInstancedMesh||!0!==c.instancing)&&(!n.isSkinnedMesh||!1!==c.skinning)&&(n.isSkinnedMesh||!0!==c.skinning)?c.envMap!==s?(p=!0,f=!0):(r.fog&&c.fog!==i||void 0!==c.numClippingPlanes&&(c.numClippingPlanes!==W.numPlanes||c.numIntersection!==W.numIntersection)||c.vertexAlphas!==l||c.planeReflProbe!==d||r.isMeshNormalMaterial&&c.flipSided!==a||c.useGTAO!==h)&&(p=!0):p=!0;else if(p=!0,c.__version=r.version,r.nodeRGBArr)for(let e=0;ee.far||t.push({distance:n,point:il.clone(),uv:ui.getUV(il,ul,dl,hl,pl,fl,ml,new Be),face:null,object:this}))}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function gl(e,t,n,r,i,a){sl.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(ll.x=a*sl.x-i*sl.y,ll.y=i*sl.x+a*sl.y):ll.copy(sl),e.copy(t),e.x+=ll.x,e.y+=ll.y,e.applyMatrix4(cl)}vl.prototype.isSprite=!0;const _l=new vt,xl=new vt;class yl extends he{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);var n=e.levels;for(let e=0,t=n.length;e=r[e].distance;e++)r[e-1].object.visible=!1,r[e].object.visible=!0;for(this._currentLevel=e-1;en.far||r.push({distance:d,point:f.clone().applyMatrix4(this.matrixWorld),index:e,face:null,faceIndex:null,object:this}))}else for(let e=Math.max(0,a.start),t=Math.min(c.count,a.start+a.count)-1;en.far||r.push({distance:l,point:f.clone().applyMatrix4(this.matrixWorld),index:e,face:null,faceIndex:null,object:this}))}else e.isGeometry&&console.error("v3d.Line.raycast() no longer supports v3d.Geometry. Use v3d.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(0i.far||a.push({distance:n,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}$l.prototype.isPoints=!0;class tc extends Hn{constructor(t,e,n,r,i,a,o,s,l){super(t,e,n,r,i,a,o,s,l),this.format=void 0!==o?o:wt,this.minFilter=void 0!==a?a:ht,this.magFilter=void 0!==i?i:ht,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)})}clone(){return new this.constructor(this.image).copy(this)}update(){var e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}tc.prototype.isVideoTexture=!0;class nc extends Hn{constructor(e,t,n,r,i,a,o,s,l,c,u,d){super(null,a,o,s,l,c,r,i,u,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}nc.prototype.isCompressedTexture=!0;class rc extends Hn{constructor(e,t,n,r,i,a,o,s,l){super(e,t,n,r,i,a,o,s,l),this.needsUpdate=!0}}rc.prototype.isCanvasTexture=!0;class ic extends Hn{constructor(e,t,n,r,i,a,o,s,l,c){if((c=void 0!==c?c:Ze)!==Ze&&c!==qe)throw new Error("DepthTexture format must be either v3d.DepthFormat or v3d.DepthStencilFormat");super(null,r,i,a,o,s,c,n=void 0===(n=void 0===n&&c===Ze?V:n)&&c===qe?Ye:n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:dt,this.minFilter=void 0!==s?s:dt,this.flipY=!1,this.generateMipmaps=!1}}ic.prototype.isDepthTexture=!0;class ac extends S{constructor(n=1,r=8,i=0,a=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:n,segments:r,thetaStart:i,thetaLength:a},r=Math.max(3,r);const t=[],o=[],s=[],l=[],c=new vt,u=new Be;o.push(0,0,0),s.push(0,0,1),l.push(.5,.5);for(let e=0,t=3;e<=r;e++,t+=3){var d=i+e/r*a;c.x=n*Math.cos(d),c.y=n*Math.sin(d),o.push(c.x,c.y,c.z),s.push(0,0,1),u.x=(o[t]/n+1)/2,u.y=(o[t+1]/n+1)/2,l.push(u.x,u.y)}for(let e=1;e<=r;e++)t.push(e,e+1,0);this.setIndex(t),this.setAttribute("position",new k(o,3)),this.setAttribute("normal",new k(s,3)),this.setAttribute("uv",new k(l,2))}static fromJSON(e){return new ac(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class oc extends S{constructor(p=1,f=1,t=1,m=8,r=1,e=!1,v=0,g=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:p,radiusBottom:f,height:t,radialSegments:m,heightSegments:r,openEnded:e,thetaStart:v,thetaLength:g};const _=this,x=(m=Math.floor(m),r=Math.floor(r),[]),y=[],b=[],M=[];let A=0;const i=[],w=t/2;let S=0;{const E=new vt,L=new vt;let n=0;var a=(f-p)/t;for(let e=0;e<=r;e++){const R=[];var o=e/r,s=o*(f-p)+p;for(let e=0;e<=m;e++){var l=e/m,c=l*g+v,u=Math.sin(c),c=Math.cos(c);L.x=s*u,L.y=-o*t+w,L.z=s*c,y.push(L.x,L.y,L.z),E.set(u,a,c).normalize(),b.push(E.x,E.y,E.z),M.push(l,1-o),R.push(A++)}i.push(R)}for(let t=0;tNumber.EPSILON&&(o.normalize(),u=Math.acos(ft(r[e-1].dot(r[e]),-1,1)),i[e].applyMatrix4(s.makeRotationAxis(o,u))),a[e].crossVectors(r[e],i[e]);if(!0===e){let t=Math.acos(ft(i[0].dot(i[n]),-1,1));t/=n,0r;)i-=r;it.length-2?t.length-1:r+1],t=t[r>t.length-3?t.length-1:r+2];return n.set(wc(e,i.x,a.x,o.x,t.x),wc(e,i.y,a.y,o.y,t.y)),n}copy(n){super.copy(n),this.points=[];for(let e=0,t=n.points.length;e=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if((a=s)===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x=n.x&&n.x>=c&&r!==n.x&&Gc(io.x||n.x===o.x&&function(e,t){return kc(e.prev,e,t.prev)<0&&kc(t.next,e,e.next)<0}(o,n)))&&(o=n,d=h)),n=n.next,n!==l;);return o}(e,t))&&(e=Zc(t,e),Bc(t,t.next),Bc(e,e.next))}(i[a],n),n=Bc(n,n.next);return n}(t,e,a,n)),t.length>80*n){s=c=t[0],l=u=t[1];for(let e=n;ec&&(c=d),h>u&&(u=h);p=0!==(p=Math.max(c-s,u-l))?1/p:0}return zc(a,o,n,s,l,p),o}};function Fc(e,t,n,r,i){let a,o;if(i===0=t;a-=r)o=qc(a,e[a],e[a+1],o);return o&&Wc(o,o.next)&&(Qc(o),o=o.next),o}function Bc(e,t){if(!e)return e;t=t||e;let n=e,r;do{if(r=!1,n.steiner||!Wc(n,n.next)&&0!==kc(n.prev,n,n.next))n=n.next;else{if(Qc(n),(n=t=n.prev)===n.next)break;r=!0}}while(r||n!==t);return t}function zc(r,i,a,o,s,l,c){if(r){if(!c&&l){var u=r,d=o,h=s,p=l;let c=u;for(;null===c.z&&(c.z=Uc(c.x,c.y,d,h,p)),c.prevZ=c.prev,c.nextZ=c.next,(c=c.next)!==u;);c.prevZ.nextZ=null,c.prevZ=null;{var f=c;let e,t,n,r,i,a,o,s,l=1;do{for(t=f,f=null,i=null,a=0;t;){for(a++,n=t,o=0,e=0;ea.x?i.x>o.x?i:o:a.x>o.x?a:o).x,u=(i.y>a.y?i.y>o.y?i:o:a.y>o.y?a:o).y,d=Uc(s,l,t,n,r),h=Uc(c,u,t,n,r);let p=e.prevZ,f=e.nextZ;for(;p&&p.z>=d&&f&&f.z<=h;){if(p!==e.prev&&p!==e.next&&Gc(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=kc(p.prev,p,p.next))return;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Gc(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=kc(f.prev,f,f.next))return;f=f.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&Gc(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=kc(p.prev,p,p.next))return;p=p.prevZ}for(;f&&f.z<=h;){if(f!==e.prev&&f!==e.next&&Gc(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=kc(f.prev,f,f.next))return;f=f.nextZ}return 1}(r,o,s,l):function(e){var t=e.prev,n=e,r=e.next;if(0<=kc(t,n,r))return;let i=e.next.next;for(;i!==e.prev;){if(Gc(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&0<=kc(i.prev,i,i.next))return;i=i.next}return 1}(r))i.push(t.i/a),i.push(r.i/a),i.push(n.i/a),Qc(r),r=n.next,e=n.next;else if((r=n)===e){c?1===c?zc(r=function(e,t,n){let r=e;do{var i=r.prev,a=r.next.next;!Wc(i,a)&&Hc(i,r,r.next,a)&&Yc(i,a)&&Yc(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Qc(r),Qc(r.next),r=e=a),r=r.next}while(r!==e);return Bc(r)}(Bc(r),i,a),i,a,o,s,l,2):2===c&&function(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){var s;if(o.i!==e.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Hc(n,n.next,e,t))return 1}while(n=n.next,n!==e);return}(e,t)&&(Yc(e,t)&&Yc(t,e)&&function(e,t){let n=e,r=!1;var i=(e.x+t.x)/2,a=(e.y+t.y)/2;for(;n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next,n!==e;);return r}(e,t)&&(kc(e.prev,e,t.prev)||kc(e,t.prev,t))||Wc(e,t)&&0=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function jc(e){return 0Number.EPSILON){var d=Math.sqrt(u),h=Math.sqrt(l*l+c*c),p=t.x-s/d,t=t.y+o/d,d=((n.x-c/h-p)*c-(n.y+l/h-t)*l)/(o*c-s*l),n=(r=p+o*d-e.x,i=t+s*d-e.y,r*r+i*i);if(n<=2)return new Be(r,i);a=Math.sqrt(n/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(s)===Math.sign(c)&&(e=!0),a=e?(r=-s,i=o,Math.sqrt(u)):(r=o,i=s,Math.sqrt(u/2))}return new Be(r/a,i/a)}const A=[];for(let e=0,t=x.length,n=t-1,r=e+1;e!(c[3*e]===c[3*t]&&c[3*e+1]===c[3*t+1]&&c[3*e+2]===c[3*t+2]||c[3*e]===c[3*n]&&c[3*e+1]===c[3*n+1]&&c[3*e+2]===c[3*n+2]||c[3*t]===c[3*n]&&c[3*t+1]===c[3*n+1]&&c[3*t+2]===c[3*n+2]);for(let e=0;e<3;e++)v[e]=new gt;var $=t?32:28,E=n+1;let ee=0,L=0,R=0,te=0,P=0;for(let r=a?0:20;r<$;r++)if(i||r<20||28<=r){for(let n=0;n<3;n++){for(let t=0;t<4;t++)for(let e=0;e<4;e++)p[4*e+t]=U[3*V[16*r+4*t+e]+n],B&&20<=r&&r<28&&2!==n&&(p[4*e+t]*=1.077),z||2!==n||(p[4*e+t]*=1.3);X.set(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15]),j.multiplyMatrices(X,h),v[n].multiplyMatrices(K,j)}for(let e=0;e<=n;e++){var I=e/n;for(let e=0;e<=n;e++){var N=e/n;for(M=4,y=b=1;M--;)G[M]=y,k[M]=b,y*=I,b*=N,3===M?(f[M]=m[M]=0,A=w=1):(f[M]=A*(3-M),m[M]=w*(3-M),A*=I,w*=N);T.fromArray(G),C.fromArray(k),Y.fromArray(f),Z.fromArray(m);for(let e=0;e<3;e++)(x=T.clone()).applyMatrix4(v[e]),g[e]=x.dot(C),(x=Y.clone()).applyMatrix4(v[e]),W[e]=x.dot(C),(x=T.clone()).applyMatrix4(v[e]),H[e]=x.dot(Z);q.fromArray(W),Q.fromArray(H),_.crossVectors(Q,q),_.normalize(),0===g[0]&&0===g[1]?S.set(0,g[2]>o?1:-1,0):S.set(_.x,_.z,-_.y),c[L++]=s*g[0],c[L++]=s*(g[2]-o),c[L++]=-s*g[1],u[R++]=S.x,u[R++]=S.y,u[R++]=S.z,d[te++]=1-N,d[te++]=1-I}}for(let t=0;t=a)break e;var s=n[1];t=(a=n[--r-1]))break t}e=r,r=0}for(;r>>1;t "+r[i]+";"}t+="}",console.log(t)},Nu.DiGraph=zu,Vu.prototype.either=function(){return this.v},Vu.prototype.other=function(e){return e==this.v?this.w:this.v},Vu.prototype.from=function(){return this.v},Vu.prototype.to=function(){return this.w},Vu.prototype.copy=function(){var e,t=new Vu(0,0,0);for(e in this)this.hasOwnProperty(e)&&(t[e]=this[e]);return t},Nu.Edge=Vu,Uu.prototype.dfs=function(e,t){this.marked[t]=!0;for(var n=e.adj(t),r=0;r "+n);(i<1||1!=i&&"normal"==r)&&(a="mix("+r+","+a+","+Be(i)+")","normal"==r&&(a="normalize("+a+")"));return a}(D[0].name,D[0].type,ne,me,fe)}):console.error("MeshNodeMaterial: wrong node connections")):ge?I.inputs.push({code:"normal"}):I.inputs.push({code:Te(ne,te)})}}function ye(e,t,n){for(var r=e.findInEdges(t),i=0;i"+a+", please reexport your scene")}for(i=0;ia.tracks[e].times[0]&&(c=a.tracks[e].times[0]);for(let e=0;e=f.times[l]){c=l*o+e,u=c+o-e;n=y.arraySlice(f.values,c,u)}else{const g=f.createInterpolant();l=e,o=o-e;g.evaluate(a),n=y.arraySlice(g.resultBuffer,l,o)}if("quaternion"===m){const _=(new de).fromArray(n).normalize().conjugate();_.toArray(n)}var d=v.times.length;for(let e=0;et;)--o;return++o,0===a&&o===i||(a>=o&&(o=Math.max(o,1),a=o-1),n=this.getValueSize(),this.times=y.arraySlice(r,a,o),this.values=y.arraySlice(this.values,a*n,o*n)),this}validate(){let n=!0;var e=this.getValueSize(),t=(e-Math.floor(e)!=0&&(console.error("v3d.KeyframeTrack: Invalid value size in track.",this),n=!1),this.times),r=this.values,i=t.length;0===i&&(console.error("v3d.KeyframeTrack: Track is empty.",this),n=!1);let a=null;for(let e=0;e!==i;e++){var o=t[e];if("number"==typeof o&&isNaN(o)){console.error("v3d.KeyframeTrack: Time is not a valid number.",this,e,o),n=!1;break}if(null!==a&&a>o){console.error("v3d.KeyframeTrack: Out of order keys.",this,e,o,a),n=!1;break}a=o}if(void 0!==r&&y.isTypedArray(r))for(let e=0,t=r.length;e!==t;++e){var s=r[e];if(isNaN(s)){console.error("v3d.KeyframeTrack: Value is not a valid number.",this,e,s),n=!1;break}}return n}optimize(){const n=y.arraySlice(this.times),r=y.arraySlice(this.values),i=this.getValueSize(),a=this.getInterpolation()===en,o=n.length-1;let s=1;for(let e=1;e=t){var i=n[r]-t;const o=this.curves[r];var a=o.getLength();return o.getPointAt(0===a?0:1-i/a)}r++}return null}getLength(){var e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const n=[];let r=0;for(let e=0,t=this.curves.length;eNumber.EPSILON){if(r<0&&(e=s[a],n=-n,t=s[i],r=-r),!(o.yt.y))if(o.y===e.y){if(o.x===e.x)return 1}else{var c=r*(o.x-e.x)-n*(o.y-e.y);if(0==c)return 1;c<0||(l=!l)}}else if(o.y===e.y&&(t.x<=o.x&&o.x<=e.x||e.x<=o.x&&o.x<=t.x))return 1}return l}(g.p,d[e].p)||(r!==e&&_.push({froms:r,tos:e,hole:n}),t?(t=!1,u[e].push(g)):i=!0);t&&u[r].push(g)}}0<_.length&&(i||(h=u))}for(let n=0,e=d.length;n=o){var u=o++,d=n[u];r[d.uuid]=c,n[c]=d,r[l]=u,n[u]=s;for(let e=0,t=a;e!==t;++e){const h=i[e],p=h[u],f=h[c];h[c]=p,h[u]=f}}}this.nCachedObjects_=o}uncache(){const n=this._objects,r=this._indicesByUUID,i=this._bindings,a=i.length;let o=this.nCachedObjects_,s=n.length;for(let e=0,t=arguments.length;e!==t;++e){var l=arguments[e].uuid,c=r[l];if(void 0!==c)if(delete r[l],cr.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1)))}return this._effectiveWeight=t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;var n;null!==r&&(n=r.evaluate(e)[0],t*=n,e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t}_loopIsPing(e){return 2202!==this.loop||(-1==e||0==(1&e)===this._pingIsEven)}_updateTime(e){if(0===e)return this.time;if(2200!==this.loop&&this.repetitions<=0)return this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1}),this.time;var t,n,r,i,a=this.timeStart,o=Math.max(a,this._clip.duration),s=o-a;return 2200===this.loop?(this.time+=e,-1===this._loopCount&&(this._loopCount=0,this._setEndings(!0,!0,!1)),(this.timeo)&&(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=ft(this.time,a,o),this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1}))):(t=2202===this.loop,r=this._loopIsPing(this._loopCount)?1:-1,this.time+=r*e,r=this.timeo,n=!1,-1===this._loopCount&&(this._loopCount=(n=r)?-1:0,this._pingIsEven=!n,0<=e?this._setEndings(!0,0===this.repetitions,t):this._setEndings(0===this.repetitions,!0,t)),r&&(r=Math.floor((this.time-a)/s),this._loopCount+=Math.abs(r),(i=this.repetitions-this._loopCount)<=0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=ft(this.time,a,o),this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})):(1==i?this._setEndings(i=e<0,!i,t):this._setEndings(!1,!1,t),(e=(this.time-a)%s)<0&&(e+=s),this.time=t?o-e:e+a,n||this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:r})))),this.time}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=nn,r.endingEnd=nn):(r.endingStart=e?this.zeroSlopeAtStart?nn:tn:rn,r.endingEnd=t?this.zeroSlopeAtEnd?nn:tn:rn)}_scheduleFading(e,t,n){const r=this._mixer,i=r.time;let a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}class Uh extends n{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,a=i.length,o=e._propertyBindings,s=e._interpolants,l=r.uuid,t=this._bindingsByRootAndName;let c=t[l];void 0===c&&(c={},t[l]=c);for(let t=0;t!==a;++t){const d=i[t],h=d.name;let e=c[h];if(void 0!==e)o[t]=e;else{if(void 0!==(e=o[t])){null===e._cacheIndex&&(++e.referenceCount,this._addInactiveBinding(e,l,h));continue}var u=n&&n._propertyBindings[t].binding.parsedPath;++(e=new Ph(C.create(r,h,u),d.ValueTypeName,d.getValueSize())).referenceCount,this._addInactiveBinding(e,l,h),o[t]=e}s[t].resultBuffer=e.buffer}}_activateAction(e){if(!this._isActiveAction(e)){null===e._cacheIndex&&(t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n],this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t));var t,n,r,i=e._propertyBindings;for(let e=0,t=i.length;e!==t;++e){const a=i[e];0==a.useCount++&&(this._lendBinding(a),a.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){var n=e._propertyBindings;for(let e=0,t=n.length;e!==t;++e){const r=n[e];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){e=e._cacheIndex;return null!==e&&ethis.max.x||e.ythis.max.y)}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}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))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){const t=Hh.copy(e).clamp(this.min,this.max);return t.sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),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)}}Xh.prototype.isBox2=!0;const jh=new vt,Yh=new vt;class Zh{constructor(e=new vt,t=new vt){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){jh.subVectors(e,this.start),Yh.subVectors(this.end,this.start);e=Yh.dot(Yh);let n=Yh.dot(jh)/e;return n=t?ft(n,0,1):n}closestPointToPoint(e,t,n){e=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(e).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}class qh extends he{constructor(e){super(),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}qh.prototype.isImmediateRenderObject=!0;const Qh=new vt;class Kh extends he{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;const n=new S,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let e=0,t=1;e<32;e++,t++){var i=e/32*Math.PI*2,a=t/32*Math.PI*2;r.push(Math.cos(i),Math.sin(i),1,Math.cos(a),Math.sin(a),1)}n.setAttribute("position",new k(r,3));e=new Bl({fog:!1,toneMapped:!1});this.cone=new jl(n,e),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();var e=this.light.distance||1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Qh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Qh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Jh=new vt,$h=new gt,ep=new gt;class tp extends jl{constructor(e){var t=function t(n){const r=[];n&&n.isBone&&r.push(n);for(let e=0;e>16&32768,n=e>>12&2047;var r=e>>23&255;return r<103?t:142>114-r)+(n>>113-r&1)):t=(t|=r-112<<10|n>>1)+(1&n)}}let Tp=256;const Cp=[{relSize:1,sigma:0,origin:[0,0]},{relSize:.5,sigma:.025,origin:[0,2/3]},{relSize:.25,sigma:.07,origin:[.5,2/3]},{relSize:1/8,sigma:.18,origin:[.75,2/3]},{relSize:1/16,sigma:.24,origin:[.875,2/3]},{relSize:1/16,sigma:.3,origin:[.875,17/24]},{relSize:1/16,sigma:.36,origin:[.875,.75]},{relSize:1/16,sigma:.42,origin:[.875,19/24]},{relSize:1/16,sigma:.48,origin:[.875,20/24]},{relSize:1/16,sigma:.54,origin:[.875,.875]},{relSize:1/16,sigma:.6,origin:[.875,22/24]}];function Ep(e){return Cp[e].relSize*Tp}let Lp=!1;const Rp=20,Pp={[an]:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},Ip=new Rs;let Np=null,Dp=null,Op=null;const Fp=Cp.map(function(e,t){var t=1/(Ep(t)-1),n=-t/2,t=1+t/2,r=[n,n,t,n,t,t,n,n,t,t,n,t];const i=new Float32Array(108),a=new Float32Array(72),o=new Float32Array(36);for(let e=0;e<6;e++){var s=e%3*2/3-1,l=2 + +vec3 getSample(float theta, vec3 axis) { + float cosTheta = cos(theta); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross(axis, vOutputDirection) * sin(theta) + + axis * dot(axis, vOutputDirection) * (1.0 - cosTheta); + return bilinearCubeUV(envMap, sampleDirection, lodIdx); +} + +void main() { + vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection); + if (all(equal(axis, vec3(0.0)))) + axis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x); + axis = normalize(axis); + gl_FragColor = vec4(0.0); + gl_FragColor.rgb += weights[0] * getSample(0.0, axis); + for (int i = 1; i < n; i++) { + if (i >= samples) + break; + float theta = dTheta * float(i); + gl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis); + gl_FragColor.rgb += weights[i] * getSample(theta, axis); + } + gl_FragColor = linearToOutputTexel(gl_FragColor); +} + `,blending:ce,depthTest:!1,depthWrite:!1});return a.type="SphericalGaussianBlur",a}(Rp,this.maxTileSize,this.blurLinEncodingOptimization))}fromScene(t,e=0,n=.1,r=100){zp=x.getRenderTarget();var i=Gp();{var a=t,o=(t=n,n=r,i);const c=new da(90,1,t,n),u=[1,1,1,1,-1,1],d=[1,1,-1,-1,-1,1],h=x.outputEncoding,p=x.toneMapping,f=x.toneMappingExposure,m=x.getClearColor(new _t),v=x.getClearAlpha();x.toneMapping=1,x.toneMappingExposure=1,x.outputEncoding=an,a.scale.z*=-1;let e=a.background;e&&e.isColor&&(e.convertSRGBToLinear(),t=Math.max(e.r,e.g,e.b),n=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127),e=e.multiplyScalar(Math.pow(2,-n)),t=(n+128)/255,x.setClearColor(e,t),a.background=null);for(let e=0;e<6;e++){var s=e%3,l=(0==s?(c.up.set(0,u[e],0),c.lookAt(d[e],0,0)):1==s?(c.up.set(0,0,u[e]),c.lookAt(0,d[e],0)):(c.up.set(0,u[e],0),c.lookAt(0,0,d[e])),Ep(0));Xp(o,s*l,2Rp&&(h=Rp,d=(Rp-1)/3,u=i/d);const p=[];let f=0;for(let e=0;e + + vec4 inputTexelToLinear(vec4 value){ + if(inputEncoding == 0){ + return value; + }else if(inputEncoding == 1){ + return sRGBToLinear(value); + }else if(inputEncoding == 2){ + return RGBEToLinear(value); + }else if(inputEncoding == 3){ + return RGBMToLinear(value, 7.0); + }else if(inputEncoding == 4){ + return RGBMToLinear(value, 16.0); + }else if(inputEncoding == 5){ + return RGBDToLinear(value, 256.0); + }else{ + return GammaToLinear(value, 2.2); + } + } + + vec4 linearToOutputTexel(vec4 value){ + if(outputEncoding == 0){ + return value; + }else if(outputEncoding == 1){ + return LinearTosRGB(value); + }else if(outputEncoding == 2){ + return LinearToRGBE(value); + }else if(outputEncoding == 3){ + return LinearToRGBM(value, 7.0); + }else if(outputEncoding == 4){ + return LinearToRGBM(value, 16.0); + }else if(outputEncoding == 5){ + return LinearToRGBD(value, 256.0); + }else{ + return LinearToGamma(value, 2.2); + } + } + + vec4 envMapTexelToLinear(vec4 color) { + return inputTexelToLinear(color); + } + +#endif + `}mc.create=function(e,t){return console.log("v3d.Curve.create() has been deprecated"),e.prototype=Object.create(mc.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Nd.prototype.fromPoints=function(e){return console.warn("v3d.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)},sp.prototype.setColors=function(){console.error("v3d.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},tp.prototype.update=function(){console.error("v3d.SkeletonHelper: update() no longer needs to be called.")},Sd.prototype.extractUrlBase=function(e){return console.warn("v3d.Loader: .extractUrlBase() has been deprecated. Use v3d.LoaderUtils.extractUrlBase() instead."),eh.extractUrlBase(e)},Sd.Handlers={add:function(){console.error("v3d.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("v3d.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Xh.prototype.center=function(e){return console.warn("v3d.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},Xh.prototype.empty=function(){return console.warn("v3d.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Xh.prototype.isIntersectionBox=function(e){return console.warn("v3d.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Xh.prototype.size=function(e){return console.warn("v3d.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},g.prototype.center=function(e){return console.warn("v3d.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},g.prototype.empty=function(){return console.warn("v3d.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},g.prototype.isIntersectionBox=function(e){return console.warn("v3d.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},g.prototype.isIntersectionSphere=function(e){return console.warn("v3d.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},g.prototype.size=function(e){return console.warn("v3d.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},fr.prototype.empty=function(){return console.warn("v3d.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ma.prototype.setFromMatrix=function(e){return console.warn("v3d.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Zh.prototype.center=function(e){return console.warn("v3d.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Un.prototype.flattenToArrayOffset=function(e,t){return console.warn("v3d.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Un.prototype.multiplyVector3=function(e){return console.warn("v3d.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3(matrix) instead."),e.applyMatrix3(this)},Un.prototype.multiplyVector3Array=function(){console.error("v3d.Matrix3: .multiplyVector3Array() has been removed.")},Un.prototype.applyToBufferAttribute=function(e){return console.warn("v3d.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3(matrix) instead."),e.applyMatrix3(this)},Un.prototype.applyToVector3Array=function(){console.error("v3d.Matrix3: .applyToVector3Array() has been removed.")},Un.prototype.getInverse=function(e){return console.warn("v3d.Matrix3: .getInverse() has been removed. Use matrixInv.copy(matrix).invert(); instead."),this.copy(e).invert()},gt.prototype.extractPosition=function(e){return console.warn("v3d.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},gt.prototype.flattenToArrayOffset=function(e,t){return console.warn("v3d.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},gt.prototype.getPosition=function(){return console.warn("v3d.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition(matrix) instead."),(new vt).setFromMatrixColumn(this,3)},gt.prototype.setRotationFromQuaternion=function(e){return console.warn("v3d.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},gt.prototype.multiplyToArray=function(){console.warn("v3d.Matrix4: .multiplyToArray() has been removed.")},gt.prototype.multiplyVector3=function(e){return console.warn("v3d.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},gt.prototype.multiplyVector4=function(e){return console.warn("v3d.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},gt.prototype.multiplyVector3Array=function(){console.error("v3d.Matrix4: .multiplyVector3Array() has been removed.")},gt.prototype.rotateAxis=function(e){console.warn("v3d.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection(matrix) instead."),e.transformDirection(this)},gt.prototype.crossVector=function(e){return console.warn("v3d.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},gt.prototype.translate=function(){console.error("v3d.Matrix4: .translate() has been removed.")},gt.prototype.rotateX=function(){console.error("v3d.Matrix4: .rotateX() has been removed.")},gt.prototype.rotateY=function(){console.error("v3d.Matrix4: .rotateY() has been removed.")},gt.prototype.rotateZ=function(){console.error("v3d.Matrix4: .rotateZ() has been removed.")},gt.prototype.rotateByAxis=function(){console.error("v3d.Matrix4: .rotateByAxis() has been removed.")},gt.prototype.applyToBufferAttribute=function(e){return console.warn("v3d.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4(matrix) instead."),e.applyMatrix4(this)},gt.prototype.applyToVector3Array=function(){console.error("v3d.Matrix4: .applyToVector3Array() has been removed.")},gt.prototype.makeFrustum=function(e,t,n,r,i,a){return console.warn("v3d.Matrix4: .makeFrustum() has been removed. Use .makePerspective(left, right, top, bottom, near, far) instead."),this.makePerspective(e,t,r,n,i,a)},gt.prototype.getInverse=function(e){return console.warn("v3d.Matrix4: .getInverse() has been removed. Use matrixInv.copy(matrix).invert(); instead."),this.copy(e).invert()},xa.prototype.isIntersectionLine=function(e){return console.warn("v3d.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},de.prototype.multiplyVector3=function(e){return console.warn("v3d.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion(quaternion) instead."),e.applyQuaternion(this)},de.prototype.inverse=function(){return console.warn("v3d.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Mr.prototype.isIntersectionBox=function(e){return console.warn("v3d.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Mr.prototype.isIntersectionPlane=function(e){return console.warn("v3d.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Mr.prototype.isIntersectionSphere=function(e){return console.warn("v3d.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},ui.prototype.area=function(){return console.warn("v3d.Triangle: .area() has been renamed to .getArea()."),this.getArea()},ui.prototype.barycoordFromPoint=function(e,t){return console.warn("v3d.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},ui.prototype.midpoint=function(e){return console.warn("v3d.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},ui.prototypenormal=function(e){return console.warn("v3d.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},ui.prototype.plane=function(e){return console.warn("v3d.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},ui.barycoordFromPoint=function(e,t,n,r,i){return console.warn("v3d.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),ui.getBarycoord(e,t,n,r,i)},ui.normal=function(e,t,n,r){return console.warn("v3d.Triangle: .normal() has been renamed to .getNormal()."),ui.getNormal(e,t,n,r)},Dd.prototype.extractAllPoints=function(e){return console.warn("v3d.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},Dd.prototype.extrude=function(e){return console.warn("v3d.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new tu(this,e)},Dd.prototype.makeGeometry=function(e){return console.warn("v3d.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new lu(this,e)},Be.prototype.fromAttribute=function(e,t,n){return console.warn("v3d.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Be.prototype.distanceToManhattan=function(e){return console.warn("v3d.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},Be.prototype.lengthManhattan=function(){return console.warn("v3d.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},vt.prototype.setEulerFromRotationMatrix=function(){console.error("v3d.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},vt.prototype.setEulerFromQuaternion=function(){console.error("v3d.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},vt.prototype.getPositionFromMatrix=function(e){return console.warn("v3d.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},vt.prototype.getScaleFromMatrix=function(e){return console.warn("v3d.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},vt.prototype.getColumnFromMatrix=function(e,t){return console.warn("v3d.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},vt.prototype.applyProjection=function(e){return console.warn("v3d.Vector3: .applyProjection() has been removed. Use .applyMatrix4(m) instead."),this.applyMatrix4(e)},vt.prototype.fromAttribute=function(e,t,n){return console.warn("v3d.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},vt.prototype.distanceToManhattan=function(e){return console.warn("v3d.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},vt.prototype.lengthManhattan=function(){return console.warn("v3d.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},mt.prototype.fromAttribute=function(e,t,n){return console.warn("v3d.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},mt.prototype.lengthManhattan=function(){return console.warn("v3d.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},he.prototype.getChildByName=function(e){return console.warn("v3d.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},he.prototype.renderDepth=function(){console.warn("v3d.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},he.prototype.translate=function(e,t){return console.warn("v3d.Object3D: .translate() has been removed. Use .translateOnAxis(axis, distance) instead."),this.translateOnAxis(t,e)},he.prototype.getWorldRotation=function(){console.error("v3d.Object3D: .getWorldRotation() has been removed. Use v3d.Object3D.getWorldQuaternion(target) instead.")},he.prototype.applyMatrix=function(e){return console.warn("v3d.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(he.prototype,{eulerOrder:{get:function(){return console.warn("v3d.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("v3d.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("v3d.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("v3d.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),ee.prototype.setDrawMode=function(){console.error("v3d.Mesh: .setDrawMode() has been removed. The renderer now always assumes v3d.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(ee.prototype,{drawMode:{get:function(){return console.error("v3d.Mesh: .drawMode has been removed. The renderer now always assumes v3d.TrianglesDrawMode."),0},set:function(){console.error("v3d.Mesh: .drawMode has been removed. The renderer now always assumes v3d.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Tl.prototype.initBones=function(){console.error("v3d.SkinnedMesh: initBones() has been removed.")},da.prototype.setLens=function(e,t){console.warn("v3d.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Od.prototype,{onlyShadow:{set:function(){console.warn("v3d.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("v3d.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("v3d.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("v3d.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("v3d.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("v3d.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("v3d.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("v3d.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("v3d.Light: .shadowCameraVisible has been removed. Use new v3d.CameraHelper(light.shadow.camera) instead.")}},shadowBias:{set:function(e){console.warn("v3d.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("v3d.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("v3d.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("v3d.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(re.prototype,{length:{get:function(){return console.warn("v3d.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("v3d.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===vn},set:function(){console.warn("v3d.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(vn)}}}),re.prototype.setDynamic=function(e){return console.warn("v3d.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?vn:mn),this},re.prototype.copyIndicesArray=function(){console.error("v3d.BufferAttribute: .copyIndicesArray() has been removed.")},re.prototype.setArray=function(){console.error("v3d.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},S.prototype.addIndex=function(e){console.warn("v3d.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},S.prototype.addAttribute=function(e,t){return console.warn("v3d.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("v3d.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("v3d.BufferGeometry: .addAttribute() now expects (name, attribute)."),this.setAttribute(e,new re(t,arguments[2])))},S.prototype.addDrawCall=function(e,t,n){void 0!==n&&console.warn("v3d.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("v3d.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},S.prototype.clearDrawCalls=function(){console.warn("v3d.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},S.prototype.computeOffsets=function(){console.warn("v3d.BufferGeometry: .computeOffsets() has been removed.")},S.prototype.removeAttribute=function(e){return console.warn("v3d.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},S.prototype.applyMatrix=function(e){return console.warn("v3d.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(S.prototype,{drawcalls:{get:function(){return console.error("v3d.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("v3d.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),$s.prototype.setDynamic=function(e){return console.warn("v3d.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?vn:mn),this},$s.prototype.setArray=function(){console.error("v3d.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},tu.prototype.getArrays=function(){console.error("v3d.ExtrudeGeometry: .getArrays() has been removed.")},tu.prototype.addShapeList=function(){console.error("v3d.ExtrudeGeometry: .addShapeList() has been removed.")},tu.prototype.addShape=function(){console.error("v3d.ExtrudeGeometry: .addShape() has been removed.")},Js.prototype.dispose=function(){console.error("v3d.Scene: .dispose() has been removed.")},Gh.prototype.onUpdate=function(){return console.warn("v3d.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(pi.prototype,{wrapAround:{get:function(){console.warn("v3d.Material: .wrapAround has been removed.")},set:function(){console.warn("v3d.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("v3d.Material: .overdraw has been removed.")},set:function(){console.warn("v3d.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("v3d.Material: .wrapRGB has been removed."),new _t}},shading:{get:function(){console.error("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("v3d."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("v3d."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("v3d."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(T.prototype,{derivatives:{get:function(){return console.warn("v3d.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("v3d. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),i.prototype.clearTarget=function(e,t,n,r){console.warn("v3d.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},i.prototype.animate=function(e){console.warn("v3d.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},i.prototype.getCurrentRenderTarget=function(){return console.warn("v3d.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},i.prototype.getMaxAnisotropy=function(){return console.warn("v3d.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},i.prototype.getPrecision=function(){return console.warn("v3d.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},i.prototype.resetGLState=function(){return console.warn("v3d.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},i.prototype.supportsFloatTextures=function(){return console.warn("v3d.WebGLRenderer: .supportsFloatTextures() is now .extensions.get('OES_texture_float')."),this.extensions.get("OES_texture_float")},i.prototype.supportsHalfFloatTextures=function(){return console.warn("v3d.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get('OES_texture_half_float')."),this.extensions.get("OES_texture_half_float")},i.prototype.supportsStandardDerivatives=function(){return console.warn("v3d.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get('OES_standard_derivatives')."),this.extensions.get("OES_standard_derivatives")},i.prototype.supportsCompressedTextureS3TC=function(){return console.warn("v3d.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get('WEBGL_compressed_texture_s3tc')."),this.extensions.get("WEBGL_compressed_texture_s3tc")},i.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("v3d.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get('WEBGL_compressed_texture_pvrtc')."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},i.prototype.supportsBlendMinMax=function(){return console.warn("v3d.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get('EXT_blend_minmax')."),this.extensions.get("EXT_blend_minmax")},i.prototype.supportsVertexTextures=function(){return console.warn("v3d.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},i.prototype.supportsInstancedArrays=function(){return console.warn("v3d.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get('ANGLE_instanced_arrays')."),this.extensions.get("ANGLE_instanced_arrays")},i.prototype.enableScissorTest=function(e){console.warn("v3d.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},i.prototype.initMaterial=function(){console.warn("v3d.WebGLRenderer: .initMaterial() has been removed.")},i.prototype.addPrePlugin=function(){console.warn("v3d.WebGLRenderer: .addPrePlugin() has been removed.")},i.prototype.addPostPlugin=function(){console.warn("v3d.WebGLRenderer: .addPostPlugin() has been removed.")},i.prototype.updateShadowMap=function(){console.warn("v3d.WebGLRenderer: .updateShadowMap() has been removed.")},i.prototype.setFaceCulling=function(){console.warn("v3d.WebGLRenderer: .setFaceCulling() has been removed.")},i.prototype.allocTextureUnit=function(){console.warn("v3d.WebGLRenderer: .allocTextureUnit() has been removed.")},i.prototype.setTexture=function(){console.warn("v3d.WebGLRenderer: .setTexture() has been removed.")},i.prototype.setTexture2D=function(){console.warn("v3d.WebGLRenderer: .setTexture2D() has been removed.")},i.prototype.setTextureCube=function(){console.warn("v3d.WebGLRenderer: .setTextureCube() has been removed.")},i.prototype.getActiveMipMapLevel=function(){return console.warn("v3d.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(i.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("v3d.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("v3d.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("v3d.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("v3d.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("v3d.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("v3d.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("v3d.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?on:an}},toneMappingWhitePoint:{get:function(){return console.warn("v3d.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("v3d.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Os.prototype,{cullFace:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("v3d.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(ze.prototype,{wrapS:{get:function(){return console.warn("v3d.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("v3d.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("v3d.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("v3d.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("v3d.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("v3d.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("v3d.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("v3d.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("v3d.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("v3d.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("v3d.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("v3d.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("v3d.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("v3d.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("v3d.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("v3d.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("v3d.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("v3d.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("v3d.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("v3d.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Sh.prototype.load=function(e){console.warn("v3d.Audio: .load has been deprecated. Use v3d.AudioLoader instead.");const t=this,n=new ph;return n.load(e,function(e){t.setBuffer(e)}),this},Rh.prototype.getData=function(){return console.warn("v3d.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},ha.prototype.updateCubeMap=function(e,t){return console.warn("v3d.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},ha.prototype.clear=function(e,t,n,r){return console.warn("v3d.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,r)},kn.crossOrigin=void 0,kn.loadTexture=function(e,t,n,r){console.warn("v3d.ImageUtils.loadTexture has been deprecated. Use v3d.TextureLoader() instead.");const i=new Pd,a=(i.setCrossOrigin(this.crossOrigin),i.load(e,n,void 0,r));return t&&(a.mapping=t),a},kn.loadTextureCube=function(e,t,n,r){console.warn("v3d.ImageUtils.loadTextureCube has been deprecated. Use v3d.CubeTextureLoader() instead.");const i=new Ld,a=(i.setCrossOrigin(this.crossOrigin),i.load(e,n,void 0,r));return t&&(a.mapping=t),a},kn.loadCompressedTexture=function(){console.error("v3d.ImageUtils.loadCompressedTexture has been removed. Use v3d.DDSLoader instead.")},kn.loadCompressedTextureCube=function(){console.error("v3d.ImageUtils.loadCompressedTextureCube has been removed. Use v3d.DDSLoader instead.")};var $p,ef=new vt,tf=new vt,nf=new vt,rf=new Be,af=new Be,of=new Be,sf=new vt,lf=new vt;function cf(e,t,n,r,i,a,o,s){ef.fromBufferAttribute(r,a),tf.fromBufferAttribute(r,o),nf.fromBufferAttribute(r,s);e=(r=e).material,t=t,n=n,l=ef,d=tf,u=nf,c=sf;var l,c,u,d=null===(n=e.side===Fe?n.intersectTriangle(u,d,l,!0,c):n.intersectTriangle(l,d,u,e.side!==Ue,c))?null:(lf.copy(c),lf.applyMatrix4(r.matrixWorld),(l=t.ray.origin.distanceTo(lf))t.far?null:{distance:l,point:lf.clone(),object:r});return d&&(i&&(rf.fromBufferAttribute(i,a),af.fromBufferAttribute(i,o),of.fromBufferAttribute(i,s),d.uv=ui.getUV(sf,ef,tf,nf,rf,af,of,new Be)),u=new vt,d.face=new di(a,o,s,ui.getNormal(ef,tf,nf,u)),d.faceIndex=a),d}function uf(e,t,n,r,i,a){var o=3*i,s=t.index.getX(o),l=t.index.getX(1+o),o=t.index.getX(2+o),e=cf(e,n,r,t.attributes.position,t.attributes.uv,s,l,o);return e?(e.faceIndex=i,a&&a.push(e),e):null}function df(e,t){return t.min.x=e[0],t.min.y=e[1],t.min.z=e[2],t.max.x=e[3],t.max.y=e[4],t.max.z=e[5],t}function hf(e){for(var t=-1,n=-1/0,r=0;r<3;r++){var i=e[r+3]-e[r];ne.max||e.min>this.max}}pf.prototype.setFromBox=($p=new vt,function(e,t){for(var n=t.min,r=t.max,i=1/0,a=-1/0,o=0;o<=1;o++)for(var s=0;s<=1;s++)for(var l=0;l<=1;l++){$p.x=n.x*o+r.x*(1-o),$p.y=n.y*s+r.y*(1-s),$p.z=n.z*l+r.z*(1-l);var c=e.dot($p),i=Math.min(c,i),a=Math.max(c,a)}this.min=i,this.max=a});ff=new vt,mf=new vt,vf=new vt;var ff,mf,vf,gf,_f,xf,yf,bf,Mf,Af,wf,Sf,Tf,Cf,Ef,Lf,Rf,Pf,If,Nf,Df,Of,Ff,Bf,zf,Vf,Uf,Gf,kf,Wf,Hf,Xf,jf,Yf,Zf,qf=function(e,t,n){var r=e.start,i=ff,a=t.start,o=mf,r=(vf.subVectors(r,a),ff.subVectors(e.end,t.start),mf.subVectors(t.end,t.start),vf.dot(o)),a=o.dot(i),e=o.dot(o),t=vf.dot(i),o=i.dot(i)*e-a*a,i=0!=o?(r*a-t*e)/o:0,t=(r+i*a)/e;n.x=i,n.y=t},Qf=(gf=new Be,_f=new vt,xf=new vt,function(e,t,n,r){qf(e,t,gf);var i,a=gf.x,o=gf.y;0<=a&&a<=1&&0<=o&&o<=1?(e.at(a,n),t.at(o,r)):0<=a&&a<=1?(o<0?t.at(0,r):t.at(1,r),e.closestPointToPoint(r,!0,n)):0<=o&&o<=1?(a<0?e.at(0,n):e.at(1,n),t.closestPointToPoint(n,!0,r)):(a=a<0?e.start:e.end,o=o<0?t.start:t.end,i=xf,e.closestPointToPoint(o,!0,e=_f),t.closestPointToPoint(a,!0,xf),e.distanceToSquared(o)<=i.distanceToSquared(a)?(n.copy(e),r.copy(o)):(n.copy(a),r.copy(i)))}),Kf=(yf=new vt,bf=new vt,Mf=new xa,Af=new Zh,function(e,t){var n=e.radius,e=e.center,r=t.a,i=t.b,a=t.c;if(Af.start=r,Af.end=i,Af.closestPointToPoint(e,!0,yf).distanceTo(e)<=n)return!0;if(Af.start=r,Af.end=a,Af.closestPointToPoint(e,!0,yf).distanceTo(e)<=n)return!0;if(Af.start=i,Af.end=a,Af.closestPointToPoint(e,!0,yf).distanceTo(e)<=n)return!0;r=t.getPlane(Mf);if(Math.abs(r.distanceToPoint(e))<=n){i=r.projectPoint(e,bf);if(t.containsPoint(i))return!0}return!1});class Jf extends ui{constructor(...e){super(...e),this.isSeparatingAxisTriangle=!0,this.satAxes=new Array(4).fill().map(function(){return new vt}),this.satBounds=new Array(4).fill().map(function(){return new pf}),this.points=[this.a,this.b,this.c],this.sphere=new fr}}Jf.prototype.update=(wf=new Array(3),function(){var e=this.a,t=this.b,n=this.c,r=(wf[0]=this.a,wf[1]=this.b,wf[2]=this.c,this.satAxes),i=this.satBounds,a=r[0],o=i[0],o=(this.getNormal(a),o.setFromPoints(a,wf),r[1]),a=i[1],a=(o.subVectors(e,t),a.setFromPoints(o,wf),r[2]),o=i[2],t=(a.subVectors(t,n),o.setFromPoints(a,wf),r[3]),o=i[3];t.subVectors(n,e),o.setFromPoints(t,wf),this.sphere.setFromPoints(this.points)}),Jf.prototype.intersectsTriangle=(Sf=new Jf,Tf=new Array(3),Cf=new Array(3),Ef=new pf,Lf=new pf,Rf=new vt,function(e){e.isSeparatingAxisTriangle||(Sf.copy(e),Sf.update(),e=Sf);var t=this.satBounds,n=this.satAxes;Cf[0]=e.a,Cf[1]=e.b,Cf[2]=e.c;for(var r=0;r<4;r++){var i=t[r],a=n[r];if(Ef.setFromPoints(a,Cf),i.isSeparated(Ef))return!1}var o=e.satBounds,s=e.satAxes;Tf[0]=this.a,Tf[1]=this.b,Tf[2]=this.c;for(var l=0;l<4;l++){var c=o[l],u=s[l];if(Ef.setFromPoints(u,Tf),c.isSeparated(Ef))return!1}for(var d=0;d<4;d++)for(var h=n[d],p=0;p<4;p++){var f=s[p];if(Rf.crossVectors(h,f),Ef.setFromPoints(Rf,Tf),Lf.setFromPoints(Rf,Cf),Ef.isSeparated(Lf))return!1}return!0}),Jf.prototype.distanceToPoint=(Pf=new vt,function(e){return this.closestPointToPoint(e,Pf),e.distanceTo(Pf)}),Jf.prototype.distanceToTriangle=(If=new vt,Nf=new vt,Df=["a","b","c"],Of=new Zh,Ff=new Zh,function(e,t=null,n=null){if(this.intersectsTriangle(e))return(t||n)&&(this.getMidpoint(If),e.closestPointToPoint(If,Nf),this.closestPointToPoint(Nf,If),t&&t.copy(If),n&&n.copy(Nf)),0;for(var r=1/0,i=0;i<3;i++){var a=void 0,o=Df[i],s=e[o],s=(this.closestPointToPoint(s,If),(a=s.distanceToSquared(If))=a;)i--;if(!(r=s.maxDepth&&(c=!0),n<=s.maxLeafTris||r>=s.maxDepth)return e.offset=t,e.count=n,e;var i=l.getOptimalSplit(e.boundingData,t,n,s.strategy);if(-1===i.axis)return e.offset=t,e.count=n,e;var a,o=l.partition(t,n,i);return o===t||o===t+n?(e.offset=t,e.count=n):(e.splitAxis=i.axis,(i=e.left=new x0).boundingData=l.getBounds(a=t,t=o-t,new Float32Array(6)),u(i,a,t,r+1),(i=e.right=new x0).boundingData=l.getBounds(a=o,o=n-t,new Float32Array(6)),u(i,a,o,r+1)),e},r=[],i=this._getRootIndexRanges(e);if(1===i.length){var a=new x0,o=i[0];null!=e.boundingBox?a.boundingData=(t=e.boundingBox,(n=new Float32Array(6))[0]=t.min.x,n[1]=t.min.y,n[2]=t.min.z,n[3]=t.max.x,n[4]=t.max.y,n[5]=t.max.z,n):a.boundingData=l.getBounds(o.offset,o.count,new Float32Array(6)),u(a,o.offset,o.count),r.push(a)}else for(var d=0;do;)this.remove(this.children.pop())}}}class E0 extends he{constructor(e,t=10){super("MeshBVHVisualizer"),this.depth=t,this._mesh=e,this._roots=[],this.update()}update(){for(var e=this._mesh.geometry.boundsTree,t=e?e._roots.length:0;this._roots.length>t;)this._roots.pop();for(var n,r=0;r=this._roots.length?(n=new C0(this._mesh,this.depth,r),this.add(n),this._roots.push(n)):((n=this._roots[r]).depth=this.depth,n.update());this.position.copy(this._mesh.position),this.rotation.copy(this._mesh.rotation),this.scale.copy(this._mesh.scale)}}var L0=new Mr,R0=new gt,P0=ee.prototype.raycast;function I0(e,t){if(this.geometry.boundsTree){if(!this.isAuxClippingMesh&&void 0!==this.material){try{R0.copy(this.matrixWorld).invert()}catch(e){return}var n;L0.copy(e.ray).applyMatrix4(R0),!0===e.firstHitOnly?(n=this.geometry.boundsTree.raycastFirst(this,e,L0))&&t.push(n):this.geometry.boundsTree.raycast(this,e,L0,t)}}else P0.call(this,e,t)}function N0(e){return this.boundsTree=new A0(this,e),this.boundsTree}function D0(){this.boundsTree=null}var O0=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","gradientMap","lightMap","map","metalnessMap","normalMap","roughnessMap","specularMap"],F0={disposeTextures:function(t){if(O0.forEach(function(e){t[e]&&t[e].isTexture&&t[e].dispose()}),"MeshNodeMaterial"==t.type)for(var e in t.nodeTextures)t.nodeTextures[e]&&t.nodeTextures[e].dispose()}};class B0{constuctor(){this.name="",this.type="Constraint",this.mute=!1}_updateObjMatrixWorld(e){e.matrixAutoUpdate&&e.matrix.compose(e.position,e.quaternion,e.scale),null==e.parent?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(e.parent.matrixWorld,e.matrix)}update(e){this.mute}copy(e){return this.name=e.name,this.mute=e.mute,this}clone(){return(new this.constructor).copy(this)}}B0.prototype.isConstraint=!0;class z0 extends B0{constructor(e){super(),this.type="TargetConstraint",this.target=e}copy(e){return super.copy(e),this.target=e.target,this}clone(){return new this.constructor(this.target).copy(this)}}z0.prototype.isTargetConstraint=!0;const V0=new gt,U0=(new de).setFromAxisAngle(new vt(1,0,0),-Math.PI/2);class G0 extends z0{constructor(e){super(e),this.type="ChildOfConstraint",this.offsetMatrix=new gt,this.fixCameraLightRotation=!1}copy(e){return super.copy(e),this.offsetMatrix.copy(e.offsetMatrix),this.fixCameraLightRotation=e.fixCameraLightRotation,this}update(e){super.update(e),this.mute||(V0.multiplyMatrices(this.target.matrixWorld,this.offsetMatrix),V0.decompose(e.position,e.quaternion,e.scale),this.fixCameraLightRotation&&(e.isCamera||e.isLight)&&e.quaternion.multiply(U0))}}G0.prototype.isChildOfConstraint=!0;const k0=new vt,W0=new de,H0=new vt;class X0 extends z0{constructor(e){super(e),this.type="CopyLocationConstraint",this.useX=!0,this.useY=!0,this.useZ=!0,this.invertX=!1,this.invertY=!1,this.invertZ=!1,this.useOffset=!1,this.influence=1,this._firstIteration=!0,this._objPosInit=new vt,this._offset=new vt}copy(e){return super.copy(e),this.useX=e.useX,this.useY=e.useY,this.useZ=e.useZ,this.invertX=e.invertX,this.invertY=e.invertY,this.invertZ=e.invertZ,this.useOffset=e.useOffset,this.influence=e.influence,this._firstIteration=!1,this}update(e){super.update(e),this.mute||(this.target.matrixWorld.decompose(k0,W0,H0),this._firstIteration&&(this._updateObjMatrixWorld(e),e.getWorldPositionNU(this._objPosInit),this._offset.subVectors(k0,this._objPosInit),this._firstIteration=!1),this.useX&&(this.invertX&&(k0.x=-k0.x),this.useOffset&&(k0.x-=this._offset.x)),this.useY&&(this.invertY&&(k0.y=-k0.y),this.useOffset&&(k0.y-=this._offset.y)),this.useZ&&(this.invertZ&&(k0.z=-k0.z),this.useOffset&&(k0.z-=this._offset.z)),e.position.lerpVectors(this._objPosInit,k0,this.influence),e.parent&&e.parent.worldToLocal(e.position))}}X0.prototype.isCopyLocationConstraint=!0;const j0=(new de).setFromAxisAngle(new vt(1,0,0),-Math.PI/2),Y0=new vt,Z0=new de,q0=new vt;class Q0 extends z0{constructor(e){super(e),this.type="CopyRotationConstraint",this.useX=!0,this.useY=!0,this.useZ=!0,this.invertX=!1,this.invertY=!1,this.invertZ=!1,this.mixMode="REPLACE",this.influence=1,this.fixCameraLightRotation=!1,this._firstIteration=!0,this._objQuatInit=new de}copy(e){return super.copy(e),this.useX=e.useX,this.useY=e.useY,this.useZ=e.useZ,this.invertX=e.invertX,this.invertY=e.invertY,this.invertZ=e.invertZ,this.mixMode=e.mixMode,this.influence=e.influence,this.fixCameraLightRotation=e.fixCameraLightRotation,this._firstIteration=!1,this}update(e){super.update(e),this.mute||(this.target.matrixWorld.decompose(Y0,Z0,q0),this._firstIteration&&(this._updateObjMatrixWorld(e),e.matrixWorld.decompose(Y0,this._objQuatInit,q0),this._firstIteration=!1),e.quaternion.copy(this._objQuatInit),(this.useX||this.useY||this.useZ)&&("REPLACE"!=this.mixMode&&"ADD"!=this.mixMode&&("BEFORE"==this.mixMode?Z0.multiply(e.quaternion):"AFTER"==this.mixMode?Z0.premultiply(e.quaternion):this.mixMode),e.quaternion.slerp(Z0,this.influence)),e.parent&&(e.parent.matrixWorld.decompose(Y0,Z0,q0),e.quaternion.premultiply(Z0.invert())),this.fixCameraLightRotation&&(e.isCamera||e.isLight)&&e.quaternion.multiply(j0))}}Q0.prototype.isCopyRotationConstraint=!0;const K0=new vt,J0=new de,t=new vt;class $0 extends z0{constructor(e){super(e),this.type="CopyScaleConstraint",this.useX=!0,this.useY=!0,this.useZ=!0,this.power=1,this.useMakeUniform=!1,this.useOffset=!1,this.useAdd=!1,this.influence=1,this._objInitScale=new vt,this._volumeScaleFactor=new vt,this._firstIteration=!0}copy(e){return super.copy(e),this.useX=e.useX,this.useY=e.useY,this.useZ=e.useZ,this.power=e.power,this.useMakeUniform=e.useMakeUniform,this.useOffset=e.useOffset,this.useAdd=e.useAdd,this.influence=e.influence,this._firstIteration=!1,this}update(e){if(super.update(e),!this.mute){if(this.target.matrixWorld.decompose(K0,J0,t),this._firstIteration&&(this._updateObjMatrixWorld(e),e.matrixWorld.decompose(K0,J0,this._objInitScale),this._volumeScaleFactor.set(Math.pow(t.x-this._objInitScale.x,3),Math.pow(t.y-this._objInitScale.y,3),Math.pow(t.z-this._objInitScale.z,3)),this._firstIteration=!1),this.useMakeUniform){let e=1;this.useX&&(e*=t.x),this.useY&&(e*=t.y),this.useZ&&(e*=t.z),e=Math.pow(Math.cbrt(e),this.power),t.set(e,e,e),this.useOffset&&(this.useAdd?(t.add(this._objInitScale),t.addScalar(-1)):t.multiply(this._objInitScale))}else t.set(this.useX?Math.pow(t.x,this.power):this._objInitScale.x,this.useY?Math.pow(t.y,this.power):this._objInitScale.y,this.useZ?Math.pow(t.z,this.power):this._objInitScale.z),this.useOffset&&(this.useAdd?t.set(this.useX?t.x+this._objInitScale.x-1:t.x,this.useY?t.y+this._objInitScale.y-1:t.y,this.useZ?t.z+this._objInitScale.z-1:t.z):t.set(this.useX?t.x*this._objInitScale.x:t.x,this.useY?t.y*this._objInitScale.y:t.y,this.useZ?t.z*this._objInitScale.z:t.z));e.scale.copy(this._objInitScale),e.scale.lerp(t,this.influence)}}}$0.prototype.isCopyScaleConstraint=!0;const em=(new de).setFromAxisAngle(new vt(1,0,0),-Math.PI/2),tm=new gt,nm=new vt,rm=new de,im=new vt;class am extends z0{constructor(e){super(e),this.type="CopyTransformsConstraint",this.mixMode="REPLACE",this.influence=1,this.fixCameraLightRotation=!1,this._firstIteration=!0,this._objMatrixWorldInit=new gt}copy(e){return super.copy(e),this.mixMode=e.mixMode,this.influence=e.influence,this.fixCameraLightRotation=e.fixCameraLightRotation,this._firstIteration=!0,this}update(e){super.update(e),this.mute||(this._firstIteration&&(this._updateObjMatrixWorld(e),this._objMatrixWorldInit.copy(e.matrixWorld),this._firstIteration=!1),tm.copy(this.target.matrixWorld),"REPLACE"!=this.mixMode&&("BEFORE"==this.mixMode?tm.multiply(this._objMatrixWorldInit):"AFTER"==this.mixMode&&tm.premultiply(this._objMatrixWorldInit)),tm.decompose(nm,rm,im),this._objMatrixWorldInit.decompose(e.position,e.quaternion,e.scale),e.position.lerp(nm,this.influence),e.quaternion.slerp(rm,this.influence),e.scale.lerp(im,this.influence),this.fixCameraLightRotation&&(e.isCamera||e.isLight)&&e.quaternion.multiply(em))}}am.prototype.isCopyTransformsConstraint=!0;const om=(new de).setFromAxisAngle(new vt(1,0,0),-Math.PI/2),sm=new vt,lm=new de,cm=new vt,um=new vt,dm=new vt,hm=new vt,pm=new vt,fm={X:0,Y:1,Z:2,"-X":3,"-Y":4,"-Z":5},mm={0:new vt(1,0,0),1:new vt(0,1,0),2:new vt(0,0,1),3:new vt(-1,0,0),4:new vt(0,-1,0),5:new vt(0,0,-1)};class vm extends z0{constructor(e){super(e),this.type="DampedTrackConstraint",this.trackAxis="X",this.influence=1,this.fixCameraLightRotation=!1,this._firstIteration=!0}copy(e){return super.copy(e),this.trackAxis=e.trackAxis,this.influence=e.influence,this.fixCameraLightRotation=e.fixCameraLightRotation,this._firstIteration=!1,this}update(t){if(super.update(t),!this.mute&&(this.target.matrixWorld.decompose(sm,lm,cm),this._firstIteration&&(this._updateObjMatrixWorld(t),this._firstIteration=!1),t.matrixWorld.decompose(um,lm,cm),dm.subVectors(sm,um),0!=dm.length())){let e;if(dm.normalize(),hm.copy(mm[fm[this.trackAxis]]),hm.applyQuaternion(lm),0==hm.length()&&hm.copy(mm[fm[this.trackAxis]]),hm.normalize(),pm.crossVectors(hm,dm),e=hm.angleTo(dm),pm.length()r.x?r.copy(xm):r.x=Math.max(r.x,a.x);break;case"Y":a.y+=n*t.y,ym.subVectors(r,a),e=_m.dot(ym),_m.multiplyScalar(e),xm.subVectors(ym,_m).add(a),xm.y>r.y?r.copy(xm):r.y=Math.max(r.y,a.y);break;case"Z":a.z+=n*t.z,ym.subVectors(r,a),e=_m.dot(ym),_m.multiplyScalar(e),xm.subVectors(ym,_m).add(a),xm.z>r.z?r.copy(xm):r.z=Math.max(r.z,a.z);break;case"-X":a.x+=n*t.x,ym.subVectors(r,a),e=_m.dot(ym),_m.multiplyScalar(e),xm.subVectors(ym,_m).add(a),xm.x=this.distance&&(this._clampSurf=1,0!=this._distInit&&(this._sfac=this.distance/this._distInit)):"LIMITDIST_OUTSIDE"==this.limitMode?this._distInit<=this.distance&&(this._clampSurf=1,0!=this._distInit&&(this._sfac=this.distance/this._distInit)):"LIMITDIST_ONSURFACE"==this.limitMode&&this._distInit-this.distance!=0&&(this._clampSurf=1,0!=this._distInit&&(this._sfac=this.distance/this._distInit)),this._clampSurf&&(e.position.lerpVectors(this._objPosInit,Mm,(1-this._sfac)*this.influence),e.parent&&e.parent.worldToLocal(e.position)))}}Tm.prototype.isLimitDistanceConstraint=!0;class Cm extends B0{constructor(){super(),this.type="LimitLocationConstraint",this.min=(new vt).setScalar(-1/0),this.max=(new vt).setScalar(1/0)}copy(e){return super.copy(e),this.min.copy(e.min),this.max.copy(e.max),this}update(e){super.update(e),this.mute||e.position.clamp(this.min,this.max)}}Cm.prototype.isLimitLocationConstraint=!0;const Em=new Ir;class Lm extends B0{constructor(){super(),this.type="LimitRotationConstraint",this.axis="Y",this.min=0,this.max=2*Math.PI}copy(e){return super.copy(e),this.axis=e.axis,this.min=e.min,this.max=e.max,this}update(e){super.update(e),this.mute||("X"==this.axis?(Em.setFromQuaternion(e.quaternion,"XYZ"),Em.x=this._clampAngle(Em.x,this.min,this.max)):"Y"==this.axis?(Em.setFromQuaternion(e.quaternion,"YZX"),Em.y=this._clampAngle(Em.y,this.min,this.max)):"Z"==this.axis&&(Em.setFromQuaternion(e.quaternion,"ZXY"),Em.z=this._clampAngle(Em.z,this.min,this.max)),e.quaternion.setFromEuler(Em))}_clampAngle(e,t,n){return e=Math.abs(n-t)<2*Math.PI?zn(e,t,n):e}}Lm.prototype.isLimitRotationConstraint=!0;class Rm extends B0{constructor(){super(),this.type="LimitScaleConstraint",this.min=(new vt).setScalar(-1/0),this.max=(new vt).setScalar(1/0)}copy(e){return super.copy(e),this.min.copy(e.min),this.max.copy(e.max),this}update(e){super.update(e),this.mute||e.scale.clamp(this.min,this.max)}}Rm.prototype.isLimitScaleConstraint=!0;const Pm=(new de).setFromAxisAngle(new vt(1,0,0),-Math.PI/2),Im=new vt,Nm=new vt,Dm=new vt,Om=new vt,Fm=new vt,Bm=new xa,zm=new vt,Vm=new vt,Um=new de;class Gm extends z0{constructor(e){super(e),this.type="LockedTrackConstraint",this.trackAxis="X",this.lockAxis="Y",this.fixCameraLightRotation=!1}copy(e){return super.copy(e),this.trackAxis=e.trackAxis,this.lockAxis=e.lockAxis,this.fixCameraLightRotation=e.fixCameraLightRotation,this}update(e){var t;super.update(e),this.mute||(Dm.set("X"==this.trackAxis?1:"-X"==this.trackAxis?-1:0,"Y"==this.trackAxis?1:"-Y"==this.trackAxis?-1:0,"Z"==this.trackAxis?1:"-Z"==this.trackAxis?-1:0),Om.set("X"==this.lockAxis?1:0,"Y"==this.lockAxis?1:0,"Z"==this.lockAxis?1:0),1!=Math.abs(Dm.dot(Om))&&(Im.setFromMatrixPosition(e.matrixWorld),Nm.setFromMatrixPosition(this.target.matrixWorld),Bm.setFromNormalAndCoplanarPoint(Om,Im),Bm.projectPoint(Nm,Fm).sub(Im),t=0=this.minWidth&&n<=this.maxWidth&&r>=this.minHeight&&r<=this.maxHeight&&e?n>=this.minWidth&&n<=this.maxWidth&&r>=this.minHeight&&r<=this.maxHeight&&e?t.traverse(e=>{e.internVisible=!0}):t.traverse(e=>{e.internVisible=!1}):(t=this.findAlternativeCamera(t,this.appInstance.scene,n,r))&&this.appInstance.setCamera(t)}}findAlternativeCamera(e,t,r,i){let a,o,s=!1;return e&&t.traverse(function(t){if(!s&&t.isCamera&&t!=e)for(let e=0;e=n.minWidth&&r<=n.maxWidth&&i>=n.minHeight&&i<=n.maxHeight&&a&&(o?(console.error("CanvasBreakpointsConstraint: two or more alternative cameras"),s=!0):o=t)}}}),o}}s1.prototype.isCanvasBreakpointsConstraint=!0;var l1,c1,u1,pe={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE_BREAK:19,CAPS_LOCK:20,ESCAPE:27,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,INSERT:45,DELETE:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LEFT_WINDOW_KEY:91,RIGHT_WINDOW_KEY:92,SELECT_KEY:93,NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9:105,MULTIPLY:106,ADD:107,SUBTRACT:109,DECIMAL_POINT:110,DIVIDE:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUM_LOCK:144,SCROLL_LOCK:145,SEMI_COLON:186,EQUAL_SIGN:187,COMMA:188,DASH:189,PERIOD:190,FORWARD_SLASH:191,GRAVE_ACCENT:192,OPEN_BRACKET:219,BACK_SLASH:220,CLOSE_BRAKET:221,SINGLE_QUOTE:222};function d1(e){for(var t in this.isKeyDown={},pe)this.isKeyDown[pe[t]]=!1;this.onKeyDown=null,this.onKeyUp=null,this._domElement=e,this._keydownCb=function(e){this.isKeyDown[e.keyCode]=!0,this.onKeyDown&&this.onKeyDown(e)}.bind(this),this._keyupCb=function(e){this.isKeyDown[e.keyCode]=!1,this.onKeyUp&&this.onKeyUp(e)}.bind(this),this._domElement.addEventListener("keydown",this._keydownCb,!1),this._domElement.addEventListener("keyup",this._keyupCb,!1)}function h1(){this.posFrom=new vt,this.targetFrom=new vt,this.posTo=new vt,this.targetTo=new vt,this.sphericalFrom=new ad,this.sphericalTo=new ad,this.finishCb=function(){},this.movementType=0,this.active=!1,this.duration=0,this.clock=new _h}Object.assign(d1.prototype,{dispose:function(){this._domElement.removeEventListener("keydown",this._keydownCb,!1),this._domElement.removeEventListener("keyup",this._keyupCb,!1)}}),Object.assign(h1.prototype,{setup:(u1=new vt,function({posFrom:e=new vt,targetFrom:t=new vt,posTo:n=new vt,targetTo:r=new vt,finishCb:i=function(){},movementType:a=0}){return this.posFrom.copy(e),this.targetFrom.copy(t),this.posTo.copy(n),this.targetTo.copy(r),this.finishCb=i,this.movementType=a,1===this.movementType&&(u1.copy(this.posFrom).sub(this.targetFrom),this.sphericalFrom.setFromVector3(u1),u1.copy(this.posTo).sub(this.targetTo),this.sphericalTo.setFromVector3(u1),e=Fn(this.sphericalFrom.theta),t=Fn(this.sphericalTo.theta),(n=Math.abs(e-t))>Math.PI&&(t=e+Math.sign(e-t)*(2*Math.PI-n)),this.sphericalFrom.theta=e,this.sphericalTo.theta=t),this}),start(e){this.active=!0,this.duration=e,this.clock.start()},update:(l1=new vt,c1=new vt,function(e=function(e,t,n){}){var t,n,r,i=Cn(this.clock.getElapsedTime()/this.duration,0,1);c1.lerpVectors(this.targetFrom,this.targetTo,i),0===this.movementType?l1.lerpVectors(this.posFrom,this.posTo,i):1===this.movementType&&(t=Tn(this.sphericalFrom.radius,this.sphericalTo.radius,i),n=Tn(this.sphericalFrom.phi,this.sphericalTo.phi,i),r=Tn(this.sphericalFrom.theta,this.sphericalTo.theta,i),l1.setFromSphericalCoords(t,n,r),l1.add(c1)),e(i,l1,c1),1<=i&&(this.active=!1,this.finishCb())})});class p1 extends n{constructor(F,e){super();var l=this;this.object=F,this.domElement=void 0!==e?e:document,this.enabled=!0,this.screen={left:0,top:0,width:0,height:0},this.enableDamping=!0,this.enableRotate=!0,this.rotateSpeed=.9,this.rotateSpeedTouch=.75,this.rotateInertia=.05,this.rotateInertiaTouch=.05,this.enableZoom=!0,this.zoomSpeed=30,this.zoomSpeedKey=.2,this.zoomInertia=.05,this.enablePan=!0,this.panSpeedKey=.15,this.panInertia=.05,this.enableKeys=!0,this.gazeLevel=1.8,this.storyHeight=3;let t=!(this.collisionMeshes=[]);Object.defineProperty(this,"enablePointerLock",{get(){return t},set(e){t!==e&&(t=e,$())}}),Object.defineProperty(this,"inTween",{get(){return R.active}});var c,n,s,u,d,h=new _h,B=new vt,p=new vt,z=new vt,f=new vt,V=new de,m=new vt,v={},r=(v[pe.W]=v[pe.S]=v[pe.A]=v[pe.D]=v[pe.UP_ARROW]=v[pe.DOWN_ARROW]=v[pe.LEFT_ARROW]=v[pe.RIGHT_ARROW]=0,!1),g=new ad,_=new ad,x=new Be,y=1,b=1,i=new Be,a=new Be,M=0,A=0,w=1,S=1,T=new Be,C=new Be,U=1,G=1,E=new Ws(new vt,new vt(0,-1,0)),L=E.params.checkVisibility=!1,R=new h1,k={type:"change"},o={type:"start"},P={type:"end"},I=(this.handleResize=function(){var e,t;this.domElement===document?(this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight):(e=this.domElement.getBoundingClientRect(),t=this.domElement.ownerDocument.documentElement,this.screen.left=e.left+window.pageXOffset-t.clientLeft,this.screen.top=e.top+window.pageYOffset-t.clientTop,this.screen.width=e.width,this.screen.height=e.height)},this.handleEvent=function(e){"function"==typeof this[e.type]&&this[e.type](e)},n=new Be,function(e,t){return n.set((e-.5*l.screen.width-l.screen.left)/(.5*l.screen.width),(l.screen.height+2*(l.screen.top-t))/l.screen.width),n});const W=function(){const n=new Be;return function(e,t){return n.set(e,-t).multiplyScalar(2/l.screen.width)}}();function H(e){!1!==l.enabled&&(e.preventDefault(),!1!==l.enableRotate&&(a.copy(I(e.pageX,e.pageY).negate()),i.copy(a),r=!0,document.addEventListener("mousemove",N,!1),document.addEventListener("mouseup",D,!1),document.addEventListener("mouseleave",D,!1),l.dispatchEvent(o)))}function N(e){!1!==l.enabled&&(e.preventDefault(),r&&!1!==l.enableRotate&&(a.copy(I(e.pageX,e.pageY).negate()),x.add(a).sub(i),i.copy(a),y=l.rotateSpeed,b=l.rotateInertia))}function D(e){!1!==l.enabled&&(e.preventDefault(),r=!1,document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",D),document.removeEventListener("mouseleave",D),l.dispatchEvent(P))}function X(e){if(!1!==l.enabled&&!1!==l.enableZoom){switch(e.preventDefault(),e.stopPropagation(),e.deltaMode){case 2:A-=.025*e.deltaY,w=l.zoomSpeed,S=l.zoomInertia;break;case 1:A-=.01*e.deltaY,w=l.zoomSpeed,S=l.zoomInertia;break;default:A-=25e-5*e.deltaY,w=l.zoomSpeed,S=l.zoomInertia}l.dispatchEvent(o),l.dispatchEvent(P)}}function j(e){!1!==l.enabled&&(e=e.touches[0],r=!0,a.copy(I(e.pageX,e.pageY).negate()),i.copy(a),l.dispatchEvent(o))}function Y(e){!1!==l.enabled&&(e.preventDefault(),e=e.touches[0],!1!==l.enableRotate&&(a.copy(I(e.pageX,e.pageY).negate()),x.add(a).sub(i),i.copy(a),y=l.rotateSpeedTouch,b=l.rotateInertiaTouch))}function Z(e){if(!1!==l.enabled){if(0===e.touches.length)r=!1;else{if(!1===l.enableRotate)return;r=!0,a.copy(I(e.touches[0].pageX,e.touches[0].pageY).negate()),i.copy(a)}l.dispatchEvent(P)}}function q(e){!1!==l.enabled&&e.preventDefault()}function Q(e){l.domElement.requestPointerLock()}function K(e){document.pointerLockElement===l.domElement?(l.dispatchEvent(o),document.addEventListener("mousemove",O)):(l.dispatchEvent(P),document.removeEventListener("mousemove",O))}function J(e){console.error("Pointer lock failed")}function O(e){e.preventDefault(),l.enabled&&l.enableRotate&&(x.add(W(e.movementX,e.movementY).negate()),y=l.rotateSpeed,b=l.rotateInertia)}function $(){ee(),l.domElement.addEventListener("contextmenu",q),l.enablePointerLock?(l.domElement.addEventListener("click",Q),document.addEventListener("pointerlockchange",K),document.addEventListener("pointerlockerror",J)):l.domElement.addEventListener("mousedown",H),l.domElement.addEventListener("wheel",X),l.domElement.addEventListener("touchstart",j),l.domElement.addEventListener("touchend",Z),l.domElement.addEventListener("touchmove",Y),(c=new d1(window)).onKeyDown=function(e){e.keyCode in v&&(v[e.keyCode]=1)}}function ee(){l.domElement.removeEventListener("contextmenu",q),l.domElement.removeEventListener("click",Q),document.removeEventListener("pointerlockchange",K),document.removeEventListener("pointerlockerror",J),document.removeEventListener("mousemove",O),l.domElement.removeEventListener("mousedown",H),l.domElement.removeEventListener("wheel",X),l.domElement.removeEventListener("touchstart",j),l.domElement.removeEventListener("touchend",Z),l.domElement.removeEventListener("touchmove",Y),document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",D),document.removeEventListener("mouseleave",D),c&&c.dispose()}this.update=function(){if(R.active)R.update(function(e,t,n){if(l.object.position.copy(t),l.object.lookAt(n),1<=e){for(var r in _.set(0,0,0),x.set(0,0),A=M=0,T.set(0,0),C.set(0,0),v)v[r]=0;h.getDelta()}});else{l.object.getLocalDirection(m),g.setFromVector3(m),g.theta+=_.theta*y,g.phi+=_.phi*y,g.makeSafe(),m.setFromSpherical(g),B.copy(m).add(l.object.position),l.object.lookAtLocal(B),l.object.isPerspectiveCamera?l.object.position.addScaledVector(m,M):l.object.isOrthographicCamera&&(l.object.zoom*=1+.15*M,l.object.updateProjectionMatrix()),p.copy(m).cross(l.object.up).setLength(-T.x),p.add(z.copy(l.object.up).setLength(T.y)),l.object.position.add(p);var e,t=h.getDelta();for(e in _.set(_.radius,x.y,x.x),x.x=l.enableDamping?On(x.x,0,t,b,.001):0,x.y=l.enableDamping?On(x.y,0,t,b,.001):0,_.set(_.radius,_.phi-x.y,_.theta-x.x),T.copy(C),C.x=l.enableDamping?On(C.x,0,t,G,.001):0,C.y=l.enableDamping?On(C.y,0,t,G,.001):0,T.sub(C),T.multiplyScalar(U),M=A,A=l.enableDamping?On(A,0,t,S,.001):0,M=(M-A)*w,v){var n,r=e==pe.A||e==pe.LEFT_ARROW||e==pe.D||e==pe.RIGHT_ARROW,i=e==pe.W||e==pe.UP_ARROW||e==pe.S||e==pe.DOWN_ARROW,a=r?l.panInertia:l.zoomInertia,o=r?l.panSpeedKey:l.zoomSpeedKey;a=c.isKeyDown[e]?v[e]=1:(n=v[e],v[e]=On(v[e],0,t,a,.001),n-v[e]),l.enabled&&l.enableKeys&&(r&&!l.enablePan||i&&!l.enableZoom||(a*=60*t*o,e==pe.A||e==pe.LEFT_ARROW?T.x+=a:e==pe.D||e==pe.RIGHT_ARROW?T.x-=a:e==pe.W||e==pe.UP_ARROW?M+=a:e!=pe.S&&e!=pe.DOWN_ARROW||(M-=a)))}}l.collisionMeshes.length&&(E.ray.origin.copy(l.object.position),E.far=l.storyHeight,0<(s=E.intersectObjects(l.collisionMeshes)).length?(s=s[0],l.object.position.y=s.point.y+l.gazeLevel,L=!0):L&&l.object.position.copy(f));var s=!1;1e-6Math.abs(t)&&(y+=e,b=l.zoomSpeedTouch,M=l.zoomInertiaTouch),l.enablePan&&Math.abs(e)<=Math.abs(t)&&(T.add(n),C=l.panSpeedTouch,E=l.panInertiaTouch))}}function K(e){if(!1!==l.enabled){switch(e.touches.length){case 0:a=i.NONE;break;case 1:if(!1===l.enableRotate)return;a=i.TOUCH_ROTATE,_.copy(D(e.touches[0].pageX,e.touches[0].pageY).negate()),o.copy(_)}l.dispatchEvent(t)}}function J(e){!1!==l.enabled&&e.preventDefault()}this.update=function(){if(P.active)P.update(function(e,t,n){if(l.object.position.copy(t),l.object.lookAt(n),1<=e){for(var r in f.set(0,0,0),m.set(0,0),y=x=0,S.set(0,0),T.set(0,0),d)d[r]=0;U.getDelta()}});else{l.object.getLocalDirection(u),p.setFromVector3(u),p.theta+=f.theta*v,p.phi+=f.phi*v,p.theta=Math.max(l.minAzimuthAngle,Math.min(l.maxAzimuthAngle,p.theta)),p.phi=Math.max(l.minPolarAngle,Math.min(l.maxPolarAngle,p.phi)),p.makeSafe(),u.setFromSpherical(p),G.copy(u).add(l.object.position),l.object.lookAtLocal(G),l.object.isPerspectiveCamera?l.object.position.addScaledVector(u,x):l.object.isOrthographicCamera&&(l.object.zoom*=1+.15*x,l.object.updateProjectionMatrix()),c.copy(u).cross(l.object.up).setLength(-S.x),c.add(k.copy(l.object.up).setLength(S.y)),l.object.position.add(c);var e,t=U.getDelta();for(e in f.set(f.radius,m.y,m.x),m.x=l.enableDamping?On(m.x,0,t,g,.001):0,m.y=l.enableDamping?On(m.y,0,t,g,.001):0,f.set(f.radius,f.phi-m.y,f.theta-m.x),S.copy(T),T.x=l.enableDamping?On(T.x,0,t,E,.001):0,T.y=l.enableDamping?On(T.y,0,t,E,.001):0,S.sub(T),S.multiplyScalar(C),x=y,y=l.enableDamping?On(y,0,t,M,.001):0,x=(x-y)*b,d){var n,r=e==pe.A||e==pe.LEFT_ARROW||e==pe.D||e==pe.RIGHT_ARROW,i=e==pe.W||e==pe.UP_ARROW||e==pe.S||e==pe.DOWN_ARROW,a=r?l.panInertia:l.zoomInertia,o=r?l.panSpeedKey:l.zoomSpeedKey;a=h.isKeyDown[e]?d[e]=1:(n=d[e],d[e]=On(d[e],0,t,a,.001),n-d[e]),l.enabled&&l.enableKeys&&(r&&!l.enablePan||i&&!l.enableZoom||(a*=60*t*o,e==pe.A||e==pe.LEFT_ARROW?S.x+=a:e==pe.D||e==pe.RIGHT_ARROW?S.x-=a:e==pe.W||e==pe.UP_ARROW?x+=a:e!=pe.S&&e!=pe.DOWN_ARROW||(x-=a)))}}var s=!1;1e-6k||8*(1-d.dot(h.object.quaternion))>k)&&(h.dispatchEvent(G),u.copy(h.object.position),d.copy(h.object.quaternion),!(x=!1))}),this.dispose=function(){h.domElement.removeEventListener("contextmenu",ue,!1),h.domElement.removeEventListener("mousedown",ie,!1),h.domElement.removeEventListener("wheel",oe,!1),h.domElement.removeEventListener("touchstart",se,!1),h.domElement.removeEventListener("touchend",ce,!1),h.domElement.removeEventListener("touchmove",le,!1),document.removeEventListener("mousemove",ae,!1),document.removeEventListener("mouseup",F,!1),document.removeEventListener("mouseleave",F,!1),W.dispose()},this.tween=(U=new vt,a=new vt,function(e,t,n,r,i){h.targetObj.updateWorldMatrix(!0,!1),a.setFromMatrixPosition(h.targetObj.matrixWorld),h.object.parent&&(e=U.copy(e),h.object.parent.worldToLocal(e));e.manhattanDistanceTo(h.object.position)<1e-5&&t.manhattanDistanceTo(a)<1e-5?void 0!==r&&r():D.setup({posFrom:h.object.position,targetFrom:a,posTo:e,targetTo:t,finishCb:r,movementType:i}).start(n)});var z,o,s,l,c,V,u,d,U,a,h=this,G={type:"change"},i={type:"start"},t={type:"end"},p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY_PAN:4},f=p.NONE,k=1e-6,m=new ad,v=new ad,g=1,_=new vt,x=!1,y={},W=(y[pe.W]=y[pe.S]=y[pe.A]=y[pe.D]=y[pe.UP_ARROW]=y[pe.DOWN_ARROW]=y[pe.LEFT_ARROW]=y[pe.RIGHT_ARROW]=0,new d1(window)),b=(W.onKeyDown=function(e){e.keyCode in y&&(y[e.keyCode]=1)},new Be),H=new Be,M=new Be,A=new Be,w=1,S=1,T=new Be,C=new Be,E=new Be,L=new Be,R=new Be,P=new Be,I=new Be,N=1,X=1,j=1,Y=new _h,D=new h1;function O(){return Math.pow(.95,X)}function Z(e){v.theta-=e}function q(e,t){H.set(e,t),A.add(H).sub(b),b.copy(H)}n=new vt;var n,r,Q,K,J=function(e,t){n.setFromMatrixColumn(t,0),n.multiplyScalar(-e),_.add(n)},$=(r=new vt,function(e,t){!0===h.screenSpacePanning?r.setFromMatrixColumn(t,1):(r.setFromMatrixColumn(t,0),r.crossVectors(h.object.up,r)),r.multiplyScalar(e),_.add(r)}),ee=(Q=new vt,K=new vt,function(e,t){var n,r=h.domElement===document?h.domElement.body:h.domElement,i=r.clientWidth,r=r.clientHeight;i&&r&&(h.object.isPerspectiveCamera?(h.targetObj.updateWorldMatrix(!0,!1),K.setFromMatrixPosition(h.targetObj.matrixWorld),n=h.object.position,Q.copy(n).sub(K),n=Q.length(),n*=Math.tan(h.object.fov/2*Mn),J(2*e*n/r,h.object.matrix),$(2*t*n/r,h.object.matrix)):h.object.isOrthographicCamera?(J(e*(h.object.right-h.object.left)/h.object.zoom/i,h.object.matrix),$(t*(h.object.top-h.object.bottom)/h.object.zoom/r,h.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),h.enablePan=!1))});function te(e){h.object.isPerspectiveCamera?N/=e:h.object.isOrthographicCamera?(N/=e,x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),h.enableZoom=!1)}function ne(e){h.object.isPerspectiveCamera?N*=e:h.object.isOrthographicCamera?(N*=e,x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),h.enableZoom=!1)}function re(e){var t;t=e.clientX,e=e.clientY,C.set(t,e),L.add(C).sub(T),T.copy(C)}function ie(e){if(!1!==h.enabled){switch(e.preventDefault(),e.button){case h.mouseButtons.ROTATE:if(!1===h.enableRotate)return;b.set(e.clientX,e.clientY),f=p.ROTATE;break;case h.mouseButtons.ZOOM:case h.mouseButtons.PAN:if(!1===h.enablePan)return;T.set(e.clientX,e.clientY),f=p.PAN}f!==p.NONE&&(document.addEventListener("mousemove",ae,!1),document.addEventListener("mouseup",F,!1),document.addEventListener("mouseleave",F,!1),h.dispatchEvent(i))}}function ae(e){if(!1!==h.enabled)switch(e.preventDefault(),f){case p.ROTATE:if(!1===h.enableRotate)return;q(e.clientX,e.clientY),w=h.rotateSpeed,S=h.rotateInertia;break;case p.DOLLY:if(!1===h.enableZoom)return;P.set(e.clientX,e.clientY),I.subVectors(P,R),0Math.abs(E.length())&&(0 + + gl_FragColor = linearToOutputTexel(gl_FragColor); + } + `}),this.shader.map=e,this.shader.uniforms.cubemap.value=e,this.planeMesh=new ee(new Sa(2,2),this.shader),this.scene=new Js,this.scene.add(this.camera),this.scene.add(this.planeMesh)}function g1(e,t){this.sourceTexture=e,this.resolution=void 0!==t?t:256;e=this.resolution,t={format:this.sourceTexture.format,magFilter:this.sourceTexture.magFilter,minFilter:this.sourceTexture.minFilter,type:this.sourceTexture.type,generateMipmaps:this.sourceTexture.generateMipmaps,anisotropy:this.sourceTexture.anisotropy,encoding:this.sourceTexture.encoding};this.renderTarget=new fa(e,e,t),this.renderTarget.texture.name="EquiCube.cube",this.camera=new Rs(-1,1,1,-1,0,1e3),this.shader=new T(E.equicube),this.planeMesh=new ee(new Sa(2,2),this.shader),this.planeMesh.material.side=Ue,this.scene=new Js,this.scene.add(this.planeMesh),this.scene.add(this.camera),this.invertU=!1,this.offsetU=0,this.shader.uniforms.tEquirect.value=this.sourceTexture}Object.defineProperties(m1.prototype,{center:{get:function(){return console.warn("v3d.OrbitControls: .center has been deprecated, use .targetObj instead"),new vt}},target:{get:function(){return console.warn("v3d.OrbitControls: .target has been deprecated, use .targetObj instead"),new vt},set:function(){console.warn("v3d.OrbitControls: .target has been deprecated, use .targetObj instead")}},noZoom:{get:function(){return console.warn("v3d.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("v3d.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("v3d.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("v3d.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("v3d.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("v3d.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("v3d.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("v3d.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("v3d.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(e){console.warn("v3d.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!e}}}),v1.prototype={constructor:v1,render:function(e,t,n=1){var r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=1,e.toneMappingExposure=n;for(var o=0;o<6;o++)e.setRenderTarget(t,o),this.shader.uniforms.faceIdx.value=o,e.render(this.scene,this.camera);e.toneMapping=r,e.toneMappingExposure=i,e.setRenderTarget(a)},dispose:function(){this.planeMesh.geometry.dispose(),this.planeMesh.material.dispose()}},g1.prototype={constructor:g1,update:function(e){var t=e.gammaInput,n=e.gammaOutput,r=e.toneMapping,i=e.toneMappingExposure,a=e.getRenderTarget();e.toneMapping=1,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1,this.renderToCubeMapTarget(e,this.renderTarget),e.setRenderTarget(a),e.toneMapping=r,e.toneMappingExposure=i,e.gammaInput=t,e.gammaOutput=n},renderToCubeMapTarget:function(e,t){this.shader.uniforms.invertU.value=this.invertU,this.shader.uniforms.offsetU.value=this.offsetU;for(var n=0;n<6;n++)this.renderToCubeMapTargetFace(e,t,n)},renderToCubeMapTargetFace:function(e,t,n){this.shader.uniforms.faceIndex.value=n,e.setRenderTarget(t,n),e.render(this.scene,this.camera)},dispose:function(){this.renderTarget.dispose(),this.planeMesh.geometry.dispose(),this.planeMesh.material.dispose()}};class _1 extends n{constructor(){super(),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setCamera(e){}setSize(e,t){}dispose(){}render(e,t,n,r,i){console.error("v3d.Pass: .render() must be implemented in derived pass.")}}const x1=new Rs(-1,1,1,-1,0,1),y1=new Sa(2,2);class b1{constructor(e){this._mesh=new ee(y1,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,x1)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}static dispose(){y1.dispose()}}class M1 extends _1{constructor(e,t,n){super(),this.damp=t,this.shader=E.afterimage,this.uniforms=ca.clone(this.shader.uniforms),this.uniforms.damp.value=this.damp,this.textureComp=new ze(e.x,e.y,n),this.textureOld=new ze(e.x,e.y,n),this.shaderMaterial=new T({uniforms:this.uniforms,vertexShader:this.shader.vertexShader,fragmentShader:this.shader.fragmentShader}),this.compFsQuad=new b1(this.shaderMaterial);t=new fi;this.copyFsQuad=new b1(t)}dispose(){this.textureComp.dispose(),this.textureOld.dispose()}render(e,t,n,r,i){this.uniforms.tOld.value=this.textureOld.texture,this.uniforms.tNew.value=n.texture,this.uniforms.damp.value=this.damp,e.setRenderTarget(this.textureComp),this.compFsQuad.render(e),this.copyFsQuad.material.map=this.textureComp.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.copyFsQuad.render(e);n=this.textureOld;this.textureOld=this.textureComp,this.textureComp=n}setSize(e,t){this.textureComp.setSize(e,t),this.textureOld.setSize(e,t)}}class A1 extends _1{constructor(e,t,n,r,i){super(),this.strength=void 0!==t?t:1,this.radius=n,this.threshold=r,this.resolution=void 0!==e?new Be(e.x,e.y):new Be(256,256),i=i||{minFilter:ht,magFilter:ht,format:pt},this.clearColor=new _t(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;var a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);this.renderTargetBright=new ze(a,o,i),this.renderTargetBright.texture.name="BloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(var s=0;sMADE WITH VERGE3D TRIAL`,t.appendChild(r),setTimeout(function(){t.contains(r)&&890310108==Nn(r.textContent)||e.dispose()},1e3)}},isXML:function(e){return null!==e.match(/.*\.xml$/)},isJS:function(e){return null!==e.match(/.*\.js$/)},createLineObjectHTML:function(d,h,p,e,t,f){console.warn("v3d.AppUtils.createLineObjectHTML has been deprecated. Use v3d.LineHTML instead."),e=e||2,t=t?t.convertSRGBToLinear():new _t(1,0,.2),f=f||5;const m=new vt(1,0,0),n=new P1;n.setGeometry([0,0,0,m.x,m.y,m.z]);t=new B1({color:t,lineWidth:e,sizeAttenuation:0});const v=new ee(n.geometry,t),g=(v.name=h.name+"_LINE",h.add(v),new vt),_=new vt,x=new de;d.renderCallbacks.push(function(){d.camera.updateMatrixWorld(),h.traverseAncestors(function(e){e.updateMatrixWorld()});var e=p.getBoundingClientRect(),t=(e.left+e.right)/2,n=(e.top+e.bottom)/2;const r=h.getWorldPosition(g);r.project(d.camera);var i=(r.x+1)/2*d.getWidth(),a=(1-r.y)/2*d.getHeight(),o=(n-a)/(t-i),s=(e.height+2*f)/(e.width+2*f);let l,c;Math.abs(o)>s?(c=nt.type?1:e.width!=t.width?t.width-e.width:t.height-e.height});for(let e=0;e{!e.isCubeReflectionProbe&&this._isVisible(e)||(n[e.id]=e.layers.mask,e.layers.disableAll())}),e.worldMaterial);var i=null!==r&&r.isMeshNodeMaterial&&r.needsLightPathDir();let a;i&&(a=r.defines.LIGHT_PATH_IS_CAM_RAY,r.defines.LIGHT_PATH_IS_CAM_RAY=0),Y1.renderSceneToCubemap(e,t,this._renderTargetCube,{camPos:this.position,clipStart:this.probeClipStart,clipEnd:this.probeClipEnd}),this._exposureRenderTargetCube.texture.type=this._renderTargetCube.texture.type;const o=new v1(this._renderTargetCube.texture);o.render(t,this._exposureRenderTargetCube,this.probeIntensity),o.dispose(),this.renderTarget=this.onUpdate(this._exposureRenderTargetCube),i&&(r.defines.LIGHT_PATH_IS_CAM_RAY=a),e.traverse(e=>{!e.isCubeReflectionProbe&&this._isVisible(e)||(e.layers.mask=n[e.id])})}onUpdate(e){return e}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}copy(e){return super.copy(e),this.influenceType=e.influenceType,this.influenceDistance=e.influenceDistance,this.parallaxType=e.parallaxType,this.parallaxDistance=e.parallaxDistance,this.probeClipStart=e.probeClipStart,this.probeClipEnd=e.probeClipEnd,this.probeIntensity=e.probeIntensity,this.visibilityGroup=e.visibilityGroup,this.visibilityGroupInv=e.visibilityGroupInv,this.influenceGroup=e.influenceGroup,this.influenceGroupInv=e.influenceGroupInv,this.setSize(e._renderTargetCube.width),this.matrixWorldInverse.copy(e.matrixWorldInverse),this}dispose(){null!==this._renderTargetCube&&this._renderTargetCube.dispose(),null!==this._exposureRenderTargetCube&&this._exposureRenderTargetCube.dispose(),null!==this.renderTarget&&(this.renderTarget.dispose(),this.renderTarget=null),this.dispatchEvent({type:"dispose"})}_isVisible(e){return null===this.visibilityGroup||(!e.isMesh||-1!==e.groupNames.indexOf(this.visibilityGroup)^this.visibilityGroupInv)}}$1.prototype.isCubeReflectionProbe=!0;class ev{constructor(e,t){var n;this.renderer=e,void 0===t&&(n={minFilter:ht,magFilter:ht,format:pt,stencilBuffer:!0},e=e.getDrawingBufferSize(),(t=new ze(e.width,e.height,n)).texture.name="EffectComposer.rt1",t.texture.encoding=on),this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new S1(E.copy),this._previousFrameTime=Date.now(),this._pixelRatio=1}swapBuffers(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e);var t=this.renderer.getDrawingBufferSize(new Be);e.setSize(t.width,t.height)}insertPass(e,t){this.passes.splice(t,0,e)}isLastEnabledPass(e){for(var t=e+1;t>2,n=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),l+=String.fromCharCode(r<<2|i>>4),64!==a&&(l+=String.fromCharCode(t)),64!==o&&(l+=String.fromCharCode(n)),c>>0)s(0|e,0|t,0|n);else{if(r=e+n|0,3&(e^t)){if(r>>>0<4)n=e;else if((i=r-4|0)>>>0>>0)n=e;else for(n=e;;)if(y[0|n]=M[0|t],y[n+1|0]=M[t+1|0],y[n+2|0]=M[t+2|0],y[n+3|0]=M[t+3|0],t=t+4|0,!((n=n+4|0)>>>0<=i>>>0))break}else{e:if((0|n)<1)n=e;else if(3&e)for(n=e;;){if(y[0|n]=M[0|t],t=t+1|0,r>>>0<=(n=n+1|0)>>>0)break e;if(!(3&n))break}else n=e;if(!((e=-4&r)>>>0<64||(i=e+-64|0)>>>0>>0))for(;;)if(b[n>>2]=b[t>>2],b[n+4>>2]=b[t+4>>2],b[n+8>>2]=b[t+8>>2],b[n+12>>2]=b[t+12>>2],b[n+16>>2]=b[t+16>>2],b[n+20>>2]=b[t+20>>2],b[n+24>>2]=b[t+24>>2],b[n+28>>2]=b[t+28>>2],b[n+32>>2]=b[t+32>>2],b[n+36>>2]=b[t+36>>2],b[n+40>>2]=b[t+40>>2],b[n+44>>2]=b[t+44>>2],b[n+48>>2]=b[t+48>>2],b[n+52>>2]=b[t+52>>2],b[n+56>>2]=b[t+56>>2],b[n+60>>2]=b[t+60>>2],t=t- -64|0,!((n=n- -64|0)>>>0<=i>>>0))break;if(!(e>>>0<=n>>>0))for(;;)if(b[n>>2]=b[t>>2],t=t+4|0,!((n=n+4|0)>>>0>>0))break}if(n>>>0>>0)for(;;)if(y[0|n]=M[0|t],t=t+1|0,(0|r)==(0|(n=n+1|0)))break}}function T(e,t,n){if(n^=-1,t)for(;;)if(n=b[1056+((M[0|e]^255&n)<<2)>>2]^n>>>8,e=e+1|0,!(t=t+-1|0))break;return-1^n}function p(e){var t;e&&(t=b[e+1200>>2],b[t+60>>2]&&C(b[t+24>>2]),C(t),C(e))}function f(e){var t;return!((0|(e=(t=b[263312])+(e+3&-4)|0))<=-1)&&(e>>>0<=(a.byteLength/65536|0)<<16>>>0||l(0|e))?(b[263312]=e,t):(b[263185]=48,-1)}function C(e){var t,n=0,r=0,i=0,a=0,o=0,s=0;e:if(e){t=(i=e+-8|0)+(e=-8&(r=b[e+-4>>2]))|0;t:if(!(1&r)){if(!(3&r))break e;if((i=i-(r=b[i>>2])|0)>>>0>>0<=255)a=b[i+8>>2],r=r>>>3|0,(0|(n=b[i+12>>2]))==(0|a)?b[263186]=b[263186]&N(r):(b[a+12>>2]=n,b[n+8>>2]=a);else{if(s=b[i+24>>2],(0|i)!=(0|(r=b[i+12>>2])))n=b[i+8>>2],b[n+12>>2]=r,b[r+8>>2]=n;else if((n=b[(a=i+20|0)>>2])||(n=b[(a=i+16|0)>>2])){for(;;)if(o=a,!((n=b[(a=(r=n)+20|0)>>2])||(a=r+16|0,n=b[r+16>>2])))break;b[o>>2]=0}else r=0;if(s){a=b[i+28>>2];n:{if(b[(n=1053048+(a<<2)|0)>>2]==(0|i)){if(b[n>>2]=r)break n;b[263187]=b[263187]&N(a);break t}if(!(b[s+(b[s+16>>2]==(0|i)?16:20)>>2]=r))break t}b[r+24>>2]=s,(n=b[i+16>>2])&&(b[r+16>>2]=n,b[n+24>>2]=r),(n=b[i+20>>2])&&(b[r+20>>2]=n,b[n+24>>2]=r)}}else if(3==(3&(r=b[4+t>>2])))return b[263188]=e,b[4+t>>2]=-2&r,b[i+4>>2]=1|e,void(b[e+i>>2]=e)}if(!(t>>>0<=i>>>0)&&1&(r=b[4+t>>2])){t:{if(!(2&r)){if(b[263192]==(0|t)){if(b[263192]=i,e=b[263189]+e|0,b[263189]=e,b[i+4>>2]=1|e,b[263191]!=(0|i))break e;return b[263188]=0,void(b[263191]=0)}if(b[263191]==(0|t))return b[263191]=i,e=b[263188]+e|0,b[263188]=e,b[i+4>>2]=1|e,void(b[e+i>>2]=e);e=(-8&r)+e|0;n:if(r>>>0<=255)r=r>>>3|0,(0|(n=b[8+t>>2]))==(0|(a=b[12+t>>2]))?b[263186]=b[263186]&N(r):(b[n+12>>2]=a,b[a+8>>2]=n);else{if(s=b[24+t>>2],(0|t)!=(0|(r=b[12+t>>2])))n=b[8+t>>2],b[n+12>>2]=r,b[r+8>>2]=n;else if((n=b[(a=20+t|0)>>2])||(n=b[(a=16+t|0)>>2])){for(;;)if(o=a,!((n=b[(a=(r=n)+20|0)>>2])||(a=r+16|0,n=b[r+16>>2])))break;b[o>>2]=0}else r=0;if(s){a=b[28+t>>2];r:{if(b[(n=1053048+(a<<2)|0)>>2]==(0|t)){if(b[n>>2]=r)break r;b[263187]=b[263187]&N(a);break n}if(!(b[s+(b[s+16>>2]==(0|t)?16:20)>>2]=r))break n}b[r+24>>2]=s,(n=b[16+t>>2])&&(b[r+16>>2]=n,b[n+24>>2]=r),(n=b[20+t>>2])&&(b[r+20>>2]=n,b[n+24>>2]=r)}}if(b[i+4>>2]=1|e,b[e+i>>2]=e,b[263191]!=(0|i))break t;return void(b[263188]=e)}b[4+t>>2]=-2&r,b[i+4>>2]=1|e,b[e+i>>2]=e}if(e>>>0<=255)return r=1052784+((e=e>>>3|0)<<3)|0,e=(n=b[263186])&(e=1<>2]:(b[263186]=e|n,r),b[r+8>>2]=i,b[e+12>>2]=i,b[i+12>>2]=r,void(b[i+8>>2]=e);b[i+16>>2]=0,(a=e>>>8|(n=b[i+20>>2]=0))&&(n=31,16777215>>0||(n=a,n=28+((n=((n=(n<<=a=a+1048320>>>16&8)<<(s=n+520192>>>16&4))<<(o=n+245760>>>16&2)>>>15|0)-(o|a|s)|0)<<1|e>>>n+21&1)|0)),o=1053048+((b[(r=i)+28>>2]=n)<<2)|0;t:{n:{if((a=b[263187])&(r=1<>>1|0)|0),r=b[o>>2];;){if((-8&b[(n=r)+4>>2])==(0|e))break n;if(r=a>>>29|0,a<<=1,!(r=b[(o=n+(4&r)|0)+16>>2]))break}b[o+16>>2]=i,b[i+24>>2]=n}else b[263187]=r|a,b[o>>2]=i,b[i+24>>2]=o;b[i+12>>2]=i,b[i+8>>2]=i;break t}e=b[n+8>>2],b[e+12>>2]=i,b[n+8>>2]=i,b[i+24>>2]=0,b[i+12>>2]=n,b[i+8>>2]=e}if(e=b[263194]+-1|0,!(b[263194]=e)){for(i=1053200;;)if(i=(e=b[i>>2])+8|0,!e)break;b[263194]=-1}}}}function E(e,t){var n;if(t&&(y[(n=e+t|0)-1|0]=0,!(t>>>(y[0|e]=0)<3||(y[n-2|0]=0,y[e+1|0]=0,y[n-3|0]=0,t>>>(y[e+2|0]=0)<7||(y[n-4|0]=0,t>>>(y[e+3|0]=0)<9||(b[(e=(n=0-e&3)+e|0)>>2]=0,(n=t-n&-4)>>>(b[(t=n+e|0)+-4>>2]=0)<9||(b[e+8>>2]=0,b[e+4>>2]=0,b[t+-8>>2]=0,n>>>(b[t+-12>>2]=0)<25||(b[e+24>>2]=0,b[e+20>>2]=0,b[e+16>>2]=0,b[e+12>>2]=0,b[t+-16>>2]=0,b[t+-20>>2]=0,b[t+-24>>2]=0,b[t+-28>>2]=0,(t=(t=n)-(n=4&e|24)|0)>>>0<32))))))))for(e=e+n|0;;)if(b[e+24>>2]=0,b[e+28>>2]=0,b[e+16>>2]=0,b[e+20>>2]=0,b[e+8>>2]=0,b[e+12>>2]=0,b[e>>2]=0,e=e+32|(b[e+4>>2]=0),!(31<(t=t+-32|0)>>>0))break}function L(e){var t,n=0,r=0,i=0,a=0,o=0,s=0,l=0,c=0,u=0,d=0;h=t=h-16|0;e:{t:{n:{r:{i:{a:{o:{s:{l:{c:{u:{if(e>>>0<=244){if(3&(n=(o=b[263186])>>>(e=(s=e>>>0<11?16:e+11&-8)>>>3|0)|0)){e=(n=b[(a=(r=e+(1&(-1^n))|0)<<3)+1052792>>2])+8|0,(0|(i=b[n+8>>2]))==(0|(a=a+1052784|0))?b[263186]=N(r)&o:(b[i+12>>2]=a,b[a+8>>2]=i),b[n+4>>2]=3|(r<<=3),b[(n=n+r|0)+4>>2]=1|b[n+4>>2];break e}if(s>>>0<=(c=b[263188])>>>0)break u;if(n){r=n=(e=(0-(e=(0-(r=2<>>12&16,n=b[(i=(r=((r=(r|=n=(e=e>>>n|0)>>>5&8)|(n=(e=e>>>n|0)>>>2&4)|(n=(e=e>>>n|0)>>>1&2))|(n=(e=e>>>n|0)>>>1&1))+(e>>>n|0)|0)<<3)+1052792>>2],(0|(e=b[n+8>>2]))==(0|(i=i+1052784|0))?(o=N(r)&o,b[263186]=o):(b[e+12>>2]=i,b[i+8>>2]=e),e=n+8|0,b[n+4>>2]=3|s,b[(l=n+s|0)+4>>2]=1|(a=(r<<=3)-s|0),b[n+r>>2]=a,c&&(n=1052784+((r=c>>>3|0)<<3)|0,i=b[263191],r=(r=1<>2]:(b[263186]=r|o,n),b[n+8>>2]=i,b[r+12>>2]=i,b[i+12>>2]=n,b[i+8>>2]=r),b[263191]=l,b[263188]=a;break e}if(!(d=b[263187]))break u;for(r=n=(e=(d&0-d)-1|0)>>>12&16,n=b[1053048+(((r=(r|=n=(e=e>>>n|0)>>>5&8)|(n=(e=e>>>n|0)>>>2&4)|(n=(e=e>>>n|0)>>>1&2))|(n=(e=e>>>n|0)>>>1&1))+(e>>>n|0)<<2)>>2],i=(-8&b[n+4>>2])-s|0,r=n;;){if(!(e=b[r+16>>2])&&!(e=b[r+20>>2]))break;i=(r=(a=(-8&b[e+4>>2])-s|0)>>>0>>0)?a:i,n=r?e:n,r=e}if(u=b[n+24>>2],(0|(a=b[n+12>>2]))!=(0|n)){e=b[n+8>>2],b[e+12>>2]=a,b[a+8>>2]=e;break t}if(!(e=b[(r=n+20|0)>>2])){if(!(e=b[n+16>>2]))break c;r=n+16|0}for(;;)if(l=r,!((e=b[(r=(a=e)+20|0)>>2])||(r=a+16|0,e=b[a+16>>2])))break;b[l>>2]=0;break t}if(s=-1,!(4294967231>>0)&&(s=-8&(n=e+11|0),c=b[263187])){r=0-s|0,(n=n>>>8|(o=0))&&(o=31,16777215>>0||(o=28+((e=((o=(n<<=i=n+1048320>>>16&8)<<(e=n+520192>>>16&4))<<(n=o+245760>>>16&2)>>>15|0)-(n|e|i)|0)<<1|s>>>e+21&1)|0));d:{h:{if(i=b[1053048+(o<<2)>>2])for(n=s<<(31==(0|o)?0:25-(o>>>1|0)|0),e=0;;){if(!(r>>>0<=(l=(-8&b[i+4>>2])-s|0)>>>0||(a=i,r=l))){r=0,e=i;break h}if(l=b[i+20>>2],i=b[16+((n>>>29&4)+i|0)>>2],e=!l||(0|l)==(0|i)?e:l,n<<=0!=(0|i),!i)break}else e=0;if(!(e|a)){if(!(e=(0-(e=2<>>12&16,e=b[1053048+(((i=(i|=n=(e=e>>>n|0)>>>5&8)|(n=(e=e>>>n|0)>>>2&4)|(n=(e=e>>>n|0)>>>1&2))|(n=(e=e>>>n|0)>>>1&1))+(e>>>n|0)<<2)>>2]}if(!e)break d}for(;;)if(r=(n=(i=(-8&b[e+4>>2])-s|0)>>>0>>0)?i:r,a=n?e:a,!(e=(n=b[e+16>>2])||b[e+20>>2]))break}if(!(!a|r>>>0>=b[263188]-s>>>0)){if(l=b[a+24>>2],(0|a)!=(0|(n=b[a+12>>2]))){e=b[a+8>>2],b[e+12>>2]=n,b[n+8>>2]=e;break n}if(!(e=b[(i=a+20|0)>>2])){if(!(e=b[a+16>>2]))break l;i=a+16|0}for(;;)if(o=i,!((e=b[(i=(n=e)+20|0)>>2])||(i=n+16|0,e=b[n+16>>2])))break;b[o>>2]=0;break n}}}if(s>>>0<=(n=b[263188])>>>0){e=b[263191],16<=(r=n-s|0)>>>0?(b[263188]=r,b[263191]=i=e+s|0,b[i+4>>2]=1|r,b[e+n>>2]=r,b[e+4>>2]=3|s):(b[263191]=0,b[263188]=0,b[e+4>>2]=3|n,b[(n=e+n|0)+4>>2]=1|b[n+4>>2]),e=e+8|0;break e}if(s>>>0<(i=b[263189])>>>0){b[263189]=n=i-s|0,e=b[263192],b[263192]=r=e+s|0,b[r+4>>2]=1|n,b[e+4>>2]=3|s,e=e+8|0;break e}if((r=(o=(r=a=s+47|(e=0))+(n=b[263304]?b[263306]:(b[263307]=-1,b[263308]=-1,b[263305]=4096,b[263306]=4096,b[263304]=12+t&-16^1431655768,b[263309]=0,b[263297]=0,4096))|0)&(l=0-n|0))>>>0<=s>>>0)break e;if((n=b[263296])&&(u=(c=b[263294])+r|0)>>>0<=c>>>0|n>>>0>>0)break e;if(4&M[1053188])break a;u:{d:{if(n=b[263192])for(e=1053192;;){if((c=b[e>>2])+b[e+4>>2]>>>0>n>>>0&&c>>>0<=n>>>0)break d;if(!(e=b[e+8>>2]))break}if(-1==(0|(n=f(0))))break o;if(o=r,(o=(i=(e=b[263305])+-1|0)&n?(r-n|0)+(n+i&0-e)|0:o)>>>0<=s>>>0|2147483646>>0)break o;if((e=b[263296])&&(l=(i=b[263294])+o|0)>>>0<=i>>>0|e>>>0>>0)break o;if((0|n)!=(0|(e=f(o))))break u;break i}if(2147483646<(o=l&o-i)>>>0)break o;if((0|(n=f(o)))==(b[e>>2]+b[e+4>>2]|0))break s;e=n}if(!(s+48>>>0<=o>>>0|2147483646>>0|-1==(0|(n=e)))){if(2147483646<(e=(e=b[263306])+(a-o|0)&0-e)>>>0)break i;if(-1!=(0|f(e))){o=e+o|0;break i}f(0-o|0);break o}if(-1!=(0|n))break i;break o}a=0;break t}n=0;break n}if(-1!=(0|n))break i}b[263297]=4|b[263297]}if(2147483646>>0)break r;if(n=f(r),(e=f(0))>>>0<=n>>>0|-1==(0|n)|-1==(0|e))break r;if((o=e-n|0)>>>0<=s+40>>>0)break r}e=b[263294]+o|0,(b[263294]=e)>>>0>A[263295]&&(b[263295]=e);i:{a:{o:{if(r=b[263192]){for(e=1053192;;){if(((i=b[e>>2])+(a=b[e+4>>2])|0)==(0|n))break o;if(!(e=b[e+8>>2]))break}break a}for((e=b[263190])>>>0<=n>>>0&&e||(b[263190]=n),e=0,b[263299]=o,b[263298]=n,b[263194]=-1,b[263195]=b[263304],b[263301]=0;;)if(b[(r=e<<3)+1052792>>2]=i=r+1052784|0,b[r+1052796>>2]=i,32==(0|(e=e+1|0)))break;b[263189]=i=(e=o+-40|0)-(r=n+8&7?-8-n&7:0)|0,b[263192]=r=n+r|0,b[r+4>>2]=1|i,b[4+(e+n|0)>>2]=40,b[263193]=b[263308];break i}if(!(8&M[e+12|0]|n>>>0<=r>>>0|r>>>0>>0)){b[e+4>>2]=a+o,b[263192]=n=(e=r+8&7?-8-r&7:0)+r|0,i=b[263189]+o|0,b[263189]=e=i-e|0,b[n+4>>2]=1|e,b[4+(r+i|0)>>2]=40,b[263193]=b[263308];break i}}n>>>0<(a=b[263190])>>>0&&(b[263190]=n,a=0),i=n+o|0,e=1053192;a:{o:{s:{l:{c:{u:{for(;;){if((0|i)==b[e>>2])break;if(!(e=b[e+8>>2]))break u}if(!(8&M[e+12|0]))break c}for(e=1053192;;){if((i=b[e>>2])>>>0<=r>>>0&&r>>>0<(a=i+b[e+4>>2]|0)>>>0)break l;e=b[e+8>>2]}}if(b[e>>2]=n,b[e+4>>2]=b[e+4>>2]+o,b[(u=(n+8&7?-8-n&7:0)+n|0)+4>>2]=3|s,e=((n=i+(i+8&7?-8-i&7:0)|0)-u|0)-s|0,l=s+u|0,(0|n)==(0|r)){b[263192]=l,e=b[263189]+e|0,b[263189]=e,b[l+4>>2]=1|e;break o}if(b[263191]==(0|n)){b[263191]=l,e=b[263188]+e|0,b[263188]=e,b[l+4>>2]=1|e,b[e+l>>2]=e;break o}if(1==(3&(r=b[n+4>>2]))){d=-8&r;c:if(r>>>0<=255)a=r>>>3|0,r=b[n+8>>2],(0|(i=b[n+12>>2]))==(0|r)?b[263186]=b[263186]&N(a):(b[r+12>>2]=i,b[i+8>>2]=r);else{if(c=b[n+24>>2],(0|(o=b[n+12>>2]))!=(0|n))r=b[n+8>>2],b[r+12>>2]=o,b[o+8>>2]=r;else if((s=b[(i=n+20|0)>>2])||(s=b[(i=n+16|0)>>2])){for(;;)if(r=i,!((s=b[(i=(o=s)+20|0)>>2])||(i=o+16|0,s=b[o+16>>2])))break;b[r>>2]=0}else o=0;if(c){r=b[n+28>>2];u:{if(b[(i=1053048+(r<<2)|0)>>2]==(0|n)){if(b[i>>2]=o)break u;b[263187]=b[263187]&N(r);break c}if(!(b[c+(b[c+16>>2]==(0|n)?16:20)>>2]=o))break c}b[o+24>>2]=c,(r=b[n+16>>2])&&(b[o+16>>2]=r,b[r+24>>2]=o),(r=b[n+20>>2])&&(b[o+20>>2]=r,b[r+24>>2]=o)}}n=n+d|0,e=e+d|0}if(b[n+4>>2]=-2&b[n+4>>2],b[l+4>>2]=1|e,(b[e+l>>2]=e)>>>0<=255){e=1052784+((n=e>>>3|0)<<3)|0,n=(r=b[263186])&(n=1<>2]:(b[263186]=n|r,e),b[e+8>>2]=l,b[n+12>>2]=l,b[l+12>>2]=e,b[l+8>>2]=n;break o}if((i=e>>>8|(n=0))&&(n=31,16777215>>0||(n=28+((n=((s=(i<<=a=i+1048320>>>16&8)<<(n=i+520192>>>16&4))<<(i=s+245760>>>16&2)>>>15|0)-(i|n|a)|0)<<1|e>>>n+21&1)|0)),b[(r=l)+28>>2]=n,b[l+16>>2]=0,r=1053048+(n<<2)|(b[l+20>>2]=0),(i=b[263187])&(a=1<>>1|0)|0),n=b[r>>2];;){if((-8&b[(r=n)+4>>2])==(0|e))break s;if(n=i>>>29|0,i<<=1,!(n=b[(a=(4&n)+r|0)+16>>2]))break}b[a+16>>2]=l}else b[263187]=i|a,b[r>>2]=l;b[l+24>>2]=r,b[l+12>>2]=l,b[l+8>>2]=l;break o}for(b[263189]=l=(e=o+-40|0)-(i=n+8&7?-8-n&7:0)|0,b[263192]=i=n+i|0,b[i+4>>2]=1|l,b[4+(e+n|0)>>2]=40,b[263193]=b[263308],b[(i=(e=(a+(a+-39&7?39-a&7:0)|0)-47|0)>>>0>>0?r:e)+4>>2]=27,e=b[263301],b[i+16>>2]=b[263300],b[i+20>>2]=e,e=b[263299],b[i+8>>2]=b[263298],b[i+12>>2]=e,b[263300]=i+8,b[263299]=o,b[263298]=n,e=i+24|(b[263301]=0);;)if(b[e+4>>2]=7,n=e+8|0,e=e+4|0,!(n>>>0>>0))break;if((0|r)==(0|i))break i;if(b[i+4>>2]=-2&b[i+4>>2],b[r+4>>2]=1|(a=i-r|0),(b[i>>2]=a)>>>0<=255){e=1052784+((n=a>>>3|0)<<3)|0,n=(i=b[263186])&(n=1<>2]:(b[263186]=n|i,e),b[e+8>>2]=r,b[n+12>>2]=r,b[r+12>>2]=e,b[r+8>>2]=n;break i}if(b[r+16>>2]=0,(i=a>>>8|(e=b[r+20>>2]=0))&&(e=31,16777215>>0||(e=28+((e=((l=(i<<=o=i+1048320>>>16&8)<<(e=i+520192>>>16&4))<<(i=l+245760>>>16&2)>>>15|0)-(i|e|o)|0)<<1|a>>>e+21&1)|0)),n=1053048+((b[(n=r)+28>>2]=e)<<2)|0,(i=b[263187])&(o=1<>>1|0)|0),n=b[n>>2];;){if((0|a)==(-8&b[(i=n)+4>>2]))break a;if(n=e>>>29|0,e<<=1,!(n=b[(o=i+(4&n)|0)+16>>2]))break}b[o+16>>2]=r,b[r+24>>2]=i}else b[263187]=i|o,b[n>>2]=r,b[r+24>>2]=n;b[r+12>>2]=r,b[r+8>>2]=r;break i}e=b[r+8>>2],b[e+12>>2]=l,b[r+8>>2]=l,b[l+24>>2]=0,b[l+12>>2]=r,b[l+8>>2]=e}e=u+8|0;break e}e=b[i+8>>2],b[e+12>>2]=r,b[i+8>>2]=r,b[r+24>>2]=0,b[r+12>>2]=i,b[r+8>>2]=e}if(!((e=b[263189])>>>0<=s>>>0)){b[263189]=n=e-s|0,e=b[263192],b[263192]=r=e+s|0,b[r+4>>2]=1|n,b[e+4>>2]=3|s,e=e+8|0;break e}}b[263185]=48,e=0;break e}n:if(l){e=b[a+28>>2];r:{if(b[(i=1053048+(e<<2)|0)>>2]==(0|a)){if(b[i>>2]=n)break r;c=N(e)&c,b[263187]=c;break n}if(!(b[l+(b[l+16>>2]==(0|a)?16:20)>>2]=n))break n}b[n+24>>2]=l,(e=b[a+16>>2])&&(b[n+16>>2]=e,b[e+24>>2]=n),(e=b[a+20>>2])&&(b[n+20>>2]=e,b[e+24>>2]=n)}n:if(r>>>0<=15)b[a+4>>2]=3|(e=r+s|0),b[(e=e+a|0)+4>>2]=1|b[e+4>>2];else if(b[a+4>>2]=3|s,b[(i=a+s|0)+4>>2]=1|r,(b[r+i>>2]=r)>>>0<=255)e=1052784+((n=r>>>3|0)<<3)|0,n=(r=b[263186])&(n=1<>2]:(b[263186]=n|r,e),b[e+8>>2]=i,b[n+12>>2]=i,b[i+12>>2]=e,b[i+8>>2]=n;else{(s=r>>>8|(e=0))&&(e=31,16777215>>0||(e=28+((e=((l=(s<<=o=s+1048320>>>16&8)<<(e=s+520192>>>16&4))<<(s=l+245760>>>16&2)>>>15|0)-(s|e|o)|0)<<1|r>>>e+21&1)|0)),b[(n=i)+28>>2]=e,b[i+16>>2]=0,n=1053048+(e<<2)|(b[i+20>>2]=0);r:{if((s=1<>>1|0)|0),s=b[n>>2];;){if((-8&b[(n=s)+4>>2])==(0|r))break r;if(s=e>>>29|0,e<<=1,!(s=b[(o=(4&s)+n|0)+16>>2]))break}b[o+16>>2]=i}else b[263187]=s|c,b[n>>2]=i;b[i+24>>2]=n,b[i+12>>2]=i,b[i+8>>2]=i;break n}e=b[n+8>>2],b[e+12>>2]=i,b[n+8>>2]=i,b[i+24>>2]=0,b[i+12>>2]=n,b[i+8>>2]=e}e=a+8|0;break e}t:if(u){e=b[n+28>>2];n:{if(b[(r=1053048+(e<<2)|0)>>2]==(0|n)){if(b[r>>2]=a)break n;b[263187]=N(e)&d;break t}if(!(b[u+(b[u+16>>2]==(0|n)?16:20)>>2]=a))break t}b[a+24>>2]=u,(e=b[n+16>>2])&&(b[a+16>>2]=e,b[e+24>>2]=a),(e=b[n+20>>2])&&(b[a+20>>2]=e,b[e+24>>2]=a)}i>>>0<=15?(b[n+4>>2]=3|(e=i+s|0),b[(e=e+n|0)+4>>2]=1|b[e+4>>2]):(b[n+4>>2]=3|s,b[(s=n+s|0)+4>>2]=1|i,b[i+s>>2]=i,c&&(e=1052784+((r=c>>>3|0)<<3)|0,a=b[263191],r=(r=1<>2]:(b[263186]=r|o,e),b[e+8>>2]=a,b[r+12>>2]=a,b[a+12>>2]=e,b[a+8>>2]=r),b[263191]=s,b[263188]=i),e=n+8|0}return h=16+t|0,e}function m(e){var t,n,r,i=0,a=0,o=0,s=0,l=0,c=0,u=0,d=0,h=0,p=0,f=0,m=0,v=0,a=b[e+40>>2],h=b[e+32>>2];if(!(a>>>0<=h>>>0)&&(i=b[e+104>>2])&&(l=b[e+84>>2],!(A[e+36>>2]<=l>>>0|A[e+48>>2]<=l>>>0))){if(b[e+104>>2]=i-(c=(a=a-h|0)>>>0>>0?a:i),i=(-1^l)+h|0,i=h>>>0<=l>>>0?b[e+44>>2]+i|0:i,l=b[e+24>>2],a=M[i+l|0],b[e+32>>2]=h+1,y[l+h|0]=a,o=c+-1|0)for(;;)if(i=(0|(a=i+1|0))==b[e+44>>2]?0:a,c=b[e+24>>2],l=M[i+c|0],a=b[e+32>>2],b[e+32>>2]=a+1,y[a+c|0]=l,!(o=o+-1|0))break;h=b[e+32>>2],A[e+36>>2]>=h>>>0||(b[e+36>>2]=h)}e:{t:if(!(h>>>0>=A[e+40>>2]))for(t=e+1756|0,n=e+2784|0,r=e+84|0;;){if((l=b[e+16>>2])>>>0>A[e+20>>2])break t;if(c=p=(((f=b[e+100>>2])<<5)+e|0)+((u=b[e+116>>2]&h)<<1)|0,16777216<=(s=b[e>>2])>>>0?o=b[e+4>>2]:(s<<=8,b[e>>2]=s,b[e+16>>2]=a=l+1|0,o=M[b[e+12>>2]+l|0]|b[e+4>>2]<<8,b[e+4>>2]=o,l=a),a=_[c+120>>1],o>>>0<(i=x(a,s>>>11|0))>>>0){b[e>>2]=i,g[c+120>>1]=a+(2048-a>>>5|0),s=h+-1|0,s=h?s:b[e+44>>2]+s|0,u=b[e+108>>2],p=0,m=(a=(b[e+112>>2]&h)<>2])?M[b[e+24>>2]+s|0]:p)>>>8-u|0)|0,s=1;n:{if(f>>>0<=6)for(;;)if(c=3812+((s<<=1)+(x(m,1536)+e|0)|0)|0,16777215>>0?a=i:(b[e>>2]=a=i<<8,b[e+16>>2]=i=l+1|0,o=M[b[e+12>>2]+l|0]|o<<8,b[e+4>>2]=o,l=i),u=_[c>>1],(i=x(u,a>>>11|0))>>>0<=o>>>0?(b[e+4>>2]=o=o-i|0,b[e>>2]=i=a-i|0,g[c>>1]=u-(u>>>5|0),s|=1):(b[e>>2]=i,g[c>>1]=u+(2048-u>>>5|0)),!(s>>>0<256))break n;for(s=(-1^(a=b[e+84>>2]))+h|0,s=h>>>0<=a>>>0?b[e+44>>2]+s|0:s,c=c?M[b[e+24>>2]+s|0]:0,s=1,d=256;;)if(f=d&(c<<=1),u=3812+((x(m,1536)+e|0)+((f+d|0)+s<<1)|0)|0,16777215>>0?p=i:(b[e>>2]=p=i<<8,b[e+16>>2]=a=l+1|0,o=M[b[e+12>>2]+l|0]|o<<8,b[e+4>>2]=o,l=a),u=_[(v=a=u)>>1],a=(i=x(u,p>>>11|0))>>>0<=o>>>0?(b[e+4>>2]=o=o-i|0,b[e>>2]=i=p-i|0,p=1,u-(u>>>5|(d=0))|0):(b[e>>2]=i,u+(2048-u>>>5|(p=0))|0),g[v>>1]=a,d^=f,!((s=s<<1|p)>>>0<256))break}(b[e+32>>2]=h+1,y[b[e+24>>2]+h|0]=s,h=b[e+32>>2],A[e+36>>2]>>0&&(b[e+36>>2]=h),(a=b[e+100>>2])>>>0<=3)?b[e+100>>2]=0:b[e+100>>2]=a>>>0<=9?a+-3:a+-6}else{b[e+4>>2]=o=o-i|0,b[e>>2]=i=s-i|0,g[c+120>>1]=a-(a>>>5|0),c=m=(f<<1)+e|0,16777215>>0?a=l:(i<<=8,b[e>>2]=i,b[e+16>>2]=a=l+1|0,o=M[b[e+12>>2]+l|0]|o<<8,b[e+4>>2]=o),f=_[c+504>>1];n:if((l=x(f,i>>>11|0))>>>0<=o>>>0){b[e+4>>2]=o=o-l|0,b[e>>2]=i=i-l|0,g[c+504>>1]=f-(f>>>5|0),16777215>>0?c=a:(i<<=8,b[e>>2]=i,b[e+16>>2]=c=a+1|0,o=M[b[e+12>>2]+a|0]|o<<8,b[e+4>>2]=o),a=_[m+528>>1];r:{if(o>>>0<(s=x(a,i>>>11|0))>>>0){if(b[e>>2]=s,g[m+528>>1]=a+(2048-a>>>5|0),s>>>0<=16777215&&(s<<=8,b[e>>2]=s,b[e+16>>2]=c+1,o=M[b[e+12>>2]+c|0]|o<<8,b[e+4>>2]=o),i=_[p+600>>1],(a=x(i,s>>>11|0))>>>0<=o>>>0){b[e+4>>2]=o-a,b[e>>2]=s-a,g[p+600>>1]=i-(i>>>5|0);break r}b[e>>2]=a,g[p+600>>1]=i+(2048-i>>>5|0),b[e+104>>2]=1,b[e+100>>2]=A[e+100>>2]<7?9:11;break n}b[e+4>>2]=o=o-s|0,b[e>>2]=i=i-s|0,g[m+528>>1]=a-(a>>>5|0),16777215>>0?a=c:(i<<=8,b[e>>2]=i,b[e+16>>2]=a=c+1|0,o=M[b[e+12>>2]+c|0]|o<<8,b[e+4>>2]=o),c=_[m+552>>1],o>>>0<(l=x(c,i>>>11|0))>>>0?(b[e>>2]=l,g[m+552>>1]=c+(2048-c>>>5|0),i=b[e+88>>2]):(b[e+4>>2]=o=o-l|0,b[e>>2]=i=i-l|0,g[m+552>>1]=c-(c>>>5|0),i>>>0<=16777215&&(i<<=8,b[e>>2]=i,b[e+16>>2]=a+1,o=M[b[e+12>>2]+a|0]|o<<8,b[e+4>>2]=o),l=_[m+576>>1],o>>>0<(a=x(l,i>>>11|0))>>>0?(b[e>>2]=a,g[m+576>>1]=l+(2048-l>>>5|0),i=b[e+92>>2]):(b[e+4>>2]=o-a,b[e>>2]=i-a,g[m+576>>1]=l-(l>>>5|0),i=b[e+96>>2],b[e+96>>2]=b[e+92>>2]),b[e+92>>2]=b[e+88>>2]),b[e+88>>2]=b[e+84>>2],b[e+84>>2]=i}b[e+100>>2]=A[e+100>>2]<7?8:11,P(e,n,u)}else{for(b[e>>2]=l,g[c+504>>1]=f+(2048-f>>>5|0),b[e+96>>2]=b[e+92>>2],a=b[e+88>>2],b[e+88>>2]=b[e+84>>2],b[e+92>>2]=a,b[e+100>>2]=A[e+100>>2]<7?7:10,P(e,t,u),l=(a=b[e+104>>2])>>>0<6?a+-2|0:3,i=b[e>>2],o=1;;)if(c=(o<<=1)+((l<<7)+e|0)|0,16777216<=i>>>0?s=b[e+4>>2]:(i<<=8,b[e>>2]=i,a=b[e+16>>2],b[e+16>>2]=a+1,s=M[a+b[e+12>>2]|0]|b[e+4>>2]<<8,b[e+4>>2]=s),u=_[c+984>>1],(a=x(u,i>>>11|0))>>>0<=s>>>0?(b[e+4>>2]=s=s-a|0,b[e>>2]=i=i-a|0,g[c+984>>1]=u-(u>>>5|0),o|=1):(b[e>>2]=a,g[c+984>>1]=u+(2048-u>>>5|0),i=a),!(o>>>0<64))break;if((l=o+-64|0)>>>0<=3)b[e+84>>2]=l;else if(b[e+84>>2]=d=1&l|2,a=l>>>1|0,l>>>0<=13){for(l=1538+((((b[e+84>>2]=p=d<<(c=a+-1|0))<<(d=1))+r|0)+(0-o<<1)|0)|0,o=0;;)if(u=l+(d<<=1)|0,16777215>>0?a=i:(b[e>>2]=a=i<<8,i=b[e+16>>2],b[e+16>>2]=i+1,s=M[i+b[e+12>>2]|0]|s<<8,b[e+4>>2]=s),f=_[u>>1],s>>>0<(i=x(f,a>>>11|0))>>>0?(b[e>>2]=i,g[u>>1]=f+(2048-f>>>5|0)):(b[e+4>>2]=s=s-i|0,b[e>>2]=i=a-i|0,g[u>>1]=f-(f>>>5|0),b[e+84>>2]=p=(1<>>0>>0))break}else{for(l=a+-5|0;;)if(16777215>>0?o=i:(b[e>>2]=o=i<<8,a=b[e+16>>2],b[e+16>>2]=a+1,s=M[a+b[e+12>>2]|0]|s<<8,b[e+4>>2]=s),b[e>>2]=i=o>>>1|0,b[e+84>>2]=d=(a=(c=s-i|0)>>31)+(d<<1|1)|0,b[e+4>>2]=s=c+(i&a)|0,!(l=l+-1|0))break;d<<=4,b[e+84>>2]=d,o>>>0<=33554431&&(i<<=8,b[e>>2]=i,a=b[e+16>>2],b[e+16>>2]=a+1,s=M[a+b[e+12>>2]|0]|s<<8,b[e+4>>2]=s),l=_[(a=e)+1726>>1],c=1724+(a+(l=(i=s>>>0<(o=x(l,i>>>11|0))>>>0?(b[e>>2]=o,g[e+1726>>1]=l+(2048-l>>>5|0),2):(b[e+4>>2]=s=s-o|0,b[e>>2]=o=i-o|0,d|=1,b[e+84>>2]=d,g[e+1726>>1]=l-(l>>>5|0),3))<<1)|0)|0,o>>>0<=16777215&&(o<<=8,b[e>>2]=o,a=b[e+16>>2],b[e+16>>2]=a+1,s=M[a+b[e+12>>2]|0]|s<<8,b[e+4>>2]=s),a=_[c>>1],(i=x(a,o>>>11|0))>>>0<=s>>>0?(b[e+4>>2]=s=s-i|0,b[e>>2]=i=o-i|0,g[c>>1]=a-(a>>>5|0),b[e+84>>2]=d=d+2|0,l|=1):(b[e>>2]=i,g[c>>1]=a+(2048-a>>>5|0)),c=1724+((l<<=1)+e|0)|0,i>>>0<=16777215&&(i<<=8,b[e>>2]=i,a=b[e+16>>2],b[e+16>>2]=a+1,s=M[a+b[e+12>>2]|0]|s<<8,b[e+4>>2]=s),a=_[c>>1],(o=x(a,i>>>11|0))>>>0<=s>>>0?(b[e+4>>2]=s=s-o|0,b[e>>2]=o=i-o|0,g[c>>1]=a-(a>>>5|0),b[e+84>>2]=d=d+4|0,l|=1):(b[e>>2]=o,g[c>>1]=a+(2048-a>>>5|0)),o>>>0<=16777215&&(o<<=8,b[e>>2]=o,a=b[e+16>>2],b[e+16>>2]=a+1,s=M[a+b[e+12>>2]|0]|s<<8,b[e+4>>2]=s),l=_[(a=1724+((l<<1)+e|0)|0)>>1],(i=x(l,o>>>11|0))>>>0<=s>>>0?(b[e+4>>2]=s-i,b[e>>2]=o-i,g[a>>1]=l-(l>>>5|0),b[e+84>>2]=d+8):(b[e>>2]=i,g[a>>1]=l+(2048-l>>>5|0))}}if(l=b[e+84>>2],A[e+36>>2]<=l>>>(i=0)|A[e+48>>2]<=l>>>0)break e;if(u=b[e+32>>2],a=b[e+40>>2]-u|0,i=b[e+104>>2],b[e+104>>2]=i-(c=a>>>0>>0?a:i),i=u+(-1^l)|0,i=u>>>0<=l>>>0?b[e+44>>2]+i|0:i,l=b[e+24>>2],a=M[i+l|0],b[e+32>>2]=u+1,y[l+u|0]=a,s=c+-1|0)for(;;)if(i=(0|(a=i+1|0))==b[e+44>>2]?0:a,c=b[e+24>>2],l=M[i+c|0],a=b[e+32>>2],b[e+32>>2]=a+1,y[a+c|0]=l,!(s=s+-1|0))break;h=b[e+32>>2],A[e+36>>2]>=h>>>0||(b[e+36>>2]=h)}if(!(h>>>0>2]))break}i=1,16777215<(a=b[e>>2])>>>0||(b[e>>2]=a<<8,a=b[e+16>>2],b[e+16>>2]=a+1,b[e+4>>2]=M[a+b[e+12>>2]|0]|b[e+4>>2]<<8)}return i}function R(e,t,n){var r=0,i=0,a=0;e:if(n){for(;;){if((0|(r=M[0|e]))!=(0|(i=M[0|t])))break;if(t=t+1|0,e=e+1|0,!(n=n+-1|0))break e}a=r-i|0}return a}function P(e,t,n){var r,i=0,a=0,o=0,s=0,l=0,c=0;for(16777216<=(s=b[e>>2])>>>0?o=b[e+4>>2]:(b[e>>2]=s<<=8,a=b[e+16>>2],b[e+16>>2]=a+1,o=M[a+b[e+12>>2]|0]|b[e+4>>2]<<8,b[e+4>>2]=o),a=_[t>>1],a=o>>>0<(i=x(a,s>>>11|0))>>>0?(b[e>>2]=i,g[t>>1]=a+(2048-a>>>5|0),c=4+((n<<4)+t|0)|0,l=2,8):(b[e+4>>2]=o=o-i|0,b[e>>2]=s=s-i|0,g[t>>1]=a-(a>>>5|0),s>>>0<=16777215&&(b[e>>2]=s<<=8,a=b[e+16>>2],b[e+16>>2]=a+1,o=M[a+b[e+12>>2]|0]|o<<8,b[e+4>>2]=o),a=_[t+2>>1],o>>>0<(i=x(a,s>>>11|0))>>>0?(b[e>>2]=i,g[t+2>>1]=a+(2048-a>>>5|0),c=260+((n<<4)+t|0)|0,l=10,8):(b[e+4>>2]=o=o-i|0,b[e>>2]=i=s-i|0,g[t+2>>1]=a-(a>>>5|0),c=t+516|0,l=18,256)),b[e+104>>2]=l,t=1;;)if(s=c+(t<<=1)|0,16777215>>0?n=i:(b[e>>2]=n=i<<8,i=b[e+16>>2],b[e+16>>2]=i+1,o=M[i+b[e+12>>2]|0]|o<<8,b[e+4>>2]=o),r=_[s>>1],(i=x(r,n>>>11|0))>>>0<=o>>>0?(b[e+4>>2]=o=o-i|0,b[e>>2]=i=n-i|0,g[s>>1]=r-(r>>>5|0),t|=1):(b[e>>2]=i,g[s>>1]=(2048-r>>>5|0)+r),!(t>>>0>>0))break;b[e+104>>2]=(t-a|0)+l}function I(e){for(var t,n,r,i=0,a=0,o=0,s=0,l=0,c=0,u=e+28392|0,d=e+28388|0;;){i=b[e+64>>2];e:{t:{n:{r:{i:{a:{o:{s:{l:{c:{u:{d:{h:{p:{f:{if(a=b[132105],(o=b[132106])>>>0<=a>>>0){if(7==(0|i))break f;return 0}if(8>>0)continue;switch(i-1|0){case 4:break l;case 3:break c;case 2:break u;case 1:break d;case 0:break h;case 6:break f;case 7:break a;case 5:break s;default:break p}}i=b[e+76>>2];break o}if(b[132105]=a+(l=1),!(i=M[b[132104]+a|0]))break i;if(!(1!=(0|i)&&i>>>0<=223)){g[e+80>>1]=256,b[e+60>>2]||(o=b[132108],b[e+24>>2]=o+b[132107],b[e+44>>2]=b[132109]-o),b[e+28>>2]=0,b[e+32>>2]=0,b[e+36>>2]=0,b[e+40>>2]=0;break n}if(M[e+80|0])return 7;break n}b[132105]=a+1,i=M[b[132104]+a|0],b[e+64>>2]=2,b[e+72>>2]=b[e+72>>2]+(i<<8);continue}b[132105]=a+1,i=M[b[132104]+a|0],b[e+64>>2]=3,b[e+72>>2]=1+(i+b[e+72>>2]|0);continue}b[132105]=a+1,i=M[b[132104]+a|0],b[e+64>>2]=4,b[e+76>>2]=i<<8;continue}b[132105]=a+1,i=M[b[132104]+a|0],b[e+64>>2]=b[e+68>>2],b[e+76>>2]=1+(i+b[e+76>>2]|0);continue}if(b[132105]=a+1,l=7,224<(i=M[b[132104]+a|0])>>>0)break i;if(o=e,s=i>>>(a=0)<45?0:(i=(i=i+-45|0)-x(s=((255&i)>>>0)/45|0,45)|0,s+1|0),b[o+116>>2]=-1<>>0&&(a=(o=((255&(i=i+-9|0))>>>0)/9|0)+1|0,i=i-x(o,9)|0),b[e+112>>2]=a,i&=255,4<(b[e+108>>2]=i)+a>>>0)break i;for(b[e+112>>2]=-1<>2]=i=0,b[e+92>>2]=0,b[e+96>>2]=0,b[e+84>>2]=0,b[e+88>>2]=0;;)if(g[120+((i<<1)+e|0)>>1]=1024,14134==(0|(i=i+1|0)))break;b[e+64>>2]=6,b[e+8>>2]=5,b[e>>2]=-1,b[e+4>>2]=0}if((l=b[e+76>>2])>>>0<5)return 7;if(a=b[e+8>>2])for(i=b[132105],s=b[132106];;){if((0|i)==(0|s))return 0;if(c=b[e+4>>2],b[132105]=o=i+1|0,i=M[b[132104]+i|0],b[e+8>>2]=a=a+-1|0,b[e+4>>2]=i|c<<8,i=o,!a)break}b[e+64>>2]=7,b[e+76>>2]=i=l+-5|0}o=b[e+32>>2],a=(a=b[132109]-b[132108]|0)>>>0<(l=b[e+72>>2])>>>0?a:l,l=b[e+44>>2],b[e+40>>2]=a>>>0>>0?o+a|0:l,a=(s=b[132106])-(o=b[132105])|0,l=b[e+28388>>2];o:{if(!i||l){if(S(4+(l+d|0)|0,s=b[132104]+o|0,i=a>>>0<(i=(i=i-l|0)>>>0<(o=42-l|0)>>>0?i:o)>>>0?a:i),(0|(o=(a=b[e+28388>>2])+i|0))==b[e+76>>2])E(4+(i+(a+d|0)|0)|0,63-o|0),o=i+b[e+28388>>2]|0;else{if(o>>>0<=20){b[e+28388>>2]=o,b[132105]=i+b[132105];break o}o=o+-21|0}if(b[e+16>>2]=0,b[e+12>>2]=u,b[e+20>>2]=o,l=7,!m(e))break i;if(o=b[e+16>>2],(a=b[e+28388>>2])+i>>>0>>0)break i;if(i=b[e+76>>2]-o|0,b[e+76>>2]=i,o>>>0>>0){!function(e,t,n){var r=0,i=0;s:if((0|e)!=(0|t)){if(!(e>>>0>>0&&t>>>0<(i=e+n|0)>>>0))return S(e,t,n);if(r=3&(e^t),e>>>0>>0){if(!r){if(3&e)for(;;){if(!n)break s;if(y[0|e]=M[0|t],t=t+1|0,n=n+-1|0,!(3&(e=e+1|0)))break}if(!(n>>>0<=3)){for(r=n;;)if(b[e>>2]=b[t>>2],t=t+4|0,e=e+4|0,!(3<(r=r+-4|0)>>>0))break;n&=3}}if(n)for(;;)if(y[0|e]=M[0|t],e=e+1|0,t=t+1|0,!(n=n+-1|0))break}else{if(!r){if(3&i)for(;;){if(!n)break s;if(y[0|(r=(n=n+-1|0)+e|0)]=M[t+n|0],!(3&r))break}if(!(n>>>0<=3))for(;;)if(b[(n=n+-4|0)+e>>2]=b[t+n>>2],!(3>>0))break}if(n)for(;;)if(y[(n=n+-1|0)+e|0]=M[t+n|0],!n)break}}}(u,4+(o+d|0)|0,b[e+28388>>2]=i=a-o|0);break o}o=b[132105]+(o-a|0)|0,b[132105]=o,b[e+28388>>2]=0,a=(s=b[132106])-o|0}if(21<=a>>>0){if(l=b[132104],b[e+16>>2]=o,b[e+12>>2]=l,b[e+20>>2]=a>>>0>>0?s+-21|0:i+o|0,l=7,!m(e))break i;if((i=b[e+76>>2])>>>0<(a=(o=b[e+16>>2])-b[132105]|0)>>>0)break i;if(b[e+76>>2]=i=i-a|0,b[132105]=o,20<(a=b[132106]-o|0)>>>0)break o}S(u,b[132104]+o|0,i=i>>>0>>0?i:a),b[e+28388>>2]=i,b[132105]=i+b[132105]}if(a=(i=b[e+32>>2])-(l=b[e+28>>2])|0,b[(o=e)+60>>2]&&((0|i)==b[e+44>>2]&&(b[e+32>>2]=0),S(b[132107]+b[132108]|0,l+b[e+24>>2]|0,a),i=b[e+32>>2]),b[o+28>>2]=i,i=a+b[132108]|0,b[132108]=i,o=b[e+72>>2]-a|0,!(b[e+72>>2]=o)){if(l=7,b[e+4>>2]|(b[e+76>>2]|b[e+104>>2]))break i;b[e+64>>2]=0;break t}if(((l=0)|i)==b[132109])break i;if(b[132105]!=b[132106]|A[e+28388>>2]>=A[e+76>>2])continue;break i}if(!(s=b[e+76>>2]))break r;if(!(o>>>(l=0)<=a>>>0))for(;;){if((i=b[132109])>>>0<=(c=b[132108])>>>0)break i;if(r=s,t=b[e+32>>2],n=b[e+44>>2]-t|0,b[e+76>>2]=r-(s=s>>>0<(i=n>>>0<(i=(o=o-a|0)>>>0<(i=i-c|0)>>>0?o:i)>>>0?n:i)>>>0?s:i),S(b[e+24>>2]+t|0,b[132104]+a|0,s),i=s+b[e+32>>2]|0,b[e+32>>2]=i,A[e+36>>2]>>0&&(b[e+36>>2]=i),b[(o=e)+60>>2]&&((0|i)==b[e+44>>2]&&(b[e+32>>2]=0),S(b[132107]+b[132108]|0,b[132104]+b[132105]|0,s),i=b[e+32>>2]),b[o+28>>2]=i,b[132108]=s+b[132108],a=s+b[132105]|0,b[132105]=a,!(s=b[e+76>>2]))break r;if(!(a>>>0<(o=b[132106])>>>0))break}}return l}b[e+64>>2]=0;continue}if(-1>24)break e;if(b[e+64>>2]=1,b[e+72>>2]=i<<16&2031616,192<=i>>>0){b[e+68>>2]=5,y[e+81|0]=0;continue}if(M[e+81|0])return 7;if(b[e+68>>2]=6,i>>>0<160)continue;for(b[e+84>>2]=0,b[e+88>>2]=0,b[e+100>>2]=i=0,b[e+92>>2]=0,b[e+96>>2]=0;;)if(g[120+((i<<1)+e|0)>>1]=1024,14134==(0|(i=i+1|0)))break}b[e+8>>2]=5,b[e>>2]=-1,b[e+4>>2]=0;continue}if(!(i>>>0<=2))break;b[e+64>>2]=3,b[e+68>>2]=8}return 7}function v(){var e,t,n=0;if(e=L(1208)){if(b[e+36>>2]=2,t=0,n=(t=L(28456))?(b[t+52>>2]=8388608,b[t+60>>2]=2,b[t+56>>2]=0,b[t+24>>2]=0,t):0,b[e+1200>>2]=n)return y[e+40|0]=0,b[e>>2]=0,b[e+4>>2]=0,b[e+24>>2]=0,E(e+72|(b[e+28>>2]=0),100),b[e+172>>2]=12,e;C(e)}return 0}function d(e){var t,n,r,i,a=0,o=0,s=0,l=0,c=0,u=0,d=0,h=0,p=0,f=0,m=0,v=0,g=0,o=b[e+36>>2]?b[e>>2]:(y[e+40|0]=0,b[e>>2]=0,b[e+4>>2]=0,b[e+24>>2]=0,E(e+72|(b[e+28>>2]=0),100),b[e+172>>2]=12,0),_=b[132108],x=b[132105];b[e+16>>2]=x,n=e+96|0,v=(a=e)+182|0,r=a+176|0,d=a+168|0;e:{t:{n:{r:{i:{for(;;)if(!(9>>0)){e=d;a:{o:{s:{l:{c:{u:switch(o-1|0){case 1:u=b[132106],o=b[132104],l=b[a+172>>2],s=b[a+168>>2];break c;default:if(s=b[132105],o=b[132106]-s|0,c=b[a+168>>2],u=b[a+172>>2]-c|0,S(8+(c+d|0)|0,s+b[132104]|0,o=o>>>0>>0?o:u),b[132105]=o+b[132105],o=o+b[a+168>>2]|(l=0),s=b[a+172>>2],b[a+168>>2]=(0|s)==(0|o)?0:o,(0|o)!=(0|s))break e;if(b[a>>2]=1,R(r,1024,6)){l=5;break e}if((0|T(v,2,0))!=(M[a+184|0]|M[a+185|0]<<8|(M[a+186|0]<<16|M[a+187|0]<<24))){l=7;break e}if(l=6,M[0|v])break e;if(o=M[a+183|0],15<(b[a+32>>2]=o)>>>0)break e;if(l=2,!(1<>>0)break e;break;case 4:break o;case 3:break s;case 2:break l;case 0:break u;case 8:break n;case 7:break r;case 6:break i;case 5:break a}if((0|(u=b[132106]))==(0|(s=b[132105]))){l=0;break e}if(o=b[132104],!(c=M[s+o|0])){b[132105]=s+1,b[a+16>>2]=s,b[a>>2]=o=6;continue}b[a+168>>2]=0,b[a>>2]=2,b[a+172>>2]=l=4+(c<<2)|0,b[a+64>>2]=l,s=0}if(c=u,S(8+(e+s|0)|0,o+(u=b[132105])|0,c=(c=c-u|0)>>>0<(l=l-s|0)>>>0?c:l),b[132105]=c+b[132105],e=c+b[a+168>>2]|(l=0),o=b[a+172>>2],b[a+168>>2]=(0|o)==(0|e)?0:e,(0|e)!=(0|o))break e;if(o=T(r,b[a+172>>2]=e=e+-4|0,0),p=b[a+172>>2],(0|o)!=(M[(e=p+a|0)+176|0]|M[e+177|0]<<8|(M[e+178|0]<<16|M[e+179|0]<<24))){l=7;break e}if(b[a+168>>2]=2,63&(t=y[a+177|0])){l=6;break e}if(o=2,c=s=g=h=-1,64&t){for((u=b[a+4>>2])||(b[a+8>>2]=0,b[a+12>>2]=0);;){if(p>>>0<=o>>>0){l=7;break e}f=M[8+(o+d|0)|0],b[a+168>>2]=o=o+1|0,i=b[(e=a)+12>>2],m=127&f,l=31&(s=u),s=32<=(63&s)>>>0?(c=m<>>32-l,m<>2],c=l=c|i,b[e+8>>2]=s,b[e+12>>2]=c;c:{if(!(128&f)){if(f|!u)break c;l=7;break e}if(63!=(0|(b[a+4>>2]=u=u+(l=7)|0)))continue;break e}break}b[a+4>>2]=0}if(b[a+48>>2]=s,b[a+52>>2]=c,(0|t)<=-1){for((u=b[a+4>>2])||(b[a+8>>2]=0,b[a+12>>2]=0);;){if(p>>>0<=o>>>0){l=7;break e}f=M[8+(o+d|0)|0],b[a+168>>2]=o=o+1|0,m=b[(e=a)+12>>2],h=127&f,l=31&(s=u),h=(s=32<=(63&s)>>>0?(c=h<>>32-l,h<>2],g=s=c|m,b[e+8>>2]=h,b[e+12>>2]=s;c:{if(!(128&f)){if(f|!u)break c;l=7;break e}if(63!=(0|(b[a+4>>2]=u=u+(l=7)|0)))continue;break e}break}b[a+4>>2]=0}if(b[a+56>>2]=h,b[a+60>>2]=g,p-o>>>0<2){l=7;break e}if(b[a+168>>2]=s=o+1|0,33!=M[8+(o+d|0)|0]){l=6;break e}if(b[a+168>>2]=e=o+2|0,1!=M[8+(s+d|0)|0]){l=6;break e}if(l=7,(0|e)==(0|p))break e;if(b[a+168>>2]=o+3,l=function(e,t){var n=0,r=0;n=6;c:if(!(39>>0)){if(t=(1&t|2)<<11+(t>>>1|0),b[e+48>>2]=t,r=b[e+60>>2]){if(n=4,t>>>0>A[e+52>>2])break c;if(b[e+44>>2]=t,!(2!=(0|r)|A[e+56>>2]>=t>>>0||(C(b[e+24>>2]),t=L(b[e+48>>2]),b[e+24>>2]=t)))return b[e+56>>2]=0,3}b[e+28388>>2]=0,b[e+64>>2]=0,y[e+80|0]=1,b[e+104>>2]=0,n=0}return n}(b[a+1200>>2],M[8+(e+d|0)|0]))break e;o=b[a+168>>2],s=b[a+172>>2];c:{for(;;){if(s>>>0<=o>>>0)break c;if(c=o+d|0,o=b[a+168>>2]=e=o+1|0,M[c+8|0])break}l=6;break e}b[a+168>>2]=0,b[a+80>>2]=0,b[a+84>>2]=0,b[a+72>>2]=0,b[a+76>>2]=0,b[a>>2]=3}if(b[a+16>>2]=b[132105],b[a+20>>2]=b[132108],l=I(b[a+1200>>2]),e=b[(o=a)+76>>2],u=c=(s=b[132105]-b[a+16>>2]|0)+b[a+72>>2]|0,s=e=c>>>0>>0?e+1|0:e,b[o+72>>2]=c,b[o+76>>2]=e,e=b[a+84>>2],p=b[a+20>>2],c=e=(f=(c=h=b[132108]-p|0)+b[a+80>>2]|0)>>>0>>0?e+1|0:e,b[o+80>>2]=f,b[o+84>>2]=e,(0|(e=b[a+52>>2]))==(0|s)&u>>>0>A[a+48>>2]|e>>>0>>0){l=7;break e}if((0|(e=b[a+60>>2]))==(0|c)&f>>>0>A[a+56>>2]|e>>>0>>0){l=7;break e}o=b[a+32>>2]+-1|0;l:if(!(3>>0)){e=a;c:{u:switch(o-1|0){default:o=T(p+b[132107]|0,h,b[a+24>>2]),s=0;break c;case 0:case 1:break l;case 2:break u}o=function(e,t,n,r){var i=0;if(n^=-1,r^=-1,t)for(;;)if(i=2080+((M[0|e]^255&n)<<3)|0,n=b[i>>2]^((255&r)<<24|n>>>8),r=b[4+i>>2]^r>>>8,e=e+1|0,!(t=t+-1|0))break;return w=-1^r,-1^n}(p+b[132107]|0,h,b[a+24>>2],b[a+28>>2]),s=w}b[e+24>>2]=o,b[e+28>>2]=s}if(1!=(0|l))break e;if(o=e=b[a+52>>2],!(-1==(0|(s=b[a+48>>2]))&-1==(0|o)|b[a+72>>2]==(0|s)&b[a+76>>2]==(0|o))){l=7;break e}if(e=b[a+80>>2],o=b[a+84>>2],c=u=b[a+60>>2],-1==(0|(s=b[a+56>>2]))&-1==(0|c))s=e,c=o;else if(l=7,(0|e)!=(0|s)|(0|o)!=(0|c))break e;c=c+b[a+108>>2]|0,(o=s+b[a+104>>2]|0)>>>0>>0&&(c=c+1|0),b[a+104>>2]=o,b[a+108>>2]=c,c=b[a+100>>2],e=b[a+76>>2],e=(e=(u=(s=b[a+64>>2])+b[a+72>>2]|0)>>>0>>0?e+1|0:e)+c|0,e=(s=u+b[a+96>>2]|0)>>>0>>0?e+1|0:e,(s=(c=s)+M[b[a+32>>2]+1040|0]|0)>>>0>>0&&(e=e+1|0),b[a+96>>2]=s,b[a+100>>2]=e,b[a+112>>2]=T(n,24,b[a+112>>2]),b[a>>2]=4,o=b[a+92>>2],(s=b[a+88>>2]+1|0)>>>0<1&&(o=o+1|0),b[a+88>>2]=s,b[a+92>>2]=o}if(c=b[a+76>>2],3&(s=b[a+72>>2]))for(o=b[132105],u=b[132106];;){if((0|o)==(0|u)){l=0;break e}if(b[132105]=e=o+1|0,M[b[132104]+o|0]){l=7;break e}if((s=s+1|0)>>>0<1&&(c=c+1|0),b[a+72>>2]=s,b[a+76>>2]=c,o=e,!(3&s))break}b[a>>2]=5}o:{s:if(!(3<(o=(e=b[a+32>>2])+-1|0)>>>0)){l:switch(o-1|0){default:for(o=b[132105],l=b[132106];;){if((0|o)==(0|l)){l=0;break e}if(u=b[a+24>>2],s=b[a+28>>2],e=b[a+4>>2],b[132105]=c=o+1|0,h=M[b[132104]+o|0],p=u,o=s,u=31&e,(0|h)!=(255&(32<=(63&e)>>>0?o>>>u|0:((1<>>u))){l=7;break e}if(o=c,!((b[a+4>>2]=e=e+8|0)>>>0<32))break}b[a+24>>2]=0,b[a+28>>2]=0;break o;case 0:case 1:break s;case 2:break l}for(o=b[132105],l=b[132106];;){if((0|o)==(0|l)){l=0;break e}if(u=b[a+24>>2],s=b[a+28>>2],e=b[a+4>>2],b[132105]=c=o+1|0,h=M[b[132104]+o|0],p=u,o=s,u=31&e,(0|h)!=(255&(32<=(63&e)>>>0?o>>>u|0:((1<>>u))){l=7;break e}if(o=c,!((b[a+4>>2]=e=e+8|0)>>>0<64))break}b[a+24>>2]=0,b[a+28>>2]=0;break o}if(o=b[a+4>>2],!((e=M[e+1040|0])>>>0<=o>>>0))for(l=b[132105],s=b[132106];;){if((0|l)==(0|s)){l=0;break e}if(b[132105]=l=l+1|0,(0|e)==(0|(b[a+4>>2]=o=o+1|0)))break}}b[a+4>>2]=0,b[a>>2]=o=1;continue}break}for(f=a+144|0;;){m=b[132106],h=b[132104],(e=b[a+4>>2])||(b[a+8>>2]=0,b[a+12>>2]=0),o=b[132105];a:{for(;;){if(m>>>0<=o>>>0)l=0;else if(d=M[o+h|0],b[132105]=o=o+1|0,v=b[(u=a)+12>>2],p=127&d,l=31&e,s=32<=(63&e)>>>0?(c=p<>>32-l,p<>2],c=l=c|v,b[u+8>>2]=s,b[u+12>>2]=c,128&d){if(63!=(0|(b[a+4>>2]=e=e+(l=7)|0)))continue}else{if(d|!e)break a;l=7}break}e=b[a+132>>2],(d=(c=(s=o)-(o=b[a+16>>2])|0)+b[a+128>>2]|0)>>>0>>0&&(e=e+1|0),b[a+128>>2]=d,b[a+132>>2]=e,b[a+24>>2]=T(o+h|0,c,b[a+24>>2]),b[a+28>>2]=0;break e}b[a+4>>2]=0;a:{if((e=b[a+120>>2])>>>0<=2){o:switch(e-1|0){default:if(b[a+136>>2]=s,b[a+140>>2]=c,(0|s)!=b[a+88>>2]|(0|c)!=b[a+92>>2]){l=7;break e}b[a+120>>2]=1;break a;case 1:e=c+b[a+156>>2]|0,(c=s+b[a+152>>2]|0)>>>0>>0&&(e=e+1|0),b[a+152>>2]=c,b[a+156>>2]=e,b[a+160>>2]=T(f,24,b[a+160>>2]),b[a+120>>2]=1,c=b[a+140>>2]+-1|0,(o=b[a+136>>2]+-1|0)>>>0<4294967295&&(c=c+1|0),s=o,b[a+136>>2]=o,b[a+140>>2]=c;break a;case 0:break o}b[a+120>>2]=2,e=c+b[a+148>>2]|0,(c=s+b[a+144>>2]|0)>>>0>>0&&(e=e+1|0),b[a+144>>2]=c,b[a+148>>2]=e}s=b[a+136>>2],c=b[a+140>>2]}if(!(s|c))break}b[a>>2]=7}s=b[a+132>>2],p=((o=b[132105])+(((c=b[a+16>>2])-o|0)-(d=b[a+128>>2])&3)|0)-c|0;i:{for(;;){if(e=s,(l=(u=h=o-c|0)+d|0)>>>0>>0&&(e=e+1|0),!(3&(u=l)))break i;if(l=b[132104],b[132106]==(0|o)){b[a+128>>2]=u,b[a+132>>2]=e,b[a+24>>2]=T(l+c|0,h,b[a+24>>2]),l=b[a+28>>2]=0;break e}if(u=o+l|0,o=b[132105]=e=o+1|0,M[0|u])break}l=7;break e}if(o=b[132104],b[a+128>>2]=u,b[a+132>>2]=e,b[a+24>>2]=T(o+c|0,p,b[a+24>>2]),l=7,R(n,a+144|(b[a+28>>2]=0),24))break e;b[a>>2]=8}for(o=b[132105],l=b[132106];;){if((0|o)==(0|l)){l=0;break e}if(d=b[a+24>>2],c=b[a+28>>2],s=b[a+4>>2],b[132105]=e=o+1|0,u=b[132104],h=M[u+o|0],p=d,o=c,d=31&s,(0|h)!=(255&(32<=(63&s)>>>0?o>>>d|0:((1<>>d))){l=7;break e}if(o=e,!((b[a+4>>2]=s=s+8|0)>>>0<32))break}b[a+172>>2]=12,b[a+24>>2]=0,b[a+28>>2]=0,b[a>>2]=9,b[a+4>>2]=0,o=12;break t}e=b[132105],u=b[132104],l=b[132106],o=b[a+172>>2]}S(176+(a+(c=b[a+168>>2])|0)|0,e+u|0,o=(s=l-e|0)>>>0<(o=o-c|0)>>>0?s:o),b[132105]=o+b[132105],e=o+b[a+168>>2]|(l=0),o=b[a+172>>2],b[a+168>>2]=(0|o)==(0|e)?0:e,(0|e)==(0|o)&&(l=7,23129==(M[a+186|0]|M[a+187|0]<<8)&&(0|T(a+180|0,6,0))==(M[a+176|0]|M[a+177|0]<<8|(M[a+178|0]<<16|M[a+179|0]<<24))&&(o=b[a+132>>2],M[a+184|0]|(M[a+180|0]|M[a+181|0]<<8|(M[a+182|0]<<16|M[a+183|0]<<24))!=((3&o)<<30|b[a+128>>2]>>>2)|(e=o>>>2|0)||(l=b[a+32>>2]==M[a+185|0]?1:7)))}e:{if(!b[a+36>>2]){if(l){if(a=1==(0|l),e=l,l=1,a)break e}else e=b[132105]==b[132106]?7:8;return b[132108]=_,b[132105]=x,e}if(!(b[132105]!=(0|x)|l|b[132108]!=(0|_)))return e=M[a+40|0],y[a+40|0]=1,e<<3;y[a+40|0]=0}return l}function N(e){var t;return(-1>>>(t=31&e)&-2)<>>e}return n=Uv,c=(r=hv).buffer,i=new Uint8Array(c),(c=function(e,t){var n,r;if("undefined"==typeof Buffer)for(n=u(t),r=0;r>>1|0)^0-(1&r)&-306674912)>>>1|0))&-306674912^(n=(t^0-(1&n)&-306674912)>>>1|0))>>>1|0))&-306674912^(t=(t^0-(1&n)&-306674912)>>>1|0))>>>1|0)^0-(1&t)&-306674912)>>>1|0,b[1056+(r<<2)>>2]=0-(1&t)&-306674912^(t^0-(1&n)&-306674912)>>>1,256!=(0|(r=r+1|0)););for(var i,a,o=0,s=0,l=0,c=0,u=0,d=0;s=(o=c)>>>1|0,l=1&(o=(1&o)<<31|u>>>1),s^=0-(0<(a=1&u)>>>0)&-915646571,a=o^0-a&-679014590,o=s>>>1|0,o^=0-(0>>0)&-915646571,l=(s=(1&s)<<31|a>>>1)^0-l&-679014590,a=o>>>1|0,l=1&(o=(1&o)<<31|l>>>1),i=0-(s&=1)&-679014590,s=a^0-(0>>0)&-915646571,a=o^i,o=s>>>1|0,a=0-l&-679014590^(s=(1&s)<<31|a>>>1),o=(l=o^0-(0>>0)&-915646571)>>>1|0,s=(1&(o^=0-(0<(s&=1)>>>0)&-915646571))<<31|(s=(l=(1&l)<<31|a>>>1)^0-s&-679014590)>>>1,o=(l=0-(0<(a=1&l)>>>0)&-915646571^o>>>1)>>>1|0,a=1&(l=(1&l)<<31|(s^0-a&-679014590)>>>1),l^=0-(s&=1)&-679014590,s=(o^=0-(0>>0)&-915646571)>>>1|0,b[(i=2080+(d<<3)|0)>>2]=0-a&-679014590^((1&o)<<31|l>>>1),b[4+i>>2]=s^0-(0>>0)&-915646571,d=d+1|0,o=c,256!=(0|(u=c=u+1|0))|(c=o=c>>>0<1?o+1|0:o););return e=v(),0|(e=(b[263184]=e)?0:(p(0),1))},decompress:function(){var e,t=0;e:{if((e=d(b[263184]))>>>0<=8){t:switch(e-1|0){case 0:return p(b[263184]),0;case 2:return p(b[263184]),1;case 3:return p(b[263184]),2;case 4:return p(b[263184]),4;case 5:return p(b[263184]),5;case 6:case 7:break t;default:break e}return p(b[263184]),6}p(b[263184]),t=7}return 0|t},get_in_buffer_ptr:function(){return b[132104]},get_out_buffer_ptr:function(){return b[132107]},in_buffer_set_pos:function(e){b[132105]=e|=0},in_buffer_set_size:function(e){b[132106]=(e|=0)>>>0<524288?e:524288},out_buffer_set_pos:function(e){b[132108]=e|=0},out_buffer_set_size:function(e){b[132109]=(e|=0)>>>0<524288?e:524288},get_curr_output_length:function(){return b[132108]},is_input_end_reached:function(){return b[132105]==b[132106]|0},stackSave:function(){return 0|h},stackAlloc:function(e){return 0|(h=e=h-(e|=0)&-16)},stackRestore:function(e){h=e|=0},__growWasmMemory:function(e){return 0|o()}}}},instantiate:function(t,n){return{then:function(e){e({instance:new pv.Instance(new pv.Module(t,n))})}}},RuntimeError:Error},fv=[],Oh=("object"!=typeof pv&&dv("no native wasm support detected"),new pv.Table({initial:1,maximum:1,element:"anyfunc"})),mv=!1;function vv(e,t){e||Pv("Assertion failed: "+t)}function gv(e){var t=_["_"+e];return vv(t,"Cannot call unknown function "+e+", make sure it is exported"),t}function _v(e,u,t,n){var r={string:function(e){var t,n=0;return null!=e&&0!==e&&(t=1+(e.length<<2),n=Hv(t),function(e,t,n,r){if(!(0>6,t[n++]=128|63&l}else if(l<=65535){if(a<=n+2)break;t[n++]=224|l>>12,t[n++]=128|l>>6&63,t[n++]=128|63&l}else{if(a<=n+3)break;t[n++]=240|l>>18,t[n++]=128|l>>12&63,t[n++]=128|l>>6&63,t[n++]=128|63&l}}t[n]=0}(e,bv,n,t)),n},array:function(e){var t=Hv(e.length);return yv.set(e,t),t}};var e=gv(e),i=[],a=0;if(n)for(var o=0;o>10,56320|1023&s)))):a+=String.fromCharCode(l)}return a}return"";var c}(e.apply(null,i));return 0!==a&&Xv(a),e}var xv="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le");var yv,bv;Dh=_.TOTAL_MEMORY||16777216;function Mv(e){for(;0>2,n=(3&a)<<6|(o=s.indexOf(e.charAt(c++))),l+=String.fromCharCode(r<<2|i>>4),64!==a&&(l+=String.fromCharCode(t)),64!==o&&(l+=String.fromCharCode(n)),c>16&32768,n=e>>12&2047,r=e>>23&255;return r<103?t:142>114-r)+(n>>113-r&1):(t|r-112<<10|n>>1)+(1&n)}var s,p,f,m,v,e=new Uint8Array(e),g=(e.pos=0,function(e){var t,n,r=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,s={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=h(e)))return b(_,"no header found");if(!(n=t.match(/^#\?(\S+)$/)))return b(x,"bad initial token");for(s.valid|=l,s.programtype=n[1],s.string+=t+"\n";;){if(!1===(t=h(e)))break;if(s.string+=t+"\n","#"===t.charAt(0))s.comments+=t+"\n";else if((n=t.match(r))&&(s.gamma=parseFloat(n[1],10)),(n=t.match(i))&&(s.exposure=parseFloat(n[1],10)),(n=t.match(a))&&(s.valid|=c,s.format=n[1]),(n=t.match(o))&&(s.valid|=u,s.height=parseInt(n[1],10),s.width=parseInt(n[2],10)),s.valid&c&&s.valid&u)break}return s.valid&c?s.valid&u?s:b(x,"missing image size specifier"):b(x,"missing format specifier")}(e));if(n!==g){var M=g.width,A=g.height,w=function(e,t,n){var r,i,a,o,s,l,c,u,d,h,p,f,m,v=t,g=n;if(v<8||32767e.byteLength)return b(_);if(m[0]=e[a++],m[1]=e[a++],m[2]=e[a++],m[3]=e[a++],2!=m[0]||2!=m[1]||(m[2]<<8|m[3])!=v)return b(x,"bad rgbe scanline format");for(c=0;c{!e.isPlaneReflectionProbe&&this._isVisible(e)||(r[e.id]=e.layers.mask,e.layers.disableAll())}),this.reflectorWorldPosition),a=(i.setFromMatrixPosition(this.matrixWorld),this.cameraWorldPosition),o=(a.setFromMatrixPosition(t.matrixWorld),this.rotationMatrix),s=(o.extractRotation(this.matrixWorld),this.normal),l=(s.set(0,1,0),s.applyMatrix4(o),this.view);if(l.subVectors(i,a),0{!e.isPlaneReflectionProbe&&this._isVisible(e)||(e.layers.mask=r[e.id])});else{l.reflect(s).negate(),l.add(i),o.extractRotation(t.matrixWorld);const h=this.lookAtPosition,p=(h.set(0,0,-1),h.applyMatrix4(o),h.add(a),this.target),f=(p.subVectors(i,h),p.reflect(s).negate(),p.add(i),this.virtualCamera),m=(f.position.copy(l),f.up.set(0,1,0),f.up.applyMatrix4(o),f.up.reflect(s),f.lookAt(p),f.far=t.far,f.updateMatrixWorld(),f.projectionMatrix),v=(m.copy(t.projectionMatrix),this.textureMatrix),g=(v.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),v.multiply(m),v.multiply(f.matrixWorldInverse),this.reflectorPlane),_=(g.setFromNormalAndCoplanarPoint(s,i),g.applyMatrix4(f.matrixWorldInverse),this.clipPlane);_.set(g.normal.x,g.normal.y,g.normal.z,g.constant),ng.x=(Math.sign(_.x)+m.elements[8])/m.elements[0],ng.y=(Math.sign(_.y)+m.elements[9])/m.elements[5],ng.z=-1,ng.w=(1+m.elements[10])/m.elements[14],_.multiplyScalar(2/_.dot(ng)),m.elements[2]=_.x,m.elements[6]=_.y,m.elements[10]=_.z+1-this.probeClipStart,m.elements[14]=_.w;var c=n.getRenderTarget(),u=n.xr.enabled,d=n.shadowMap.autoUpdate,u=(n.xr.enabled=!1,n.shadowMap.autoUpdate=!1,n.setRenderTarget(this.renderTarget),n.state.buffers.depth.setMask(!0),!1===n.autoClear&&n.clear(),n.render(e,f),n.xr.enabled=u,n.shadowMap.autoUpdate=d,n.setRenderTarget(c),t.viewport);void 0!==u&&n.state.viewport(u),e.traverse(e=>{!e.isPlaneReflectionProbe&&this._isVisible(e)||(e.layers.mask=r[e.id])}),this._calcLocalBounding()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}copy(e){return super.copy(e),this.influenceDistance=e.influenceDistance,this.probeClipStart=e.probeClipStart,this.visibilityGroup=e.visibilityGroup,this.visibilityGroupInv=e.visibilityGroupInv,this}dispose(){null!==this.renderTarget&&(this.renderTarget.dispose(),this.renderTarget=null),this.dispatchEvent({type:"dispose"})}_isVisible(e){return null===this.visibilityGroup||(!e.isMesh||-1!==e.groupNames.indexOf(this.visibilityGroup)^this.visibilityGroupInv)}}rg.prototype.isPlaneReflectionProbe=!0;var ig={init:function(e,t){void 0!==e&&void 0!==t||console.error("RectAreaLightUniformsLib: Missing LTC data (required in Verge3D)");var n=new Float32Array(e),r=new Float32Array(t);O.LTC_FLOAT_1=new El(n,64,64,pt,At,s,ut,ut,ht,dt,1),O.LTC_FLOAT_2=new El(r,64,64,pt,At,s,ut,ut,ht,dt,1);const i=new Uint16Array(e.length),a=(e.forEach(function(e,t){i[t]=Sp.toHalfFloat(e)}),new Uint16Array(t.length));t.forEach(function(e,t){a[t]=Sp.toHalfFloat(e)}),O.LTC_HALF_1=new El(i,64,64,pt,je,s,ut,ut,ht,dt,1),O.LTC_HALF_2=new El(a,64,64,pt,je,s,ut,ut,ht,dt,1)}};const ag=new vt,og=new vt;class sg extends he{constructor(){super(),this.type="ClippingPlaneObject",this.plane=new xa,this.clippingGroup=null,this.clipShadows=!1,this.negated=!1,this.clipIntersection=!1,this.crossSection=!1,this.crossSectionColor=new _t(16711680),this.crossSectionOpacity=1,this.crossSectionRenderSide=Ve,this.crossSectionSize=100,this._crossMatProfile="blender"}updatePlane(){this.updateWorldMatrix(!0,!1),this.getWorldPosition(ag);var e=this.matrixWorld.elements;og.set(e[4],e[5],e[6]).normalize(),this.plane.setFromNormalAndCoplanarPoint(og,ag),this.negated&&this.plane.negate()}updateMatrixWorld(e){he.prototype.updateMatrixWorld.call(this,e),this.updatePlane()}needsClippingPlane(e){return e.isMesh&&(0<=e.groupNames.indexOf(this.clippingGroup)||null===this.clippingGroup)&&!e.isAuxClippingMesh}assignToObject(n,r=0){var i=this.plane;const a=n.material;var o=n.geometry;if(a.clippingPlanes=a.clippingPlanes||[],-1==a.clippingPlanes.indexOf(i)&&a.clippingPlanes.push(i),a.clipShadows=this.clipShadows,a.clipIntersection=this.clipIntersection,this.crossSection){this.cleanupAuxMeshes(n);const u=new fi;u.depthWrite=!1,u.depthTest=!1,u.colorWrite=!1,u.stencilWrite=!0,u.stencilFunc=519,u.clipShadows=this.clipShadows,u.clipIntersection=this.clipIntersection;var s=!!n.isSkinnedMesh,l=n.morphTargetInfluences,c=xt(l)&&0e!==this.plane),clipShadows:this.clipShadows,clipIntersection:this.clipIntersection,stencilWrite:!0,stencilRef:0,stencilFunc:517,stencilFail:7681,stencilZFail:7681,stencilZPass:7681,side:this.crossSectionRenderSide}),r=(this.crossSectionOpacity<1&&(n.transparent=!0,n.premultipliedAlpha=!0,n.blending=J,n.blendEquation=$,n.blendSrc=xe,n.blendDst=Ae),new Sa(this.crossSectionSize,this.crossSectionSize)),i=(this.negated?r.rotateX(-Math.PI/2):r.rotateX(Math.PI/2),new ee(r,n));i.name="ClipCrossSectionColor",i.isAuxClippingMesh=!0,i.renderOrder=t,i.onAfterRender=function(e){e.clearStencil()},this.add(i)}cleanupAuxMeshes(t=null){if(t)for(let e=t.children.length-1;0<=e;e--){const n=t.children[e];n.isAuxClippingMesh&&n.material.clippingPlanes[0]==this.plane&&(n.geometry.dispose(),n.material.dispose(),t.remove(n))}else for(let e=this.children.length-1;0<=e;e--){const r=this.children[e];r.isAuxClippingMesh&&(r.geometry.dispose(),r.material.dispose(),this.remove(r))}}copy(e){return super.copy(e),this.plane=e.plane,this.clippingGroup=e.clippingGroup,this.clipShadows=e.clipShadows,this.negated=e.negated,this.clipIntersection=e.clipIntersection,this.crossSection=e.crossSection,this.crossSectionColor.copy(e.crossSectionColor),this.crossSectionOpacity=e.crossSectionOpacity,this.crossSectionRenderSide=e.crossSectionRenderSide,this.crossSectionSize=e.crossSectionSize,this._crossMatProfile=e._crossMatProfile,this}}sg.prototype.isClippingPlaneObject=!0;class lg{constructor(e="ORBIT",t=!0,n=1,r=1){this.type=e,this.enablePan=t,this.enableKeys=!0,this.rotateSpeed=n,this.moveSpeed=r,this.orbitMinDistance=0,this.orbitMaxDistance=1/0,this.orbitMinZoom=0,this.orbitMaxZoom=1/0,this.orbitMinPolarAngle=0,this.orbitMaxPolarAngle=Math.PI,this.orbitMinAzimuthAngle=-1/0,this.orbitMaxAzimuthAngle=1/0,this.orbitTarget=null,this.collisionMaterial=null,this.gazeLevel=1.8,this.storyHeight=3,this.enablePointerLock=!1}copy(e){return this.type=e.type,this.enablePan=e.enablePan,this.enableKeys=e.enableKeys,this.rotateSpeed=e.rotateSpeed,this.moveSpeed=e.moveSpeed,this.orbitMinDistance=e.orbitMinDistance,this.orbitMaxDistance=e.orbitMaxDistance,this.orbitMinZoom=e.orbitMinZoom,this.orbitMaxZoom=e.orbitMaxZoom,this.orbitMinPolarAngle=e.orbitMinPolarAngle,this.orbitMaxPolarAngle=e.orbitMaxPolarAngle,this.orbitMinAzimuthAngle=e.orbitMinAzimuthAngle,this.orbitMaxAzimuthAngle=e.orbitMaxAzimuthAngle,this.orbitTarget=e.orbitTarget,this.collisionMaterial=e.collisionMaterial,this.gazeLevel=e.gazeLevel,this.storyHeight=e.storyHeight,this.enablePointerLock=e.enablePointerLock,this}clone(){return(new this.constructor).copy(this)}assignToControls(e){switch(this.type){case"ORBIT":e.targetObj=this.orbitTarget,e.minDistance=this.orbitMinDistance,e.maxDistance=this.orbitMaxDistance,e.minZoom=this.orbitMinZoom,e.maxZoom=this.orbitMaxZoom,e.minPolarAngle=this.orbitMinPolarAngle,e.maxPolarAngle=this.orbitMaxPolarAngle,e.minAzimuthAngle=this.orbitMinAzimuthAngle,e.maxAzimuthAngle=this.orbitMaxAzimuthAngle;break;case"FLYING":e.panSpeedTouch*=this.moveSpeed,e.zoomSpeedKey*=this.moveSpeed;break;case"FIRST_PERSON":e.gazeLevel=this.gazeLevel,e.storyHeight=this.storyHeight,e.zoomSpeedKey*=this.moveSpeed,e.enablePointerLock=this.enablePointerLock;break;default:return void console.error("ControlSettings: unsupported control type")}e.enablePan=this.enablePan,e.enableKeys=this.enableKeys,e.rotateSpeed*=this.rotateSpeed,e.rotateSpeedTouch*=this.rotateSpeed,e.panSpeed*=this.moveSpeed,e.panSpeedKey*=this.moveSpeed,e.zoomSpeed*=this.moveSpeed,e.zoomSpeedTouch*=this.moveSpeed}}const cg=["IMAGE_AR","SKYDOME_LIGHT_AR","TEXTURE_BL","TEX_IMAGE_BL","TEX_ENVIRONMENT_BL","BITMAP_MX","BITMAP_ENV_MX","TEX_ENVIRONMENT_MX","REFLECT_REFRACT_MX","FILE_MY","TEXTURE","TEX_IMAGE","TEX_ENVIRONMENT","TEX_ENVIRONMENT_MAX","BITMAP_MAX","BITMAP_ENV_MAX","REFLECT_REFRACT_MAX","AI_SKYDOME_LIGHT_MY","OSL_NODE"];class ug extends Sd{constructor(e){super(e),this.onProgress=null}load(e,t,n,r){const i=this,a=(i.onProgress=n||function(){},this.path&&"string"==typeof this.path?this.path:eh.extractUrlBase(e)),o=-1!=e.indexOf(".xz",e.length-3);let s;o?s=new qv(i.manager):(s=new Cd(i.manager)).setResponseType("arraybuffer");const l=function(e){i.onProgress&&i.onProgress(.3*e*100)};let c=l;s instanceof Cd&&(c=function(e){e=e.lengthComputable?e.loaded/e.total:1;l(e)}),s.load(e,function(e){i.parse(e,a,t,r,o)},c,r)}setPath(e){this.path=e}parse(e,t,o,n,r){const s=this;let i;const a={};var l=Lg(new Uint8Array(e,0,4)),l=(i=l===fg?(a[b.KHR_BINARY_GLTF]=new vg(e),a[b.KHR_BINARY_GLTF].content):Lg(new Uint8Array(e)),JSON.parse(i));if(void 0===l.asset||l.asset.version[0]<2)n(new Error("v3d.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{const c=l.asset.generator||"";if(-1this._layerMasks[e.id]=e.layers.mask)}_setupLayers(){this.scene.traverse(e=>{e.layers.disableAll();var t=e instanceof ee&&e.material&&!e.material.gtaoVisible,n=e instanceof ee&&e.material&&e.material.isMeshNodeMaterial&&(0e.layers.mask=this._layerMasks[e.id])}_setupNodeAlphaClipHashMaterials(){this.scene.traverse(e=>{e instanceof ee&&e.material&&e.material.isMeshNodeMaterial&&(e.material.defines.NORMAL_OUTPUT=Number(0{e instanceof ee&&e.material&&e.material.isMeshNodeMaterial&&(e.material.defines.NORMAL_OUTPUT=0,e.material.needsUpdate=!0)})}render(e){this._saveLayers(),this._setupLayers(),this.camera.layers.disableAll(),this.camera.layers.enable(1),this._setupNodeAlphaClipHashMaterials(),this._renderOverride(e,null,this.renderTargetNormalDepth,8355839,1,!0),this._restoreNodeAlphaClipHashMaterials(),this.camera.layers.disableAll(),this.camera.layers.enable(2),this._renderOverride(e,this.materialNormal,this.renderTargetNormalDepth,null,null,!0),this._restoreLayers(),this.materialGTAO.defines.ORTHO_CAMERA=this.camera.isOrthographicCamera?1:0,this.materialGTAO.defines.CALC_BENT_NORMALS=this.bentNormals?1:0,this.materialGTAO.needsUpdate=!0,this.materialGTAO.uniforms.tNormal.value=this.renderTargetNormalDepth.texture,this.materialGTAO.uniforms.tDepth.value=this.renderTargetNormalDepth.depthTexture,this.materialGTAO.uniforms.tNoise.value=this.noiseTexture,this.materialGTAO.uniforms.occlDistance.value=this.distance,this.materialGTAO.uniforms.factor.value=this.factor,this.materialGTAO.uniforms.occlPrecision.value=this.precision,this.materialGTAO.uniforms.bounceApprox.value=this.bounceApprox,this.materialGTAO.uniforms.mainCameraProjMat.value.copy(this.camera.projectionMatrix),this.materialGTAO.uniforms.resolution.value.set(this.renderTargetGTAO.width,this.renderTargetGTAO.height),this._renderPass(e,this.materialGTAO,this.renderTargetGTAO),this.materialBlur.uniforms.tDiffuse.value=this.renderTargetGTAO.texture,this.materialBlur.map=this.renderTargetGTAO.texture,this.materialBlur.uniforms.tNormal.value=this.renderTargetNormalDepth.texture,this.materialBlur.uniforms.direction.value.set(1,0),this.materialBlur.uniforms.resolution.value.set(this.renderTargetGTAO.width,this.renderTargetGTAO.height),this._renderPass(e,this.materialBlur,this.renderTargetBlurX),this.materialBlur.uniforms.tDiffuse.value=this.renderTargetBlurX.texture,this.materialBlur.map=this.renderTargetBlurX.texture,this.materialBlur.uniforms.direction.value.set(0,1),this.materialBlur.uniforms.resolution.value.set(this.renderTargetBlurX.width,this.renderTargetBlurX.height),this._renderPass(e,this.materialBlur,this.renderTarget)}_renderOverride(e,t,n,r,i,a){var o=e.getRenderTarget(),s=e.getClearColor(Dg),l=e.getClearAlpha(),c=e.autoClear,u=this.scene.background;e.setRenderTarget(n),null!=r&&(e.setClearColor(r),e.setClearAlpha(null!=i?i:0),e.clear()),e.autoClear=!1,a&&(this.scene.background=null),t&&(this.scene.overrideMaterial=t),e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.setRenderTarget(o),e.setClearColor(s),e.setClearAlpha(l),e.autoClear=c,this.scene.background=u}_renderPass(e,t,n,r,i){var a=e.getRenderTarget(),o=e.getClearColor(Dg),s=e.getClearAlpha(),l=e.autoClear;e.setRenderTarget(n),null!=r&&(e.setClearColor(r),e.setClearAlpha(null!=i?i:0),e.clear()),e.autoClear=!1,this.fsQuad.material=t,this.fsQuad.render(e),e.setRenderTarget(a),e.setClearColor(o),e.setClearAlpha(s),e.autoClear=l}createNoiseTexture(){var t=new Uint8Array([65,247,203,177,54,149,96,135,122,62,109,206,27,217,152,103,250,78,122,228,3,83,233,160,45,242,108,40,125,93,201,35,231,187,254,207,147,13,87,134,246,197,177,224,59,92,132,169,49,183,140,3,58,165,27,204,12,83,196,4,159,183,92,197,170,140,24,127,109,255,35,210,79,193,178,141,168,11,69,130,182,27,147,47,191,170,66,13,187,76,0,197,161,66,146,172,104,134,58,97,182,232,162,115,34,73,2,238,162,188,6,243,218,31,69,193,244,87,146,130,248,172,225,104,235,21,218,117,236,49,87,155,228,69,15,166,235,24,48,86,119,238,195,90,6,221,165,105,20,255,120,146,211,129,88,236,21,52,245,17,73,158,24,7,126,43,64,190,218,95,128,23,207,46,113,145,85,102,229,119,40,106,222,66,49,152,31,126,46,145,57,10,191,104,213,3,42,197,182,104,147,1,223,252,60,34,161,45,244,61,208,133,89,199,37,56,245,29,174,152,114,190,212,127,179,238,216,195,246,109,26,240,170,51,155,108,81,249,28,195,60,175,153,19,208,177,15,187,114,211,93,72,178,203,82,162,28,72,179,242,160,83,120,55,214,128,156,100,180,136,214,106,144,117,30,231,71,155,177,106,94,224,47,69,229,99,83,4,45,114,87,141,72,156,203,79,139,13,232,181,137,67,159,212,10,130,254,77,52,160,235,80,5,241,192,18,254,111,227,131,248,147,115,59,133,207,26,248,91,67,31,202,13,78,229,16,201,82,183,52,240,18,221,7,139,163,202,12,134,32,164,224,198,63,33,170,51,224,101,19,116,211,61,198,36,226,121,93,236,38,200,97,141,123,33,102,139,165,58,133,157,4,96,41,199,13,219,98,16,227,144,39,189,172,237,113,53,189,126,67,173,156,4,101,141,114,205,63,191,79,118,241,185,57,143,248,102,154,229,121,0,178,38,150,186,254,89,4,101,173,17,186,54,112,167,0,215,247,63,203,227,42,85,220,34,207,64,173,80,51,186,37,171,73,110,161,9,220,81,140,164,241,25,95,253,38,215,194,170,43,85,125,250,21,40,149,108,208,76,21,130,12,183,252,94,210,241,129,68,44,165,127,242,47,152,82,142,223,71,28,179,86,189,150,24,176,122,104,184,141,239,120,225,135,89,253,125,193,243,60,97,123,44,5,212,104,148,50,223,135,120,74,248,29,229,158,53,177,214,88,5,168,42,192,90,213,74,28,135,59,83,9,225,110,27,145,215,70,205,251,22,194,155,243,133,46,8,115,73,249,14,233,77,47,23,154,106,165,205,2,152,49,24,206,232,150,183,251,66,34,203,185,20,86,57,10,150,96,186,3,137,234,102,63,254,221,119,232,174,53,148,202,162,115,195,173,154,203,235,79,189,114,6,131,105,43,91,118,59,226,162,95,213,136,55,194,163,94,212,10,240,28,64,232,104,84,178,137,74,17,198,89,131,171,77,113,160,236,199,225,128,65,209,108,75,34,155,196,132,29,157,67,112,36,240,105,19,46,220,32,93,53,10,178,58,33,226,169,63,182,235,206,18,107,198,236,39,157,205,1,127,252,177,72,191,122,42,143,199,12,218,119,35,108,54,159,23,240,219,0,143,100,177,36,166,243,15,173,224,123,19,183,49,82,15,244,141,3,217,81,185,250,142,73,106,246,124,137,99,156,240,86,202,10,135,35,170,143,69,182,27,87,109,66,147,30,115,53,150,174,221,76,164,241,57,156,248,173,226,214,99,120,60,43,247,67,16,110,51,144,89,200,56,246,94,208,146,105,179,205,94,190,128,65,170,7,122,229,22,193,162,218,15,196,46,123,29,159,73,217,84,255,13,53,130,244,174,230,43,220,202,86,245,22,93,131,33,114,95,190,2,84,140,40,9,146,179,194,130,210,80,191,219,25,119,41,139,163,11,70,239,219,124,57,162,44,228,152,97,56,209,156,180,66,42,85,253,71,143,103,224,248,113,178,44,124,224,104,150,216,23,81,185,101,137,6,111,210,52,229,180,17,213,45,131,236,63,188,206,81,232,93,28,163,121,253,152,70,237,187,80,215,116,43,169,6,34,77,253,12,113,29,239,199,38,83,131,3,232,112,27,167,214,1,188,53,96,148,4,196,161,75,189,7,119,58,159,17,234,67,185,158,11,193,65,247,144,72,204,26,122,105,255,158,52,12,223,141,40,6,92,207,172,1,31,102,252,142,191,91,234,197,135,182,87,211,138,16,116,248,98,212,146,201,182,59,131,82,153,17,207,241,63,91,238,32,205,96,144,250,198,126,169,39,254,98,139,121,86,170,107,160,92,183,168,15,70,33,117,174,106,62,233,183,55,132,107,158,230,198,59,23,128,64,111,151,21,222,53,166,74,177,191,62,30,172,52,121,92,238,38,246,171,69,34,128,184,23,117,49,168,67,222,34,88,51,214,78,29,57,206,233,40,21,221,7,250,54,228,152,198,133,215,245,75,204,169,101,22,244,44,66,124,88,180,226,157,212,175,47,102,68,127,246,106,46,226,158,136,242,77,9,155,19,105,198,118,225,142,105,229,153,215,138,246,17,130,176,229,3,116,148,129,173,6,75,153,199,59,117,34,138,80,43,242,87,20,186,149,9,128,81,220,194,140,213,16,148,49,8,81,32,249,0,231,205,155,27,4,147,88,12,109,219,41,186,228,208,138,49,21,190,85,167,14,56,80,101,187,42,111,74,156,103,240,195,90,225,111,244,178,127,238,190,210,100,218,2,112,165,56,98,35,48,249,156,114,34,177,78,250,166,110,241,99,199,123,143,88,172,39,194,217,125,255,204,24,194,96,128,61,164,77,234,97,59,212,42,243,201,175,0,230,150,210,192,25,61,180,16,69,35,144,50,99,28,88,70,151,173,125,65,181,140,200,232,119,214,191,18,68,236,7,97,200,39,219,184,138,55,72,187,16,115,79,236,99,66,181,79,57,166,148,251,31,114,7,176,149,253,9,133,71,114,31,126,64,88,12,247,142,220,45,208,249,158,189,216,15,137,164,47,10,22,193,235,31,222,14,70,163,142,60,91,168,146,121,57,133,19,65,119,13,230,161,213,241,58,137,177,51,160,33,134,240,118,1,71,216,90,189,221,32,121,162,184,94,226,157,252,204,166,53,98,122,82,164,134,118,0,82,63,202,253,185,228,109,246,91,146,48,103,128,84,242,1,108,227,201,45,216,187,238,154,90,207,174,44,25,95,36,153,223,6,119,210,16,222,92,175,50,197,139,243,45,131,70,106,204,22,144,195,47,106,22,137,217,35,173,231,28,95,236,175,224,125,103,39,76,215,132,57,201,77,159,253,209,28,175,188,37,132,254,26,85,107,164,30,247,76,147,107,252,132,202,109,22,249,88,193,149,107,40,231,211,23,105,154,18,166,237,51,82,246,61,6,86,179,77,240,112,185,68,10,193,55,108,43,23,167,148,8,118,154,27,168,38,121,178,6,62,154,95,223,54,76,153,176,4,70,222,51,128,190,2,218,81,169,65,184,75,166,45,233,71,186,11,158,76,124,181,62,84,193,2,215,175,36,219,130,237,149,40,192,3,131,249,153,205,143,213,73,198,243,85,230,179,65,96,209,240,19,219,111,195,43,135,117,208,12,101,124,233,141,201,15,101,231,60,117,195,48,12,125,206,101,139,25,127,245,54,141,98,247,35,227,208,96,118,137,153,100,114,165,207,15,223,60,161,90,47,104,79,18,255,156,135,57,31,204,48,248,1,187,136,69,90,143,233,79,248,21,164,243,184,59,194,34,114,172,151,40,180,23,156,235,224,146,244,35,220,62,174,86,115,206,191,5,169,52,142,251,29,64,233,9,190,49,69,122,102,142,200,235,29,225,126,180,93,4,120,97,187,111,137,162,78,104,226,46,165,30,183,10,203,66,145,83,217,44,159,93,252,65,208,85,243,140,99,30,89,57,1,160,113,199,7,214,163,20,66,221,129,112,11,160,180,44,198,76,255,92,27,175,245,83,19,116,168,188,61,36,165,50,223,173,12,218,21,233,125,151,14,199,251,57,102,125,171,48,110,31,134,16,238,78,8,132,226,19,124,72,205,171,115,191,80,180,93,251,151,37,236,46,94,148,79,237,201,71,90,221,126,18,157,136,231,187,37,210,54,71,216,9,147,231,69,193,240,76,147,60,90,193,37,55,177,114,131,214,157,224,92,239,196,229,98,206,119,177,215,49,96,166,197,5,255,44,135,239,216,23,131,50,103,77,123,178,254,26,187,39,103,20,242,147,105,171,209,58,111,11,162,124,150,252,134,99,206,112,141,17,33,207,127,252,169,72,212,245,92,26,82,3,71,39,18,150,181,1,167,69,143,24,155,188,35,146,55,109,220,65,19,152,39,70,233,189,15,227,136,196,109,161,215,59,170,132,189,54,33,82,227,40,145,74,195,93,0,178,42,83,25,246,125,89,107,157,45,100,29,121,5,158,203,235,145,188,244,208,116,78,61,129,46,249,192,57,105,246,116,235,178,82,158,185,98,202,122,173,145,61,166,205,28,55,0,85,121,140,231,210,3,118,249,200,8,98,246,215,50,234,220,107,199,158,56,175,41,212,235,177,7,200,227,185,106,134,65,44,167,108,54,175,140,255,23,220,90,113,36,231,83,2,70,200,15,31,126,230,9,84,250,107,10,213,115,90,156,72,223,242,14,32,75,45,87,158,176,68,133,190,168,116,20,132,33,64,241,13,226,188,2,148,61,82,136,239,53,149,82,220,17,99,226,31,126,8,193,100,160,204,185,16,148,209,127,172,219,136,93,242,143,52,214,164,47,197,32,78,247,41,235,144,102,173,205,183,152,99,238,216,17,108,151,28,86,61,181,154,78,171,143,116,95,75,167,221,192,20,115,68,165,13,40,253,176,196,76,154,237,87,44,230,30,136,76,239,164,95,47,22,157,61,43,206,181,71,118,25,140,94,224,179,132,7,184,200,126,48,64,249,112,195,26,127,56,234,42,219,239,5,207,250,91,189,27,211,134,253,103,121,48,248,182,95,217,129,192,58,117,138,22,202,60,169,216,68,109,52,122,5,64,195,227,183,102,250,113,167,6,103,244,192,64,237,150,54,162,97,67,20,34,163,90,134,6,168,69,142,182,201,78,124,162,142,104,39,123,12,233,49,66,32,144,14,90,160,36,205,24,109,232,92,159,0,245,111,94,130,16,183,153,247,176,222,141,31,74,133,10,212,28,147,81,222,38,174,124,2,111,21,209,121,221,253,110,214,17,229,53,220,37,254,93,1,171,100,50,71,192,223,56,202,109,162,182,198,238,209,227,64,140,243,153,74,172,33,212,49,179,219,38,250,144,205,9,84,211,44,106,254,118,233,86,191,67,236,197,133,15,156,86,217,74,245,194,44,84,171,143,188,77,150,117,203,81,159,120,30,212,247,14,232,26,134,168,148,74,245,8,83,53,26,170,126,3,84,50,201,9,241,132,85,69,149,25,191,77,117,35,163,96,20,150,181,56,167,40,155,122,48,95,58,254,203,46,185,167,35,137,154,10,56,235,99,40,246,178,102,13,189,228,60,135,186,154,113,177,83,6,228,41,93,154,130,180,73,98,196,111,230,184,123,62,146,106,188,231,123,165,54,103,223,63,242,129,198,79,8,203,25,138,221,0,181,164,24,114,100,144,234,61,106,91,226,181,72,131,1,210,60,22,138,240,47,107,148,75,38,89,209,62,255,99,120,214,20,206,114,37,223,147,254,43,19,166,97,222,20,207,41,10,97,211,14,236,172,140,189,52,230,160,217,92,110,239,73,103,247,214,141,229,72,8,28,130,207,13,250,112,198,30,162,121,194,91,156,68,215,9,200,237,19,225,127,46,198,32,186,136,173,63,248,160,190,11,58,135,217,151,33,248,79,174,157,254,65,196,130,42,87,26,1,109,69,30,123,246,60,172,197,131,20,64,35,188,170,216,155,241,79,172,26,50,150,222,242,80,171,226,34,129,164,88,175,123,101,168,2,142,161,239,70,50,234,104,0,92,120,79,174,199,89,70,118,191,136,55,115,30,141,81,245,155,184,120,210,252,177,143,46,185,149,16,38,89,159,205,82,125,44,89,117,54,193,146,124,212,87,103,44,141,17,51,252,112,187,27,248,42,67,195,243,80,108,14,151,87,29,196,140,46,211,232,25,106,245,13,49,232,5,94,201,222,181,4,107,217,72,233,149,39,85,101,227,4,81,211,229,53,179,112,237,18,197,250,179,3,98,39,237,63,168,6,185,68,209,100,200,2,78,222,55,139,155,217,31,58,176,205,218,126,165,225,68,18,243,155,128,37,209,183,154,212,169,73,238,45,122,163,55,34,17,97,59,165,192,22,204,134,164,106,121,143,244,4,153,98,139,66,32,224,204,73,187,138,23,249,110,228,130,152,174,63,144,119,204,8,111,183,92,121,230,23,98,6,252,111,182,145,99,52,72,168,139,60,101,128,28,110,149,20,89,230,193,145,175,203,129,11,218,116,237,54,68,255,28,190,74,40,217,56,228,163,113,133,159,107,11,219,120,201,156,36,12,87,231,43,243,160,89,234,74,24,251,149,41,136,192,78,56,38,204,171,6,194,223,113,2,227,80,41,251,186,59,172,210,68,132,247,80,110,239,47,75,157,91,36,199,176,11,222,94,169,129,184,11,78,240,19,55,254,174,91,50,76,178,58,244,122,24,192,102,35,18,189,171,132,51,201,167,64,243,180,157,130,82,28,117,252,88,178,23,242,161,200,11,220,135,242,7,103,42,26,220,3,183,138,249,174,14,127,149,100,47,137,62,208,24,105,201,45,176,212,85,36,148,230,26,132,96,217,187,71,211,135,168,218,125,64,210,98,14,225,84,105,33,119,11,239,216,232,134,59,34,144,206,95,120,67,145,83,99,34,156,202,117,167,62,155,93,30,64,107,213,186,241,81,231,160,119,251,85,233,145,124,96,152,195,116,66,207,161,238,2,142,164,46,110,8,78,52,250,146,39,240,160,116,4,210,229,140,196,94,66,43,184,162,215,77,50,190,32,234,180,48,125,189,77,255,141,88,236,210,122,199,150,225,24,56,1,206,111,26,196,5,152,37,68,220,0,29,243,138,8,186,41,107,197,30,88,255,151,180,230,94,197,5,108,76,185,58,145,172,72,22,51,165,107,147,200,8,100,245,127,154,9,109,166,22,217,232,14,55,181,19,190,51,13,231,42,83,120,142,70,169,38,182,77,54,177,114,192,249,59,183,75,225,100,126,83,248,55,118,225,18,62,202,31,118,157,176,221,139,29,195,253,43,91,184,247,207,14,125,71,237,115,21,174,60,221,253,88,199,66,112,173,128,224,36,110,78,134,176,102,190,163,252,95,219,127,245,139,215,237,91,16,166,132,108,157,50,16,216,169,151,73,176,207,129,101,240,137,68,21,84,48,236,94,123,17,216,132,153,114,81,224,27,92,151,45,225,194,138,75,39,129,157,4,144,43,95,72,239,146,165,251,62,5,237,32,202,48,153,9,62,99,13,161,128,48,80,213,36,232,176,200,63,25,228,7,137,36,81,169,0,45,185,247,211,129,10,203,68,166,104,231,1,62,37,179,255,56,209,168,86,3,101,211,182,54,235,102,245,214,195,158,0,202,96,27,213,154,74,133,16,108,188,87,227,198,110,32,203,228,148,190,7,92,115,253,145,97,193,109,184,246,51,218,192,148,228,104,164,61,151,175,245,50,79,31,189,239,139,161,7,192,130,33,67,249,122,15,148,25,206,79,32,169,20,120,63,219,45,126,194,113,90,222,178,67,234,27,173,149,51,254,71,20,102,244,65,139,26,80,37,131,47,238,14,93,159,112,74,123,89,33,15,115,227,37,110,143,208,158,121,87,214,104,228,112,176,234,142,162,198,230,91,172,117,188,133,50,87,249,139,174,84,241,11,52,170,38,246,143,117,206,41,123,84,167,138,182,120,42,170,197,156,236,209,163,70,213,146,60,230,25,11,210,56,179,206,75,191,88,5,182,224,57,11,199,45,73,149,82,18,97,49,27,111,58,41,247,69,10,220,151,107,200,12,35,106,181,226,147,207,124,2,54,161,76,13,237,189,222,2,58,208,86,224,126,52,1,181,117,21,85,172,124,201,136,253,167,234,131,147,250,47,136,236,20,128,94,251,171,133,25,203,55,218,188,241,75,180,221,158,140,97,239,61,180,228,75,234,155,59,134,72,19,101,186,85,213,97,250,136,62,25,96,113,241,152,30,14,249,94,67,104,226,195,250,32,103,43,187,65,100,42,3,85,23,160,100,197,73,168,39,113,66,184,235,164,116,0,126,151,209,18,84,123,3,194,163,18,125,41,24,186,118,208,253,31,163,238,65,230,22,194,179,108,215,159,202,37,175,133,73,185,111,217,167,18,138,56,153,4,223,78,161,29,150,199,119,184,222,62,212,119,29,244,145,218,17,100,35,138,252,69,171,40,103,135,252,33,214,48,112,204,93,145,167,97,48,5,193,92,116,46,140,155,37,129,49,5,146,74,127,52,90,231,211,161,44,147,201,232,41,91,129,179,205,244,116,89,219,242,71,105,238,36,176,153,53,204,77,191,157,242,86,215,23,192,90,228,12,202,170,70,182,235,80,30,254,213,65,243,221,141,77,171,218,197,7,105,171,226,89,241,33,229,180,248,21,105,4,60,84,130,32,76,186,238,110,68,50,139,24,174,8,135,53,169,13,134,88,1,229,105,131,8,51,124,61,179,108,48,144,244,64,115,51,145,101,129,154,57,175,2,84,128,159,109,16,57,244,127,80,251,203,70,118,165,191,102,15,67,166,196,142,242,190,10,251,120,158,9,216,166,14,98,234,61,188,38,209,151,196,113,255,67,186,24,91,173,227,200,12,234,159,211,122,30,163,86,196,219,22,9,225,188,136,115,196,19,36,237,184,152,40,27,181,59,15,150,25,55,80,137,209,153,221,124,38,113,225,100,175,63,208,83,29,255,194,152,204,123,81,251,95,21,76,47,218,144,163,240,211,41,110,151,79,39,98,8,75,223,187,5,239,42,161,247,74,95,41,233,52,170,204,63,96,213,135,112,208,96,138,223,178,216,251,7,116,49,86,26,75,170,53,213,21,149,46,103,142,119,37,73,227,17,108,159,216,125,233,181,99,38,118,58,137,71,251,29,133]);const n=new Uint8Array(12288);for(let e=0;e<4096;e++)n[3*e]=t[e],n[3*e+1]=n[3*e+2]=0;const e=new El(n,64,64,wt,Mt);return e.wrapS=U,e.wrapT=U,e}}var Fg,Bg={fromCubeTexture:function(e){for(var t,n=0,r=new vt,i=new vt,a=new mt,o=[0,0,0,0,0,0,0,0,0],s=new Kd,l=s.coefficients,c=0;c<6;c++)for(var u=e.image[c],d=u.width,h=u.height,p=document.createElement("canvas"),p=(p.width=d,p.height=h,p.getContext("2d")),u=(p.drawImage(u,0,0,d,h),p.getImageData(0,0,d,h)),f=u.data,m=u.width,v=2/m,g=0,_=f.length;g<_;g+=4){a.set(f[g]/255,f[g+1]/255,f[g+2]/255,f[g+3]/255),zg(a,e.encoding);var x=g/4,y=(x%m+.5)*v-1,b=1-(Math.floor(x/m)+.5)*v;switch(c){case 0:r.set(-1,b,-y);break;case 1:r.set(1,b,y);break;case 2:r.set(-y,1,-b);break;case 3:r.set(-y,-1,b);break;case 4:r.set(-y,b,1);break;case 5:r.set(y,b,-1)}x=r.lengthSq(),n+=t=4/(Math.sqrt(x)*x),i.copy(r).normalize(),Kd.getBasisAt(i,o);for(var M=0;M<9;M++)l[M].x+=o[M]*a.x*t,l[M].y+=o[M]*a.y*t,l[M].z+=o[M]*a.z*t}for(var A=4*Math.PI/n,M=0;M<9;M++)l[M].x*=A,l[M].y*=A,l[M].z*=A;return new Jd(s)},fromCubeRenderTarget:function(e,t){for(var n,r=0,i=new vt,a=new vt,o=new mt,s=[0,0,0,0,0,0,0,0,0],l=new Kd,c=l.coefficients,u=0;u<6;u++)for(var d=t.width,h=new Uint8Array(d*d*4),p=(e.readRenderTargetPixels(t,0,0,d,d,h,u),2/d),f=0,m=h.length;f=r&&(this._timer&&(window.clearTimeout(this._timer),this._timer=null),this._counter=0,this._callback()))}.bind(this),this._domElement.addEventListener("keydown",this._keydownCb,!1)}function kg(e){this.data=void 0!==e?e:null,this.useHDR=!1}Object.assign(Gg.prototype,{dispose:function(){this._domElement.removeEventListener("keydown",this._keydownCb,!1),this._timer&&window.clearTimeout(this._timer)}}),Object.assign(kg.prototype,{isSceneBackground:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(e){null===e.data?this.data=null:e.data.isColor?this.data=e.data.clone():e.data.isCubeTexture||e.data.isTexture?(this.data=e.data.clone(),this.data.needsUpdate=!0):e.data.isWebGLCubeRenderTarget?(this.data=e.data.clone(),this.data.texture.needsUpdate=!0):this.data=e.data,this.useHDR=e.useHDR},toJSON:function(e){const t={metadata:{version:4.5,type:"SceneBackground",generator:"SceneBackground.toJSON"}};return null!==this.data&&(t.data=this.data.toJSON(e)),t}});const Wg={createMultiMaterialObject:function(n,r){const i=new Us;for(let e=0,t=r.length;e{t.isMesh&&e.layers.set(7)}),e.useHiDPIRenderPass=!0,e.renderer.setPixelRatio(window.devicePixelRatio))}),e.useHiDPIRenderPass&&t.scene.traverse(function(e){e.isLight&&e.layers.enable(7)})}_updateMeshesRaycastFromGLTF(e){e.scene&&e.scene.traverse(function(e){const t=e.geometry;!e.isMesh||!t.computeBoundsTree||0!==Object.keys(t.morphAttributes).length||t.attributes.position.isInterleavedBufferAttribute||t.index&&t.index.isInterleavedBufferAttribute||t.computeBoundsTree({verbose:!1})})}_prepareReflProbesFromGLTF(e){e.scene&&e.scene.traverse(e=>{var t;e.isCubeReflectionProbe?this._prepareEnvMapProbe(e):e.isPlaneReflectionProbe&&0<(t=this._checkMSAA(this.renderer,4))&&e.makeMultisampleRenderTarget(t)})}_prepareEnvMapProbe(e){switch(e.setSize(this._pmremMaxTileSize),this._envIBLMode){case 0:e.onUpdate=e=>this.generateRTargetPMREM(e);break;case 1:break;case 2:e.onUpdate=()=>null}}_prepareReflProbesEncoding(e,t){e.traverse(e=>{(e.isCubeReflectionProbe||e.isPlaneReflectionProbe)&&e.setEncoding(t)})}_prepareEnvMapProbeWorld(){const e=new Js,t=(e.worldMaterial=this.scene.worldMaterial,null===this.scene.worldEnvMapProbe&&(this.scene.worldEnvMapProbe=new $1(this._pmremMaxTileSize),this.scene.worldEnvMapProbe.influenceType=0,this.scene.worldEnvMapProbe.parallaxType=0),this.scene.worldEnvMapProbe);switch(this._envIBLMode){case 0:t.onUpdate=e=>this.generateRTargetPMREM(e);break;case 1:case 2:t.onUpdate=e=>{const t=e.clone(),n=(t.setSize(this._lightProbeCubemapRes,this._lightProbeCubemapRes),t.texture.type=Mt,t.texture.format=pt,t.texture.encoding=sn,new v1(e.texture));return n.render(this.renderer,t),n.dispose(),this._disposeEnvLightProbe(),this._envLightProbe=Bg.fromCubeRenderTarget(this.renderer,t),this.scene.add(this._envLightProbe),t.dispose(),1===this._envIBLMode?e:null}}t.update(e,this.renderer),this.renderer.compatSettings.useSpecEnvBlenderApprox=0===this._envIBLMode}_updateMaterialsFromGLTF(e){const n=this;e.scene&&e.scene.traverse(function(e){const t=e.material;t&&n.useHDR&&(t.useHDR=!0,t.useFloatTex=ma.checkFloatTex(n.renderer,!0),t.isMeshNodeMaterial&&t.updateNodeGraph())})}_updateAnimationsFromGLTF(e,r){const i=this;!i.mixer&&e.animations&&e.animations.length&&(i.mixer=new Uh(i.scene)),(e.animations||[]).forEach(function(t){var n=r.getObjectById(t.nodeId);if(n){let e;(e=n.id==r.id||""!==n.name&&"root"!==n.name&&"."!==n.name&&n.name!==r.name&&n.name!==r.uuid?i.mixer.clipAction(t.clip,r):i.mixer.clipAction(t.clip,n)).setLoop(t.loop,t.repetitions),e.startAt(t.startAt+i.mixer.time),e.clampWhenFinished=!0,t.auto?e.play():(e.stop(),e.paused=!0),i.actions.push(e)}})}_traverseSceneForTexUniforms(e,n){e.traverse(function(t){if(t.material){const e=Array.isArray(t.material)?t.material:[t.material];e.forEach(function(e){void 0!==e.program&&n(t,e,e.program.getTexUniformCount())})}})}_checkMSAA(e,t){return Math.min(t,e.capabilities.maxSamples)}_precompileSceneAsync(e,t,n,r){const i=this,a=i.compileCallbacks;for(let e=0;e{e.isPlaneReflectionProbe&&e.setSize(t,n)});var r=t/n;const s=this.camera;if(s.isPerspectiveCamera){var e=s.aspect{e.isPlaneReflectionProbe&&e.update(this.scene,this.camera,this.renderer)}),this.postprocessing){const r=this.postprocessing.gtaoGenerator,i=(r&&r.render(this.renderer),this.postprocessing.composer);i.render(this.elapsed)}else n&&this.renderer.render(this.scene,this.camera);n&&this.useHiDPIRenderPass&&(n=this.camera.layers.mask,e=this.scene.background,t=this.renderer.autoClear,this.scene.background=null,this.camera.layers.set(7),this.renderer.autoClear=!1,this.renderer.clearDepth(),this.renderer.render(this.scene,this.camera),this.camera.layers.mask=n,this.scene.background=e,this.renderer.autoClear=t),this.dispatchEvent({type:"onAfterRender"})}enableControls(e){const n=this.camera;if(n.controls){switch(n.controls.type){case"ORBIT":this.controls=new m1(n,e||this.renderer.domElement);break;case"FLYING":this.controls=new f1(n,this.renderer.domElement);break;case"FIRST_PERSON":this.controls=new p1(n,this.renderer.domElement),this.controls.collisionMeshes=[];const r=this;this.scene.traverse(function(e){var t=e.material;t&&n.controls.collisionMaterial&&t.name==n.controls.collisionMaterial.name&&r.controls.collisionMeshes.push(e)});break;default:this.controls=null}this.controls&&(n.controls.assignToControls(this.controls),this.controls.update())}}setCamera(t){if(this.camera=t,this.postprocessing){const n=this.postprocessing.composer.passes;for(let e=0;e{i.removeEventListener("dispose",v),this.renderer.disposeGTAO()};i.addEventListener("dispose",v),this.renderer.gtaoMap=i.renderTarget.texture}i.distance=h.distance,i.factor=h.factor,i.precision=h.precision,i.bentNormals=null!=(m=h.bentNormals)&&m,i.bounceApprox=h.bounceApprox;break;case"outline":let a;this.postprocessing.outlinePass?a=this.postprocessing.outlinePass:(a=new z1(new Be(this.getWidth(),this.getHeight()),this.scene,this.camera),u.insertPass(a,l),this.postprocessing.outlinePass=a),a.edgeStrength=h.edgeStrength,a.edgeGlow=h.edgeGlow,a.edgeThickness=h.edgeThickness,a.pulsePeriod=h.pulsePeriod,a.visibleEdgeColor.fromArray(h.visibleEdgeColor),a.hiddenEdgeColor.fromArray(h.hiddenEdgeColor),void 0===h.renderHiddenEdge?(d=0===h.hiddenEdgeColor[0]&&0===h.hiddenEdgeColor[1]&&0===h.hiddenEdgeColor[2],a.hiddenEdgeColor.setW(Number(!d))):a.hiddenEdgeColor.setW(Number(h.renderHiddenEdge));break;case"ssr":if(!ma.checkHalfFloatTex(this.renderer,!1)){console.warn("v3d.App: disabling SSR since your hardware does not support half float textures");break}let o=!1,s;((o=xt(h.useRefract)?h.useRefract:o)?this.postprocessing.ssrPassRefract:this.postprocessing.ssrPassReflect)?s=o?this.postprocessing.ssrPassRefract:this.postprocessing.ssrPassReflect:(s=new G1(this.scene,this.camera),u.insertPassAfter(s,[this.postprocessing.renderPass,this.postprocessing.ssrPassRefract,this.postprocessing.ssrPassReflect]),o?this.postprocessing.ssrPassRefract=s:this.postprocessing.ssrPassReflect=s),s.useRefract=o,xt(h.objects)&&(s.objects=h.objects),xt(h.intensity)&&(s.intensity=h.intensity),xt(h.steps)&&(s.steps=h.steps),xt(h.stride)&&(s.stride=h.stride),xt(h.binarySearchSteps)&&(s.binarySearchSteps=h.binarySearchSteps),xt(h.renderTargetScale)&&(s.renderTargetScale=h.renderTargetScale),xt(h.thickness)&&(s.thickness=h.thickness),xt(h.maxDistance)&&(s.maxDistance=h.maxDistance),xt(h.jitter)&&(s.jitter=h.jitter),xt(h.renderAfter)&&(s.renderAfter=h.renderAfter),xt(h.simpleRefraction)&&(s.simpleRefraction=h.simpleRefraction),this.onResize&&this.onResize();break;default:console.error(`v3d.App: wrong postprocessing effect "${h.type}"`)}}1==u.passes.length&&(r=new S1(E.copy),u.passes.push(r),this.postprocessing.copyPass=r)}disablePostprocessing(e,t){if(this.postprocessing){const r=this.postprocessing.gtaoGenerator,i=(!t&&r&&(r.dispose(),this.postprocessing.gtaoGenerator=null),["afterimagePass","bloomPass","brightnessContrastPass","bokehPass","grayscalePass","ssrPassReflect","ssrPassRefract"]),a=(e||i.push("outlinePass"),this.postprocessing.composer);for(let e=0;e{e.isCubeReflectionProbe&&e.update(this.scene,this.renderer)})}updateObjectMaterialEnv(e){console.warn("v3d.App.updateObjectMaterialEnv has been deprecated: not needed anymore")}generateRTargetPMREM(e){if(!e.isWebGLCubeRenderTarget)return null;const t=new Up(this.renderer,this._pmremMaxTileSize,!0);t.flipCubemapX=!1;e=t.fromCubeRenderTarget(e,{encoding:an});return t.dispose(),e}initWebXR(r,i,a,e,n,o){a=a||function(){},e=e||function(){},n=n||function(){},o=o||{};const s=this;function l(e){s.xrSession.removeEventListener("end",l),s.renderer.xr.setSession(null),n();for(let e=0;e[]));for(var i=Math.log10(1/t),f=Math.pow(10,i),h=0;hp?(t=co.maxTextureSize||e.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);var p=e.data;if(t===wt)for(var p=new Uint8ClampedArray(e.height*e.width*4),f=0,m=0;fe.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(o.evaluate(t),e.values.length),n=i.length-1}else for(s=0;st){i.set(e.times.slice(0,s+1),0),i[s+1]=t,i.set(e.times.slice(s+1),s+2),a.set(e.values.slice(0,(s+1)*r),0),a.set(o.evaluate(t),(s+1)*r),a.set(e.values.slice((s+1)*r),(s+2)*r),n=s+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var n=[],r={},i=e.tracks,a=0;a + + 水管 + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/ButtonChart7Icon2.png b/src/assets/ButtonChart7Icon2.png new file mode 100644 index 0000000..b968d31 Binary files /dev/null and b/src/assets/ButtonChart7Icon2.png differ diff --git a/src/assets/ButtonChart7Icon2.svg b/src/assets/ButtonChart7Icon2.svg new file mode 100644 index 0000000..e6909fb --- /dev/null +++ b/src/assets/ButtonChart7Icon2.svg @@ -0,0 +1,17 @@ + + + 氢气 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/ButtonChart7ItemBg.png b/src/assets/ButtonChart7ItemBg.png new file mode 100644 index 0000000..08a7a83 Binary files /dev/null and b/src/assets/ButtonChart7ItemBg.png differ diff --git a/src/assets/CenterChart2ItemBg.png b/src/assets/CenterChart2ItemBg.png new file mode 100644 index 0000000..79b694d Binary files /dev/null and b/src/assets/CenterChart2ItemBg.png differ diff --git a/src/assets/CenterChart2icon1.svg b/src/assets/CenterChart2icon1.svg new file mode 100644 index 0000000..659200e --- /dev/null +++ b/src/assets/CenterChart2icon1.svg @@ -0,0 +1,26 @@ + + + 217时间-线性 + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/CenterChart2icon2.svg b/src/assets/CenterChart2icon2.svg new file mode 100644 index 0000000..9e0d2dc --- /dev/null +++ b/src/assets/CenterChart2icon2.svg @@ -0,0 +1,29 @@ + + + 燃脂 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/CenterChart2icon3.svg b/src/assets/CenterChart2icon3.svg new file mode 100644 index 0000000..910c739 --- /dev/null +++ b/src/assets/CenterChart2icon3.svg @@ -0,0 +1,29 @@ + + + 沙漏 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/CenterChart2icon4.svg b/src/assets/CenterChart2icon4.svg new file mode 100644 index 0000000..527c796 --- /dev/null +++ b/src/assets/CenterChart2icon4.svg @@ -0,0 +1,31 @@ + + + 编组 36 + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/Gap.png b/src/assets/Gap.png new file mode 100644 index 0000000..bae9288 Binary files /dev/null and b/src/assets/Gap.png differ diff --git a/src/assets/Icon/ButtonChart1Icon1.png b/src/assets/Icon/ButtonChart1Icon1.png new file mode 100644 index 0000000..f81818f Binary files /dev/null and b/src/assets/Icon/ButtonChart1Icon1.png differ diff --git a/src/assets/Icon/ButtonChart1Icon2.png b/src/assets/Icon/ButtonChart1Icon2.png new file mode 100644 index 0000000..a4a1a93 Binary files /dev/null and b/src/assets/Icon/ButtonChart1Icon2.png differ diff --git a/src/assets/Icon/ButtonChart2Icon1.png b/src/assets/Icon/ButtonChart2Icon1.png new file mode 100644 index 0000000..d871d3b Binary files /dev/null and b/src/assets/Icon/ButtonChart2Icon1.png differ diff --git a/src/assets/Icon/ButtonChart3Icon1.png b/src/assets/Icon/ButtonChart3Icon1.png new file mode 100644 index 0000000..b059950 Binary files /dev/null and b/src/assets/Icon/ButtonChart3Icon1.png differ diff --git a/src/assets/Icon/ButtonChart4Icon1.png b/src/assets/Icon/ButtonChart4Icon1.png new file mode 100644 index 0000000..ea94e5d Binary files /dev/null and b/src/assets/Icon/ButtonChart4Icon1.png differ diff --git a/src/assets/Icon/LeftChart2Icon.png b/src/assets/Icon/LeftChart2Icon.png new file mode 100644 index 0000000..6f4ea34 Binary files /dev/null and b/src/assets/Icon/LeftChart2Icon.png differ diff --git a/src/assets/Icon/LeftChart2Icon2.png b/src/assets/Icon/LeftChart2Icon2.png new file mode 100644 index 0000000..5dff845 Binary files /dev/null and b/src/assets/Icon/LeftChart2Icon2.png differ diff --git a/src/assets/Icon/LeftrChart1ICon.png b/src/assets/Icon/LeftrChart1ICon.png new file mode 100644 index 0000000..a9f2d0c Binary files /dev/null and b/src/assets/Icon/LeftrChart1ICon.png differ diff --git a/src/assets/Icon/RightChart1Icon2.png b/src/assets/Icon/RightChart1Icon2.png new file mode 100644 index 0000000..fbb3b08 Binary files /dev/null and b/src/assets/Icon/RightChart1Icon2.png differ diff --git a/src/assets/Icon/rightChart1ICon.png b/src/assets/Icon/rightChart1ICon.png new file mode 100644 index 0000000..42fc6fd Binary files /dev/null and b/src/assets/Icon/rightChart1ICon.png differ diff --git a/src/assets/Icon/rightChart2ICon.png b/src/assets/Icon/rightChart2ICon.png new file mode 100644 index 0000000..a694c6e Binary files /dev/null and b/src/assets/Icon/rightChart2ICon.png differ diff --git a/src/assets/Icon/rightChart3ICon.png b/src/assets/Icon/rightChart3ICon.png new file mode 100644 index 0000000..3777441 Binary files /dev/null and b/src/assets/Icon/rightChart3ICon.png differ diff --git a/src/assets/ItemBg.png b/src/assets/ItemBg.png new file mode 100644 index 0000000..b03d2d7 Binary files /dev/null and b/src/assets/ItemBg.png differ diff --git a/src/assets/ItemBg2.png b/src/assets/ItemBg2.png new file mode 100644 index 0000000..af03faa Binary files /dev/null and b/src/assets/ItemBg2.png differ diff --git a/src/assets/ItemBg3.png b/src/assets/ItemBg3.png new file mode 100644 index 0000000..690e073 Binary files /dev/null and b/src/assets/ItemBg3.png differ diff --git a/src/assets/ItemLineTop.png b/src/assets/ItemLineTop.png new file mode 100644 index 0000000..cd3ba39 Binary files /dev/null and b/src/assets/ItemLineTop.png differ diff --git a/src/assets/MainBG.png b/src/assets/MainBG.png new file mode 100644 index 0000000..bac9fe5 Binary files /dev/null and b/src/assets/MainBG.png differ diff --git a/src/assets/Thumbs.db b/src/assets/Thumbs.db new file mode 100644 index 0000000..02c5e85 Binary files /dev/null and b/src/assets/Thumbs.db differ diff --git a/src/assets/TopButtonLine.png b/src/assets/TopButtonLine.png new file mode 100644 index 0000000..b90a616 Binary files /dev/null and b/src/assets/TopButtonLine.png differ diff --git a/src/assets/TopSide.png b/src/assets/TopSide.png new file mode 100644 index 0000000..dac19b5 Binary files /dev/null and b/src/assets/TopSide.png differ diff --git a/src/assets/TopTitleLeft.png b/src/assets/TopTitleLeft.png new file mode 100644 index 0000000..9128649 Binary files /dev/null and b/src/assets/TopTitleLeft.png differ diff --git a/src/assets/TopTitleLeftIcon.png b/src/assets/TopTitleLeftIcon.png new file mode 100644 index 0000000..97f5442 Binary files /dev/null and b/src/assets/TopTitleLeftIcon.png differ diff --git a/src/assets/TopTitleRight.png b/src/assets/TopTitleRight.png new file mode 100644 index 0000000..f372fdd Binary files /dev/null and b/src/assets/TopTitleRight.png differ diff --git a/src/assets/TopTitleRightIcon.png b/src/assets/TopTitleRightIcon.png new file mode 100644 index 0000000..7a04d81 Binary files /dev/null and b/src/assets/TopTitleRightIcon.png differ diff --git a/src/assets/V3DBG.png b/src/assets/V3DBG.png new file mode 100644 index 0000000..66e85d0 Binary files /dev/null and b/src/assets/V3DBG.png differ diff --git a/src/assets/buttonChart2GapLine.png b/src/assets/buttonChart2GapLine.png new file mode 100644 index 0000000..31edb01 Binary files /dev/null and b/src/assets/buttonChart2GapLine.png differ diff --git a/src/assets/status/fault.svg b/src/assets/status/fault.svg new file mode 100644 index 0000000..d7bf9f6 --- /dev/null +++ b/src/assets/status/fault.svg @@ -0,0 +1,27 @@ + + + 矩形备份 7 + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/status/maintenance.svg b/src/assets/status/maintenance.svg new file mode 100644 index 0000000..742a425 --- /dev/null +++ b/src/assets/status/maintenance.svg @@ -0,0 +1,25 @@ + + + 矩形备份 16 2 + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assets/status/normal.svg b/src/assets/status/normal.svg new file mode 100644 index 0000000..962ddd2 --- /dev/null +++ b/src/assets/status/normal.svg @@ -0,0 +1,29 @@ + + + 矩形备份 16 + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/BottomBar/Chart1.jsx b/src/components/BottomBar/Chart1.jsx new file mode 100644 index 0000000..3e3aee3 --- /dev/null +++ b/src/components/BottomBar/Chart1.jsx @@ -0,0 +1,127 @@ +import React, { useEffect, useState } from 'react'; +import { motion } from 'framer-motion'; + +//小时蒸汽产生量 +import Item from './substitutionCharts/Chart1.jsx'; + +//窑炉温度变化 +import Item2 from './substitutionCharts/Chart4.jsx'; + +import ICon1 from '../../assets/Icon/ButtonChart1Icon1.png'; +import ICon2 from '../../assets/Icon/ButtonChart1Icon2.png'; + +import './Chart1.less'; + +const Daytitle = '日发电量统计'; +const Dayxdata = [ + '1:00', + '2:00', + '3:00', + '4:00', + '5:00', + '6:00', + '7:00', + '8:00', + '9:00', + '10:00', + '11:00', + '12:00', + '13:00', + '14:00', + '15:00', + '16:00', + '17:00', + '18:00', + '19:00', + '20:00', + '21:00', + '22:00', + '23:00', + '24:00', +]; +const Daydata = [ + 70, + 45, + 10, + 28, + 18, + 28, + 46, + 70, + 45, + 10, + 28, + 18, + 28, + 46, + 70, + 45, + 10, + 28, + 18, + 28, + 46, + 22, + 25, + 26, +]; + +const Monthtitle = '月发电量统计'; +const Monthxdata = ['一月', '二月', '三月', '四月', '五月', '六月', '七月']; +const Monthdata = [170, 145, 110, 128, 118, 128, 146]; + +const Yeartitle = '年发电量统计'; +const Yearxdata = ['2016', '2017', '2018', '2019', '2020', '2021', '2022']; +const Yeardata = [870, 845, 810, 828, 818, 828, 846]; + +export default function Chart1() { + const [index, setIndex] = useState(1); + + useEffect(() => { + const timer = setInterval(() => { + SwitchIndex(); + }, 10000); + return () => clearInterval(timer); + }, []); + let num = 1; + + function SwitchIndex() { + num = num + 1; + if (num < 3) { + setIndex(num); + } else { + num = 1; + setIndex(num); + } + } + + //切换图表 + function SwitchChart(index) { + switch (index) { + case 1: + return ; + case 2: + return ; + default: + return ; + } + } + + return ( +
+
+ 图片读取失败 +
+ {index == 1 ? '小时蒸汽产生量' : '窑炉温度变化'} +
+
+ + {SwitchChart(index)} + +
+ ); +} diff --git a/src/components/BottomBar/Chart1.less b/src/components/BottomBar/Chart1.less new file mode 100644 index 0000000..1cc34f6 --- /dev/null +++ b/src/components/BottomBar/Chart1.less @@ -0,0 +1,38 @@ +.ButtonChart1AllBorder { + width: 625px; + height: 306px; + background: url('../../assets/ItemBg.png'); + display: flex; + flex-direction: column; + justify-content: space-between; + + .ButtonChart1ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 202px; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + vertical-align: middle; + + .ButtonChart1ItemIcon { + width: 24px; + height: 24px; + margin-top: 2px; + } + .ButtonChart1ItemTitle { + font-size: 24px; + color: #ffffff; + margin-left: 8px; + margin-top: -5px; + } + } + .ButtonChart1ItemBorder { + width: 95%; + height: 227px; + margin-left: 16px; + margin-bottom: 16px; + + } +} diff --git a/src/components/BottomBar/Chart2.jsx b/src/components/BottomBar/Chart2.jsx new file mode 100644 index 0000000..adcc48f --- /dev/null +++ b/src/components/BottomBar/Chart2.jsx @@ -0,0 +1,23 @@ +import { useEffect, useState } from 'react' + +import Item2 from './substitutionCharts/Chart2.jsx' +import Icon from '../../assets/Icon/ButtonChart2Icon1.png' +import GapLine from '../../assets/buttonChart2GapLine.png' +import './Chart2.less' + + +export default function Chart2() { + return ( +
+
+ 图片加载错误 +
AB线成品量
+
+
+ +
+ +
+
+ ) +} diff --git a/src/components/BottomBar/Chart2.less b/src/components/BottomBar/Chart2.less new file mode 100644 index 0000000..57ac882 --- /dev/null +++ b/src/components/BottomBar/Chart2.less @@ -0,0 +1,50 @@ +.ButtonChart2AllBorder { + width: 625px; + height: 306px; + background: url('../../assets/ItemBg.png'); + display: flex; + flex-direction: column; + justify-content: space-between; + + .ButtonChart2ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 202px; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + vertical-align: middle; + + .ButtonChart2ItemIcon { + width: 24px; + height: 24px; + margin-top:2px; + } + + .ButtonChart2ItemTitle { + font-size: 24px; + color: #ffffff; + margin-left: 8px; + margin-top: -5px; + } + } + + .ButtonChart2ItemBorder { + width: 95%; + height: 227px; + margin-left: 16px; + margin-bottom: 16px; + display: flex; + flex-direction: row; + justify-content: space-around; + .ButtonChart2ItemGap {/* */ + float: left; + width: 1px; + height: 90%; + background:url('../../assets/Gap.png'); + border-width: 1.3px; + z-index: 20; + } + } +} diff --git a/src/components/BottomBar/Chart3.jsx b/src/components/BottomBar/Chart3.jsx new file mode 100644 index 0000000..82461b3 --- /dev/null +++ b/src/components/BottomBar/Chart3.jsx @@ -0,0 +1,36 @@ +import React from 'react' + +//导入图表 +import Item from './Form/Form.jsx' +import Item1 from './Form/Form1.jsx' + +import Icon1 from '../../assets/Icon/ButtonChart3Icon1.png' +import Icon2 from '../../assets/Icon/ButtonChart1Icon1.png' + +import './Chart3.less' + +export default function Chart3() { + return ( +
+
+
+ 图片加载错误 +
退火风机状况
+
+
+ +
+
+
+
+
+ 图片加载错误 +
空压机运行时间
+
+
+ +
+
+
+ ) +} diff --git a/src/components/BottomBar/Chart3.less b/src/components/BottomBar/Chart3.less new file mode 100644 index 0000000..246b03a --- /dev/null +++ b/src/components/BottomBar/Chart3.less @@ -0,0 +1,56 @@ +.ButtonChart3AllBorder { + width: 625px; + height: 306px; + background: url('../../assets/ItemBg.png'); + display: flex; + flex-direction: row; + justify-content: space-around; + + .ButtonChart3ItemBorder { + width: 48%; + height: 100%; + + .ButtonChart3ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 100%; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + vertical-align: middle; + + + .ButtonChart3ItemIcon { + width: 24px; + height: 24px; + margin-top:3px; + } + + .ButtonChart3ItemTitle { + font-size: 24px; + color: #ffffff; + margin-left: 8px; + margin-top: -5px; + } + } + + .ButtonChart3ItemDetail { + width: 92%; + height: 230px; + margin-left: 16px; + margin-bottom: 16px; + + } + } + .ButtonChart3ItemGap{ + float: left; + margin-top: 8%; + width: 1px; + height:75%; + background:url('../../assets/Gap.png'); + background-repeat: no-repeat; + border-width: 1.3px; + z-index:20; + } +} \ No newline at end of file diff --git a/src/components/BottomBar/Chart4.jsx b/src/components/BottomBar/Chart4.jsx new file mode 100644 index 0000000..cd6b335 --- /dev/null +++ b/src/components/BottomBar/Chart4.jsx @@ -0,0 +1,68 @@ +import React, { useEffect, useState } from 'react'; +import { motion } from 'framer-motion'; + +//火炉实时流量 +import Chart1 from './substitutionCharts/Chart3.jsx'; + +//空压机运行时间 +import Chart2 from './substitutionCharts/Chart4.jsx'; + +import Icon1 from '../../assets/Icon/ButtonChart4Icon1.png'; +import Icon2 from '../../assets/Icon/ButtonChart1Icon2.png'; + +import './Chart4.less'; + + +export default function Chart4() { + const [index, setIndex] = useState(1); + let num = 1; + useEffect(() => { + const timer = setInterval(() => { + SwitchIndex(); + }, 10000); + return () => clearInterval(timer); + }, []); + + function SwitchIndex() { + num = num + 1; + if (num < 3) { + setIndex(num); + } else { + num = 1; + setIndex(num); + } + } + + function SwitchData(index) { + switch (index) { + case 1: + return ; + case 2: + return ; + } + } + + return ( +
+
+ 图片加载错误 +
+ {index == 1 ? '火炉实时流量' : '火炉实时温度'} +
+
+ +
{SwitchData(index)}
+
+
+ ); +} diff --git a/src/components/BottomBar/Chart4.less b/src/components/BottomBar/Chart4.less new file mode 100644 index 0000000..6fabdfe --- /dev/null +++ b/src/components/BottomBar/Chart4.less @@ -0,0 +1,47 @@ +.ButtonChart4AllBorder { + width: 528px; + height: 306px; + background: url('../../assets/ItemBg3.png'); + display: flex; + flex-direction: column; + justify-content: space-between; + + .ButtonChart4ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 100%; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + vertical-align: middle; + .ButtonChart4ItemIcon { + width: 24px; + height: 24px; + margin-top: 3px; + } + .ButtonChart4ItemTitle { + font-size: 24px; + color: #ffffff; + margin-left: 8px; + margin-top: -5px; + } + } + + .ButtonChart4ItemBorder { + width: 95%; + height: 227px; + margin-left: 16px; + margin-bottom: 16px; + background-repeat: round; + display: flex; + flex-direction: row; + justify-content: space-around; + + .ButtonChart4ItemBorder1 { + margin-top: 1%; + width: 98%; + height: 90%; + } + } +} diff --git a/src/components/BottomBar/Form/Form.jsx b/src/components/BottomBar/Form/Form.jsx new file mode 100644 index 0000000..de7a453 --- /dev/null +++ b/src/components/BottomBar/Form/Form.jsx @@ -0,0 +1,67 @@ + +import React, { Component } from 'react'; + +import { ScrollBoard } from '@jiaminghi/data-view-react' + +import fault from '@/assets/status/fault.svg' +import maintenance from '@/assets/status/maintenance.svg' +import normal from '@/assets/status/normal.svg' +import './Form.less' +//  
欢迎来到php中文网学习html技术,这里有全面的css教程
+// background-image: radial-gradient(circle, red, yellow, green);, color:#1723ff",radial-gradient(circle, red, yellow, green) +const Style1 = `
Error 正常
` +const Style2 = `
Error 维修
` +const Style3 = `
Error 故障
` + +//rgba(201, 196, 191,0.5) + +let config = { + headerBGC: 'rgba(4, 36, 68,0.5)', + header: ['设备名称 ', '设备状态 '], + align: ['center'], + indexHeader: '序号 ', + index: true, + rowNum: 7, + columnWidth: [400, 400, 400], + headerHeight: 35, + oddRowBGC: "#042444", + evenRowBGC: "#042c4c", + data: [ + ['退火1', Style1], + ['退火2', Style2], + ['退火3', Style1], + ['退火4', Style2], + ['退火5', Style1], + ['退火6', Style3], + ['退火7', Style3], + ['退火8', Style1], + ['退火9', Style1], + ['退火10', Style3] + ] +} + + +function replaceStyle(STR) { + if (STR) { + return ` ${STR}` + } +} + + + +class Form extends Component { + + + render() { + return ( +
+
+
+ +
+ + ); + } +} + +export default Form; diff --git a/src/components/BottomBar/Form/Form.less b/src/components/BottomBar/Form/Form.less new file mode 100644 index 0000000..71663d9 --- /dev/null +++ b/src/components/BottomBar/Form/Form.less @@ -0,0 +1,28 @@ +.ButtonFormitemDetailBorder { + width: 98%; + height: 100%; + margin-top: 2%; + position: relative; + + .ButtonFormitemDetailBorderLine1 { + width: 1px; + height: 95%; + background-color:#041c2c; + float: left; + margin-left:28%; + z-index: 5; + position: absolute; + border-width: 1px; + } + .ButtonFormitemDetailBorderLine2 { + width: 1px; + height: 95%; + background-color:#041c2c; + float: left; + margin-left: 60%; + z-index: 10; + position: absolute; + border-width: 1px; + + } +} diff --git a/src/components/BottomBar/Form/Form1.jsx b/src/components/BottomBar/Form/Form1.jsx new file mode 100644 index 0000000..80ef2b2 --- /dev/null +++ b/src/components/BottomBar/Form/Form1.jsx @@ -0,0 +1,62 @@ +import React, { Component } from 'react'; + +import { ScrollBoard } from '@jiaminghi/data-view-react' + + +import './Form1.less' + +let config = { + headerBGC: 'rgba(4, 36, 68,0.5)', + header: ['设备名称 ', '运行时间 '], + index: true, + align: ['center'], + oddRowBGC: "#042444", + evenRowBGC: "#042c4c", + indexHeader: '序号 ', + rowNum: 5, + columnWidth: [300, 350, 300], + headerHeight: 35, + rowNum:7, + data: [ + ['#1空压', '2039'], + ['#2空压', '23212'], + ['#3空压', '2532'], + ['#4空压', '1252'], + ['#5空压', '1231'], + ['#6空压', '1231'], + ['#7空压', '3532'], + ['#8空压', '3567'], + ['#9空压', '3054'], + ['#10空压', '3564'], + ] +} + +// function (STR) { + +// if (STR) { +// return ` ${STR}` +// } + +// } + + + + +class Form extends Component { + + + + render() { + return ( + <> +
+ + + +
+ + ); + } +} + +export default Form; diff --git a/src/components/BottomBar/Form/Form1.less b/src/components/BottomBar/Form/Form1.less new file mode 100644 index 0000000..a5ff42e --- /dev/null +++ b/src/components/BottomBar/Form/Form1.less @@ -0,0 +1,26 @@ +.ButtonForm1itemDetailBorder { + width: 98%; + height: 100%; + margin-top: 2%; + position: relative; + + .RightFormitemDetailBorderLine1 { + width: 1px; + height: 100%; + background-color: #041c2c; + float: left; + margin-left: 28%; + z-index: 10; + position: absolute; + } + + .RightFormitemDetailBorderLine2 { + width: 1px; + height: 100%; + background-color: #041c2c; + float: left; + margin-left: 58%; + z-index: 10; + position: absolute; + } +} \ No newline at end of file diff --git a/src/components/BottomBar/index.jsx b/src/components/BottomBar/index.jsx new file mode 100644 index 0000000..2b85968 --- /dev/null +++ b/src/components/BottomBar/index.jsx @@ -0,0 +1,20 @@ +import React from 'react' +import { useEffect, useState } from 'react' +import { motion } from 'framer-motion' +import Chart1 from './Chart1' +import Chart2 from './Chart2' +import Chart3 from './Chart3' +import Chart4 from './Chart4' + +import './index.less' + +export default function index() { + return ( +
+ + + + +
+ ) +} diff --git a/src/components/BottomBar/index.less b/src/components/BottomBar/index.less new file mode 100644 index 0000000..7f22ad9 --- /dev/null +++ b/src/components/BottomBar/index.less @@ -0,0 +1,8 @@ +.ButtonBorder { + width: 100%; + height: 100%; + + display: flex; + flex-direction: row; + justify-content: space-around; +} diff --git a/src/components/BottomBar/substitutionCharts/Chart1.jsx b/src/components/BottomBar/substitutionCharts/Chart1.jsx new file mode 100644 index 0000000..dd821a7 --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart1.jsx @@ -0,0 +1,207 @@ + +import React, { Component } from 'react'; +import './Chart3.less' +import ReactECharts from 'echarts-for-react'; + +var colors = 'rgb(13, 119, 145)'; +var fontColor = '#fff' +var lineColor = 'rgba(33, 50, 89,0.8)' + + + +var datalist = [ + { + name: "天津之眼", + value: [25, 85], + symbolSize: 30, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [100, 305], + symbolSize: 50, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [200, 525], + symbolSize: 70, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [255, 405], + symbolSize: 30, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [500, 705], + symbolSize: 50, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [400, 525], + symbolSize: 70, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [255, 405], + symbolSize: 30, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [700, 805], + symbolSize: 50, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [300, 425], + symbolSize: 70, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [365, 505], + symbolSize: 30, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [600, 705], + symbolSize: 40, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [400, 525], + symbolSize: 70, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [800, 925], + symbolSize: 30, + opacity: 0.6, + }, + { + name: "天津之眼", + value: [900, 985], + symbolSize: 20, + opacity: 0.6, + }, + +]; +var datas = []; +for (var i = 0; i < datalist.length; i++) { + var item = datalist[i]; + const colorInex = i % colors.length; + + datas.push({ + ...item, + label: { + normal: { + textStyle: { + fontSize: 11, + }, + }, + }, + itemStyle: { + normal: { + color: colors, + opacity: item.opacity, + }, + }, + }); +} + + + +class Chart3 extends Component { + + getOption = () => ({ + grid: { + show: false, + right: 15, + left: 10, + top: 10, + bottom: 10, + containLabel: true + }, + xAxis: [ + { + gridIndex: 0, + type: "value", + // show: false, + min: 0, + max: 1000, + nameLocation: "middle", + nameGap: 5, + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + }, + ], + yAxis: [ + { + gridIndex: 0, + min: 0, + // show: false, + max: 1000, + nameLocation: "middle", + nameGap: 30, + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + show: true, + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + }, + + ], + series: [ + { + type: "scatter", + symbol: "circle", + symbolSize: 120, + data: datas, + }, + ], + }) + + render() { + return ( +
+ +
+ ); + } +} + +export default Chart3; diff --git a/src/components/BottomBar/substitutionCharts/Chart1.less b/src/components/BottomBar/substitutionCharts/Chart1.less new file mode 100644 index 0000000..52e140f --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart1.less @@ -0,0 +1,6 @@ +.ButtonChart1itemDetailBorder { + width: 100%; + height: 100%; + + +} \ No newline at end of file diff --git a/src/components/BottomBar/substitutionCharts/Chart2.jsx b/src/components/BottomBar/substitutionCharts/Chart2.jsx new file mode 100644 index 0000000..e3ce256 --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart2.jsx @@ -0,0 +1,142 @@ + +import React, { Component } from 'react'; +import './Chart2.less' +import ReactECharts from 'echarts-for-react'; + + + + + + +class Chart2 extends Component { + + + getOption = () => ({ + + title: [{ + text: `${this.props.data[0]}%`, + x: "center", + y: "32%", + textStyle: { + fontWeight: "normal", + color: "#5CB2FF", + fontSize: "34px", + }, + }, + { + text: "成品率", + x: "center", + y: "55%", + textStyle: { + fontWeight: "normal", + color: "rgba(255,255,255,0.7)", + fontSize: "18px", + }, + }, + ], + + color: ["rgba(176, 212, 251, 1)"], + + series: [ + { + name: "Line 1", + type: "pie", + clockWise: true, + radius: ["65%", "95%"], + itemStyle: { + normal: { + label: { + show: false, + }, + labelLine: { + show: false, + }, + }, + }, + hoverAnimation: false, + data: [ + { + value: this.props.data[0], + name: "01", + itemStyle: { + normal: { + borderWidth: 1, + shadowBlur: 7, + borderColor: "rgba(90,107,255,0.5)", + shadowColor: "rgba(92,183,255,0.9)", + color: { + // 完成的圆环的颜色 + colorStops: [ + { + offset: 0, + color: "rgba(90,107,255,1)", // 0% 处的颜色 + }, + { + offset: 1, + color: "rgba(92,183,255,0.5)", // 100% 处的颜色 + }, + ], + }, + label: { + show: false, + }, + labelLine: { + show: false, + }, + }, + }, + }, + { + name: "02", + value: 100 - this.props.data[0], + itemStyle: { + normal: { + color:"rgba(255,255,255,0.25)",//未完成圆环颜色 + borderWidth: 1, + shadowBlur: 7, + borderColor: "rgba(90,107,255,0.5)", + shadowColor: "rgba(92,183,255,0.9)", + label: { + show: false, + }, + labelLine: { + show: false, + }, + }, + }, + }, + ], + }, + ], + + }) + + render() { + return ( +
+
+ +
+
+

{this.props.title}

+
+
+
+

订单总量:

+

{this.props.data[1]}

+
+
+

成品量:

+

{this.props.data[2]}

+
+
+ + + +
+
+ ); + } +} + +export default Chart2; diff --git a/src/components/BottomBar/substitutionCharts/Chart2.less b/src/components/BottomBar/substitutionCharts/Chart2.less new file mode 100644 index 0000000..e3757e9 --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart2.less @@ -0,0 +1,66 @@ +.buttonChart2itemDetailBorder { + width: 215px; + height: 216px; + display: flex; + flex-direction: column; + justify-content: flex-start; + .buttonChart2itemEchart { + width: 160px; + height: 160px; + align-self: center; + + } + .buttonChart2itemTitle { + width: 88%; + height: 56px; + margin-left: 20px; + margin-top: 8px; + align-self: center; + display: flex; + flex-direction: row; + justify-content: flex-start; + + .buttonChart2itemTitle1 { + color: rgb(255, 255, 255); + font-size: 22px; + line-height: 24px; + font-style: normal; + margin-top: 10px; + white-space: nowrap; + } + + .buttonChart2itemTitleGAp { + width: 2px; + height: 80%; + margin-left: 15px; + background-color: #73808C; + } + + .buttonChart2itemTitleDetail { + width: 158px; + height: 44px; + display: flex; + flex-direction: column; + justify-content: flex-start; + + + .buttonChart2itemTitleDetailRow { + width: 100%; + height: 50%; + display: flex; + flex-direction: row; + justify-content: center; + + .buttonChart2itemTitle2 { + font-size: 15px; + color: rgba(255, 255, 255, 0.8); + } + + .buttonChart2itemTitle3 { + color: rgb(255, 255, 255); + font-size: 15px; + } + } + } + } +} \ No newline at end of file diff --git a/src/components/BottomBar/substitutionCharts/Chart3.jsx b/src/components/BottomBar/substitutionCharts/Chart3.jsx new file mode 100644 index 0000000..d1240f6 --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart3.jsx @@ -0,0 +1,124 @@ + +import React, { Component } from 'react'; +import './Chart3.less' +import ReactECharts from 'echarts-for-react'; + +var data = [[800, 4302, 200, 3234, 800, 4302, 200, 3234, 800, 4302, 200, 3234, 800, 4302, 200, 3234], +[4450, 553, 2350, 234, 4450, 553, 2350, 234, 4450, 553, 2350, 234, 4450, 553, 2350, 234], +[2400, 305, 3500, 234, 2400, 305, 3500, 234, 2400, 305, 3500, 234, 2400, 305, 3500, 234], +[50, 3302, 480, 3334, 50, 3302, 480, 3334, 50, 3302, 480, 3334, 50, 3302, 480, 3334], + +] + +var name = ['10HZ-15HZ', '15HZ-25HZ', '30HZ-35HZ', '40HZ-45HZ'] + + +var color = ["#2760ff", "#ffb70c", "#3dbdc2", "#e02094"] +var fontColor = '#fff' +var lineColor = 'rgba(33, 50, 89,0.8)' + +function makeseries(data, name, color) { + if (data) { + let All = [] + for (let i in data) { + All.push({ + name: name[i], + type: 'line', + showSymbol: false, + symbol: "circle", + data: data[i], + lineStyle: { + width: 1, + color: color[i] + }, + itemStyle: { + + color: color[i], + + }, + }) + } + return All; + } +} + + + +class Chart3 extends Component { + + + getOption = () => ({ + legend: { + right: "0%", + width: "80%", + height: "14%", + itemWidth: 12, + itemHeight: 11, + textStyle: { + fontSize: 12, + color: "#F1F1F3", + }, + // itemStyle: { + // color: "rgba(222, 9, 9, 1)" + // }, + data: name + }, + grid: { + top: '15%', + left: '2%', + right: '4%', + bottom: '3%', + containLabel: true + }, + + xAxis: { + type: 'category', + boundaryGap: false, + data: ['day1', 'day2', 'day3', 'day4', 'day5', 'day6', 'day7', 'day5', 'day6', 'day7', 'day6', 'day7', 'day5', 'day6', 'day7'], + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + }, + yAxis: { + type: 'value', + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + show: true, + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + }, + series: makeseries(data, name, color) + }) + render() { + return ( +
+ +
+ ); + } +} + +export default Chart3; diff --git a/src/components/BottomBar/substitutionCharts/Chart3.less b/src/components/BottomBar/substitutionCharts/Chart3.less new file mode 100644 index 0000000..14e4ec3 --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart3.less @@ -0,0 +1,6 @@ +.ButtonChart3itemDetailBorder { + width: 100%; + height: 100%; + + +} \ No newline at end of file diff --git a/src/components/BottomBar/substitutionCharts/Chart4.jsx b/src/components/BottomBar/substitutionCharts/Chart4.jsx new file mode 100644 index 0000000..7884584 --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart4.jsx @@ -0,0 +1,117 @@ + +import React, { Component } from 'react'; +import './Chart4.less' +import ReactECharts from 'echarts-for-react'; + + + +var name = ['10HZ-15HZ', '15HZ-25HZ', '30HZ-35HZ', '40HZ-45HZ'] + +import * as echarts from 'echarts'; + +var color = ["#2760ff", "#ffb70c", "#3dbdc2", "#e02094"] +var fontColor = '#fff' +var lineColor = 'rgba(33, 50, 89,0.8)' + + + + + +class Chart3 extends Component { + + + getOption = () => ({ + + + + legend: { + right: "0%", + width: "70%", + height: "14%", + itemWidth: 17, + itemHeight: 13.5, + textStyle: { + fontSize: 12, + color: "#F1F1F3", + }, + + data: name + }, + grid: { + left: '3%', + right: '4%', + bottom: '5%', + top:'3%', + containLabel: true, + }, + + xAxis: { + type: 'category', + boundaryGap: false, + data: ['day1', 'day2', 'day3', 'day4', 'day5', 'day6', 'day7', 'day5', 'day6', 'day7', 'day6', 'day7', 'day5', 'day6', 'day7'], + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + lineStyle: { + color: lineColor, + }, + }, + }, + yAxis: { + type: 'value', + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + show: true, + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + }, + }, + }, + series: { + + name:'发电量', + type: 'line', + showSymbol: true, + symbol: "circle", + symbolSize:8, + symbolBorder:"rgba(17, 36, 246,0.1)", + data: [200,320,121,125,585,213,521,326,542,258,632,145,258,632,145], + lineStyle: { + width: 1, + color:"rgba(246, 23, 106,0.9)", + }, + areaStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: 'rgba(246, 23, 106,0.3)' }, + { offset: 0.5, color: 'rgba(246, 23, 106,0.2)' }, + { offset: 1, color: 'rgba(246, 23, 106,0.1)' } + ]), + }, + itemStyle: { + borderColor: '#F6176A', + color: "rgba(4, 20, 36,0.8)", + }, + + } + }) + + render() { + return ( +
+ +
+ ); + } +} + +export default Chart3; diff --git a/src/components/BottomBar/substitutionCharts/Chart4.less b/src/components/BottomBar/substitutionCharts/Chart4.less new file mode 100644 index 0000000..8ae72b3 --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart4.less @@ -0,0 +1,9 @@ +.ButtonChart4itemDetailBorder { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top: 15px; +} diff --git a/src/components/BottomBar/substitutionCharts/Chart6.jsx b/src/components/BottomBar/substitutionCharts/Chart6.jsx new file mode 100644 index 0000000..02847b7 --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart6.jsx @@ -0,0 +1,183 @@ + +import React, { Component } from 'react'; + +import ReactECharts from 'echarts-for-react'; + + + +import './Chart2.less' + +class Chart2 extends Component { + + getOption = () => ({ + grid: { + left: "5%", + right: "2%", + top: "2%", + bottom: "5%", + containLabel: true, + }, + + legend: { + + itemWidth: 14, + itemHeight: 5, + itemGap: 13, + data: ["窑炉1", "窑炉2", "窑炉3"], + top:'5%', + right: "4%", + textStyle: { + fontSize: 12, + color: "#F1F1F3", + }, + }, + grid: { + left: "3%", + right: "4%", + bottom: "3%", + containLabel: true, + }, + xAxis: [ + { + type: "category", + boundaryGap: false, + axisLine: { + lineStyle: { + color: "#57617B", + }, + }, + data: [ + "00:00", + "01:05", + "02:10", + "03:15", + "04:20", + "05:25", + "06:30", + "07:35", + "08:40", + "09:45", + "10:45", + "11:45", + "12:45", + + "13:00", + "14:05", + "15:10", + "16:15", + "17:20", + "18:25", + "19:30", + "20:35", + "21:40", + "22:45", + "23:50", + "24:55", + ], + }, + + ], + yAxis: [ + { + type: "value", + name: "单位(%)", + + axisTick: { + show: false, + }, + axisLine: { + lineStyle: { + color: "#57617B", + }, + }, + axisLabel: { + margin: 10, + textStyle: { + fontSize: 14, + }, + }, + splitLine: { + lineStyle: { + color: "#57617B", + }, + }, + }, + ], + series: [ + { + name: "窑炉1", + type: "line", + smooth: false, + symbol: "circle", + symbolSize: 6, + showSymbol: true, + lineStyle: { + color: "rgba(116, 172, 100,0.8)", + width:3, + }, + itemStyle: { + borderWidth: 3, + borderColor: 'rgba(116, 172, 100,0.8)', + color:'rgba(4, 28, 52,1)', + + }, + data: this.props.data[0], + }, + { + name: "窑炉2", + type: "line", + smooth: false, + symbol: "circle", + symbolSize: 6, + showSymbol: true, + + lineStyle: { + color: "rgba(164, 132, 44,1)", + width:3, + }, + itemStyle: { + borderWidth: 3, + borderColor: 'rgba(164, 132, 44,1)', + color:'rgba(4, 28, 52,1)', + + }, + + + data: this.props.data[1], + }, + { + name: "窑炉3", + type: "line", + smooth: false, + symbol: "circle", + symbolSize:6, + showSymbol: true, + + lineStyle: { + color: "rgba(52, 156, 172,1)", + width:3, + }, + itemStyle: { + borderWidth: 3, + borderColor: 'rgba(52, 156, 172,1)', + color:'rgba(4, 28, 52,1)', + + }, + + + + data: this.props.data[2], + }, + ], + }) + + render() { + return ( +
+ +
+ ); + } +} + +export default Chart2; diff --git a/src/components/BottomBar/substitutionCharts/Chart6.less b/src/components/BottomBar/substitutionCharts/Chart6.less new file mode 100644 index 0000000..5b722cf --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart6.less @@ -0,0 +1,6 @@ +.ButtonChart2itemDetailBorder { + width: 100%; + height: 100%; + + +} \ No newline at end of file diff --git a/src/components/BottomBar/substitutionCharts/Chart7.jsx b/src/components/BottomBar/substitutionCharts/Chart7.jsx new file mode 100644 index 0000000..44a524d --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart7.jsx @@ -0,0 +1,38 @@ + +import React, { Component } from 'react'; + +import './Chart7.less' + +export default class Chart7 extends Component { + + parseData() { + const { data } = this.props + const name = Object.keys(data) + const Value = Object.values(data) + return name.map((item, index) => ( + +
+ +
+

{name[index]}:

+
+
+

{Value[index]}

+
+
+ + )) + } + + render() { + return ( +
+ {this.parseData()} +
+ ); + } +} + + + + diff --git a/src/components/BottomBar/substitutionCharts/Chart7.less b/src/components/BottomBar/substitutionCharts/Chart7.less new file mode 100644 index 0000000..d98e54f --- /dev/null +++ b/src/components/BottomBar/substitutionCharts/Chart7.less @@ -0,0 +1,44 @@ +.ButtonChart7itemDetailBorder { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top:-8px; + + .buttonChart7FormBorder { + background: url(../../assets/ButtonChart7ItemBg.png); + margin-top: 1.5%; + width: 288px; + height: 48px; + border-radius: 3px; + display: flex; + flex-direction: row; + justify-content: left; + .buttonChart7FormTxt2Border { + width: 30%; + height: 100%; + .buttonChart7FormTxt2 { + margin-left: 20%; + margin-right: 5%; + margin-top: 13px; + text-align:left; + font-size: 15px; + color: rgba(255, 255, 255, 1); + } + } + .buttonChart7FormTxt1Border { + width: 55%; + height: 100%; + + .buttonChart7FormTxt1 { + margin-top: 13px; + margin-left: 3%; + text-align:right; + font-size: 15px; + color: rgba(255, 255, 255, 1); + } + } + } +} diff --git a/src/components/CenterTopData/index.jsx b/src/components/CenterTopData/index.jsx new file mode 100644 index 0000000..805b3c9 --- /dev/null +++ b/src/components/CenterTopData/index.jsx @@ -0,0 +1,19 @@ +import React from 'react' + +import Item2 from './substitutionCharts/Chart1.jsx' +import Item1 from './substitutionCharts/Chart2.jsx' + +import cls from './index.module.less' + +export default function index() { + return ( +
+
+ +
+
+ +
+
+ ) +} diff --git a/src/components/CenterTopData/index.module.less b/src/components/CenterTopData/index.module.less new file mode 100644 index 0000000..9cd80d2 --- /dev/null +++ b/src/components/CenterTopData/index.module.less @@ -0,0 +1,8 @@ +.leftGrid { + width: 416px; + height: 212px; +} +.rightTable { + width: 410px; + height: 240px; +} diff --git a/src/components/CenterTopData/substitutionCharts/Chart1.jsx b/src/components/CenterTopData/substitutionCharts/Chart1.jsx new file mode 100644 index 0000000..0a94a18 --- /dev/null +++ b/src/components/CenterTopData/substitutionCharts/Chart1.jsx @@ -0,0 +1,59 @@ + +import React, { Component } from 'react'; +import './Chart1.less' + +import { ScrollBoard } from '@jiaminghi/data-view-react' + +let data = [ + ['产线0', '10mm', '10mm', '10mm'], + ['产线2', '8mm', '8mm', '8mm'], + ['产线3', '15mm', '15mm', '15mm'], + ['产线4', '15mm', '15mm', '15mm'], +] + +let header = ['产线名', '原板宽度', '净板宽', '玻璃厚度'] + +let config = { + headerBGC: 'rgba(4, 44, 76, 0.3)', + header: ['产线名', '原板宽度', '净板宽', '玻璃厚度'], + oddRowBGC: "#042444", + evenRowBGC: "#042c4c", + columnWidth: [90], + headerHeight: 40, + hoverPause: false, + data: replaceStyle(data, 0.7) +} + +function replaceStyle(Arr, opencity) { + let temp = []; + + for (let i = 0; i < Arr.length; i++) { + temp[i] = []; + for (let j = 0; j < Arr[i].length; j++) { + temp[i][j] = ` ${Arr[i][j]}` + } + } + + return temp; +} + +class Chart1 extends Component { + + + render() { + return ( +
+

当前产线生产规格

+
+ + + + +
+ +
+ ); + } +} + +export default Chart1; diff --git a/src/components/CenterTopData/substitutionCharts/Chart1.less b/src/components/CenterTopData/substitutionCharts/Chart1.less new file mode 100644 index 0000000..5d1e293 --- /dev/null +++ b/src/components/CenterTopData/substitutionCharts/Chart1.less @@ -0,0 +1,52 @@ +.CenterChart1itemDetailBorder { + width: 100%; + height: 240px; + display: flex; + flex-direction:column; + justify-content: flex-start; + + background-color: rgba(4, 44, 76, 0.2); + .CenterChart1itemTXT { + width: 100%; + height: 10%; + font-size: 20px; + color:rgba(255,255,255,0.8); + text-align: center; + margin-top: 2%; + + } + .CenterChart1itemContainer { + + width: 95%; + height:100px; + position:relative; + + .CenterFormitemDetailBorderLine1 { + width: 1px; + height: 200px; + background-color:#041c2c; + float: left; + margin-left: 18%; + z-index: 10; + position: absolute; + } + .CenterFormitemDetailBorderLine2 { + width: 1px; + height: 200px; + background-color:#041c2c; + float: left; + margin-left: 46%; + z-index: 10; + position: absolute; + } + .CenterFormitemDetailBorderLine3 { + width: 1px; + height: 200px; + background-color:#041c2c; + float: left; + margin-left: 72%; + z-index: 10; + position: absolute; + } + } +} diff --git a/src/components/CenterTopData/substitutionCharts/Chart2.jsx b/src/components/CenterTopData/substitutionCharts/Chart2.jsx new file mode 100644 index 0000000..298b84f --- /dev/null +++ b/src/components/CenterTopData/substitutionCharts/Chart2.jsx @@ -0,0 +1,89 @@ + +import React, { useEffect, useState, useRef } from 'react' + +import icon1 from '@/assets/CenterChart2icon1.svg' +import icon2 from '@/assets/CenterChart2icon2.svg' +import icon3 from '@/assets/CenterChart2icon3.svg' +import icon4 from '@/assets/CenterChart2icon4.svg' + + +import './Chart2.less' + + +const Chart2 = () => { + + const timmer = useRef(); + const [year, setYear] = useState('') + const [month, setMonth] = useState('') + const [day, setDay] = useState('') + + + const getNewDate = () => { + const Time = new Date(); + const year = Time.getFullYear(); + const month = Time.getMonth() + 1; + const day = Time.getDate(); + + + setYear(year); + setMonth(month); + setDay(day); + + } + + + useEffect(() => { + getNewDate(); + timmer.current = setInterval(getNewDate, 10000); + return () => { + clearTimeout(timmer.current) + } + //eslint-disable-next-line + }, []) + + + + + + return ( +
+ +
+
+ Error +
+

车间温度

+

27℃

+
+
+
+ Error +
+

当前火向

+

XXX

+
+
+
+
+
+ Error +
+

换火时间

+

12:41:45

+
+
+
+ Error +
+

剩余时间

+

20h

+
+
+
+ + +
+ ); +} + +export default Chart2; diff --git a/src/components/CenterTopData/substitutionCharts/Chart2.less b/src/components/CenterTopData/substitutionCharts/Chart2.less new file mode 100644 index 0000000..cd50ae4 --- /dev/null +++ b/src/components/CenterTopData/substitutionCharts/Chart2.less @@ -0,0 +1,53 @@ +.CenterChart2itemDetailBorder { + width: 440px; + height: 100%; + display: flex; + flex-direction: column; + justify-content: start; + + .CenterChart2itemcontentOUT { + width: 100%; + height: 50%; + display: flex; + flex-direction: row; + justify-content: center; + + .CenterChart2itemcontent { + width: 224px; + height: 95%; + background: url(../../../assets/CenterChart2ItemBg.png); + background-repeat: no-repeat; + display: flex; + flex-direction: row; + justify-content: left; + margin-top: 3%; + margin-left: 2%; + + .CenterChart2itemcontentIcon { + margin-top: 2%; + width: 48px; + height: 48px; + margin-left: 5%; + } + + .CenterChart2itemcontentText { + width: 50%; + height: 70%; + margin-left: -2%; + + .CenterChart2itemcontentText1 { + color: rgba(224, 222, 222, 0.8); + font-size: 15px; + margin-top: 10%; + } + + .CenterChart2itemcontentText2 { + color: rgb(255, 255, 255); + font-size: 34px; + margin-top: -10%; + margin-left: -3%; + } + } + } + } +} diff --git a/src/components/Head/index.jsx b/src/components/Head/index.jsx new file mode 100644 index 0000000..6c75b4e --- /dev/null +++ b/src/components/Head/index.jsx @@ -0,0 +1,68 @@ +import React, { useEffect, useState, useRef } from 'react' + +import TopSide from "../../assets/TopSide.png" +import LeftLine from "../../assets/TopTitleLeftIcon.png" +import RightLine from "../../assets/TopTitleRightIcon.png" +import ButtonLine from "../../assets/TopButtonLine.png" +import './index.less' + +export default function index() { + const timmer = useRef() + const [Hour, setHour] = useState(''); + const [Seconds, setSeconds] = useState(''); + const [Minutes, setMinutes] = useState(''); + const [Year, setYear] = useState(''); + const [Month, setMonth] = useState(''); + const [Day, setDay] = useState(''); + + const getNewDate = () => { + const time = new Date(); + const year = time.getFullYear(); + const month = time.getMonth() + 1; + const day = time.getDate(); + const hour = time.getHours(); + const minutes = time.getMinutes(); + const s = time.getSeconds(); + const seconds = s <= 9 ? "0" + s : s; + // const t = `${year}年${month}月${day}日 ${hour}:${minutes}:${seconds}` + setHour(hour) + setSeconds(seconds) + if (minutes < 10) { + setMinutes(`0${minutes}`) + } else { + setMinutes(minutes) + } + setYear(year) + setMonth(month) + setDay(day) + + } + + useEffect(() => { + timmer.current = setInterval(getNewDate, 1000); + return () => { + clearTimeout(timmer.current) + } + // eslint-disable-next-line + }, []) + + + return ( +
+ 图片丢失 +
+ 图片丢失 +

单位:中建材智能自动化研究院

+
+
+

许昌安彩新能科技  4800万方光伏轻质基板生产线

+ 图片加载错误 +
+
+

{Year}.{Month}.{Day} {Hour}.{Minutes}.{Seconds}

+ 图片丢失 +
+ 图片丢失 +
+ ) +} diff --git a/src/components/Head/index.less b/src/components/Head/index.less new file mode 100644 index 0000000..fbc2e9f --- /dev/null +++ b/src/components/Head/index.less @@ -0,0 +1,89 @@ +.TopTitleBoder { + width: 3840px; + height: 84px; + display: flex; + flex-direction: row; + justify-content: space-between; + background: #17b2747a; + + .TopSideRight { + margin-top: 40px; + margin-right: 40px; + width: 493px; + height: 16px; + } + + .TopSideLeft { + margin-left: 40px; + margin-top: 40px; + width: 493px; + height: 16px; + } + + .TopSideLeftLine { + background: url('../../assets/TopTitleLeft.png'); + width: 899px; + height: 40px; + margin-top: 42px; + display: flex; + flex-direction: row; + justify-content: right; + + .TopSideLeftLineicon { + margin-right: 40px; + margin-top: 25px; + width: 204.32px; + height: 2.79px; + } + + .TopSideLeftTxt { + margin-right: 120px; + margin-top: 15px; + color: rgb(255, 255, 255, 0.8); + font-size: 20px; + font-weight: 300px; + line-height: 22.174976px; + } + } + + .TopSiderightLine { + background: url('../../assets/TopTitleRight.png'); + width: 899px; + height: 40px; + margin-top: 42px; + display: flex; + flex-direction: row; + justify-content: left; + + .TopSideRightLineicon { + margin-left: 40px; + margin-top: 25px; + width: 204.32px; + height: 2.79px; + } + + .TopSideRightTxt { + margin-left: 120px; + margin-top: 15px; + color: rgb(255, 255, 255, 0.8); + font-size: 20px; + font-weight: 600px; + line-height: 22.174976px; + } + } + + .TopButtonLine { + margin-top: -9px; + width: 760px; + height: 14px; + } + + .TopTitleText { + margin-top: 16px; + letter-spacing: 8px; + font-size: 32px; + color: #00fff7; + text-align: center; + letter-spacing: 2px; + } +} diff --git a/src/components/LeftBar/Chart1.jsx b/src/components/LeftBar/Chart1.jsx new file mode 100644 index 0000000..dbfdefa --- /dev/null +++ b/src/components/LeftBar/Chart1.jsx @@ -0,0 +1,72 @@ +import React from 'react' + +import { useState, useEffect } from 'react' +import { motion } from 'framer-motion' + +import Item from './substitutionCharts/Chart1.jsx' + +import Icon from '../../assets/Icon/LeftrChart1ICon.png' +import Icon1 from '../../assets/ButtonChart7Icon1.svg' +import Icon2 from '../../assets/ButtonChart7Icon2.svg' + +import './Chart1.less' + +var Data1 = { + '冷水管温度': '3℃', + '主线冷水管水压': ' 500Pa', + '冷管流量': '800m³' +} + +var Data2 = { + '冷水管温度': '8℃', + '主线冷水管水压': ' 900Pa', + '冷管流量': '400m³' +} +//循环的参数 +var Number = 1 + +export default function Chart1() { + + useEffect(() => { + setInterval(() => { + Number = Number + 1 + setNum(Number % 2) + if (Number == 3) { + Number = 1 + } + }, 10000) + }, []) + + + + const [num, setNum] = useState(1) + + return ( +
+
+ 图片加载错误 +
公共工程
+
+
+
+
+ +

水泵水管

+
+ +
+
+
+
+ +

氢气

+
+ +
+
+
+ +
+ + ) +} diff --git a/src/components/LeftBar/Chart1.less b/src/components/LeftBar/Chart1.less new file mode 100644 index 0000000..3a452bb --- /dev/null +++ b/src/components/LeftBar/Chart1.less @@ -0,0 +1,63 @@ +.LeftChart1AllBorder { + width: 625px; + height: 305px; + background: url('../../assets/ItemBg.png'); + display: flex; + flex-direction: column; + justify-content: space-between; + + .LeftChart1ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 202px; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + vertical-align: middle; + + .LeftChart1ItemIcon { + width: 24px; + height: 24px; + margin-top: 2px; + } + + .LeftChart1ItemTitle { + font-size: 24px; + color: #ffffff; + font-weight: 900px; + margin-left: 8px; + margin-top: -5px; + font-family: 'pingFangSC-Medium'; + } + } + + .LeftChart1ItemBorder { + width: 95%; + height: 227px; + margin-left: 16px; + margin-bottom: 16px; + display: flex; + flex-direction: row; + justify-content: space-between; + .LeftChart1ItemRow { + width: 288px; + height: 100%; + display: flex; + flex-direction:column; + justify-content: flex-start; + .LeftChart1ItemRowDetail{ + width: 100%; + height: 32px; + display: flex; + flex-direction: row; + .LeftChart1ItemRowDetailTxt{ + font-size: 22px; + font-weight: 400px; + color: #FFFFFF; + margin-left: 8px; + } + } + } + } +} diff --git a/src/components/LeftBar/Chart2.jsx b/src/components/LeftBar/Chart2.jsx new file mode 100644 index 0000000..dc67244 --- /dev/null +++ b/src/components/LeftBar/Chart2.jsx @@ -0,0 +1,113 @@ +import React, { useEffect, useState } from 'react' +import { motion } from "framer-motion" + +//烟气处理 +import Item1 from './substitutionCharts/Chart2.jsx' + +//温度变化 +import Item2 from './substitutionCharts/Chart3.jsx' + +//发电量 +import Item3 from './substitutionCharts/Chart4.jsx' + +import Icon1 from '../../assets/Icon/LeftChart2Icon.png' +import Icon2 from '../../assets/Icon/LeftChart2Icon2.png' +import './Chart2.less' + +const data = [10, 25, 30, 25, 58, 23, 36, 34] + +//温度 +const Temptitle = "温度变化"; +const Tempxdata = ["1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00", "8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", "24:00"] +const Tempdata = [420, 410, 410, 300, 350, 380, 352, 410, 410, 300, 350, 380, 352, 410, 410, 300, 350, 380, 352, 350, 380, 352, 380, 352] + + +//风机频率数据 +var data2 = [[800, 4302, 200, 3234, 800, 4302, 200, 3234, 800, 4302, 200, 3234, 800, 4302, 200, 3234], +[4450, 553, 2350, 234, 4450, 553, 2350, 234, 4450, 553, 2350, 234, 4450, 553, 2350, 234], +[2400, 305, 3500, 234, 2400, 305, 3500, 234, 2400, 305, 3500, 234, 2400, 305, 3500, 234], +[50, 3302, 480, 3334, 50, 3302, 480, 3334, 50, 3302, 480, 3334, 50, 3302, 480, 3334], +] + +var data3 = [[4450, 553, 2350, 234, 4452, 553, 2350, 234, 4450, 553, 2350, 234, 4450, 553, 2350, 234], +[700, 4002, 200, 3234, 800, 4302, 200, 3234, 700, 3302, 200, 3234, 800, 4302, 200, 3234], +[50, 3302, 480, 3334, 53, 3302, 480, 3034, 50, 3302, 480, 3334, 20, 3302, 580, 3334], +[2400, 305, 3500, 234, 2400, 305, 3500, 234, 2400, 305, 3500, 234, 2400, 205, 3500, 234], +] + + +export default function Chart2() { + + const [index, setIndex] = useState(1) + let num = 1; + useEffect(() => { + const timer = setInterval(() => { SwitchIndex() }, 10000); + return () => clearInterval(timer); + }, []) + + function SwitchIndex() { + num = num + 1 + if (num < 3) { + setIndex(num) + } + else { + num = 1 + setIndex(num) + + } + } + + function SwitchData(index) { + switch (index) { + case 1: return + case 2: return + } + } + + //切换标题 + function SwitchTitle(index) { + switch (index) { + case 1: return "烟气处理" + case 2: return "余热发电" + } + } + + //切换LOGO + function SwitchIcon(index) { + switch (index) { + case 1: return Icon1 + case 2: return Icon2 + } + } + + //切换图表1 + function SwitchChart1(index) { + switch (index) { + case 1: return + case 2: return + } + } + + //切换图表2 + function SwitchChart2(index) { + switch (index) { + case 1: return + case 2: return + } + } + + return ( +
+
+ 图片加载错误 +
{SwitchTitle(index)}
+
+
+ {SwitchChart1(index)} +
+
+ {SwitchChart2(index)} +
+
+ ) +} diff --git a/src/components/LeftBar/Chart2.less b/src/components/LeftBar/Chart2.less new file mode 100644 index 0000000..8875755 --- /dev/null +++ b/src/components/LeftBar/Chart2.less @@ -0,0 +1,48 @@ +.LeftChart2AllBorder { + width: 624px; + height: 632px; + background: url('../../assets/ItemBg2.png'); + display: flex; + flex-direction: column; + justify-content: space-between; + + .LeftChart2ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 100%; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + vertical-align: middle; + + .LeftChart2ItemIcon { + width: 24px; + height: 24px; + margin-top: 3px; + } + + .LeftChart2ItemTitle { + font-size: 24px; + color: #ffffff; + margin-left: 8px; + margin-top: -5px; + } + } + + .LeftChart2Item1Row1 { + width: 95%; + height: 271px; + align-self: center; + margin-top: -56px; + + + } + .LeftChart2Item1Row2 { + width: 95%; + height: 271px; + align-self: center; + margin-bottom:24px; + + } +} diff --git a/src/components/LeftBar/index.jsx b/src/components/LeftBar/index.jsx new file mode 100644 index 0000000..fb8961e --- /dev/null +++ b/src/components/LeftBar/index.jsx @@ -0,0 +1,15 @@ +import React from 'react' + + +import Chart1 from './Chart1' +import Chart2 from './Chart2' + +import './index.less' +export default function index() { + return ( +
+ + +
+ ) +} diff --git a/src/components/LeftBar/index.less b/src/components/LeftBar/index.less new file mode 100644 index 0000000..1c9e408 --- /dev/null +++ b/src/components/LeftBar/index.less @@ -0,0 +1,25 @@ +.LeftBorder { + width: 625px; + height: 966px; + margin-left: 40px; + + display: flex; + flex-direction: column; + justify-content: space-between; + + .LeftChart1Border { + width: 100%; + height: 304px; + background: url('../../assets/ItemBg.png'); + + } + + .LeftChart2Border { + width: 624px; + height: 632px; + background: url('../../assets/ItemBg2.png'); + display: flex; + flex-direction: column; + //justify-content: space-between; + } +} diff --git a/src/components/LeftBar/substitutionCharts/Chart1.jsx b/src/components/LeftBar/substitutionCharts/Chart1.jsx new file mode 100644 index 0000000..f31298b --- /dev/null +++ b/src/components/LeftBar/substitutionCharts/Chart1.jsx @@ -0,0 +1,38 @@ + +import React, { Component } from 'react'; + +import './Chart1.less' + +export default class Chart7 extends Component { + + parseData() { + const { data } = this.props + const name = Object.keys(data) + const Value = Object.values(data) + return name.map((item, index) => ( + +
+ +
+

{name[index]}:

+
+
+

{Value[index]}

+
+
+ + )) + } + + render() { + return ( +
+ {this.parseData()} +
+ ); + } +} + + + + diff --git a/src/components/LeftBar/substitutionCharts/Chart1.less b/src/components/LeftBar/substitutionCharts/Chart1.less new file mode 100644 index 0000000..68a803c --- /dev/null +++ b/src/components/LeftBar/substitutionCharts/Chart1.less @@ -0,0 +1,44 @@ +.ButtonChart7itemDetailBorder { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top:-8px; + + .buttonChart7FormBorder { + background: url(../../../assets/ButtonChart7ItemBg.png); + margin-top: 1.5%; + width: 288px; + height: 48px; + border-radius: 3px; + display: flex; + flex-direction: row; + justify-content: left; + .buttonChart7FormTxt2Border { + width: 30%; + height: 100%; + .buttonChart7FormTxt2 { + margin-left: 20%; + margin-right: 5%; + margin-top: 13px; + text-align:left; + font-size: 15px; + color: rgba(255, 255, 255, 1); + } + } + .buttonChart7FormTxt1Border { + width: 55%; + height: 100%; + + .buttonChart7FormTxt1 { + margin-top: 13px; + margin-left: 3%; + text-align:right; + font-size: 15px; + color: rgba(255, 255, 255, 1); + } + } + } +} diff --git a/src/components/LeftBar/substitutionCharts/Chart2.jsx b/src/components/LeftBar/substitutionCharts/Chart2.jsx new file mode 100644 index 0000000..6f2ac31 --- /dev/null +++ b/src/components/LeftBar/substitutionCharts/Chart2.jsx @@ -0,0 +1,109 @@ + +import React, { Component } from 'react'; +import './Chart2.less' +import ReactECharts from 'echarts-for-react'; + +var data = [[320, 302, 301, 334, 390, 330, 320, 100], [120, 132, 101, 134, 90, 230, 210, 100], [220, 182, 191, 234, 290, 330, 310, 100], [150, 212, 201, 154, 190, 330, 410, 100], [320, 332, 301, 334, 290, 330, 320, 300], [320, 332, 301, 334, 290, 330, 320, 300]] + +var name = ['烟气总量', '余氧总量', '氮氧化物排放浓度', '二氧化碳排放浓度', '颗粒物排放浓度', '烟气流速'] + + +var color = ["#2760ff", "#8167f6", "#5b9bff", "#99d66c", "#ffd160", "#ff8a40"] +var fontColor = '#fff' +var lineColor = 'rgba(33, 50, 89,0.8)' + +function makeseries(data, name, color) { + if (data) { + let All = [] + for (let i in data) { + All.push({ + name: name[i], + type: 'bar', + stack: 'total', + barWidth: "20%", + itemStyle: { + normal: { + color: color[i], + }, + }, + label: { + + }, + data: data[i] + }) + } + return All; + } +} + + + +class Chart2 extends Component { + + + getOption = () => ({ + + legend: { + right: "0%", + width: "70%", + height: "14%", + itemWidth: 17, + itemHeight: 13.5, + orient: "vertical", + textStyle: { + fontSize: 12, + color: "#F1F1F3", + }, + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + containLabel: true + }, + xAxis: { + type: 'category', + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + lineStyle: { + color: lineColor, + }, + }, + + }, + yAxis: { + type: 'value', + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + show:true, + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + }, + series: makeseries(data, name, color) + }) + + render() { + return ( +
+ +
+ ); + } +} + +export default Chart2; diff --git a/src/components/LeftBar/substitutionCharts/Chart2.less b/src/components/LeftBar/substitutionCharts/Chart2.less new file mode 100644 index 0000000..cd5efc3 --- /dev/null +++ b/src/components/LeftBar/substitutionCharts/Chart2.less @@ -0,0 +1,11 @@ +.LeftChart2itemDetailBorder { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top:-8px; + + +} diff --git a/src/components/LeftBar/substitutionCharts/Chart3.jsx b/src/components/LeftBar/substitutionCharts/Chart3.jsx new file mode 100644 index 0000000..05c9579 --- /dev/null +++ b/src/components/LeftBar/substitutionCharts/Chart3.jsx @@ -0,0 +1,120 @@ + +import React, { Component } from 'react'; +import './Chart3.less' +import ReactECharts from 'echarts-for-react'; + + + +var name = ['10HZ-15HZ', '15HZ-25HZ', '30HZ-35HZ', '40HZ-45HZ'] + + +var color = ["#2760ff", "#ffb70c", "#3dbdc2", "#e02094"] +var fontColor = '#fff' +var lineColor = 'rgba(33, 50, 89,0.8)' + +function makeseries(data, name, color) { + if (data) { + let All = [] + for (let i in data) { + All.push({ + name: name[i], + type: 'line', + showSymbol: false, + symbol: "circle", + data: data[i], + lineStyle: { + width: 1, + color: color[i] + }, + itemStyle: { + + color: color[i], + + }, + }) + } + return All; + } +} + + + +class Chart3 extends Component { + + + getOption = () => ({ + + title: { + text: '风机运行频率', + textStyle: { + fontSize: 20, + color: "#52FFF8" + }, + }, + + legend: { + right: "0%", + width: "70%", + height: "14%", + itemWidth: 17, + itemHeight: 13.5, + textStyle: { + fontSize: 12, + color: "#F1F1F3", + }, + // itemStyle: { + // color: "rgba(222, 9, 9, 1)" + // }, + data: name + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', containLabel: true + }, + + xAxis: { + type: 'category', + boundaryGap: false, + data: ['day1', 'day2', 'day3', 'day4', 'day5', 'day6', 'day7', 'day5', 'day6', 'day7', 'day6', 'day7', 'day5', 'day6', 'day7'], + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + lineStyle: { + color: lineColor, + }, + }, + }, + yAxis: { + type: 'value', + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + show:true, + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + }, + }, + }, + series: makeseries(this.props.data, name, color) + }) + + render() { + return ( +
+ +
+ ); + } +} + +export default Chart3; diff --git a/src/components/LeftBar/substitutionCharts/Chart3.less b/src/components/LeftBar/substitutionCharts/Chart3.less new file mode 100644 index 0000000..95032e2 --- /dev/null +++ b/src/components/LeftBar/substitutionCharts/Chart3.less @@ -0,0 +1,9 @@ +.LeftChart3itemDetailBorder { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top:-8px; +} diff --git a/src/components/LeftBar/substitutionCharts/Chart4.jsx b/src/components/LeftBar/substitutionCharts/Chart4.jsx new file mode 100644 index 0000000..1207c9c --- /dev/null +++ b/src/components/LeftBar/substitutionCharts/Chart4.jsx @@ -0,0 +1,126 @@ + +import React, { Component } from 'react'; +import './Chart4.less' +import ReactECharts from 'echarts-for-react'; + + + +var name = ['10HZ-15HZ', '15HZ-25HZ', '30HZ-35HZ', '40HZ-45HZ'] + +import * as echarts from 'echarts'; + +var color = ["#2760ff", "#ffb70c", "#3dbdc2", "#e02094"] +var fontColor = '#fff' +var lineColor = 'rgba(33, 50, 89,0.8)' + + + + + +class Chart3 extends Component { + + + getOption = () => ({ + + title: { + text: '发电量', + top: "2%", + textStyle: { + fontSize: 20, + color: "#52FFF8" + }, + }, + + legend: { + right: "0%", + width: "70%", + height: "14%", + itemWidth: 17, + itemHeight: 13.5, + textStyle: { + fontSize: 12, + color: "#F1F1F3", + }, + // itemStyle: { + // color: "rgba(222, 9, 9, 1)" + // }, + data: name + }, + grid: { + left: '3%', + right: '4%', + bottom: '0%', + top:'30%', + containLabel: true, + }, + + xAxis: { + type: 'category', + boundaryGap: false, + data: ['day1', 'day2', 'day3', 'day4', 'day5', 'day6', 'day7', 'day5', 'day6', 'day7', 'day6', 'day7', 'day5', 'day6', 'day7'], + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + lineStyle: { + color: lineColor, + }, + }, + }, + yAxis: { + type: 'value', + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + show: true, + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + }, + }, + }, + series: { + + name:'发电量', + type: 'line', + showSymbol: true, + symbol: "circle", + symbolSize:8, + symbolBorder:"rgba(17, 36, 246,0.1)", + data: [200,320,121,125,585,213,521,326,542,258,632,145,258,632,145], + lineStyle: { + width: 1, + color:"rgba(246, 23, 106,0.9)", + }, + areaStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: 'rgba(246, 23, 106,0.3)' }, + { offset: 0.5, color: 'rgba(246, 23, 106,0.2)' }, + { offset: 1, color: 'rgba(246, 23, 106,0.1)' } + ]), + }, + itemStyle: { + borderColor: '#F6176A', + color: "rgba(4, 20, 36,0.8)", + }, + + } + }) + + render() { + return ( +
+ +
+ ); + } +} + +export default Chart3; diff --git a/src/components/LeftBar/substitutionCharts/Chart4.less b/src/components/LeftBar/substitutionCharts/Chart4.less new file mode 100644 index 0000000..c97be92 --- /dev/null +++ b/src/components/LeftBar/substitutionCharts/Chart4.less @@ -0,0 +1,9 @@ +.LeftChart4itemDetailBorder { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + margin-top: 15px; +} diff --git a/src/components/RightBar/Chart1.jsx b/src/components/RightBar/Chart1.jsx new file mode 100644 index 0000000..6cbd19a --- /dev/null +++ b/src/components/RightBar/Chart1.jsx @@ -0,0 +1,28 @@ +import React, { useEffect, useState } from 'react' + +import Item from './substitutionCharts/Chart1/index.jsx' +import Icon1 from '../../assets/Icon/rightChart1ICon.png' + +import "./Chart1.less" + +export default function Chart1() { + return ( +
+ +
+ 图片加载错误 +
储能电站
+
+
+ + + + + + +
+ + +
+ ) +} diff --git a/src/components/RightBar/Chart1.less b/src/components/RightBar/Chart1.less new file mode 100644 index 0000000..a10a8e9 --- /dev/null +++ b/src/components/RightBar/Chart1.less @@ -0,0 +1,45 @@ +.rightChart1Border { + width: 625px; + height: 306px; + background: url('../../assets/ItemBg.png'); + display: flex; + flex-direction: column; + justify-content: space-between; + + .RightChart1ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 100%; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + vertical-align: middle; + + .RightChart1ItemIcon { + width: 24px; + height: 24px; + margin-top: 3px; + } + + .RightChart1Title { + font-size: 24px; + color: #ffffff; + margin-left: 8px; + margin-top: -5px; + + } + } + + .RightChart1ItemBorder { + width: 579px; + height: 230px; + margin-left: 16px; + margin-bottom: 8px; + display: flex; + flex-direction: row; + justify-content:space-around; + flex-wrap: wrap; + + } +} \ No newline at end of file diff --git a/src/components/RightBar/Chart2.jsx b/src/components/RightBar/Chart2.jsx new file mode 100644 index 0000000..8459517 --- /dev/null +++ b/src/components/RightBar/Chart2.jsx @@ -0,0 +1,109 @@ +import React from 'react' +import { useState, useEffect } from 'react' +import styled from 'styled-components' +import { motion } from 'framer-motion' + +import Icon from '../../assets/Icon/rightChart2ICon.png' + +import Item from './substitutionCharts/Chart2.jsx' + +import './Chart2.less' + +const Daytitle = "日电量统计"; +const DayLendged = ["日储能", "日放能"]; +const Dayxdata = ["7:00", "8:00", "9:00", "10:00", "11:00", "12:00", "13:00"] +const Daydata = [[70, 45, 10, 28, 18, 28, 46], [80, 55, 70, 18, 48, 58, 76]] + +const Monthtitle = "月电量统计"; +const MonthLendged = ["月储能", "月放能"]; +const Monthxdata = ["一月", "二月", "三月", "四月", "五月", "六月", "七月"] +const Monthdata = [[70, 45, 10, 28, 18, 28, 46], [80, 55, 70, 18, 48, 58, 76]] + +const Yeartitle = "收益统计"; +const YearLendged = ["日收益", "月收益"]; +const Yearxdata = ["2016", "2017", "2018", "2019", "2020", "2021", "2022"] +const Yeardata = [[70, 45, 10, 28, 18, 28, 46], [80, 55, 70, 18, 48, 58, 76]] + + +const Gap = styled.div` +width:1px; +height:80%; +margin-top:20px; + +transform: translatey(-17px); +background-color:#010D18; +` + +const Gap2 = styled(Gap)` +transform: translateX(0px); +transform: translatey(-17px); +` + +// rgba(2,69,126,1) +export default function Chart2() { + + const [index, setIndex] = useState(1) + + useEffect(() => { + const timer = setInterval(() => { SwitchIndex() }, 10000); + return () => clearInterval(timer); + }, []) + + let num = 1; + + + function SwitchIndex() { + num = num + 1 + if (num < 4) { + setIndex(num) + } + else { + num = 1 + setIndex(num) + + } + } + + function SwitchPage(index) { + + switch (index) { + case 1: return + case 2: return + case 3: return + + } + } + + return ( +
+
+ 图片加载错误 +
光伏发电统计
+
+ < div className='rightchart2Switchbox'> +

+ +

+ +

+ + + + {SwitchPage(index)} + + +
+ + + + + + + + ) +} diff --git a/src/components/RightBar/Chart2.less b/src/components/RightBar/Chart2.less new file mode 100644 index 0000000..a8e3819 --- /dev/null +++ b/src/components/RightBar/Chart2.less @@ -0,0 +1,71 @@ +.rightchart2AllBorder { + width: 625px; + height: 306px; + background: url('../../assets/ItemBg.png'); + display: flex; + flex-direction: column; + justify-content: space-between; + margin-top: 24px; + + .rightchart2ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 100%; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + + + .rightchart2ItemIcon { + width: 24px; + height: 24px; + margin-top: 3px; + } + + .rightchart2ItemTitle { + font-size: 24px; + color: #ffffff; + margin-left: 8px; + margin-top: -5px; + + } + } + + + .rightchart2Switchbox { + width: 150px; + height: 32px; + background-color: #03233C; + align-self: flex-end; + margin-right: 15px; + border-radius: 5px; + display: flex; + flex-direction: row; + justify-content: space-between; + + .rightchart2SlelectBox { + width: 33%; + height: 100%; + + border-radius: 5px; + + } + + .rightchart2SlelectBox p { + margin: 3 auto; + color: #fff; + font-size: 15px; + text-align: center; + cursor : pointer; + } + } + + .rightchart2ItemBorder { + width: 95%; + height: 300px; + margin-left: 16px; + margin-top: -15px; + + } +} \ No newline at end of file diff --git a/src/components/RightBar/Chart3.jsx b/src/components/RightBar/Chart3.jsx new file mode 100644 index 0000000..32a5eda --- /dev/null +++ b/src/components/RightBar/Chart3.jsx @@ -0,0 +1,100 @@ +import React, { useEffect, useState } from 'react' +import { motion } from "framer-motion" +import styled from 'styled-components' + + +import Item from './substitutionCharts/Chart3.jsx' +import Icon from '../../assets/Icon/rightChart3ICon.png' +import './Chart3.less' + +const Dayxdata = ["7:00", "8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00"] +const Daydata = [70, 45, 10, 28, 18, 28, 46, 18, 28, 46, 20] + +const Monthxdata = ["一月", "二月", "三月", "四月", "五月", "六月", "七月"] +const Monthdata = [70, 45, 10, 28, 18, 28, 46] + +const Yearxdata = ["2016", "2017", "2018", "2019", "2020", "2021", "2022"] +const Yeardata = [70, 45, 10, 28, 18, 28, 46] + + + + +const Gap = styled.div` +width:1px; +height:80%; +margin-top:20px +transform: translateX(22px); +transform: translatey(3px); +background-color:#010D18; +` + +const Gap2 = styled(Gap)` +transform: translateX(0px); +transform: translatey(3px); +` + + + +export default function Chart3() { + + const [index, setIndex] = useState(1) + + useEffect(() => { + setInterval(() => { SwitchIndex() }, 10000); + }, []) + + + + let num = 1; + + + function SwitchIndex() { + num = num + 1 + if (num < 4) { + setIndex(num) + } + else { + num = 1 + setIndex(num) + + } + } + + function SwitchPage(index) { + + switch (index) { + case 1: return + case 2: return + case 3: return + + } + } + + + + return ( +
+ +
+ 图片加载错误 +
储能电站
+
+ < div className='rightchart3Switchbox'> +

+ +

+ +

+ + + {SwitchPage(index)} + +
+ + ) +} diff --git a/src/components/RightBar/Chart3.less b/src/components/RightBar/Chart3.less new file mode 100644 index 0000000..48dcb43 --- /dev/null +++ b/src/components/RightBar/Chart3.less @@ -0,0 +1,70 @@ +.RightChart3AllBorder { + width: 625px; + height: 306px; + background: url('../../assets/ItemBg.png'); + margin-top: 24px; + display: flex; + flex-direction: column; + justify-content: space-between; + .RightChart3ItemitemBorder { + margin-top: 24px; + margin-left: 24px; + width: 100%; + height: 24px; + display: flex; + flex-direction: row; + justify-content: flex-start; + vertical-align: middle; + + .RightChart3ItemIcon { + width: 24px; + height: 24px; + margin-top: 3px; + + } + + .RightChart3ItemTitle { + font-size: 24px; + color: #ffffff; + margin-left: 8px; + margin-top: -5px; + } + } + + .rightchart3Switchbox { + width: 150px; + height: 32px; + background-color: #03233C; + align-self: flex-end; + + margin-right: 15px; + border-radius: 5px; + display: flex; + flex-direction: row; + justify-content: space-between; + + .rightchart3SlelectBox { + width: 33%; + height: 100%; + + border-radius: 5px; + + } + + .rightchart3SlelectBox p { + margin: 3 auto; + color: #fff; + font-size: 15px; + text-align: center; + cursor : pointer; + } + } + + .RightChart3ItemBorder { + width: 95%; + height: 227px; + margin-left: 16px; + margin-bottom: 16px; + + } +} diff --git a/src/components/RightBar/index.jsx b/src/components/RightBar/index.jsx new file mode 100644 index 0000000..1882516 --- /dev/null +++ b/src/components/RightBar/index.jsx @@ -0,0 +1,27 @@ +import React from 'react' + + +import Chart1 from './Chart1' + +import Chart2 from './Chart2' + +import Chart3 from './Chart3' +// import RightChart2 from './Chart2' + +//引用原来的公共工程 +import RightChart2 from './Chart2' + + +import RightChart3 from './Chart3' + +import './index.less' + +export default function index() { + return ( +
+ + + +
+ ) +} diff --git a/src/components/RightBar/index.less b/src/components/RightBar/index.less new file mode 100644 index 0000000..11004d3 --- /dev/null +++ b/src/components/RightBar/index.less @@ -0,0 +1,18 @@ +.RightBorder { + width: 625px; + height: 966px; + margin-left: 24px; + display: flex; + flex-direction:column; + justify-content: flex-start; + + .RightBorder1 { + width: 440px; + height: 340px; + } + .RightBorder2 { + width: 850px; + height: 305px; + margin-left: 25px; + } +} diff --git a/src/components/RightBar/substitutionCharts/Chart1/Chart1.jsx b/src/components/RightBar/substitutionCharts/Chart1/Chart1.jsx new file mode 100644 index 0000000..fe1857b --- /dev/null +++ b/src/components/RightBar/substitutionCharts/Chart1/Chart1.jsx @@ -0,0 +1,126 @@ + +import React, { Component } from 'react'; +import './Chart1.less' +import ReactECharts from 'echarts-for-react'; + +class Chart1 extends Component { + + switchColor = (index) => { + + switch (index) { + case 1: return '#52FFF8'; + case 2: return '#52FFF8'; + case 3: return '#52FFF8'; + } + } + + getOption = () => ( + { + title: [{ + text: this.props.data, + x: "center", + y: "28%", + textStyle: { + fontWeight: "normal", + color: this.props.color, + fontSize: 24, + }, + + }, + { + text: this.props.unit, + x: "center", + y: "55%", + textStyle: { + fontWeight: "normal", + color: this.props.color, + fontSize: 15, + }, + + }, + ], + + series: [ + { + name: "Line 1", + type: "pie", + clockWise: false, + radius: [40, 46], + itemStyle: { + normal: { + label: { + show: false, + }, + labelLine: { + show: false, + }, + shadowBlur: 5, + shadowColor:this.props.color, + }, + }, + hoverAnimation: false, + data: [ + { + value: 25, + name: "invisible", + itemStyle: { + normal: { + color: "rgba(255,255,255,0.5)" //未完成的颜色 + } + } + }, + { + value: 75, + name: "01", + itemStyle: { + normal: { + color: this.props.color //完成的颜色 + } + } + }, + + ], + }, + { + name: "Line 2", + type: "pie", + animation: false, + clockWise: false, + radius: [33, 36], + itemStyle: { + + normal: { + label: { + show: false, + }, + color: this.props.color, //内圈颜色 + opacity: 0.2, + + } + }, + hoverAnimation: false, + data: [ + { + value: 100, + name: "02", + + }, + { + value: 0, + name: "invisible", + }, + ], + }, + ], + }) + + render() { + return ( +
+ +
+ ); + } +} + +export default Chart1; diff --git a/src/components/RightBar/substitutionCharts/Chart1/Chart1.less b/src/components/RightBar/substitutionCharts/Chart1/Chart1.less new file mode 100644 index 0000000..6ed643c --- /dev/null +++ b/src/components/RightBar/substitutionCharts/Chart1/Chart1.less @@ -0,0 +1,5 @@ +.RightChart3itemDetailBorder { + width: 100%; + height: 100%; + overflow:visible; +} \ No newline at end of file diff --git a/src/components/RightBar/substitutionCharts/Chart1/index.jsx b/src/components/RightBar/substitutionCharts/Chart1/index.jsx new file mode 100644 index 0000000..d3a5642 --- /dev/null +++ b/src/components/RightBar/substitutionCharts/Chart1/index.jsx @@ -0,0 +1,100 @@ + +import React, { useEffect } from 'react'; +import styled from 'styled-components'; +import RightChart1Icon2 from '../../../../assets/Icon/RightChart1Icon2.png' + +import Chart1 from './Chart1.jsx' + +import './index.less' + + +//#52FFF8 + + +function Index(props) { + + + const switchColor = (index) => { + + switch (index) { + case 1: return '#52FFF8'; + case 2: return '#49B2FF'; + case 3: return '#FFB94D'; + default: return '#fff' + } + } + + + + let Border = styled.div` + width: 74px; + height: 24px; + margin-top:50px; + overflow: hidden; + ` + + + + let Ion2 = styled.div` + width: 100%; + height: 100%; + float:left; + background: url(${RightChart1Icon2}); + background-repeat: no-repeat; + transform: translatex(-82px); + filter:drop-shadow(82px 1px ${switchColor(props.index)}); + ` + + //最大值75 + let Stuff = styled.div` + float:left; + margin-top:-17.5px; + transform: translatex(3px); + width:${58}%; + height: 12px; + background: linear-gradient(to right,#051226,${switchColor(props.index)}) + ` + + + //中间三条gap的位置 + + let Gap1 = styled.div` + // float:left; + margin-top:6px; + transform: translatex(15px); + position:absolute; + width: 2px; + height:13px; + background-color: #051226; + ` + + const Gap2 = styled(Gap1)` + transform: translatex(29px); + `; + + const Gap3 = styled(Gap1)` + transform: translatex(45px); + `; + + + return ( + +
+
+ +
+
+

{props.name}

+ + + + + + + +
+
+ ); +} + +export default Index; diff --git a/src/components/RightBar/substitutionCharts/Chart1/index.less b/src/components/RightBar/substitutionCharts/Chart1/index.less new file mode 100644 index 0000000..1d63d99 --- /dev/null +++ b/src/components/RightBar/substitutionCharts/Chart1/index.less @@ -0,0 +1,33 @@ +.RightChart1ItemBorderRow { + width: 178px; + height: 96px; + display: flex; + flex-direction: row; + justify-content: space-around; + + .RightChart1ItemB1 { + width: 96px; + height: 96px; + overflow: visible; + } + + .RightChart1ItemB2 { + width: 76px; + height: 76px; + margin-top: 10px; + margin-left: 8px; + + + + .RightChart1ItemB2TXT { + font-size:16px; + font-weight: 400px; + float: left; + color: #fff; + position: absolute; + margin-top: 15px; + white-space: nowrap; + } + + } +} \ No newline at end of file diff --git a/src/components/RightBar/substitutionCharts/Chart2.jsx b/src/components/RightBar/substitutionCharts/Chart2.jsx new file mode 100644 index 0000000..b9e726d --- /dev/null +++ b/src/components/RightBar/substitutionCharts/Chart2.jsx @@ -0,0 +1,133 @@ + +import React, { Component } from 'react'; +import './Chart2.less' +import ReactECharts from 'echarts-for-react'; + +import * as echarts from 'echarts'; + +var fontColor = '#fff' +var lineColor = 'rgba(33, 50, 89,0.8)' + +class Chart2 extends Component { + + getOption = () => ({ + + grid: { + left: "2%", + right: "4%", + bottom: "5%", + top: "15%", + containLabel: true, + }, + legend: { + data: this.props.lendge, + left: "2%", + top: 0, + textStyle: { + color: "#fff", + }, + itemWidth: 12, + itemHeight: 10, + // itemGap: 35 + }, + xAxis: { + type: "category", + data:this.props.xdata, + axisLine: { + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + axisLabel: { + show: true, + color: fontColor, + textStyle: { + fontFamily: "Microsoft YaHei", + }, + }, + }, + yAxis: { + type: "value", + max:(value) => { // 百位起最大值向上取整 + return Math.ceil(value.max / 100) * 100; + }, + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + show: true, + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + }, + series: [ + { + name: this.props.lendge[0], + type: "bar", + barWidth: "15%", + itemStyle: { + normal: { + color: '#92D675', + barBorderRadius: 2, + }, + }, + label: { + show: true, + position: 'top', + valueAnimation: true, + color: "#fff" + }, + data: this.props.data[0], + }, + { + name:this.props.lendge[1], + type: "bar", + barWidth: "15%", + itemStyle: { + normal: { + + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: 'rgba(92,183,255,1)' }, + { offset: 0.5, color: 'rgba(92,183,255,1)' }, + { offset: 1, color: 'rgba(90,107,255,1)' } + ]), + + barBorderRadius: 3, + + }, + }, + label: { + show: true, + position: 'top', + valueAnimation: true, + color: "#fff" + }, + data: this.props.data[1], + },], + + }) + + render() { + return ( +
+ +
+ ); + } +} + +export default Chart2; diff --git a/src/components/RightBar/substitutionCharts/Chart2.less b/src/components/RightBar/substitutionCharts/Chart2.less new file mode 100644 index 0000000..2adbce6 --- /dev/null +++ b/src/components/RightBar/substitutionCharts/Chart2.less @@ -0,0 +1,5 @@ +.RightChart2itemDetailBorder { + width: 100%; + height: 100%; + +} \ No newline at end of file diff --git a/src/components/RightBar/substitutionCharts/Chart3.jsx b/src/components/RightBar/substitutionCharts/Chart3.jsx new file mode 100644 index 0000000..c0b987c --- /dev/null +++ b/src/components/RightBar/substitutionCharts/Chart3.jsx @@ -0,0 +1,106 @@ + +import React, { Component } from 'react'; +import './Chart3.less' +import ReactECharts from 'echarts-for-react'; + +//颜色渐变必须要 +import * as echarts from 'echarts'; + +var fontColor = '#fff' +var lineColor = 'rgba(33, 50, 89,0.8)' + +class Chart3 extends Component { + + getOption = () => ({ + grid: { + left: "2%", + right: "4%", + bottom: "5%", + top: "8%", + containLabel: true, + }, + xAxis: { + type: "category", + data: this.props.xdata, + axisLine: { + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + axisLabel: { + show: true, + color: fontColor, + textStyle: { + fontFamily: "Microsoft YaHei", + }, + }, + }, + yAxis: { + type: "value", + scale:true, + max:(value) => { // 百位起最大值向上取整 + return Math.ceil(value.max / 100) * 100; + }, + axisLabel: { + show: true, + color: fontColor, + }, + axisLine: { + show: true, + lineStyle: { + color: lineColor, + }, + }, + splitLine: { + lineStyle: { + color: lineColor, + width: 0.5, + }, + }, + }, + series: [ + { + name: "M1", + type: "bar", + barWidth: "15%", + itemStyle: { + normal: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: 'rgba(92,183,255,1)' }, + { offset: 0.5, color: 'rgba(92,183,255,1)' }, + { offset: 1, color: 'rgba(90,107,255,1)' } + ]), + barBorderRadius: 3, + }, + }, + label: { + show: true, + position: 'top', + valueAnimation: true, + color:"#fff" + }, + data: this.props.data, + }, + + ], + + }) + + render() { + return ( +
+ + + +
+ ); + } +} + +export default Chart3; diff --git a/src/components/RightBar/substitutionCharts/Chart3.less b/src/components/RightBar/substitutionCharts/Chart3.less new file mode 100644 index 0000000..4976294 --- /dev/null +++ b/src/components/RightBar/substitutionCharts/Chart3.less @@ -0,0 +1,5 @@ +.RightChart3itemDetailBorder { + width: 100%; + height: 100%; + +} \ No newline at end of file diff --git a/src/components/V3DComp/V3DApp1.js b/src/components/V3DComp/V3DApp1.js new file mode 100644 index 0000000..800c113 --- /dev/null +++ b/src/components/V3DComp/V3DApp1.js @@ -0,0 +1,24 @@ +import React from 'react'; +import * as v3dAppAPI from '@/v3dApp/app1.js'; + +import '@/v3dApp/app.css'; + +import './V3DApp1.less'; + +class V3DApp extends React.Component { + #app = null; + componentDidMount() { + v3dAppAPI.createApp().then(app => { this.#app = app; }); + + } + componentWillUnmount() { + if (this.#app !== null) { this.#app.dispose(); this.#app = null; } + + } + render() { + return ( +
+
+ )} +} +export default V3DApp; \ No newline at end of file diff --git a/src/components/V3DComp/V3DApp1.less b/src/components/V3DComp/V3DApp1.less new file mode 100644 index 0000000..bdac989 --- /dev/null +++ b/src/components/V3DComp/V3DApp1.less @@ -0,0 +1,6 @@ +#v3dAppAPI.CONTAINER_ID { + position: relative; + height: 10%; + width: min-content; + background-color: aqua; +} diff --git a/src/components/V3DComp/V3DApp2.js b/src/components/V3DComp/V3DApp2.js new file mode 100644 index 0000000..cb02cfa --- /dev/null +++ b/src/components/V3DComp/V3DApp2.js @@ -0,0 +1,24 @@ +import React from 'react'; +import * as v3dAppAPI from '@/v3dApp/app2.js'; + +import '@/v3dApp/app.css'; + +import './V3DApp1.less'; + +class V3DApp extends React.Component { + #app = null; + componentDidMount() { + v3dAppAPI.createApp().then(app => { this.#app = app; }); + + } + componentWillUnmount() { + if (this.#app !== null) { this.#app.dispose(); this.#app = null; } + + } + render() { + return ( +
+
+ )} +} +export default V3DApp; \ No newline at end of file diff --git a/src/components/V3DComp/V3DApp2.less b/src/components/V3DComp/V3DApp2.less new file mode 100644 index 0000000..93adf2d --- /dev/null +++ b/src/components/V3DComp/V3DApp2.less @@ -0,0 +1,6 @@ +#v3dAppAPI.CONTAINER_ID{ + position: relative; + height: 10%; + width: min-content; + background-color: aliceblue; +} \ No newline at end of file diff --git a/src/layouts/index.jsx b/src/layouts/index.jsx new file mode 100644 index 0000000..26bb1d2 --- /dev/null +++ b/src/layouts/index.jsx @@ -0,0 +1,10 @@ +import { Link, Outlet } from 'umi'; +import styles from './index.less'; + +export default function Layout() { + return ( +
+ +
+ ); +} diff --git a/src/layouts/index.less b/src/layouts/index.less new file mode 100644 index 0000000..199b2d5 --- /dev/null +++ b/src/layouts/index.less @@ -0,0 +1,5 @@ +.ItemitemBorder { + display: flex; + flex-direction: row; + justify-content: flex-start; +} \ No newline at end of file diff --git a/src/pages/V3D/V3D1.jsx b/src/pages/V3D/V3D1.jsx new file mode 100644 index 0000000..b217a8e --- /dev/null +++ b/src/pages/V3D/V3D1.jsx @@ -0,0 +1,12 @@ +import React from 'react' + + +import V3D from "../../components/V3DComp/V3DApp1" +import './V3D1.less' +export default function V3D1() { + return ( + <> + + + ) +} diff --git a/src/pages/V3D/V3D1.less b/src/pages/V3D/V3D1.less new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/V3D/index.jsx b/src/pages/V3D/index.jsx new file mode 100644 index 0000000..9b49f7c --- /dev/null +++ b/src/pages/V3D/index.jsx @@ -0,0 +1,13 @@ +import React, { Component } from 'react'; + +import V3D1 from './V3D1.jsx'; +import './index.less'; +export default class index extends Component { + render() { + return ( +
+ +
+ ); + } +} diff --git a/src/pages/V3D/index.less b/src/pages/V3D/index.less new file mode 100644 index 0000000..5c970d1 --- /dev/null +++ b/src/pages/V3D/index.less @@ -0,0 +1,5 @@ +.CenterV3DBorderinside { + width: 100%; + height: 100%; + +} diff --git a/src/pages/document.ejs b/src/pages/document.ejs new file mode 100644 index 0000000..036cae6 --- /dev/null +++ b/src/pages/document.ejs @@ -0,0 +1,14 @@ + + + + + + + +
+ +
+
+ +
+ \ No newline at end of file diff --git a/src/pages/global.less b/src/pages/global.less new file mode 100644 index 0000000..f975f5a --- /dev/null +++ b/src/pages/global.less @@ -0,0 +1,16 @@ +.flex { + display: flex; +} + +.justify-between { + justify-content: space-between; +} + +.w-full { + width: 100%; +} + +.h-full { + height: 100%; +} + diff --git a/src/pages/index.jsx b/src/pages/index.jsx new file mode 100644 index 0000000..557b32b --- /dev/null +++ b/src/pages/index.jsx @@ -0,0 +1,40 @@ +import React from 'react'; +import { useEffect, useState } from 'react'; + +import './global.less'; +import './index.less'; +import Head from '../components/Head'; +import LeftBar from '../components/LeftBar'; +import BottomBar from '../components/BottomBar'; +import RightBar from '../components/RightBar'; +import CenterTopData from '../components/CenterTopData'; + +import V3DBG from '../assets/V3DBG.png'; + +import V3D from './V3D'; + +export default function index() { + const [width, setWidth] = useState(window.innerWidth); + + return ( + // +
+ +
+ +
+
+ +
+ 图片加载错误 +
{/* */}
+
+ +
+
+ +
+
+ //
+ ); +} diff --git a/src/pages/index.less b/src/pages/index.less new file mode 100644 index 0000000..420e010 --- /dev/null +++ b/src/pages/index.less @@ -0,0 +1,52 @@ +#FullScreen { + width: 3840px; + height: 1080px; + transform-origin: 'lefttop'; + background-color: #040c1c; + + .Main { + background: #a935355f; + width: 3840px; + height: 996px; + display: flex; + flex-direction: row; + + .Center { + background: #ce862f69; + margin-top: 21px; + margin-left: 24px; + padding: 1px; + width: 2472px; + height: 940px; + + .CenterData { + position: absolute; + width: 2472px; + height: 240px; + z-index: 2; + } + + .V3DBG { + position: absolute; + width: 2472px; + height: 642px; + z-index: 1; + } + + .V3DBorder { + width: 100%; + height: 486px; + margin-top: 160px; + background: url('../assets/3D.png'); + background-size: 100% 100%; + background-repeat: no-repeat; + } + + .Button { + width: 100%; + height: 306px; + margin-top: -05px; + } + } + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d64f082 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,38 @@ +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "importHelpers": true, + "jsx": "react-jsx", + "esModuleInterop": true, + "sourceMap": true, + "baseUrl": "./", + "strict": false, + "paths": { + "@/*": ["src/*"], + "@@/*": ["src/.umi/*"] + }, + "allowSyntheticDefaultImports": true, + "noImplicitAny": false + }, + "include": [ + "mock/**/*", + "src/**/*", + "config/**/*", + ".umirc.ts", + "typings.d.ts" + ], + "exclude": [ + "node_modules", + "lib", + "es", + "dist", + "typings", + "**/__test__", + "test", + "docs", + "tests" + ] +} diff --git a/typings.d.ts b/typings.d.ts new file mode 100644 index 0000000..06c8a5b --- /dev/null +++ b/typings.d.ts @@ -0,0 +1,10 @@ +declare module '*.css'; +declare module '*.less'; +declare module '*.png'; +declare module '*.svg' { + export function ReactComponent( + props: React.SVGProps, + ): React.ReactElement; + const url: string; + export default url; +}