fArchiverD.pas 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. unit fArchiverD;
  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. GLScene.VectorTypes,
  12. GLScene.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. GLScene.Utils, GLS.SimpleNavigation;
  25. type
  26. TForm1 = 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. Form1: TForm1;
  46. // --------------------------------------------
  47. implementation
  48. // --------------------------------------------
  49. {$R *.dfm}
  50. procedure TForm1.GLCadencer1Progress(Sender: TObject; const deltaTime, newTime: Double);
  51. begin
  52. GLCamera.Position.Rotate(VectorMake(0, 1, 0), deltaTime * 0.1);
  53. end;
  54. procedure TForm1.FormCreate(Sender: TObject);
  55. begin
  56. var
  57. Path: TFileName := GetCurrentAssetPath();
  58. SetCurrentDir(Path + '\texture');
  59. GLMaterialLibrary1.TexturePaths := GetCurrentDir();
  60. GLPlane1.Material.Texture.Image.LoadFromFile('grass.png');
  61. SetCurrentDir(Path + '\modelext');
  62. GLSArchiveManager1.Archives[0].LoadFromFile('Chair.zlib');
  63. if GLSArchiveManager1.Archives[0].FileName = '' then
  64. ShowMessage('Archive Can not be Loaded');
  65. (* Automatic loading from archive.
  66. If file is not in archive, then it's loaded from archive directory ! *)
  67. GLFreeForm.LoadFromFile('Chair.ms3d');
  68. // Direct loading from archive
  69. GLFreeForm1.LoadFromStream('Chair.ms3d', GLSArchiveManager1.Archives[0].GetContent('Chair.ms3d'));
  70. end;
  71. end.