GteWindow3.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
10 #include <GTWindows.h>
11 #include <Graphics/GteCameraRig.h>
12 #include <Graphics/GtePVWUpdater.h>
13 #include <Graphics/GteTrackball.h>
14 
15 namespace gte
16 {
17 
18 class GTE_IMPEXP Window3 : public Window
19 {
20 protected:
21  // Abstract base class.
22  Window3(Parameters& parameters);
23 
24 public:
25  // Create the camera and camera rig.
26  void InitializeCamera(float upFovDegrees, float aspectRatio, float dmin, float dmax,
27  float translationSpeed, float rotationSpeed, std::array<float, 3> const& pos,
28  std::array<float, 3> const& dir, std::array<float, 3> const& up);
29 
30  // The camera frustum is modified. Any subscribers to the pvw-matrix
31  // update system of the camera rig must be updated. No call is made to
32  // OnDisplay() or OnIdle(). The base class is unaware of which display
33  // method you use, so to have a visual update you must override OnResize
34  // bool MyApplication::OnResize(int xSize, int ySize)
35  // {
36  // if (Window3::OnResize(xSize, ySize))
37  // {
38  // OnIdle(); // or OnDisplay() or MyOwnDrawFunction() ...
39  // }
40  // }
41  virtual bool OnResize(int xSize, int ySize) override;
42 
43  // The key 't' decreases the translation speed and the 'T' key increases
44  // the translation speed. The 'r' key decreases the rotation speed and
45  // the 'R' key increases the rotation speed.
46  virtual bool OnCharPress(unsigned char key, int x, int y) override;
47 
48  // The appropriate camera rig motion is selected when 'key' is mapped
49  // to a camera motion.
50  virtual bool OnKeyDown(int key, int x, int y) override;
51  virtual bool OnKeyUp(int key, int x, int y) override;
52 
53  // Control the rotation of the trackball.
54  virtual bool OnMouseClick(MouseButton button, MouseState state,
55  int x, int y, unsigned int modifiers) override;
56 
57  virtual bool OnMouseMotion(MouseButton button, int x, int y,
58  unsigned int modifiers) override;
59 
60 protected:
62  std::shared_ptr<Camera> mCamera;
66 };
67 
68 }
PVWUpdater mPVWMatrices
Definition: GteWindow3.h:64
Trackball mTrackball
Definition: GteWindow3.h:65
std::function< void(std::shared_ptr< Buffer > const &)> BufferUpdater
Definition: GteBuffer.h:24
GLint GLenum GLint x
Definition: glcorearb.h:404
std::shared_ptr< Camera > mCamera
Definition: GteWindow3.h:62
GLint y
Definition: glcorearb.h:98
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
BufferUpdater mUpdater
Definition: GteWindow3.h:61
CameraRig mCameraRig
Definition: GteWindow3.h:63


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:02