var BABYLON;!(function(e){var o=(function(o){function r(t,n,i,l,s){o.call(this,t,n,"fireProceduralTexture",i,l,s),this._time=0,this._speed=new e.Vector2(.5,.3),this._autoGenerateTime=!0,this._alphaThreshold=.5,this._fireColors=r.RedFireColors,this.updateShaderUniforms()}return __extends(r,o),r.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)},r.prototype.render=function(e){this._autoGenerateTime&&(this._time+=.03*this.getScene().getAnimationRatio(),this.updateShaderUniforms()),o.prototype.render.call(this,e)},Object.defineProperty(r,"PurpleFireColors",{get:function(){return[new e.Color3(.5,0,1),new e.Color3(.9,0,1),new e.Color3(.2,0,1),new e.Color3(1,.9,1),new e.Color3(.1,.1,1),new e.Color3(.9,.9,1)]},enumerable:!0,configurable:!0}),Object.defineProperty(r,"GreenFireColors",{get:function(){return[new e.Color3(.5,1,0),new e.Color3(.5,1,0),new e.Color3(.3,.4,0),new e.Color3(.5,1,0),new e.Color3(.2,0,0),new e.Color3(.5,1,0)]},enumerable:!0,configurable:!0}),Object.defineProperty(r,"RedFireColors",{get:function(){return[new e.Color3(.5,0,.1),new e.Color3(.9,0,0),new e.Color3(.2,0,0),new e.Color3(1,.9,0),new e.Color3(.1,.1,.1),new e.Color3(.9,.9,.9)]},enumerable:!0,configurable:!0}),Object.defineProperty(r,"BlueFireColors",{get:function(){return[new e.Color3(.1,0,.5),new e.Color3(0,0,.5),new e.Color3(.1,0,.2),new e.Color3(0,0,1),new e.Color3(.1,.2,.3),new e.Color3(0,.2,.9)]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"fireColors",{get:function(){return this._fireColors},set:function(e){this._fireColors=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"time",{get:function(){return this._time},set:function(e){this._time=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"speed",{get:function(){return this._speed},set:function(e){this._speed=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"alphaThreshold",{get:function(){return this._alphaThreshold},set:function(e){this._alphaThreshold=e,this.updateShaderUniforms()},enumerable:!0,configurable:!0}),r})(e.ProceduralTexture);e.FireProceduralTexture=o})(BABYLON||(BABYLON={})),BABYLON.Effect.ShadersStore.fireProceduralTexturePixelShader="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}";