ExampleFiles.cs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace SharpGLTF
  6. {
  7. /// <summary>
  8. /// Encapsulates the access to test files.
  9. /// </summary>
  10. class ExampleFiles
  11. {
  12. #region lifecycle
  13. public ExampleFiles(string workingDirectory)
  14. {
  15. _WorkingDirectory = workingDirectory;
  16. _KhronosSchemaDir = System.IO.Path.Combine(_WorkingDirectory, "glTF-Schema");
  17. _KhronosValidatorDir = System.IO.Path.Combine(_WorkingDirectory, "glTF-Validator");
  18. _KhronosSampleModelsDir = System.IO.Path.Combine(_WorkingDirectory, "glTF-Sample-Assets");
  19. _BabylonJsMeshesDir = System.IO.Path.Combine(_WorkingDirectory, "BabylonJS-Assets");
  20. _BabylonJsPlaygroundDir = System.IO.Path.Combine(_WorkingDirectory, "BabylonJS-PlaygroundScenes");
  21. _PollyModelsDir = System.IO.Path.Combine(_WorkingDirectory, "glTF-Blender-Exporter");
  22. _UniVRMModelsDir = System.IO.Path.Combine(_WorkingDirectory, "UniVRM");
  23. }
  24. public void DownloadReferenceModels()
  25. {
  26. Console.WriteLine("Downloading reference files... It might take a while, please, wait...");
  27. var dstPath = System.IO.Path.Combine(_WorkingDirectory, "GeneratedReferenceModels", "v_0_6_1.zip");
  28. _GeneratedModelsDir = DownloadUtils.DownloadFile("https://github.com/KhronosGroup/glTF-Asset-Generator/releases/download/v0.6.1/GeneratedAssets-0.6.1.zip", dstPath);
  29. dstPath = System.IO.Path.Combine(_UniVRMModelsDir, "AliciaSolid_vrm-0.51.vrm");
  30. DownloadUtils.DownloadFile("https://github.com/vrm-c/UniVRM/raw/master/Tests/Models/Alicia_vrm-0.51/AliciaSolid_vrm-0.51.vrm", dstPath);
  31. Console.WriteLine("Checking out test files... It might take a while, please, wait...");
  32. DownloadUtils.SyncronizeGitRepository("https://github.com/KhronosGroup/glTF.git", _KhronosSchemaDir);
  33. DownloadUtils.SyncronizeGitRepository("https://github.com/KhronosGroup/glTF-Validator.git", _KhronosValidatorDir);
  34. DownloadUtils.SyncronizeGitRepository("https://github.com/KhronosGroup/glTF-Sample-Assets.git", _KhronosSampleModelsDir);
  35. DownloadUtils.SyncronizeGitRepository("https://github.com/BabylonJS/Assets.git", _BabylonJsMeshesDir);
  36. // DownloadUtils.SyncronizeGitRepository("https://github.com/BabylonJS/MeshesLibrary.git", _BabylonJsMeshesDir);
  37. // DownloadUtils.SyncronizeGitRepository("https://github.com/BabylonJS/Babylon.js.git", _BabylonJsPlaygroundDir);
  38. DownloadUtils.SyncronizeGitRepository("https://github.com/KhronosGroup/glTF-Blender-Exporter.git", _PollyModelsDir);
  39. Console.WriteLine("... Download Completed.");
  40. }
  41. #endregion
  42. #region data
  43. private readonly string _WorkingDirectory;
  44. private readonly string _KhronosSchemaDir;
  45. private readonly string _KhronosValidatorDir;
  46. private readonly string _KhronosSampleModelsDir;
  47. private readonly string _PollyModelsDir;
  48. private readonly string _UniVRMModelsDir;
  49. private readonly string _BabylonJsMeshesDir;
  50. private readonly string _BabylonJsPlaygroundDir;
  51. private readonly string[] _BabylonJsInvalidFiles = Array.Empty<string>();
  52. private string _GeneratedModelsDir;
  53. #endregion
  54. }
  55. }