12345678910111213141516 |
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-procedural-textures",["babylonjs"],r):"object"==typeof exports?exports["babylonjs-procedural-textures"]=r(require("babylonjs")):e.PROCEDURALTEXTURES=r(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(function(e){return function(e){var r={};function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=e,t.c=r,t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)t.d(o,n,function(r){return e[r]}.bind(null,n));return o},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=22)}({0:function(r,t){r.exports=e},1:function(e,r,t){"use strict";t.d(r,"b",(function(){return n})),t.d(r,"a",(function(){return i}));
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- var o=function(e,r){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)};function n(e,r){function t(){this.constructor=e}o(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}function i(e,r,t,o){var n,i=arguments.length,a=i<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,t,o);else for(var u=e.length-1;u>=0;u--)(n=e[u])&&(a=(i<3?n(a):i>3?n(r,t,a):n(r,t))||a);return i>3&&a&&Object.defineProperty(r,t,a),a}Object.create;Object.create},10:function(e,r,t){"use strict";t.r(r),t.d(r,"RoadProceduralTexture",(function(){return a}));var o=t(1),n=t(0),i="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}";n.Effect.ShadersStore.roadProceduralTexturePixelShader=i;var a=function(e){function r(r,t,o,i,a){var u=e.call(this,r,t,"roadProceduralTexture",o,i,a)||this;return u._roadColor=new n.Color3(.53,.53,.53),u.updateShaderUniforms(),u}return Object(o.b)(r,e),r.prototype.updateShaderUniforms=function(){this.setColor3("roadColor",this._roadColor)},Object.defineProperty(r.prototype,"roadColor",{get:function(){return this._roadColor},set:function(e){this._roadColor=e,this.updateShaderUniforms()},enumerable:!1,configurable:!0}),r.prototype.serialize=function(){var r=n.SerializationHelper.Serialize(this,e.prototype.serialize.call(this));return r.customType="BABYLON.RoadProceduralTexture",r},r.Parse=function(e,t,o){return n.SerializationHelper.Parse((function(){return new r(e.name,e._size,t,void 0,e._generateMipMaps)}),e,t,o)},Object(o.a)([Object(n.serializeAsColor3)()],r.prototype,"roadColor",null),r}(n.ProceduralTexture);n._TypeStore.RegisteredTypes["BABYLON.RoadProceduralTexture"]=a},2:function(e,r){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t},22:function(e,r,t){"use strict";t.r(r),function(e){var o=t(10);t.d(r,"RoadProceduralTexture",(function(){return o.RoadProceduralTexture}));var n=void 0!==e?e:"undefined"!=typeof window?window:void 0;if(void 0!==n)for(var i in o)n.BABYLON[i]=o[i]}.call(this,t(2))}})}));
|