| Description | Hierarchy | Fields | Methods | Properties |
type TGLWindowNavigated = class(TGLWindowDemo)
This class has a Navigator property (TMatrixNavigator instance) and handles some usual things related to using TMatrixNavigator instance with TGLWindow window.
Po pierwsze, pole Navigator jest swobodne do odczytu i zapisu. Mozesz w dowolnym momencie wymieniac uzywany tutaj Navigator. Domyslnie Navigator = nil. W Destroy klasy jezeli OwnsNavigator (domyslnie true) robimy Navigator.Free.
W metodach Event Idle/KeyPress, w AllowsProcessMessageSuspend zajmujemy sie wywolywaniem odpowiednich metod z Navigator, o ile tylko Navigator <> nil i UseNavigator = true. Oh, and we use IdleCompSpeed for navigator.
Metoda PostRedisplayOnMatrixChanged nie jest tu nigdzie uzywana ale mozesz ja podac jako TMatrixChangedFunc przy tworzeniu Navigatora. Wywoluje ona po prostu PostRediplay. (Jezeli chcesz robic cos innego w reakcji na MatrixChanged to naturalnie nie musisz uzywac PostRedisplayOnMatrixChanged.)
This will also helps you use MouseLook feature of TMatrixWalker: This will call MouseMove of Navigator with a suitable parameters, and this gives you UpdateMouseLook method that you should use. All that remains to you is to call UpdateMouseLook at appropriate times, and mouse look will work.
Typical use of this class:
na poczatku programu
glw.Navigator := TMatrix<...>.Create(glw.PostRedisplayOnMatrixChanged); glw.Navigator.Init(...);
w OnDraw uzyj gdzies glMultMatrix/glLoadMatrix(glw.Navigator.Matrix)
And that's all.
![]() |
constructor Create; |
![]() |
destructor Destroy; override; |
![]() |
function NavExaminer: TMatrixExaminer; |
![]() |
function NavWalker: TMatrixWalker; |
![]() |
procedure PostRedisplayOnMatrixChanged(ChangedNavigator: TMatrixNavigator); |
![]() |
procedure EventInit; override; |
![]() |
procedure EventKeyDown(key: TKey; c: char); override; |
![]() |
procedure EventIdle; override; |
![]() |
procedure EventMouseDown(Button: TMouseButton); override; |
![]() |
procedure EventMouseMove(NewX, NewY: Integer); override; |
![]() |
function AllowsProcessMessageSuspend: boolean; override; |
![]() |
procedure Ray(const WindowX, WindowY: Integer; const ViewAngleDegX, ViewAngleDegY: Single; out Ray0, RayVector: TVector3Single); |
![]() |
procedure MousePickedRay( const ViewAngleDegX, ViewAngleDegY: Single; out Ray0, RayVector: TVector3Single); |
![]() |
procedure UpdateMouseLook; |
![]() |
property Navigator: TMatrixNavigator
read FNavigator write FNavigator; |
![]() |
property OwnsNavigator: boolean
read FOwnsNavigator write FOwnsNavigator default true; |
![]() |
property UseNavigator: boolean
read FUseNavigator write FUseNavigator default true; |
![]() |
constructor Create; |
![]() |
destructor Destroy; override; |
![]() |
function NavExaminer: TMatrixExaminer; |
|
These are shortcuts for writing TMatrixExaminer(Navigator) and TMatrixWalker(Navigator). In DEBUG version they use operator "as" but in RELEASE version they use direct type-casts for speed. | |
![]() |
function NavWalker: TMatrixWalker; |
![]() |
procedure PostRedisplayOnMatrixChanged(ChangedNavigator: TMatrixNavigator); |
![]() |
procedure EventInit; override; |
![]() |
procedure EventKeyDown(key: TKey; c: char); override; |
![]() |
procedure EventIdle; override; |
![]() |
procedure EventMouseDown(Button: TMouseButton); override; |
![]() |
procedure EventMouseMove(NewX, NewY: Integer); override; |
![]() |
function AllowsProcessMessageSuspend: boolean; override; |
![]() |
procedure Ray(const WindowX, WindowY: Integer; const ViewAngleDegX, ViewAngleDegY: Single; out Ray0, RayVector: TVector3Single); |
|
Calculate a ray picked by WindowX, WindowY position on the window. Use this only when Navigator <> nil and Navigator is TMatrixWalker. ViewAngleDegX, ViewAngleDegY are your camera view angles. WindowX, WindowY are given in the same style as MouseX, MouseY: WindowX = 0 is left, WindowY = 0 is top. This uses PrimaryRay call. | |
![]() |
procedure MousePickedRay( const ViewAngleDegX, ViewAngleDegY: Single; out Ray0, RayVector: TVector3Single); |
|
Calculate a ray corresponding to current Navigator (must be TMatrixWalker instance) settings and MouseX, MouseY position on the screen. This is actually just a shortcut for Ray, passing MouseX, MouseY as WindowX, WindowY. | |
![]() |
procedure UpdateMouseLook; |
|
If you use Navigator of class TMatrixWalker with this window and you want to use it's MouseLook feature then you should call this after you changed Navigator.MouseLook value. This sets Cursor (to gcNone or gcDefault, based on whether mouse look is used now, that is Navigator.MouseLook is TODO: when the need will be, cursor will not be so carelessly changed to gcDefault. You should also call this after you changed Navigator's instance, or UseNavigator, as these things also effectively change the actual state of "using mouse look". OTOH sometimes you don't have to call this — e.g. if you push/pop mode states using TGLMode and in the mode you set temporary UseNavigator = | |
![]() |
property Navigator: TMatrixNavigator
read FNavigator write FNavigator; |
|
| |
![]() |
property OwnsNavigator: boolean
read FOwnsNavigator write FOwnsNavigator default true; |
![]() |
property UseNavigator: boolean
read FUseNavigator write FUseNavigator default true; |
|
jezeli not | |