示例#1
0
        public bool CreateHighlight(MyMwmData mwmData, int lodNum, ref HashSet <string> setMaterialNames)
        {
            UniqueId = -1;
            LodNum   = lodNum;

            IB  = MyManagers.ModelBuffers.GetOrCreateIB(mwmData);
            VB0 = MyManagers.ModelBuffers.GetOrCreateVB0(mwmData);
            VB1 = MyManagers.ModelBuffers.GetOrCreateVB1(mwmData);
            VertexInputComponents = MyManagers.ModelBuffers.CreateShadowVertexInputComponents(mwmData);
            m_instanceMaterialsStrategy.Init();

            BoundingBox = mwmData.BoundindBox;
            int offset = 0;

            // a little bit confusion, but for highlights, there is no difference between solid geometry and glass geometry, therefore glass parts are not filled and everything is in the parts
            Parts      = new List <MyPart>();
            GlassParts = null;
            foreach (var mwmPartInfo in mwmData.PartInfos)
            {
                string materialName = mwmPartInfo.GetMaterialName();
                int    indicesCount = mwmPartInfo.m_indices.Count;
                MyPart part         = new MyPart();
                part.InitForHighlight(this, mwmPartInfo.GetMaterialName(), mwmPartInfo.Technique, offset, indicesCount, 0);
                Parts.Add(part);
                offset += indicesCount;

                setMaterialNames.Add(materialName);
            }
            HighlightSections = null;
            if (mwmData.SectionInfos != null && mwmData.SectionInfos.Count > 0)
            {
                HighlightSections = new Dictionary <string, MySection>(mwmData.SectionInfos.Count);
                for (int i = 0; i < mwmData.SectionInfos.Count; i++)
                {
                    MyMeshSectionInfo sectionInfo = mwmData.SectionInfos[i];
                    MySection         section     = new MySection();
                    section.Init(this, sectionInfo, Parts);
                    HighlightSections.Add(sectionInfo.Name, section);
                }
            }

            return(true);
        }
示例#2
0
        public bool CreateHighlight(MyMwmData mwmData, int lodNum, ref HashSet <string> setMaterialNames)
        {
            UniqueId = -1;
            LodNum   = lodNum;

            IB  = MyManagers.ModelBuffers.GetOrCreateIB(mwmData);
            VB0 = MyManagers.ModelBuffers.GetOrCreateVB0(mwmData);
            VB1 = MyManagers.ModelBuffers.GetOrCreateVB1(mwmData);
            VertexInputComponents = MyManagers.ModelBuffers.CreateShadowVertexInputComponents(mwmData);
            m_instanceMaterialsStrategy.Init();

            BoundingBox = mwmData.BoundindBox;
            int offset = 0;

            Parts = new List <MyPart>();
            foreach (var mwmPartInfo in mwmData.PartInfos)
            {
                string materialName = mwmPartInfo.GetMaterialName();
                int    indicesCount = mwmPartInfo.m_indices.Count;
                MyPart part         = new MyPart();
                part.InitForHighlight(this, mwmPartInfo.GetMaterialName(), mwmPartInfo.Technique, offset, indicesCount, 0);
                Parts.Add(part);
                offset += indicesCount;

                setMaterialNames.Add(materialName);
            }
            Sections = null;
            if (mwmData.SectionInfos != null && mwmData.SectionInfos.Count > 0)
            {
                Sections = new Dictionary <string, MySection>(mwmData.SectionInfos.Count);
                for (int i = 0; i < mwmData.SectionInfos.Count; i++)
                {
                    MyMeshSectionInfo sectionInfo = mwmData.SectionInfos[i];
                    MySection         section     = new MySection();
                    section.Init(this, sectionInfo, Parts);
                    Sections.Add(sectionInfo.Name, section);
                }
            }

            return(true);
        }