Cutout Vis2012
TUWienVisualisierung2(SS2012)-AdaptiveCutaways
 All Classes Namespaces Functions Pages
Vis2Window.h
1 #ifndef _VIS2WINDOW_H_
2 #define _VIS2WINDOW_H_
3 
4 #include "UserAction.h"
5 #include "GLFWGameWindow.h"
6 #include "Shader.h"
7 #include "Mesh.h"
8 #include "Framebuffer.h"
9 #include "Camera.h"
10 #include "SceneNode.h"
11 #include "MeshInstance.h"
12 #include "InputHandler.h"
13 #include "CameraController.h"
14 #include "FontRenderer.h"
15 #include "Terminal.h"
16 #include "Commander.h"
17 #include <list>
18 
19 using namespace std;
20 
21 class Vis2Window : public GLFWGameWindow
22 {
23 public:
24 
25  Vis2Window();
26  ~Vis2Window();
27 
31  virtual void init();
35  virtual void update(double frameLength);
39  virtual void draw();
40  virtual void destroy();
41 
45  void characterCallback(int character, int action);
49  void keyCallback(int key, int action);
50 
51 private:
52 
53 
54  int width, height;
55 
56  InputHandler* inputHandler;
57 
58  UserAction _currentAction;
59 
60  Shader textureScreenShader;
61  Shader depthShader;
62  Shader silhouetteShader;
63  Shader cellShader;
64  Shader combineShader;
65  Shader cutSurfaceShader;
66  Shader idShader;
67  Shader gizmoShader;
68  Shader colorShader;
69  Shader blur1Shader, blur2Shader;
70 
71 
72  Mesh screenQuad;
73 
74  float angle, scale;
75 
76  Framebuffer jumpFloodBuffers[2];
77  Framebuffer edgeBuffer;
78  Framebuffer cellBuffer;
79  Framebuffer gauss1Buffer, gauss2Buffer;
80 
81  Camera* camera;
82  CameraController* _cameraController;
83  Scene* _scene;
84  Commander* _commander;
85 
86  glm::vec3 _lightPosition;
87  float _farPlane;
88 
89  //MeshInstance* _selection;
90 
91  FontRenderer* _fontRenderer;
92  Terminal* _terminal;
93  bool _pressedTab, _pressedDel;
94 
95  void loadShaders();
96  unsigned int pick();
97  unsigned int pick(int x, int y);
98 
99  void select(MeshInstance* selection);
100  void deselect();
101  static void setPerspective(Shader* shader, const glm::mat4& perspective, float farPlane);
102 
103  Framebuffer* jumpFloodSelection();
104  void renderVisibleFrontSurfaces(Framebuffer* distanceTransform, const glm::vec3& viewLightPosition);
105  void renderCutSurfaces(Framebuffer* distanceTransform, const glm::vec3& viewLightPosition);
106 };
107 
108 static Vis2Window *globalWindow;
109 
110 #endif