I=(S=ClusterFuck = function(){
}).prototype = new Uno.Component;

I.CalcNormals = function()
{
    for (var i = 0; i < this.OrgMesh.Normals.length; i++)
    {
        this.Mesh.Normals[i] = Uno.Float3.$1(0.0, 0.0, 0.0);
    }

    for (var i = 0; i < this.OrgMesh.Indices.length; i = i + 3)
    {
        var a = this.Mesh.Vertices[this.Mesh.Indices[i + 0]];
        var b = this.Mesh.Vertices[this.Mesh.Indices[i + 1]];
        var c = this.Mesh.Vertices[this.Mesh.Indices[i + 2]];
        var ab = Uno.Float3.operator_Sub(b, a);
        var ac = Uno.Float3.operator_Sub(c, a);
        var n = Uno.Vector.Normalize(Uno.Vector.Cross(ab, ac));
        this.Mesh.Normals[this.Mesh.Indices[i + 0]] = Uno.Float3.operator_Add(this.Mesh.Normals[this.Mesh.Indices[i + 0]], n);
        this.Mesh.Normals[this.Mesh.Indices[i + 1]] = Uno.Float3.operator_Add(this.Mesh.Normals[this.Mesh.Indices[i + 1]], n);
        this.Mesh.Normals[this.Mesh.Indices[i + 2]] = Uno.Float3.operator_Add(this.Mesh.Normals[this.Mesh.Indices[i + 2]], n);
    }

    for (var i = 0; i < this.OrgMesh.Normals.length; i++)
    {
        this.Mesh.Normals[i] = Uno.Vector.Normalize(this.Mesh.Normals[i]);
    }
};

I.Update = function()
{
    var temp_unique7589 = new Uno.Float3;
    var time = Uno.Application.Time();
    var freqX = (5.0 + (Math.sin(time + 2.0) * 4.0)) + this.fuckAmount;
    var freqY = (5.0 + (Math.sin(time) * 4.0)) + this.fuckAmount;
    var freqZ = (5.0 + (Math.sin(time + 3.0) * 4.0)) + this.fuckAmount;

    for (var i = 0; i < this.OrgMesh.Vertices.length; i++)
    {
        var n = this.OrgMesh.Normals[i];
        this.Mesh.Vertices[i] = Uno.Float3.operator_Add(this.OrgMesh.Vertices[i], Uno.Float3.operator_Mul(Uno.Float3.operator_Mul_1(Uno.Float3.operator_Mul_1(Uno.Float3.operator_Mul_1((temp_unique7589 = n, Uno.Float3.$1(temp_unique7589.X, temp_unique7589.Y, temp_unique7589.Z)), Math.sin((n.X * freqX) + time)), Math.sin((n.Y * freqY) + time)), Math.sin((n.Z * freqZ) + time)), Uno.Float3.$0(70 + (Math.sin(this.fuckAmount)|0))));
    }

    this.CalcNormals();
};

I.DrawDraw = function()
{
    this.Draw.Draw();
};

I.DrawDrawOutline = function()
{
    this.DrawOutline.Draw();
};

S.$0 = function($this) {
    if (!$this) $this = new ClusterFuck;
    Uno.Component.$0($this);
    $this.OrgMesh = Uno.Content.MeshGenerator.CreateSphere(Uno.Float3.$1(0.0, 0.0, 0.0), 250.0, 100, 100);
    $this.Mesh = Uno.Content.MeshGenerator.CreateSphere(Uno.Float3.$1(0.0, 0.0, 0.0), 250.0, 100, 100);
    $this.thickness = 0.3;
    $this.fuckAmount = 1.0;
    $this.Draw = ClusterFuck.DrawExposePoint.$0($this);
    $this.DrawOutline = ClusterFuck.DrawOutlineExposePoint.$0($this);
    return $this;
};
