2
** point_based_renderer.h Point Based Render header.
5
** history: created 02-Jul-07
9
#ifndef __POINT_BASED_RENDERER_H__
10
#define __POINT_BASED_RENDERER_H__
15
#include "materials.h"
19
* Base class for rendering algorithms.
21
class PointBasedRenderer
27
* Default constructor, creates an 1024x1024 screen size.
29
PointBasedRenderer() :
30
canvas_width(1024), canvas_height(1024), scale_factor(1.0),
31
material_id(0), depth_test(1), back_face_culling(1), elliptical_weight(0),
32
reconstruction_filter_size(1.0), prefilter_size(1.0)
36
* Constructor for given screen size.
37
* @param w Screen width.
38
* @param h Screen height.
40
PointBasedRenderer(int w, int h) :
41
canvas_width(w), canvas_height(h), scale_factor(1.0),
42
material_id(0), depth_test(1), back_face_culling(1), elliptical_weight(0),
43
reconstruction_filter_size(1.0), prefilter_size(1.0)
46
virtual ~PointBasedRenderer() {}
48
virtual void init ( void ) {}
51
* Render point based model using deferred shading (per pixel shading).
53
virtual void draw( void ) {}
56
* Intepolate samples in screen space using pyramid method.
58
virtual void interpolate( void ) {}
61
* Projects samples to screen space.
62
* @param p Point to primitives instance containing samples.
64
virtual void projectSamples(Object* ) {}
67
* Clears all buffers, including those of the framebuffer object.
69
virtual void clearBuffers( void ) {}
73
virtual void setMinimumRadiusSize(double s) { minimum_radius_size = s; }
77
* Sets the size of the prefilter (default = 1.0).
78
* This filter works as an increment of the radius size in screen space.
79
* @param s Prefilter size.
81
virtual void setPrefilterSize(double s) { prefilter_size = s; }
84
* Sets the size of the reconstruction filter (default = 1.0).
85
* This filter works as a multiplier of the radius size in screen space.
86
* @param s Reconstruction filter size.
88
virtual void setReconstructionFilterSize(double s) { reconstruction_filter_size = s; }
91
* Sets the size of the reconstruction filter (default = 1.0).
92
* This filter works as a multiplier of the radius size in screen space.
93
* @param s Reconstruction filter size.
95
virtual double getReconstructionFilterSize(void) { return reconstruction_filter_size; }
98
* Sets the quality threshold for interpolating samples.
99
* @param q Quality threshold.
101
virtual void setQualityThreshold(double q) { quality_threshold = q; }
104
* Sets the quality per vertex flag.
105
* @param q Quality flag.
107
virtual void setQualityPerVertex(bool q) { quality_per_vertex = q; }
110
* Sets the kernel size, for templates rendering only.
111
* @param Kernel size.
113
virtual void setGpuMaskSize ( int ) {}
116
* Sets eye vector used mainly for backface culling.
117
* @param e Given eye vector.
119
void setEye (Point3f e) {
124
* Sets scale factor for zooming, scales sample's radius size.
125
* @param s Given scale factor.
127
void setScaleFactor (double s) {
132
* Sets the material id number for rendering.
133
* @param m Material id.
135
void setMaterial (const int m) {
136
if (m < NUM_MATERIALS)
141
* Gets the material id number for rendering.
142
* @return Current material id.
144
const int getMaterial ( void ) {
148
void upMaterial ( void ) {
150
if (material_id == NUM_MATERIALS)
154
void downMaterial ( void ) {
157
material_id = NUM_MATERIALS - 1;
161
* Sets the depth test flag on/off.
162
* @param d Given depth test state.
164
void setDepthTest( const bool d ) {
169
* Sets the backface culling flag on/off.
170
* @param b Given backface culling state.
172
void setBackFaceCulling( const bool b ) {
173
back_face_culling = b;
176
void setEllipticalWeight( const bool w ) {
177
elliptical_weight = w;
190
/// Scale factor (camera zooming)
193
/// Identification of the material from materials.h table.
196
/// Flag to turn on/off depth test
199
/// Flag to turn on/off back_face_culling
200
bool back_face_culling;
202
/// Flag to turn on/off elliptical weight
203
bool elliptical_weight;
205
/// Flag to turn on/off quality per vertex interpolation.
206
bool quality_per_vertex;
208
/// Size of quality threshold for interpolation.
209
double quality_threshold;
211
/// Size of reconstruction filter.
212
double reconstruction_filter_size;
213
/// Size of antialising filter.
214
double prefilter_size;
215
/// Minimum smallest radius size.
216
double minimum_radius_size;
220
//inline void check_for_ogl_error( char * from = 0) {
221
inline void check_for_ogl_error( string from = "") {
222
GLenum err = glGetError();
223
if (err != GL_NO_ERROR) {
224
cerr << from << endl;
225
cerr << __FILE__ << " (" << __LINE__ << ") " << gluErrorString(err) << endl;