コード例 #1
0
    public override void Render(Vector3 pos, MatrixView <BlockData> neighbors, MeshParams <WorldVertexDefinition> meshParams)
    {
        var       block    = neighbors.GetCenter();
        ShapeType shape    = GetShapeTypeData(block.data);
        Rotation  rotation = GetRotationData(block.data);

        if (m_data == null)
        {
            m_data = new BlockRendererData(id, m_material);
        }
        m_data.SetFaceUV(new Rect(0.25f, 0, 0.25f, 1)
                         , new Rect(0.5f, 0, 0.25f, 1)
                         , new Rect(0.0f, 0, 0.25f, 1));
        m_data.rotation = rotation;

        SetDrawFacesFromNeighbors(m_data, neighbors);

        switch (shape)
        {
        case ShapeType.AntiTetrahedral:
            BlockRenderer.DrawAntiTetrahedral(pos, meshParams, m_data);
            break;

        case ShapeType.Cubic:
            BlockRenderer.DrawCubic(pos, meshParams, m_data);
            break;

        case ShapeType.HalfCubic:
            BlockRenderer.DrawHalfCubic(pos, meshParams, m_data);
            break;

        case ShapeType.HorizontalHalfCubic:
            BlockRenderer.DrawHorizontalHalfCubic(pos, meshParams, m_data);
            break;

        case ShapeType.SmallPyramid:
            BlockRenderer.DrawSmallPyramid(pos, meshParams, m_data);
            break;

        case ShapeType.Tetrahedral:
            BlockRenderer.DrawThetrahedral(pos, meshParams, m_data);
            break;

        default:
            Debug.Assert(false);
            break;
        }
    }