Point Cloud Viewer  1.00
A Viewer to display point clouds with phong shading by converting them to splats.
programlogic.h
1 #ifndef PROGRAMLOGIC_H
2 #define PROGRAMLOGIC_H
3 
4 #include <list>
5 #include "visibilitypass.h"
6 #include "entitycloud.h"
7 #include "camera.h"
8 #include "attributepass.h"
9 #include "shadingpass.h"
10 #include "programlogic.h"
11 #include "light.h"
12 #include "lightpass.h"
13 
17 class ProgramLogic {
18 public:
22  ProgramLogic();
23  ~ProgramLogic();
24 
25  // CREATING AND REMOVING SCENE OBJECTS
33  bool loadCloud(QString &s, unsigned char k = 20, float epsilon = 0.0005);
34 
38  void createLight(Light *light = new Light(), QString &title = QString("Light"));
39 
45  bool closeObject(unsigned char id);
46 
50  void closeAllObjects();
51 
52  // CHANGING OBJECT VISIBILITY
56  void showAllObjects();
57 
65  bool showObject(unsigned char id);
66 
75  bool toggleObjectVisibility(unsigned char id);
76 
77  // GETTING INFORMATION ABOUT SCENE OBJECTS
82  unsigned char numberOfObjects();
83 
89  QString &objectTitle(unsigned char id);
90 
96  bool objectVisible(unsigned char id);
97 
98  // MOUSE INPUT EVENTS
105  void objectRotate(QPoint mouseVec);
106 
113  void objectMove(QPoint mouseVec);
114 
121  void objectScale(int delta);
122 
123  // CAMERA CONTROL
127  void cameraReset();
128 
129  //OBJECT CONTROL
134  void objectReset(int index);
135 
136  // PREFERENCES
142  float changeSplatScale(float newSplatScale);
143 
150  bool drawVisibilityPass();
151 
159 
167 
172  bool drawShadingPass();
173 
174  // RENDER STUFF
179  bool initRenderPasses();
180 
186  void render();
187 
193  void changeResolution(unsigned int xRes, unsigned int yRes);
194 
199  void changeFov(float fov);
200 
206  QVector3D getNpData();
207 
213  unsigned char getLights(Light **light10);
214 
220  Light* getSelectedLight(int id);
221 
227  QString getSelectedObjectName(int index);
228 
234  void updateSelectedObjectName(int index, QString newName);
235 
239  void updateVisibility();
240 
246  bool objectIsLight(unsigned int index);
247 
253  float lightGetIntensity(unsigned int index);
254 
255 private:
256  struct sceneObject {
257  EntityMoveable *em;
258  bool visible;
259  QString title;
260  enum Type{CLOUD, LIGHT} type;
261  };
262  std::list<sceneObject> sceneObjects;
263  std::list<RenderPass*> renderPasses;
264  VisibilityPass visibilityPass;
265  AttributePass attributePass;
266  ShadingPass shadingPass;
267  LightPass lightPass;
268  Camera camera;
269 
270  void cameraRotate(QPoint mouseVec);
271  void cameraMove(QPoint mouseVec);
272 };
273 
274 #endif // PROGRAMLOGIC_H
A Render Pass that performs deferred shading.
Definition: shadingpass.h:13
bool toggleObjectVisibility(unsigned char id)
Toggles the visibility status of the object with the given id.
Definition: programlogic.cpp:103
void changeResolution(unsigned int xRes, unsigned int yRes)
Notifies about a change of the resolution of the viewport.
Definition: programlogic.cpp:277
bool drawVisibilityPass()
Defines that the result of the visibility pass shall be shown on the screen.
Definition: programlogic.cpp:228
void showAllObjects()
Makes all scene objects visible.
Definition: programlogic.cpp:83
Stores information about a light.
Definition: light.h:11
QVector3D getNpData()
Returns some data about the near plane that is needed by the visibility and the attribute pass...
Definition: programlogic.cpp:296
ProgramLogic()
Creates a new program logic. No OpenGL calls.
Definition: programlogic.cpp:5
bool objectIsLight(unsigned int index)
return if object at position index is a light
Definition: programlogic.cpp:129
bool drawAttributePass_normal()
Defines that the normal map created by the attribute pass shall be shown on the screen.
Definition: programlogic.cpp:242
This class provides camera functionality.
Definition: camera.h:13
unsigned char numberOfObjects()
The number of currently open clouds.
Definition: programlogic.cpp:113
unsigned char getLights(Light **light10)
Stores the first ten lights into the given array of light pointers.
Definition: programlogic.cpp:303
Provides access to all functionality of the program.
Definition: programlogic.h:17
bool showObject(unsigned char id)
Shows the object with the given id.
Definition: programlogic.cpp:90
void changeFov(float fov)
Changes the vertical field of view.
Definition: programlogic.cpp:290
void objectRotate(QPoint mouseVec)
Rotates the currently in the UI selected object.
Definition: programlogic.cpp:141
void objectMove(QPoint mouseVec)
Moves the currently in the UI selected object.
Definition: programlogic.cpp:166
void createLight(Light *light=new Light(), QString &title=QString("Light"))
Creates a new light.
Definition: programlogic.cpp:53
void render()
Executes all Render Passes.
Definition: programlogic.cpp:262
A Render Pass that just fills a depth buffer.
Definition: visibilitypass.h:13
bool closeObject(unsigned char id)
Closes the scene object with the given id.
Definition: programlogic.cpp:64
void objectScale(int delta)
Scales the currently in the UI selected object.
Definition: programlogic.cpp:180
Complements the Entity with a possibility to define and edit a local coordinate system.
Definition: entitymoveable.h:11
float lightGetIntensity(unsigned int index)
returns intensity of light at index, index should be checked with objectIsLight(index) before calling...
Definition: programlogic.cpp:135
A Render Pass that stores attributes for later deferred shading.
Definition: attributepass.h:17
bool loadCloud(QString &s, unsigned char k=20, float epsilon=0.0005)
Loads a point cloud and converts it to a splat cloud.
Definition: programlogic.cpp:35
bool initRenderPasses()
Initializes the render passes.
Definition: programlogic.cpp:258
void cameraReset()
Resets the camera position and orientation.
Definition: programlogic.cpp:206
QString getSelectedObjectName(int index)
returns Name of scene object at index
Definition: programlogic.cpp:358
bool objectVisible(unsigned char id)
Returns if the object with the given id is selected.
Definition: programlogic.cpp:123
void closeAllObjects()
Closes all scene objects and removes them from storage.
Definition: programlogic.cpp:75
void objectReset(int index)
Resets the location, rotation and scale of the cloud with the given id.
Definition: programlogic.cpp:212
void updateVisibility()
update visibility of objects, needs to be called when something new should be rendered.
Definition: programlogic.cpp:326
QString & objectTitle(unsigned char id)
Retrieves the title of the object with the given id.
Definition: programlogic.cpp:117
void updateSelectedObjectName(int index, QString newName)
Change name of object with at index.
Definition: programlogic.cpp:364
A Render Pass that displays yellow squares at the passed locations.
Definition: lightpass.h:12
bool drawAttributePass_color()
Defines that the color map created by the attribute pass shall be shown on the screen.
Definition: programlogic.cpp:235
Light * getSelectedLight(int id)
Return the Light object at index or null if it's no light.
Definition: programlogic.cpp:346
bool drawShadingPass()
Defines that the result of the shading pass shall be shown on the screen.
Definition: programlogic.cpp:249
float changeSplatScale(float newSplatScale)
Changes the overall splat scale to the given coefficient.
Definition: programlogic.cpp:222