Ejemplo n.º 1
0
        private void setupRenderElement(MyModel model, Matrix worldMatrix)
        {
            model.LoadInDraw();

            foreach (MyMesh mesh in model.GetMeshList())
            {
                MyRender.MyRenderElement renderElement =
                    mesh.GetMaterial().DrawTechnique == MyMeshDrawTechnique.HOLO ?
                    MyRender.AddTransparentRenderElement(m_setup.TransparentRenderElementsToDraw) :
                    MyRender.AddRenderElement(m_setup.RenderElementsToDraw);
                if (renderElement == null)
                {
                    return;
                }

                renderElement.Entity    = null;
                renderElement.DebugName = "";

                renderElement.VertexBuffer = model.VertexBuffer;
                renderElement.IndexBuffer  = mesh.IndexBuffer;

                renderElement.WorldMatrixForDraw = worldMatrix;
                renderElement.WorldMatrix        = worldMatrix;

                renderElement.BoundingBox = model.BoundingBox.Transform(renderElement.WorldMatrix);

                renderElement.Material = mesh.GetMaterial();
            }
        }