Molecule Viewer
 All Classes Functions Variables Enumerations Pages
AppMain.hpp
1 #ifndef _APPMAIN_HPP_
2 #define _APPMAIN_HPP_
3 
4 #include "common.hpp"
5 #include "Shader.hpp"
6 #include "Light.hpp"
7 #include "Camera.hpp"
8 #include "Loader.hpp"
9 #include "Directions.hpp"
10 
12 
13 class AppMain {
14  public:
15 
17  AppMain(void);
18 
19  //Deletes the Molecule Renderer
20  virtual ~AppMain(void);
21 
23  void PrepareScene();
24 
26  void DrawScene();
27 
29 
30  void UpdateWindowSize();
31 
33 
34  void RotateMolecule(const double x_rotation, const double y_rotation);
35 
37 
38  void MoveLight(const double x_rotation, const double y_rotation);
39 
41 
42  void MoveCamera(const double x_translation, const double y_translation);
43 
45 
51  void ZoomInOut(const double z_translation);
52 
54  bool LoadMolecule(const string filename);
55 
57  void ChangeLightIntensity(const int pointLightIntensity);
58 
60  void ChangeAmbientIntensity(const int ambientIntensity);
61 
63  void ChangeGlossiness(const int glossiness);
64 
66  void ToggleShadow(const bool shadows);
67 
69 
73  void ChangeBorder(const int borderWidth, const int depthAwareness);
74 
76 
77  void ToggleAmbientOcclusion(const bool ambientOcclusionActive);
78 
80 
81  void ChangeOcclusionQuality(int occlusionQuality);
82 
84 
85  void ChangeColorMode(int colorMode);
86 
87  const string& GetErrorMessage() const; // Gets the error message
88 
89  private:
90 
92  void ComputeAmbientOcclusion();
93 
95  void GenerateShaders();
96 
98  GLuint _vao;
99 
101  SceneObject * _molecule;
102 
103  //Framebuffer Object, needed for offscreen rendering (for ambient occlusion and shadow mapping)
104  GLuint _FBO;
105 
107  GLuint _shadowTex;
108 
110  GLuint _ambientOcclusionTex;
111 
113  int _aoTextureSize;
114 
116  int _shadowTextureSize;
117 
119  glm::mat4 _orthoMatrix;
120 
122  int _numberOfSpheres;
123 
125  Loader * _loader;
126 
128  Directions * _occlusionDirections;
129 
130  string _errorMessage; // Contains an error message if something failed
131 
133  Camera *_camera;
134 
136  Light *_light;
137 
138  typedef std::map<string, Shader*> ShaderMap;
140  ShaderMap _shaders;
141 
143  bool _shadowsActive;
144 
145 };
146 
147 #endif //ifndef _APPMAIN_HPP_