public void AddModel(MyLodTypeEnum lod, MyRender.MyRenderElement renderElement)
        {
            var matDict = Models[GetModelIndex(lod, renderElement.DrawTechnique)];
            ModelMaterialSet vbDict;
            if (!matDict.Models.TryGetValue(renderElement.Material, out vbDict))
            {
                vbDict = new ModelMaterialSet();
                matDict.Models[renderElement.Material] = vbDict;
            }

            List<MyRender.MyRenderElement> elements;
            if (!vbDict.Models.TryGetValue(renderElement.VertexBuffer, out elements))
            {
                elements = new List<MyRender.MyRenderElement>(20);
                vbDict.Models[renderElement.VertexBuffer] = elements;
            }

            matDict.RenderElementCount++;
            vbDict.RenderElementCount++;

            elements.Add(renderElement);
        }
Example #2
0
        public void AddModel(MyLodTypeEnum lod, MyRender.MyRenderElement renderElement)
        {
            var matDict = Models[GetModelIndex(lod, renderElement.DrawTechnique)];
            ModelMaterialSet vbDict;

            if (!matDict.Models.TryGetValue(renderElement.Material, out vbDict))
            {
                vbDict = new ModelMaterialSet();
                matDict.Models[renderElement.Material] = vbDict;
            }

            List <MyRender.MyRenderElement> elements;

            if (!vbDict.Models.TryGetValue(renderElement.VertexBuffer, out elements))
            {
                elements = new List <MyRender.MyRenderElement>(20);
                vbDict.Models[renderElement.VertexBuffer] = elements;
            }

            matDict.RenderElementCount++;
            vbDict.RenderElementCount++;

            elements.Add(renderElement);
        }