Point Cloud Viewer  1.00
A Viewer to display point clouds with phong shading by converting them to splats.
attributepass.h
1 #ifndef ATTRIBUTEPASS_H
2 #define ATTRIBUTEPASS_H
3 
4 #include "renderpass.h"
5 
6 #define SO_COLOR 0
7 #define SO_NORMAL 1
8 
17 class AttributePass : public RenderPass {
18 public:
19  AttributePass();
20  ~AttributePass();
21  void render() override;
22  void cleanup() override;
23 
28  void addObjectInput(VaoChannel &vaoChannel);
29 
34  void removeObjectInput(VaoChannel &vaoChannel);
35 
39  void clearObjectInput();
40 
47  void setDepthMapInput(TextureChannel &textureChannel);
48 
56 
66  bool normalMapToScreen();
67 
75 
85  bool colorMapToScreen();
86  void removeInput() override;
87  void updateResolution() override;
88 
96  static void linkVpMat(QMatrix4x4 &vp);
97 
105  static void linkVMat(QMatrix4x4 &v);
106 
115  static void linkPointSizeCoeff(float &coeff);
116 
126  void linkSplatScale(float &scale);
127 private:
128  std::list<VaoChannel*> objectIn;
129  TextureChannel *depthMapIn, *normalMapOut, *colorMapOut;
130  GLuint fbo;
131  static GLuint vertexShader, fragmentShader, shaderProgram,
132  loc_mvp, loc_pointSizeCoeff, loc_mv, loc_viewportScale, loc_npData, loc_depthFactor,
133  loc_splatScale, loc_modelScale;
134  static QMatrix4x4 *vpMat;
135  static QMatrix4x4 *vMat;
136  static float *pointSizeCoeff;
137  static unsigned char instanceCounter;
138  float *splatScale;
139  bool initialized;
140  unsigned char drawMode; //draw mode can be: 0 - no screen output, 1 - draw color, 2 - draw normals
141 
142  bool generateFBO();
143  bool updateDepthOfFBO();
144  void removeFBO();
145  bool init();
146  void renderToScreen();
147  static bool initShaders();
148  static void cleanupShaders();
149 };
150 
151 #endif // ATTRIBUTEPASS_H
static void linkVpMat(QMatrix4x4 &vp)
Links the view projection matrix that shall be used during rendering.
Definition: attributepass.cpp:104
bool normalMapToScreen()
Changes the output mode. The normal map is now drawn onto the screen.
Definition: attributepass.cpp:63
TextureChannel & getColorMapOutput()
Returns the color map.
Definition: attributepass.cpp:70
TextureChannel & getNormalMapOutput()
Returns the normal map.
Definition: attributepass.cpp:56
void addObjectInput(VaoChannel &vaoChannel)
Adds a model to the geometry input list.
Definition: attributepass.cpp:36
An abstract class for Render Passes.
Definition: renderpass.h:26
This channel is used to link textures or data maps.
Definition: renderpass.h:210
void cleanup() override
Resets the Render Pass to the state after creation but before initialization.
Definition: attributepass.cpp:28
static void linkPointSizeCoeff(float &coeff)
Links the point size coefficient.
Definition: attributepass.cpp:112
bool colorMapToScreen()
Changes the output mode. The color map is now drawn onto the screen.
Definition: attributepass.cpp:77
void removeInput() override
Removes all input channels except for VaoChannels. If the Render Pass uses VaoChannels as input use t...
Definition: attributepass.cpp:84
void setDepthMapInput(TextureChannel &textureChannel)
Sets the depth map that shall be used during rendering.
Definition: attributepass.cpp:48
void updateResolution() override
Must be called after the screen resolution has changed.
Definition: attributepass.cpp:92
A Render Pass that stores attributes for later deferred shading.
Definition: attributepass.h:17
void render() override
Uses the input data to generate the output.
Definition: attributepass.cpp:250
void linkSplatScale(float &scale)
Links the splat scale.
Definition: attributepass.cpp:116
void removeObjectInput(VaoChannel &vaoChannel)
Removes a model from the geometry input list.
Definition: attributepass.cpp:40
void clearObjectInput()
Removes all models from the geometry input list.
Definition: attributepass.cpp:44
static void linkVMat(QMatrix4x4 &v)
Links the view matrix that shall be used during rendering.
Definition: attributepass.cpp:108