Esempio n. 1
0
 public MdlxParser(Mdlx mdlx)
 {
     if (IsEntity(mdlx))
     {
         MeshDescriptors = new Kkdf2MdlxParser(mdlx.SubModels.First())
                           .ProcessVerticesAndBuildModel(
             MdlxMatrixUtil.BuildTPoseMatrices(mdlx.SubModels.First(), Matrix4x4.Identity)
             );
     }
     else if (IsMap(mdlx))
     {
         MeshDescriptors = mdlx.MapModel.VifPackets
                           .Select(vifPacket => Parse(vifPacket))
                           .ToList();
     }
 }
Esempio n. 2
0
        private static Kkdf2MdlxBuiltModel FromEntity(Mdlx mdlx)
        {
            var parser     = new Kddf2.Kkdf2MdlxParser(mdlx.SubModels.First());
            var builtModel = parser
                             .ProcessVerticesAndBuildModel(
                MdlxMatrixUtil.BuildTPoseMatrices(mdlx.SubModels.First(), Matrix.Identity)
                );

            var ci = builtModel.textureIndexBasedModelDict.Values.Select((model, i) => new Kddf2.Kkdf2MdlxParser.CI
            {
                Indices      = model.Vertices.Select((_, index) => index).ToArray(),
                TextureIndex = i,
                SegmentIndex = i
            });

            parser.MeshDescriptors.AddRange(ci);

            return(builtModel);
        }