Exemplo n.º 1
0
        public void ReadCorrectMeshGroup() => File.OpenRead(FileName).Using(stream =>
        {
            var TestPmo = Pmo.Read(stream);

            // mesh header 1
            Assert.Equal("544", TestPmo.Meshes[0].SectionInfo.VertexCount.ToString());
            Assert.Equal("16", TestPmo.Meshes[0].SectionInfo.TriangleStripCount.ToString());
        });
Exemplo n.º 2
0
 public void ReadCorrectHeader() => File.OpenRead(FileName).Using(stream =>
 {
     var TestPmo = Pmo.Read(stream);
     Assert.Equal(0x4F4D50, (int)TestPmo.header.MagicCode);
     Assert.Equal(0, (int)TestPmo.header.SkeletonOffset);
     Assert.Equal(0xC0, (int)TestPmo.header.MeshOffset0);
     Assert.Equal(0, (int)TestPmo.header.MeshOffset1);
 });
Exemplo n.º 3
0
 public void ReadBoneHeader() => File.OpenRead(FileName).Using(stream =>
 {
     var TestPmo = Pmo.Read(stream);
     if (TestPmo.header.SkeletonOffset == 0)
     {
         Assert.True(true);
     }
     else
     {
         Assert.Equal((uint)0x4e4f42, TestPmo.skeletonHeader.MagicValue);
         Assert.Equal((uint)0x35, TestPmo.skeletonHeader.BoneCount);
     }
 });
Exemplo n.º 4
0
        private static void Convert(string PMO_Path, string PAM_Path)
        {
            Stream pmoStream = File.OpenRead(PMO_Path);
            Stream pamStream = File.OpenRead(PAM_Path);
            Pmo    pmo       = Pmo.Read(pmoStream);
            Pam    pam       = Pam.Read(pamStream);

            Assimp.Scene            nScene   = GetPMOScene(pmo);
            List <Assimp.Animation> FBXAnims = PAMtoFBXAnim(pmo, pam);

            nScene.Animations.AddRange(FBXAnims);

            pmoStream.Close();
            pamStream.Close();

            using var ctx = new AssimpContext();
            ctx.ExportFile(nScene, "Test.fbx", "fbx");
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public void WritesBackCorrectly()
        {
            Stream input   = File.OpenRead(FileName);
            var    TestPmo = Pmo.Read(input);
            Stream output  = File.Open("Bbs/res/bbs-dummy_TEST.pmo", FileMode.Create);

            Pmo.Write(output, TestPmo);

            input.Position  = 0;
            output.Position = 0;

            // Check all bytes.
            for (int i = 0; i < output.Length; i++)
            {
                if (input.ReadByte() != output.ReadByte())
                {
                    long position = output.Position;
                    Assert.False(true);
                }
            }

            Assert.True(true);
        }
Exemplo n.º 7
0
 public void ReadCorrectTextureBlock() => File.OpenRead(FileName).Using(stream =>
 {
     var TestPmo = Pmo.Read(stream);
     Assert.Equal("Dummy_tex02", TestPmo.textureInfo[0].TextureName);
     Assert.Equal(0x2300, (int)TestPmo.textureInfo[0].TextureOffset);
 });
Exemplo n.º 8
0
 public void ReadCorrectTextures() => File.OpenRead(FileName).Using(stream =>
 {
     var TestPmo   = Pmo.Read(stream);
     byte[] buffer = TestPmo.texturesData[0];
     Assert.True(buffer[0] == 0x54 && buffer[1] == 0x49 && buffer[2] == 0x4D && buffer[3] == 0x32);
 });