I=(S=Main = function(){
}).prototype = new Uno.Application;

S._typeInitState = 0;
I.Load = function()
{
    this.ch = this.music.Play();
};

I.Update = function()
{
};

I.Draw = function()
{
    var Time = this.ch.Position();

    if ((Time - this.lastTrigger) > this.changeFreq)
    {
        Uno.Application.Camera().Position(Uno.Float3.operator_Add(Uno.Float3.operator_Mul(this.rand.NextFloat3(), Uno.Float3.$0(300.0)), Uno.Float3.$1(150.0, -250.0, 150.0)));
        Uno.Application.Camera().Target(Uno.Float3.operator_Sub(Uno.Float3.operator_Mul(this.rand.NextFloat3(), Uno.Float3.$0(50.0)), Uno.Float3.$0(25.0)));
        Uno.Application.Camera().Up(Uno.Vector.Normalize(Uno.Float3.operator_Add(this.rand.NextFloat3(), Uno.Float3.$1(0.0, 100.0, 0.0))));
        Uno.Application.Camera().FovDegrees((Math.sin(Time) * 40.0) + 65.0);
        Uno.Application.Camera().ZFar(10000.0);
        this.camvel = Uno.Float3.operator_Sub(this.rand.NextFloat3(), Uno.Float3.$1(0.0, 0.5, 0.0));
        this.lastTrigger = Time;
        this.foo = this.rand.NextInt() & 62;
        this.blinkefreq = this.rand.NextInt() & 7;
        this.c.fuckAmount = (this.rand.NextFloat() * Time) * 0.05;
    }

    Uno.Application.Camera().Position(Uno.Float3.operator_Add(Uno.Application.Camera().Position(), Uno.Float3.operator_Mul_1(Uno.Float3.operator_Mul(this.camvel, Uno.Float3.$0(100.0)), Uno.Application.DeltaTime())));
    Uno.Application.Camera().Target(Uno.Float3.operator_Add(Uno.Application.Camera().Target(), Uno.Float3.operator_Mul_1(Uno.Float3.operator_Mul(this.camvel, Uno.Float3.$0(100.0)), Uno.Application.DeltaTime())));
    Main.FB.Clear(Uno.Float4.$1(0.0, 0.0, 0.0, 0.0));
    Main.FB.GLBind();
    this.c.Update();

    if (Time < 3.31)
    {
    }
    else if (Time < 15.724)
    {
        this.changeFreq = 3.310345;
        this.s.DrawDraw();

        if (Time < 11.0)
        {
            this.intro1.DrawDraw();
        }
        else
        {
            this.intro2.DrawDraw();
        }
    }
    else if (Time < 16.551)
    {
        this.changeFreq = 1.655172;
    }
    else if (Time < 28.965)
    {
        this.s.DrawDraw();
        this.c.DrawDrawOutline();
        this.c.DrawDraw();
    }
    else if (Time < 29.793)
    {
        this.c.DrawDrawOutline();
    }
    else if (Time < 43.034)
    {
        this.t.FixedUpdate();
        this.s.DrawDraw();
        this.t.Draw();
        this.changeFreq = 1.655172;
    }
    else if (Time < 54.275)
    {
        this.changeFreq = 0.8275862;
        this.t.FixedUpdate();

        if ((this.foo & 1) != 0)
        {
            this.s.DrawDraw();
        }

        if ((this.foo & 2) != 0)
        {
            this.t.Draw();
        }

        if ((this.foo & 4) != 0)
        {
            this.c.DrawDrawOutline();
        }

        if ((this.foo & 8) != 0)
        {
            this.c.DrawDraw();
        }

        if ((this.foo & 16) != 0)
        {
            this.intro2.DrawDraw();
        }
        else if ((this.foo & 32) != 0)
        {
            this.intro1.DrawDraw();
        }
    }
    else if (Time < 56.275)
    {
        this.changeFreq = 1.655172;
        this.t.FixedUpdate();
        this.s.DrawDraw();
        this.t.Draw();
        this.intro2.DrawDraw();
    }
    else
    {
        var fadeDown = 1.4 - ((Time - 56.275) * 0.300000011920929);
        this.postProc.DrawBlendDraw(this.nipples, Uno.Float4.$1(fadeDown, fadeDown, fadeDown, 0.0));
    }

    this.postProc.DrawBlendDraw(this.overlay, Uno.Float4.$1(0.0, 0.0, 0.0, 0.0));
    Main.FB.GLUnbind();
    this.postProc.Glow = (Math.pow(Math.cos(((((Time * 3.141593) * 0.25) * this.blinkefreq) * 145.0) / 60.0), 16.0) * 0.3) + 0.85;
    this.postProc.Draw();
};

S._TypeInit = function()
{
    if (Main._typeInitState == 2)
    {
        return;
    }

    if (Main._typeInitState == 1)
    {
        throw Uno.Exception.$0("TypeInitializer failed");
    }

    Main._typeInitState = 1;
    Main.FB = Uno.Graphics.Framebuffer.$0(1280, 720, 2, true);
    Main._typeInitState = 2;
};

S.$0 = function($this) {
    if (!$this) $this = new Main;
    Uno.Application.$0($this);
    $this.t = Flocking.$0();
    $this.s = Skydome.$0();
    $this.c = ClusterFuck.$0();
    $this.intro1 = Intro.$0();
    $this.intro2 = Intro2.$0();
    $this.nipples = Uno.Graphics.Texture2D.$1("nipples.png");
    $this.overlay = Uno.Graphics.Texture2D.$1("overlay.png");
    $this.postProc = PostProcRenderer.$0();
    $this.music = Uno.Audio.Sound.$0("HowGlowCanYouGo.mp3", 0);
    $this.lastTrigger = 0.0;
    $this.rand = Uno.Random.$0(2);
    $this.camvel = Uno.Float3.$1(0.0, 0.0, 0.0);
    $this.changeFreq = 1.655172;
    return $this;
};
