示例#1
0
        private VrmLib.Model CreateVrmModel(string path)
        {
            var bytes = File.ReadAllBytes(path);

            if (!VrmLib.Glb.TryParse(bytes, out VrmLib.Glb glb, out Exception ex))
            {
                throw ex;
            }

            // version check
            VrmLib.Model       model = null;
            VrmLib.IVrmStorage storage;
            if (VRMVersionCheck.IsVrm10(glb.Json.Bytes.ToArray()))
            {
                storage = new Vrm10.Vrm10Storage(glb.Json.Bytes, glb.Binary.Bytes);
                model   = VrmLib.ModelLoader.Load(storage, Path.GetFileName(path));
                model.ConvertCoordinate(VrmLib.Coordinates.Unity, ignoreVrm: true);
            }
            else
            {
                throw new NotImplementedException();
            }

            return(model);
        }
示例#2
0
        private Model CreateGlbModel(string path)
        {
            var bytes = File.ReadAllBytes(path);

            if (!VrmLib.Glb.TryParse(bytes, out VrmLib.Glb glb, out Exception ex))
            {
                throw ex;
            }

            VrmLib.Model       model = null;
            VrmLib.IVrmStorage storage;
            storage = new Vrm10Storage(glb.Json.Bytes, glb.Binary.Bytes);
            model   = VrmLib.ModelLoader.Load(storage, Path.GetFileNameWithoutExtension(path));
            model.ConvertCoordinate(VrmLib.Coordinates.Unity);

            return(model);
        }