Created
March 20, 2014 20:28
-
-
Save dogles/9673106 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using haxe.root; | |
#pragma warning disable 109, 114, 219, 429, 168, 162 | |
namespace view{ | |
public class PzBlur : Blur, haxe.lang.IHxObject { | |
public PzBlur(haxe.lang.EmptyObject empty) : base(){ | |
unchecked { | |
} | |
} | |
public PzBlur() : base(){ | |
unchecked { | |
this.m_returnTexture = false; | |
} | |
} | |
public static object __hx_createEmpty(){ | |
unchecked { | |
return new view.PzBlur(haxe.lang.EmptyObject.EMPTY); | |
} | |
} | |
public static object __hx_create(haxe.root.Array arr){ | |
unchecked { | |
return new view.PzBlur(); | |
} | |
} | |
public bool m_rendered; | |
public bool m_returnTexture; | |
public haxe.lang.Function m_onRenderDone; | |
public UnityEngine.RenderTexture m_renderTexture; | |
public UnityEngine.Camera m_blurCamera; | |
public virtual void Start(){ | |
unchecked { | |
this.blurShader = UnityEngine.Shader.Find("Hidden/FastBlur"); | |
this.blurType = Blur.BlurType.SgxGauss; | |
this.blurSize = ((float) (2.0) ); | |
this.blurIterations = 2; | |
this.downsample = 0; | |
this.m_renderTexture = new UnityEngine.RenderTexture(512, 512, 24, UnityEngine.RenderTextureFormat.Default); | |
UnityEngine.Camera.main.targetTexture = this.m_renderTexture; | |
UnityEngine.GameObject cameraGO = new UnityEngine.GameObject("Blur Camera"); | |
this.m_blurCamera = ((UnityEngine.Camera) (hugs.GameObjectMethods.addTypedComponent<object>(cameraGO, typeof(UnityEngine.Camera))) ); | |
this.m_blurCamera.cullingMask = 0; | |
view.PzBlurCopy blurCopy = ((view.PzBlurCopy) (hugs.GameObjectMethods.addTypedComponent<object>(cameraGO, typeof(view.PzBlurCopy))) ); | |
blurCopy.material.mainTexture = this.m_renderTexture; | |
} | |
} | |
public virtual void OnDestroy(){ | |
unchecked { | |
if (( UnityEngine.Camera.main != default(UnityEngine.Camera) )) { | |
UnityEngine.Camera.main.targetTexture = default(UnityEngine.RenderTexture); | |
} | |
UnityEngine.Object.Destroy(((UnityEngine.Object) (this.m_blurCamera.gameObject) )); | |
UnityEngine.Object.Destroy(((UnityEngine.Object) (this.m_renderTexture) )); | |
} | |
} | |
public virtual void renderNextFrameToTexture(haxe.lang.Function onDone){ | |
unchecked { | |
this.m_onRenderDone = onDone; | |
this.m_returnTexture = true; | |
this.m_rendered = false; | |
} | |
} | |
public override void OnRenderImage(UnityEngine.RenderTexture source, UnityEngine.RenderTexture dest){ | |
unchecked { | |
this.m_rendered = true; | |
base.OnRenderImage(source, dest); | |
} | |
} | |
public virtual void OnPostRender(){ | |
unchecked { | |
if (( this.m_returnTexture && this.m_rendered )) { | |
if (( this.m_onRenderDone != default(haxe.lang.Function) )) { | |
UnityEngine.RenderTexture renderTexture = new UnityEngine.RenderTexture(512, 512, 24, UnityEngine.RenderTextureFormat.Default); | |
UnityEngine.Graphics.Blit(((UnityEngine.Texture) (this.m_renderTexture) ), ((UnityEngine.RenderTexture) (renderTexture) )); | |
this.m_onRenderDone.__hx_invoke1_o(default(double), renderTexture); | |
} | |
this.m_returnTexture = false; | |
} | |
} | |
} | |
} | |
#pragma warning disable 109, 114, 219, 429, 168, 162 | |
namespace view{ | |
public class PzBlurCopy : UnityEngine.MonoBehaviour, haxe.lang.IHxObject { | |
public PzBlurCopy(haxe.lang.EmptyObject empty) : base(){ | |
unchecked { | |
} | |
} | |
public PzBlurCopy() : base(){ | |
unchecked { | |
} | |
} | |
public static object __hx_createEmpty(){ | |
unchecked { | |
return new view.PzBlurCopy(haxe.lang.EmptyObject.EMPTY); | |
} | |
} | |
public static object __hx_create(haxe.root.Array arr){ | |
unchecked { | |
return new view.PzBlurCopy(); | |
} | |
} | |
public UnityEngine.Material material; | |
public virtual void Awake(){ | |
unchecked { | |
this.material = new UnityEngine.Material(haxe.lang.Runtime.toString(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat(haxe.lang.Runtime.concat("Shader \"Hidden/CopyTarget\" {", "Properties {"), " _MainTex (\"Main Texture\", 2D) = \"white\" { }"), "}"), "SubShader {"), " Pass {"), " ZTest Always Cull Off ZWrite Off"), " SetTexture [_MainTex] "), " }"), "}"), "}"))); | |
} | |
} | |
public virtual void OnPostRender(){ | |
unchecked { | |
UnityEngine.GL.PushMatrix(); | |
UnityEngine.GL.LoadOrtho(); | |
{ | |
int _g1 = 0; | |
int _g = this.material.passCount; | |
while (( _g1 < _g )){ | |
int i = _g1++; | |
this.material.SetPass(i); | |
UnityEngine.GL.Begin(UnityEngine.GL.QUADS); | |
UnityEngine.GL.Color(UnityEngine.Color.white); | |
UnityEngine.GL.TexCoord2(((float) (0) ), ((float) (0) )); | |
UnityEngine.GL.Vertex3(((float) (0) ), ((float) (0) ), ((float) (0.1) )); | |
UnityEngine.GL.TexCoord2(((float) (1) ), ((float) (0) )); | |
UnityEngine.GL.Vertex3(((float) (1) ), ((float) (0) ), ((float) (0.1) )); | |
UnityEngine.GL.TexCoord2(((float) (1) ), ((float) (1) )); | |
UnityEngine.GL.Vertex3(((float) (1) ), ((float) (1) ), ((float) (0.1) )); | |
UnityEngine.GL.TexCoord2(((float) (0) ), ((float) (1) )); | |
UnityEngine.GL.Vertex3(((float) (0) ), ((float) (1) ), ((float) (0.1) )); | |
UnityEngine.GL.End(); | |
} | |
} | |
UnityEngine.GL.PopMatrix(); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment