fObjectMatsD.pas 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. unit fObjectMatsD;
  2. interface
  3. uses
  4. Winapi.Windows,
  5. Winapi.Messages,
  6. System.SysUtils,
  7. System.Variants,
  8. System.Classes,
  9. Vcl.Graphics,
  10. Vcl.Controls,
  11. Vcl.Forms,
  12. Vcl.Dialogs,
  13. GLS.Scene,
  14. GLS.VectorFileObjects,
  15. GLS.Objects,
  16. GLS.Coordinates,
  17. GLS.SceneViewer,
  18. GLS.BaseClasses,
  19. GLS.Material,
  20. GLS.Cadencer,
  21. GLS.GeomObjects,
  22. Vcl.StdCtrls,
  23. Vcl.ExtCtrls,
  24. GLS.SimpleNavigation,
  25. GLS.Utils, GLS.Mesh;
  26. type
  27. TFormMO = class(TForm)
  28. GLScene1: TGLScene;
  29. GLSceneViewer1: TGLSceneViewer;
  30. GLCamera1: TGLCamera;
  31. GLLightSource1: TGLLightSource;
  32. GLDummyCube1: TGLDummyCube;
  33. GLActor1: TGLActor;
  34. GLCadencer1: TGLCadencer;
  35. GLMatLibCube: TGLMaterialLibrary;
  36. GLPolygon1: TGLPolygon;
  37. dcCubes: TGLDummyCube;
  38. GLCube1: TGLCube;
  39. GLHexahedron1: TGLHexahedron;
  40. Panel1: TPanel;
  41. RadioGroup1: TRadioGroup;
  42. GLSimpleNavigation1: TGLSimpleNavigation;
  43. Sphere1: TGLSphere;
  44. dcSpheres: TGLDummyCube;
  45. ffSphere: TGLFreeForm;
  46. dcPlaneCube: TGLDummyCube;
  47. GLPlaneFront: TGLPlane;
  48. GLPlaneBack: TGLPlane;
  49. GLPlaneBottom: TGLPlane;
  50. GLPlaneTop: TGLPlane;
  51. GLPlaneRight: TGLPlane;
  52. GLPlaneLeft: TGLPlane;
  53. GLMesh1: TGLMesh;
  54. chbRotate: TCheckBox;
  55. procedure FormCreate(Sender: TObject);
  56. procedure RadioGroup1Click(Sender: TObject);
  57. procedure dcPlaneCubeProgress(Sender: TObject; const DeltaTime, NewTime: Double);
  58. procedure GLCadencer1Progress(Sender: TObject; const DeltaTime, NewTime: Double);
  59. private
  60. public
  61. Path: TFileName;
  62. end;
  63. var
  64. FormMO: TFormMO;
  65. implementation
  66. {$R *.dfm}
  67. procedure TFormMO.FormCreate(Sender: TObject);
  68. begin
  69. Path := GetCurrentAssetPath();
  70. SetCurrentDir(Path + '\map');
  71. Sphere1.Material.Texture.Disabled := False;
  72. Sphere1.Material.Texture.Image.LoadFromFile('earth.jpg');
  73. end;
  74. procedure TFormMO.GLCadencer1Progress(Sender: TObject; const DeltaTime, NewTime: Double);
  75. begin
  76. GLSceneViewer1.Invalidate;
  77. if chbRotate.Checked then
  78. begin
  79. GLHexahedron1.Turn(-0.1);
  80. GLCube1.Turn(0.1);
  81. dcPlaneCube.Turnangle := 90 * newTime;
  82. dcPlaneCube.PitchAngle := 90 * newTime;
  83. dcPlaneCube.RollAngle := -90 * newTime;
  84. Sphere1.Turnangle := 90 * newTime;
  85. end;
  86. end;
  87. procedure TFormMO.dcPlaneCubeProgress(Sender: TObject; const DeltaTime, NewTime: Double);
  88. begin
  89. // more movement
  90. // dcPlaneCube.MoveObjectAround(GLCamera1.TargetObject, sin(NewTime) * DeltaTime * 10, DeltaTime * 20);
  91. end;
  92. procedure TFormMO.RadioGroup1Click(Sender: TObject);
  93. begin
  94. case RadioGroup1.ItemIndex of
  95. 0: ;
  96. 1:;
  97. 2:;
  98. 3:;
  99. end;
  100. end;
  101. end.