-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyramid_point_renderer_base.h
107 lines (78 loc) · 2.48 KB
/
pyramid_point_renderer_base.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
** pyramid_point_renderer_base.h Pyramid Point Based Rendering Base header.
**
**
** history: created 02-Jul-07
*/
#ifndef __PYRAMID_POINT_RENDERER_BASE_H__
#define __PYRAMID_POINT_RENDERER_BASE_H__
#include <cmath>
#include <cassert>
#include "point_based_renderer.h"
#define FBO_TYPE GL_TEXTURE_2D
#define FBO_FORMAT GL_RGBA32F
/**
* Pyramid point renderer algorithm as described in: <br>
* Efficient Point-Based Rendering Using Image Reconstruction. <br>
* Ricardo Marroquim, Martin Kraus, Paulo Roma Cavalcanti <br>
* IEEE/Eurographics Symposium on Point-Based Graphics (PBG), Sep-2007
**/
class PyramidPointRendererBase : public PointBasedRenderer
{
private:
virtual void rasterizeAnalysisPyramid( void );
virtual void rasterizeSynthesisPyramid( void );
virtual void rasterizePhongShading(void);
protected:
void createFBO();
void projectSurfels( const Object * const );
const void activateTexture(const int text_id, const int target_id);
const void rasterizePixels(void);
void resetPointers ( void ) {
fbo_buffers = NULL;
fbo_textures = NULL;
shader_texture_names = NULL;
}
public:
PyramidPointRendererBase();
PyramidPointRendererBase(int w, int h);
PyramidPointRendererBase(int w, int h, int fbos);
~PyramidPointRendererBase();
void init ( void );
virtual void createShaders ( void ) = 0;
void draw();
void clearBuffers (void);
void projectSamples (Object* const obj );
void interpolate ( void );
protected:
/// Number of frame buffer object attachments.
int fbo_buffers_count;
/// Shaders using VCG lib
ProgramVF mShaderProjection;
ProgramVF mShaderAnalysis;
ProgramVF mShaderSynthesis;
ProgramVF mShaderPhong;
/// Textures names to pass as uniform to shaders
string *shader_texture_names;
/// The application-created framebuffer object.
vector<GLuint> fbo_lod;
/// Framebuffer for depth test.
GLuint fbo_depth;
/// usually fboBuffers[i] == GL_COLOR_ATTACHMENT0_EXT + i,
/// but we don't rely on this assumption
GLuint* fbo_buffers;
/** Textures bound to the framebuffer object;
* the ping-pong rendering switches between pairs 0-2 and 1-3
* because this can be easily generalized to triples 0-2-4 and 1-3-5 etc.
* (pairs 0-1 and 2-3 would have to be rearranged to 0-1-2 and 3-4-5).
* use getTextureOfBuffer to find the texture name of a buffer
**/
GLuint *fbo_textures;
/// Number of pyramid levels.
int levels_count;
/// Current rasterize level
int cur_level;
GLfloat vertices[4][2];
GLfloat texcoors0[4][2];
};
#endif