fdArchiver.pas 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. unit fdArchiver;
  2. interface
  3. uses
  4. Winapi.OpenGL,
  5. System.Classes,
  6. System.SysUtils,
  7. Vcl.Forms,
  8. Vcl.Controls,
  9. Vcl.Graphics,
  10. Vcl.Dialogs,
  11. Stage.VectorTypes,
  12. Stage.VectorGeometry,
  13. GLS.Scene,
  14. GLS.Objects,
  15. GLS.VectorFileObjects,
  16. GLS.Material, GLS.Cadencer,
  17. GLS.ArchiveManager,
  18. GLS.BaseClasses,
  19. GLS.FileMS3D,
  20. GLS.FileTGA,
  21. GLS.FileZLIB,
  22. GLS.Coordinates,
  23. GLS.SceneViewer,
  24. Stage.Utils, GLS.SimpleNavigation;
  25. type
  26. TFormArchiver = class(TForm)
  27. GLCadencer1: TGLCadencer;
  28. GLCamera: TGLCamera;
  29. GLDummyCube1: TGLDummyCube;
  30. GLFreeForm: TGLFreeForm;
  31. GLFreeForm1: TGLFreeForm;
  32. GLLightSource1: TGLLightSource;
  33. GLMaterialLibrary1: TGLMaterialLibrary;
  34. GLPlane1: TGLPlane;
  35. GLSArchiveManager1: TGLSArchiveManager;
  36. GLScene1: TGLScene;
  37. GLSceneViewer1: TGLSceneViewer;
  38. GLSimpleNavigation1: TGLSimpleNavigation;
  39. GLLightSource2: TGLLightSource;
  40. procedure FormCreate(Sender: TObject);
  41. procedure GLCadencer1Progress(Sender: TObject; const deltaTime, newTime: Double);
  42. private
  43. end;
  44. var
  45. FormArchiver: TFormArchiver;
  46. implementation //==============================================================
  47. {$R *.dfm}
  48. procedure TFormArchiver.GLCadencer1Progress(Sender: TObject; const deltaTime, newTime: Double);
  49. begin
  50. GLCamera.Position.Rotate(VectorMake(0, 1, 0), deltaTime * 0.1);
  51. end;
  52. procedure TFormArchiver.FormCreate(Sender: TObject);
  53. begin
  54. var
  55. Path: TFileName := GetCurrentAssetPath();
  56. SetCurrentDir(Path + '\texture');
  57. GLMaterialLibrary1.TexturePaths := GetCurrentDir();
  58. GLPlane1.Material.Texture.Image.LoadFromFile('grass.png');
  59. SetCurrentDir(Path + '\modelext');
  60. GLSArchiveManager1.Archives[0].LoadFromFile('Chair.zlib');
  61. if GLSArchiveManager1.Archives[0].FileName = '' then
  62. ShowMessage('Archive Can not be Loaded');
  63. (* Automatic loading from archive.
  64. If file is not in archive, then it's loaded from archive directory ! *)
  65. GLFreeForm.LoadFromFile('Chair.ms3d');
  66. // Direct loading from archive
  67. GLFreeForm1.LoadFromStream('Chair.ms3d', GLSArchiveManager1.Archives[0].GetContent('Chair.ms3d'));
  68. end;
  69. end.