예제 #1
0
파일: Ship.cs 프로젝트: ajul/shipbashing
    public void DrawTurret(Turret.Placement placement, float x)
    {
        GL.PushMatrix();
        float y = hull.Height(x) + placement.level * mainBatteryTurretDesign.superfiringHeight;

        if (placement.facesForwards)
        {
            GL2.MultMatrix(Matrix4x4.Translate(new Vector3(x, y, 1.0f)));
        }
        else
        {
            GL2.MultMatrix(Matrix4x4.Translate(new Vector3(x + placement.SlotSize(mainBatteryTurretDesign), y, 1.0f)));
            GL2.MultMatrix(Matrix4x4.Scale(new Vector3(-1.0f, 1.0f, 1.0f)));
        }

        mainBatteryTurretDesign.Draw(y - 0.5f * hull.Height(x));
        GL.PopMatrix();
    }
예제 #2
0
    void OnPostRender()
    {
        hullMaterial.SetPass(0);

        GL.PushMatrix();
        Matrix4x4 waterlineTransform = Matrix4x4.Translate(new Vector3(0.0f, -25.0f, 0.0f));

        GL2.MultMatrix(waterlineTransform);

        Matrix4x4 hullTransform = Matrix4x4.Translate(new Vector3(-0.5f * ship.hull.lengthOverall, 0.0f, 1.0f));

        GL2.MultMatrix(hullTransform);
        GL2.MultMatrix(Matrix4x4.Scale(new Vector3(ship.scale, ship.scale, ship.scale)));

        ship.Draw();

        GL.PopMatrix();
    }