private static List <MyMeshSectionInfo> ReadMeshSections( BinaryReader reader, int version) { var myMeshSectionInfoList = new List <MyMeshSectionInfo>(); var num = reader.ReadInt32(); for (var index = 0; index < num; ++index) { var myMeshSectionInfo = new MyMeshSectionInfo(); myMeshSectionInfo.Import(reader, version); myMeshSectionInfoList.Add(myMeshSectionInfo); } return(myMeshSectionInfoList); }
public void Init(MyLod parent, MyMeshSectionInfo info, List <MyPart> parts) { DebugName = info.Name; Parts = new MyPart[info.Meshes.Count]; for (int i = 0; i < Parts.Length; i++) { MyMeshSectionMeshInfo partInfo = info.Meshes[i]; string partName = partInfo.MaterialName; MyPart part = FindPart(parts, partName); int startIndex = part.StartIndex + partInfo.StartIndex; int indicesCount = partInfo.IndexCount; MyRenderProxy.Assert(partInfo.StartIndex + partInfo.IndexCount <= part.IndicesCount, "Section indices referencing indices out of the part"); Parts[i] = new MyPart(); Parts[i].InitForHighlight(parent, partName, part.Technique, startIndex, indicesCount, 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); }
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); }