コード例 #1
0
ファイル: Zip.cs プロジェクト: yakumo-proj/SharpGLTF
        public void AddModel(string filePath, ModelRoot model, WriteSettings settings = null)
        {
            Guard.NotNullOrEmpty(filePath, nameof(filePath));
            Guard.NotNull(model, nameof(model));

            var baseName = System.IO.Path.GetFileNameWithoutExtension(filePath);

            bool isGltfExtension = filePath
                                   .ToLower(System.Globalization.CultureInfo.InvariantCulture)
                                   .EndsWith(".gltf", StringComparison.OrdinalIgnoreCase);

            var context = WriteContext.Create(_WriteAsset);

            if (!isGltfExtension)
            {
                context.WithBinarySettings();
            }

            settings?.CopyTo(context);

            if (isGltfExtension)
            {
                context.WriteTextSchema2(baseName, model);
            }
            else
            {
                context.WriteBinarySchema2(baseName, model);
            }
        }
コード例 #2
0
        public static WriteContext Create(FileWriterCallback fileCallback)
        {
            Guard.NotNull(fileCallback, nameof(fileCallback));

            var context = new WriteContext(fileCallback)
            {
                _UpdateSupportedExtensions = true
            };

            return(context);
        }