babylonjs.proceduralTextures.min.js 40 KB

12
  1. !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-procedural-textures",["babylonjs"],t):"object"==typeof exports?exports["babylonjs-procedural-textures"]=t(require("babylonjs")):e.PTLIB=t(e.BABYLON)}(window,function(e){return function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function o(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),o(r(4)),o(r(7)),o(r(10)),o(r(13)),o(r(16)),o(r(19)),o(r(22)),o(r(25)),o(r(28)),o(r(31))},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),n=void 0!==e?e:"undefined"!=typeof window?window:void 0;if(void 0!==n)for(var i in n.BABYLON=n.BABYLON||{},o)o.hasOwnProperty(i)&&(n.BABYLON[i]=o[i]);!function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(1))}).call(this,r(3))},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(5))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.brickProceduralTexturePixelShader=r(6);var a=function(e){function t(t,r,o,n,a){var l=e.call(this,t,r,"brickProceduralTexture",o,n,a)||this;return l._numberOfBricksHeight=15,l._numberOfBricksWidth=5,l._jointColor=new i.Color3(.72,.72,.72),l._brickColor=new i.Color3(.77,.47,.4),l.updateShaderUniforms(),l}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setFloat("numberOfBricksHeight",this._numberOfBricksHeight),this.setFloat("numberOfBricksWidth",this._numberOfBricksWidth),this.setColor3("brickColor",this._brickColor),this.setColor3("jointColor",this._jointColor)},Object.defineProperty(t.prototype,"numberOfBricksHeight",{get:function(){return this._numberOfBricksHeight},set:function(e){this._numberOfBricksHeight=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numberOfBricksWidth",{get:function(){return this._numberOfBricksWidth},set:function(e){this._numberOfBricksWidth=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"jointColor",{get:function(){return this._jointColor},set:function(e){this._jointColor=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"brickColor",{get:function(){return this._brickColor},set:function(e){this._brickColor=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return t.customType="BABYLON.BrickProceduralTexture",t},t.Parse=function(e,r,o){return i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o)},n([i.serialize()],t.prototype,"numberOfBricksHeight",null),n([i.serialize()],t.prototype,"numberOfBricksWidth",null),n([i.serializeAsColor3()],t.prototype,"jointColor",null),n([i.serializeAsColor3()],t.prototype,"brickColor",null),t}(i.ProceduralTexture);t.BrickProceduralTexture=a},function(e,t){e.exports="precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float numberOfBricksHeight;\nuniform float numberOfBricksWidth;\nuniform vec3 brickColor;\nuniform vec3 jointColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nfloat roundF(float number){\nreturn sign(number)*floor(abs(number)+0.5);\n}\nvoid main(void)\n{\nfloat brickW=1.0/numberOfBricksWidth;\nfloat brickH=1.0/numberOfBricksHeight;\nfloat jointWPercentage=0.01;\nfloat jointHPercentage=0.05;\nvec3 color=brickColor;\nfloat yi=vUV.y/brickH;\nfloat nyi=roundF(yi);\nfloat xi=vUV.x/brickW;\nif (mod(floor(yi),2.0) == 0.0){\nxi=xi-0.5;\n}\nfloat nxi=roundF(xi);\nvec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/brickW);\nif (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){\ncolor=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);\n}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){\ncolor=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);\n}\nelse {\nfloat brickColorSwitch=mod(floor(yi)+floor(xi),3.0);\nif (brickColorSwitch == 0.0)\ncolor=mix(color,vec3(0.33,0.33,0.33),0.3);\nelse if (brickColorSwitch == 2.0)\ncolor=mix(color,vec3(0.11,0.11,0.11),0.3);\n}\ngl_FragColor=vec4(color,1.0);\n}"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(8))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.cloudProceduralTexturePixelShader=r(9);var a=function(e){function t(t,r,o,n,a){var l=e.call(this,t,r,"cloudProceduralTexture",o,n,a)||this;return l._skyColor=new i.Color4(.15,.68,1,1),l._cloudColor=new i.Color4(1,1,1,1),l.updateShaderUniforms(),l}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setColor4("skyColor",this._skyColor),this.setColor4("cloudColor",this._cloudColor)},Object.defineProperty(t.prototype,"skyColor",{get:function(){return this._skyColor},set:function(e){this._skyColor=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cloudColor",{get:function(){return this._cloudColor},set:function(e){this._cloudColor=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return t.customType="BABYLON.CloudProceduralTexture",t},t.Parse=function(e,r,o){return i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o)},n([i.serializeAsColor4()],t.prototype,"skyColor",null),n([i.serializeAsColor4()],t.prototype,"cloudColor",null),t}(i.ProceduralTexture);t.CloudProceduralTexture=a},function(e,t){e.exports="precision highp float;\nvarying vec2 vUV;\nuniform vec4 skyColor;\nuniform vec4 cloudColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main() {\nvec2 p=vUV*12.0;\nvec4 c=mix(skyColor,cloudColor,fbm(p));\ngl_FragColor=c;\n}\n"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(11))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.fireProceduralTexturePixelShader=r(12);var a=function(e){function t(r,o,n,a,l){var s=e.call(this,r,o,"fireProceduralTexture",n,a,l)||this;return s._time=0,s._speed=new i.Vector2(.5,.3),s._autoGenerateTime=!0,s._alphaThreshold=.5,s._fireColors=t.RedFireColors,s.updateShaderUniforms(),s}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setFloat("time",this._time),this.setVector2("speed",this._speed),this.setColor3("c1",this._fireColors[0]),this.setColor3("c2",this._fireColors[1]),this.setColor3("c3",this._fireColors[2]),this.setColor3("c4",this._fireColors[3]),this.setColor3("c5",this._fireColors[4]),this.setColor3("c6",this._fireColors[5]),this.setFloat("alphaThreshold",this._alphaThreshold)},t.prototype.render=function(t){var r=this.getScene();this._autoGenerateTime&&r&&(this._time+=.03*r.getAnimationRatio(),this.updateShaderUniforms()),e.prototype.render.call(this,t)},Object.defineProperty(t,"PurpleFireColors",{get:function(){return[new i.Color3(.5,0,1),new i.Color3(.9,0,1),new i.Color3(.2,0,1),new i.Color3(1,.9,1),new i.Color3(.1,.1,1),new i.Color3(.9,.9,1)]},enumerable:!0,configurable:!0}),Object.defineProperty(t,"GreenFireColors",{get:function(){return[new i.Color3(.5,1,0),new i.Color3(.5,1,0),new i.Color3(.3,.4,0),new i.Color3(.5,1,0),new i.Color3(.2,0,0),new i.Color3(.5,1,0)]},enumerable:!0,configurable:!0}),Object.defineProperty(t,"RedFireColors",{get:function(){return[new i.Color3(.5,0,.1),new i.Color3(.9,0,0),new i.Color3(.2,0,0),new i.Color3(1,.9,0),new i.Color3(.1,.1,.1),new i.Color3(.9,.9,.9)]},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BlueFireColors",{get:function(){return[new i.Color3(.1,0,.5),new i.Color3(0,0,.5),new i.Color3(.1,0,.2),new i.Color3(0,0,1),new i.Color3(.1,.2,.3),new i.Color3(0,.2,.9)]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"autoGenerateTime",{get:function(){return this._autoGenerateTime},set:function(e){this._autoGenerateTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fireColors",{get:function(){return this._fireColors},set:function(e){this._fireColors=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"speed",{get:function(){return this._speed},set:function(e){this._speed=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alphaThreshold",{get:function(){return this._alphaThreshold},set:function(e){this._alphaThreshold=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));t.customType="BABYLON.FireProceduralTexture",t.fireColors=[];for(var r=0;r<this._fireColors.length;r++)t.fireColors.push(this._fireColors[r].asArray());return t},t.Parse=function(e,r,o){for(var n=i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o),a=[],l=0;l<e.fireColors.length;l++)a.push(i.Color3.FromArray(e.fireColors[l]));return n.fireColors=a,n},n([i.serialize()],t.prototype,"autoGenerateTime",null),n([i.serialize()],t.prototype,"time",null),n([i.serializeAsVector2()],t.prototype,"speed",null),n([i.serialize()],t.prototype,"alphaThreshold",null),t}(i.ProceduralTexture);t.FireProceduralTexture=a},function(e,t){e.exports="precision highp float;\nuniform float time;\nuniform vec3 c1;\nuniform vec3 c2;\nuniform vec3 c3;\nuniform vec3 c4;\nuniform vec3 c5;\nuniform vec3 c6;\nuniform vec2 speed;\nuniform float shift;\nuniform float alphaThreshold;\nvarying vec2 vUV;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main() {\nvec2 p=vUV*8.0;\nfloat q=fbm(p-time*0.1);\nvec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));\nvec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);\nvec3 color=c*cos(shift*vUV.y);\nfloat luminance=dot(color.rgb,vec3(0.3,0.59,0.11));\ngl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));\n}"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(14))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.grassProceduralTexturePixelShader=r(15);var a=function(e){function t(t,r,o,n,a){var l=e.call(this,t,r,"grassProceduralTexture",o,n,a)||this;return l._groundColor=new i.Color3(1,1,1),l._grassColors=[new i.Color3(.29,.38,.02),new i.Color3(.36,.49,.09),new i.Color3(.51,.6,.28)],l.updateShaderUniforms(),l}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setColor3("herb1Color",this._grassColors[0]),this.setColor3("herb2Color",this._grassColors[1]),this.setColor3("herb3Color",this._grassColors[2]),this.setColor3("groundColor",this._groundColor)},Object.defineProperty(t.prototype,"grassColors",{get:function(){return this._grassColors},set:function(e){this._grassColors=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"groundColor",{get:function(){return this._groundColor},set:function(e){this._groundColor=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));t.customType="BABYLON.GrassProceduralTexture",t.grassColors=[];for(var r=0;r<this._grassColors.length;r++)t.grassColors.push(this._grassColors[r].asArray());return t},t.Parse=function(e,r,o){for(var n=i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o),a=[],l=0;l<e.grassColors.length;l++)a.push(i.Color3.FromArray(e.grassColors[l]));return n.grassColors=a,n},n([i.serializeAsColor3()],t.prototype,"groundColor",null),t}(i.ProceduralTexture);t.GrassProceduralTexture=a},function(e,t){e.exports="precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform vec3 herb1Color;\nuniform vec3 herb2Color;\nuniform vec3 herb3Color;\nuniform vec3 groundColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main(void) {\nvec3 color=mix(groundColor,herb1Color,rand(gl_FragCoord.xy*4.0));\ncolor=mix(color,herb2Color,rand(gl_FragCoord.xy*8.0));\ncolor=mix(color,herb3Color,rand(gl_FragCoord.xy));\ncolor=mix(color,herb1Color,fbm(gl_FragCoord.xy*16.0));\ngl_FragColor=vec4(color,1.0);\n}"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(17))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.marbleProceduralTexturePixelShader=r(18);var a=function(e){function t(t,r,o,n,a){var l=e.call(this,t,r,"marbleProceduralTexture",o,n,a)||this;return l._numberOfTilesHeight=3,l._numberOfTilesWidth=3,l._amplitude=9,l._jointColor=new i.Color3(.72,.72,.72),l.updateShaderUniforms(),l}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setFloat("numberOfTilesHeight",this._numberOfTilesHeight),this.setFloat("numberOfTilesWidth",this._numberOfTilesWidth),this.setFloat("amplitude",this._amplitude),this.setColor3("jointColor",this._jointColor)},Object.defineProperty(t.prototype,"numberOfTilesHeight",{get:function(){return this._numberOfTilesHeight},set:function(e){this._numberOfTilesHeight=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"amplitude",{get:function(){return this._amplitude},set:function(e){this._amplitude=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numberOfTilesWidth",{get:function(){return this._numberOfTilesWidth},set:function(e){this._numberOfTilesWidth=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"jointColor",{get:function(){return this._jointColor},set:function(e){this._jointColor=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return t.customType="BABYLON.MarbleProceduralTexture",t},t.Parse=function(e,r,o){return i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o)},n([i.serialize()],t.prototype,"numberOfTilesHeight",null),n([i.serialize()],t.prototype,"amplitude",null),n([i.serialize()],t.prototype,"numberOfTilesWidth",null),n([i.serialize()],t.prototype,"jointColor",null),t}(i.ProceduralTexture);t.MarbleProceduralTexture=a},function(e,t){e.exports="precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float numberOfTilesHeight;\nuniform float numberOfTilesWidth;\nuniform float amplitude;\nuniform vec3 marbleColor;\nuniform vec3 jointColor;\nconst vec3 tileSize=vec3(1.1,1.0,1.1);\nconst vec3 tilePct=vec3(0.98,1.0,0.98);\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat turbulence(vec2 P)\n{\nfloat val=0.0;\nfloat freq=1.0;\nfor (int i=0; i<4; i++)\n{\nval+=abs(noise(P*freq)/freq);\nfreq*=2.07;\n}\nreturn val;\n}\nfloat roundF(float number){\nreturn sign(number)*floor(abs(number)+0.5);\n}\nvec3 marble_color(float x)\n{\nvec3 col;\nx=0.5*(x+1.);\nx=sqrt(x); \nx=sqrt(x);\nx=sqrt(x);\ncol=vec3(.2+.75*x); \ncol.b*=0.95; \nreturn col;\n}\nvoid main()\n{\nfloat brickW=1.0/numberOfTilesWidth;\nfloat brickH=1.0/numberOfTilesHeight;\nfloat jointWPercentage=0.01;\nfloat jointHPercentage=0.01;\nvec3 color=marbleColor;\nfloat yi=vUV.y/brickH;\nfloat nyi=roundF(yi);\nfloat xi=vUV.x/brickW;\nif (mod(floor(yi),2.0) == 0.0){\nxi=xi-0.5;\n}\nfloat nxi=roundF(xi);\nvec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/brickW);\nif (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){\ncolor=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);\n}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){\ncolor=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);\n}\nelse {\nfloat t=6.28*brickvUV.x/(tileSize.x+noise(vec2(vUV)*6.0));\nt+=amplitude*turbulence(brickvUV.xy);\nt=sin(t);\ncolor=marble_color(t);\n}\ngl_FragColor=vec4(color,0.0);\n}"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(20))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.normalMapProceduralTexturePixelShader=r(21);var a=function(e){function t(t,r,o,n,i){var a=e.call(this,t,r,"normalMapProceduralTexture",o,n,i)||this;return a.updateShaderUniforms(),a}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setTexture("baseSampler",this._baseTexture),this.setFloat("size",this.getRenderSize())},t.prototype.render=function(t){e.prototype.render.call(this,t)},t.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.updateShaderUniforms()},Object.defineProperty(t.prototype,"baseTexture",{get:function(){return this._baseTexture},set:function(e){this._baseTexture=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return t.customType="BABYLON.NormalMapProceduralTexture",t},t.Parse=function(e,r,o){return i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o)},n([i.serializeAsTexture()],t.prototype,"baseTexture",null),t}(i.ProceduralTexture);t.NormalMapProceduralTexture=a},function(e,t){e.exports="precision highp float;\n\nuniform sampler2D baseSampler;\nuniform float size;\n\nvarying vec2 vUV;\n\nconst vec3 LUMA_COEFFICIENT=vec3(0.2126,0.7152,0.0722);\nfloat lumaAtCoord(vec2 coord)\n{\nvec3 pixel=texture2D(baseSampler,coord).rgb;\nfloat luma=dot(pixel,LUMA_COEFFICIENT);\nreturn luma;\n}\nvoid main()\n{\nfloat lumaU0=lumaAtCoord(vUV+vec2(-1.0,0.0)/size);\nfloat lumaU1=lumaAtCoord(vUV+vec2( 1.0,0.0)/size);\nfloat lumaV0=lumaAtCoord(vUV+vec2( 0.0,-1.0)/size);\nfloat lumaV1=lumaAtCoord(vUV+vec2( 0.0,1.0)/size);\nvec2 slope=(vec2(lumaU0-lumaU1,lumaV0-lumaV1)+1.0)*0.5;\ngl_FragColor=vec4(slope,1.0,1.0);\n}\n"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(23))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.perlinNoiseProceduralTexturePixelShader=r(24);var a=function(e){function t(t,r,o,n,i){var a=e.call(this,t,r,"perlinNoiseProceduralTexture",o,n,i)||this;return a.time=0,a.timeScale=1,a.translationSpeed=1,a._currentTranslation=0,a.updateShaderUniforms(),a}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setFloat("size",this.getRenderSize());var e=this.getScene();if(e){var t=e.getEngine().getDeltaTime();this.time+=t,this.setFloat("time",this.time*this.timeScale/1e3),this._currentTranslation+=t*this.translationSpeed/1e3,this.setFloat("translationSpeed",this._currentTranslation)}},t.prototype.render=function(t){this.updateShaderUniforms(),e.prototype.render.call(this,t)},t.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r)},t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return t.customType="BABYLON.PerlinNoiseProceduralTexture",t},t.Parse=function(e,r,o){return i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o)},n([i.serialize()],t.prototype,"time",void 0),n([i.serialize()],t.prototype,"timeScale",void 0),n([i.serialize()],t.prototype,"translationSpeed",void 0),t}(i.ProceduralTexture);t.PerlinNoiseProceduralTexture=a},function(e,t){e.exports="\nprecision highp float;\n\nuniform float size;\nuniform float time;\nuniform float translationSpeed;\n\nvarying vec2 vUV;\n\nfloat r(float n)\n{\nreturn fract(cos(n*89.42)*343.42);\n}\nvec2 r(vec2 n)\n{\nreturn vec2(r(n.x*23.62-300.0+n.y*34.35),r(n.x*45.13+256.0+n.y*38.89)); \n}\nfloat worley(vec2 n,float s)\n{\nfloat dis=1.0;\nfor(int x=-1; x<=1; x++)\n{\nfor(int y=-1; y<=1; y++)\n{\nvec2 p=floor(n/s)+vec2(x,y);\nfloat d=length(r(p)+vec2(x,y)-fract(n/s));\nif (dis>d)\ndis=d;\n}\n}\nreturn 1.0-dis;\n}\nvec3 hash33(vec3 p3)\n{\np3=fract(p3*vec3(0.1031,0.11369,0.13787));\np3+=dot(p3,p3.yxz+19.19);\nreturn -1.0+2.0*fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));\n}\nfloat perlinNoise(vec3 p)\n{\nvec3 pi=floor(p);\nvec3 pf=p-pi;\nvec3 w=pf*pf*(3.0-2.0*pf);\nreturn mix(\nmix(\nmix(\ndot(pf-vec3(0,0,0),hash33(pi+vec3(0,0,0))),\ndot(pf-vec3(1,0,0),hash33(pi+vec3(1,0,0))),\nw.x\n),\nmix(\ndot(pf-vec3(0,0,1),hash33(pi+vec3(0,0,1))),\ndot(pf-vec3(1,0,1),hash33(pi+vec3(1,0,1))),\nw.x\n),\nw.z\n),\nmix(\nmix(\ndot(pf-vec3(0,1,0),hash33(pi+vec3(0,1,0))),\ndot(pf-vec3(1,1,0),hash33(pi+vec3(1,1,0))),\nw.x\n),\nmix(\ndot(pf-vec3(0,1,1),hash33(pi+vec3(0,1,1))),\ndot(pf-vec3(1,1,1),hash33(pi+vec3(1,1,1))),\nw.x\n),\nw.z\n),\nw.y\n);\n}\n\nvoid main(void)\n{\nvec2 uv=gl_FragCoord.xy+translationSpeed;\nfloat dis=(\n1.0+perlinNoise(vec3(uv/vec2(size,size),time*0.05)*8.0))\n*(1.0+(worley(uv,32.0)+ 0.5*worley(2.0*uv,32.0)+0.25*worley(4.0*uv,32.0))\n);\ngl_FragColor=vec4(vec3(dis/4.0),1.0);\n}\n"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(26))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.roadProceduralTexturePixelShader=r(27);var a=function(e){function t(t,r,o,n,a){var l=e.call(this,t,r,"roadProceduralTexture",o,n,a)||this;return l._roadColor=new i.Color3(.53,.53,.53),l.updateShaderUniforms(),l}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setColor3("roadColor",this._roadColor)},Object.defineProperty(t.prototype,"roadColor",{get:function(){return this._roadColor},set:function(e){this._roadColor=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return t.customType="BABYLON.RoadProceduralTexture",t},t.Parse=function(e,r,o){return i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o)},n([i.serializeAsColor3()],t.prototype,"roadColor",null),t}(i.ProceduralTexture);t.RoadProceduralTexture=a},function(e,t){e.exports="precision highp float;\nvarying vec2 vUV; \nuniform vec3 roadColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main(void) {\nfloat ratioy=mod(gl_FragCoord.y*100.0 ,fbm(vUV*2.0));\nvec3 color=roadColor*ratioy;\ngl_FragColor=vec4(color,1.0);\n}"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(29))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.starfieldProceduralTexturePixelShader=r(30);var a=function(e){function t(t,r,o,n,i){var a=e.call(this,t,r,"starfieldProceduralTexture",o,n,i)||this;return a._time=1,a._alpha=.5,a._beta=.8,a._zoom=.8,a._formuparam=.53,a._stepsize=.1,a._tile=.85,a._brightness=.0015,a._darkmatter=.4,a._distfading=.73,a._saturation=.85,a.updateShaderUniforms(),a}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setFloat("time",this._time),this.setFloat("alpha",this._alpha),this.setFloat("beta",this._beta),this.setFloat("zoom",this._zoom),this.setFloat("formuparam",this._formuparam),this.setFloat("stepsize",this._stepsize),this.setFloat("tile",this._tile),this.setFloat("brightness",this._brightness),this.setFloat("darkmatter",this._darkmatter),this.setFloat("distfading",this._distfading),this.setFloat("saturation",this._saturation)},Object.defineProperty(t.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(e){this._alpha=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"beta",{get:function(){return this._beta},set:function(e){this._beta=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formuparam",{get:function(){return this._formuparam},set:function(e){this._formuparam=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stepsize",{get:function(){return this._stepsize},set:function(e){this._stepsize=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zoom",{get:function(){return this._zoom},set:function(e){this._zoom=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"tile",{get:function(){return this._tile},set:function(e){this._tile=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"brightness",{get:function(){return this._brightness},set:function(e){this._brightness=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"darkmatter",{get:function(){return this._darkmatter},set:function(e){this._darkmatter=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distfading",{get:function(){return this._distfading},set:function(e){this._distfading=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"saturation",{get:function(){return this._saturation},set:function(e){this._saturation=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return t.customType="BABYLON.StarfieldProceduralTexture",t},t.Parse=function(e,r,o){return i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o)},n([i.serialize()],t.prototype,"time",null),n([i.serialize()],t.prototype,"alpha",null),n([i.serialize()],t.prototype,"beta",null),n([i.serialize()],t.prototype,"formuparam",null),n([i.serialize()],t.prototype,"stepsize",null),n([i.serialize()],t.prototype,"zoom",null),n([i.serialize()],t.prototype,"tile",null),n([i.serialize()],t.prototype,"brightness",null),n([i.serialize()],t.prototype,"darkmatter",null),n([i.serialize()],t.prototype,"distfading",null),n([i.serialize()],t.prototype,"saturation",null),t}(i.ProceduralTexture);t.StarfieldProceduralTexture=a},function(e,t){e.exports="precision highp float;\n\n#define volsteps 20\n#define iterations 15\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float time;\nuniform float alpha;\nuniform float beta;\nuniform float zoom;\nuniform float formuparam;\nuniform float stepsize;\nuniform float tile;\nuniform float brightness;\nuniform float darkmatter;\nuniform float distfading;\nuniform float saturation;\nvoid main()\n{\nvec3 dir=vec3(vUV*zoom,1.);\nfloat localTime=time*0.0001;\n\nmat2 rot1=mat2(cos(alpha),sin(alpha),-sin(alpha),cos(alpha));\nmat2 rot2=mat2(cos(beta),sin(beta),-sin(beta),cos(beta));\ndir.xz*=rot1;\ndir.xy*=rot2;\nvec3 from=vec3(1.,.5,0.5);\nfrom+=vec3(-2.,localTime*2.,localTime);\nfrom.xz*=rot1;\nfrom.xy*=rot2;\n\nfloat s=0.1,fade=1.;\nvec3 v=vec3(0.);\nfor (int r=0; r<volsteps; r++) {\nvec3 p=from+s*dir*.5;\np=abs(vec3(tile)-mod(p,vec3(tile*2.))); \nfloat pa,a=pa=0.;\nfor (int i=0; i<iterations; i++) {\np=abs(p)/dot(p,p)-formuparam; \na+=abs(length(p)-pa); \npa=length(p);\n}\nfloat dm=max(0.,darkmatter-a*a*.001); \na*=a*a; \nif (r>6) fade*=1.-dm; \n\nv+=fade;\nv+=vec3(s,s*s,s*s*s*s)*a*brightness*fade; \nfade*=distfading; \ns+=stepsize;\n}\nv=mix(vec3(length(v)),v,saturation); \ngl_FragColor=vec4(v*.01,1.);\n}"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(32))},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),n=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var l=e.length-1;l>=0;l--)(n=e[l])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);i.Effect.ShadersStore.woodProceduralTexturePixelShader=r(33);var a=function(e){function t(t,r,o,n,a){var l=e.call(this,t,r,"woodProceduralTexture",o,n,a)||this;return l._ampScale=100,l._woodColor=new i.Color3(.32,.17,.09),l.updateShaderUniforms(),l}return o(t,e),t.prototype.updateShaderUniforms=function(){this.setFloat("ampScale",this._ampScale),this.setColor3("woodColor",this._woodColor)},Object.defineProperty(t.prototype,"ampScale",{get:function(){return this._ampScale},set:function(e){this._ampScale=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"woodColor",{get:function(){return this._woodColor},set:function(e){this._woodColor=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),t.prototype.serialize=function(){var t=i.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return t.customType="BABYLON.WoodProceduralTexture",t},t.Parse=function(e,r,o){return i.SerializationHelper.Parse(function(){return new t(e.name,e._size,r,void 0,e._generateMipMaps)},e,r,o)},n([i.serialize()],t.prototype,"ampScale",null),n([i.serializeAsColor3()],t.prototype,"woodColor",null),t}(i.ProceduralTexture);t.WoodProceduralTexture=a},function(e,t){e.exports="precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float ampScale;\nuniform vec3 woodColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main(void) {\nfloat ratioy=mod(vUV.x*ampScale,2.0+fbm(vUV*0.8));\nvec3 wood=woodColor*ratioy;\ngl_FragColor=vec4(wood,1.0);\n}"}])});
  2. //# sourceMappingURL=babylonjs.proceduralTextures.min.js.map