예제 #1
0
        public void WritesBackCorrectly() => File.OpenRead(FileName).Using(stream =>
                                                                           Helpers.AssertStream(stream, x =>
        {
            var outStream = new MemoryStream();
            Pmp.Write(outStream, Pmp.Read(stream));

            return(outStream);
        }));
예제 #2
0
파일: MapState.cs 프로젝트: shinerkz/OpenKh
        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++;
                }
            }
        }
예제 #3
0
 public void ReadCorrectHeader() => File.OpenRead(FileName).Using(stream =>
 {
     var TestPmo = Pmp.Read(stream);
     Assert.Equal(0x504D50, (int)TestPmo.header.MagicCode);
     Assert.Equal(1, TestPmo.header.ObjectCount);
 });