public BbsMap(GraphicsDevice graphics, string filePath) { _graphics = graphics; var pmp = File.OpenRead(filePath).Using(Pmp.Read); var group = new List <MeshGroup>(); int pmoIndex = 0; for (int i = 0; i < pmp.objectInfo.Count; i++) { Pmp.ObjectInfo currentInfo = pmp.objectInfo[i]; if (currentInfo.PMO_Offset != 0) { var pmpEntity = new PmpEntity(pmoIndex, new Vector3(currentInfo.PositionX, currentInfo.PositionY, currentInfo.PositionZ), new Vector3(currentInfo.RotationX, currentInfo.RotationY, currentInfo.RotationZ), new Vector3(currentInfo.ScaleX, currentInfo.ScaleY, currentInfo.ScaleZ)); pmpEntity.DifferentMatrix = pmp.hasDifferentMatrix[pmoIndex]; var pParser = new PmoParser(pmp.PmoList[pmoIndex], 100.0f); var textures = new List <Tim2KingdomTexture>(); var meshGroup = new MeshGroup(); meshGroup.MeshDescriptors = pParser.MeshDescriptors; meshGroup.Textures = new IKingdomTexture[pmp.PmoList[pmoIndex].header.TextureCount]; for (int j = 0; j < pmp.PmoList[pmoIndex].header.TextureCount; j++) { textures.Add(new Tim2KingdomTexture(pmp.PmoList[pmoIndex].texturesData[j], graphics)); meshGroup.Textures[j] = textures[j]; } _pmpEntities.Add(pmpEntity); _pmpModels.Add(meshGroup); pmoIndex++; } } }
private void LoadBBSMap(string MapPath) { Pmp pmp = Pmp.Read(File.OpenRead(MapPath)); List <MeshGroup> group = new List <MeshGroup>(); int PmoIndex = 0; for (int i = 0; i < pmp.objectInfo.Count; i++) { Pmp.ObjectInfo currentInfo = pmp.objectInfo[i]; if (currentInfo.PMO_Offset != 0) { PmpEntity pmpEnt = new PmpEntity(PmoIndex, new System.Numerics.Vector3(currentInfo.PositionX, currentInfo.PositionY, currentInfo.PositionZ), new System.Numerics.Vector3(currentInfo.RotationX, currentInfo.RotationY, currentInfo.RotationZ), new System.Numerics.Vector3(currentInfo.ScaleX, currentInfo.ScaleY, currentInfo.ScaleZ)); pmpEnt.DifferentMatrix = pmp.hasDifferentMatrix[PmoIndex]; PmoParser pParser = new PmoParser(pmp.PmoList[PmoIndex], 100.0f); List <Tim2KingdomTexture> BbsTextures = new List <Tim2KingdomTexture>(); MeshGroup g = new MeshGroup(); g.MeshDescriptors = pParser.MeshDescriptors; g.Textures = new IKingdomTexture[pmp.PmoList[PmoIndex].header.TextureCount]; for (int j = 0; j < pmp.PmoList[PmoIndex].header.TextureCount; j++) { BbsTextures.Add(new Tim2KingdomTexture(pmp.PmoList[PmoIndex].texturesData[j], _graphics.GraphicsDevice)); g.Textures[j] = BbsTextures[j]; } _pmpEntities.Add(pmpEnt); _pmpModels.Add(g); PmoIndex++; } } }