Ejemplo n.º 1
0
        public static PrettyMesh LoadHeadMesh()
        {
            var meshList = new List <PrettyMesh>();

            var manager = new AssetsManager();

            manager.LoadFiles(HeadModelFilePath);

            var lookup = SerializedObjectsLookup.Create(manager);

            foreach (var assetFile in manager.assetsFileList)
            {
                foreach (var obj in assetFile.Objects)
                {
                    if (obj.type != ClassIDType.Mesh)
                    {
                        continue;
                    }

                    var mesh = obj as Mesh;

                    if (mesh == null)
                    {
                        throw new ArgumentNullException(nameof(mesh), "One of head meshes is null.");
                    }

                    var m = new MeshWrapper(lookup, mesh, TexturedMaterialExtraProperties.Head);
                    meshList.Add(m);
                }
            }

            var result = CompositeMesh.FromMeshes(meshList.ToArray());

            return(result);
        }
Ejemplo n.º 2
0
        public static PrettyMesh LoadBodyMesh()
        {
            MeshWrapper result = null;

            var manager = new AssetsManager();

            manager.LoadFiles(BodyModelFilePath);

            var lookup = SerializedObjectsLookup.Create(manager);

            foreach (var assetFile in manager.assetsFileList)
            {
                foreach (var obj in assetFile.Objects)
                {
                    if (obj.type != ClassIDType.Mesh)
                    {
                        continue;
                    }

                    var mesh = obj as Mesh;

                    if (mesh == null)
                    {
                        throw new ArgumentNullException(nameof(mesh), "Body mesh is null.");
                    }

                    result = new MeshWrapper(lookup, mesh, TexturedMaterialExtraProperties.Body);

                    break;
                }
            }

            return(result);
        }