Point Cloud Viewer  1.00
A Viewer to display point clouds with phong shading by converting them to splats.
shadingpass.h
1 #ifndef SHADINGPASS_H
2 #define SHADINGPASS_H
3 
4 #include "renderpass.h"
5 #include "camera.h"
6 
13 class ShadingPass : public RenderPass
14 {
15 public:
16  ShadingPass();
17  ~ShadingPass();
18  void render() override;
19  void cleanup() override;
20 
25  void setDepthMapInput(TextureChannel &textureChannel);
26 
31  void setColorMapInput(TextureChannel &textureChannel);
32 
37  void setNormalMapInput(TextureChannel &textureChannel);
38 
46 
53  bool shadedImageToScreen();
54  void removeInput()override;
55  void updateResolution() override;
56 
64  static void linkVMat(QMatrix4x4 &v);
65 
73  static void linkInvProjMat(QMatrix4x4 &ip);
74 private:
75  TextureChannel *depthMapIn, *normalMapIn, *colorMapIn, *shadedImageOut;
76  GLuint fbo;
77  static GLuint vertexShader, fragmentShader, shaderProgram,
78  loc_depthMap, loc_colorTex, loc_normalTex, loc_invProj, loc_shininess, loc_ambient,
79  loc_lightPos, loc_lightCol, loc_lightIntens, loc_lightCount;
80  static QMatrix4x4 *vMat, *invProjMat;
81 
82  static unsigned char instanceCounter;
83  bool initialized;
84 
85  bool generateFBO();
86  void removeFBO();
87  bool init();
88  static bool initShaders();
89  static void cleanupShaders();
90 };
91 
92 #endif // SHADINGPASS_H
void setDepthMapInput(TextureChannel &textureChannel)
Sets the depth map that shall be used during rendering.
Definition: shadingpass.cpp:34
A Render Pass that performs deferred shading.
Definition: shadingpass.h:13
void removeInput() override
Removes all input channels except for VaoChannels. If the Render Pass uses VaoChannels as input use t...
Definition: shadingpass.cpp:68
void updateResolution() override
Must be called after the screen resolution has changed.
Definition: shadingpass.cpp:117
bool shadedImageToScreen()
Changes the output mode. The shaded image is now drawn onto the screen.
Definition: shadingpass.cpp:61
void cleanup() override
Resets the Render Pass to the state after creation but before initialization.
Definition: shadingpass.cpp:27
static void linkVMat(QMatrix4x4 &v)
Links the view matrix that shall be used during rendering.
Definition: shadingpass.cpp:130
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 setColorMapInput(TextureChannel &textureChannel)
Sets the color map that shall be used during rendering.
Definition: shadingpass.cpp:41
void setNormalMapInput(TextureChannel &textureChannel)
Sets the normal map that shall be used during rendering.
Definition: shadingpass.cpp:48
static void linkInvProjMat(QMatrix4x4 &ip)
Links the inverse projection matrix that shall be used during rendering.
Definition: shadingpass.cpp:134
TextureChannel & getShadedOutput()
Returns the shaded image.
Definition: shadingpass.cpp:55
void render() override
Uses the input data to generate the output.
Definition: shadingpass.cpp:203