//=============================================================================
// Luna_Shaders.js
//=============================================================================
//=============================================================================
// Build Date: 2020-09-15 20:40:57
//=============================================================================
//=============================================================================
// Made with LunaTea -- Haxe
//=============================================================================


// Generated by Haxe 4.1.3
/*:
@author LunaTechs - Kino
@plugindesc A plugin that displays the copyright
text on the title screen <LunaShaders>.

@target MV MZ


@help
A plugin that displays the current build version of your
project on the title screen.


MIT License
Copyright (c) 2020 LunaTechsDev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
*/



(function ($hx_exports, $global) { "use strict"
class EReg {
	constructor(r,opt) {
		this.r = new RegExp(r,opt.split("u").join(""))
	}
	match(s) {
		if(this.r.global) {
			this.r.lastIndex = 0
		}
		this.r.m = this.r.exec(s)
		this.r.s = s
		return this.r.m != null;
	}
}
class GBBlueShader extends PIXI.Filter {
	constructor(texture) {
		super(null,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void){\n  \n  vec4 oc=texture2D(uSampler,vTextureCoord);\n  vec3 col=vec3(oc.rgb);\n  vec3 greyScale=vec3(.5,.5,.5);\n  vec3 col=vec3(oc.rgb);\n  col.rgb=vec3((oc.r*.29)+(oc.g*.59)+(oc.b*.045));\n  col.b=col.b*1.95;\n  // col.rgb = vec3(col.rgb * 0.8);\n  fragColor=vec4(vec3(col.rgb),tex.a);\n  \n}",{ uSampler : texture});
	}
	static create(texture) {
		return new GBBlueShader(texture);
	}
}
class GBShader extends PIXI.Filter {
	constructor(texture) {
		super(null,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main() {\n  vec4 oc = texture2D(uSampler, vTextureCoord);\n  vec3 col = vec3(oc.rgb);\n  col.rgb = vec3((oc.r * .29) + (oc.g * .59) + (oc.b * .045));\n  col.g = col.g * 1.45;\n  //May add later for darker tones\n  // col.rgb = vec3(col.rgb * 0.8);\n  gl_FragColor = vec4((vec3(col.rgb)), oc.a);\n}",{ uSampler : texture});
	}
	static create(texture) {
		return new GBShader(texture);
	}
}
class HeatWaveShader extends PIXI.Filter {
	constructor(texture,time) {
		super(null,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float time;\nvoid main(void){\n  //Normalized Pixel Coordinates in Pixi\n  vec2 uv=vTextureCoord;\n  float update_time=.05*time;\n  const vec2 scale=vec2(.5);\n  \n  uv+=.05*sin(scale*update_time+length(uv)*1.5);\n  gl_FragColor=texture2D(uSampler,uv);\n}",{ uSampler : texture, time : time});
	}
	static create(texture,time) {
		return new HeatWaveShader(texture,time);
	}
}
class MonochromeShader extends PIXI.Filter {
	constructor(texture) {
		super(null,"varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void){\n  vec4 oc=texture2D(uSampler,vTextureCoord);\n  vec4 col=oc;\n  vec4 weighted_color=vec4(oc.r*.3,oc.g*.59,oc.b*.11,oc.a);\n  vec3 grey_scale=vec3(.35,.35,.35);\n  vec3 avg=oc.rgb*.65;\n  col.rgb=vec3((oc.r*.3)+(oc.g*.59)+(oc.b*.11));\n  vec4 avg_color=vec4(vec3(dot(oc.rgb,avg)),oc.a);\n  gl_FragColor=vec4(vec3(col.rgb),oc.a);\n}",{ uSampler : texture});
	}
	static create(texture) {
		return new MonochromeShader(texture);
	}
}
class LunaShaders {
	static main() {
		
//=============================================================================
// Parameters
//=============================================================================
      
		let _this = $plugins
		let _g = []
		let _g1 = 0
		while(_g1 < _this.length) {
			let v = _this[_g1]
			++_g1
			if(new EReg("<LunaShaders>","ig").match(v.description)) {
				_g.push(v)
			}
		}
	}
}
$hx_exports["LunaShaders"] = LunaShaders
class haxe_iterators_ArrayIterator {
	constructor(array) {
		this.current = 0
		this.array = array
	}
	hasNext() {
		return this.current < this.array.length;
	}
	next() {
		return this.array[this.current++];
	}
}
class _$LTGlobals_$ {
}
GBBlueShader.fragSrc = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void){\n  \n  vec4 oc=texture2D(uSampler,vTextureCoord);\n  vec3 col=vec3(oc.rgb);\n  vec3 greyScale=vec3(.5,.5,.5);\n  vec3 col=vec3(oc.rgb);\n  col.rgb=vec3((oc.r*.29)+(oc.g*.59)+(oc.b*.045));\n  col.b=col.b*1.95;\n  // col.rgb = vec3(col.rgb * 0.8);\n  fragColor=vec4(vec3(col.rgb),tex.a);\n  \n}";
GBShader.fragSrc = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main() {\n  vec4 oc = texture2D(uSampler, vTextureCoord);\n  vec3 col = vec3(oc.rgb);\n  col.rgb = vec3((oc.r * .29) + (oc.g * .59) + (oc.b * .045));\n  col.g = col.g * 1.45;\n  //May add later for darker tones\n  // col.rgb = vec3(col.rgb * 0.8);\n  gl_FragColor = vec4((vec3(col.rgb)), oc.a);\n}";
HeatWaveShader.fragSrc = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float time;\nvoid main(void){\n  //Normalized Pixel Coordinates in Pixi\n  vec2 uv=vTextureCoord;\n  float update_time=.05*time;\n  const vec2 scale=vec2(.5);\n  \n  uv+=.05*sin(scale*update_time+length(uv)*1.5);\n  gl_FragColor=texture2D(uSampler,uv);\n}";
MonochromeShader.fragSrc = "varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void){\n  vec4 oc=texture2D(uSampler,vTextureCoord);\n  vec4 col=oc;\n  vec4 weighted_color=vec4(oc.r*.3,oc.g*.59,oc.b*.11,oc.a);\n  vec3 grey_scale=vec3(.35,.35,.35);\n  vec3 avg=oc.rgb*.65;\n  col.rgb=vec3((oc.r*.3)+(oc.g*.59)+(oc.b*.11));\n  vec4 avg_color=vec4(vec3(dot(oc.rgb,avg)),oc.a);\n  gl_FragColor=vec4(vec3(col.rgb),oc.a);\n}";
LunaShaders.HeatWaveShader = HeatWaveShader
LunaShaders.MonochromeShader = MonochromeShader
LunaShaders.GBShader = GBShader
LunaShaders.GBBlueShader = GBBlueShader
LunaShaders.main()
})(typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this, {})
