示例#1
0
        public static (IModelMotion, IKingdomTexture[]) BBSMeshLoader(GraphicsDevice graphics, string FilePath, IModelMotion Model, IKingdomTexture[] Textures)
        {
            const float Scale = 100.0f;
            var         file  = File.OpenRead(FilePath);
            Pmo         pmo   = Pmo.Read(file);

            Model = new PmoParser(pmo, Scale);

            List <Tim2KingdomTexture> BbsTextures = new List <Tim2KingdomTexture>();

            Textures = new IKingdomTexture[pmo.header.TextureCount];

            for (int i = 0; i < pmo.header.TextureCount; i++)
            {
                BbsTextures.Add(new Tim2KingdomTexture(pmo.texturesData[i], graphics));
                Textures[i] = BbsTextures[i];
            }

            return(Model, Textures);
        }
示例#2
0
        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++;
                }
            }
        }
示例#3
0
        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++;
                }
            }
        }