OpenCOVER
coVRDePee.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7/*
8 Steffen Frey
9 Fachpraktikum Graphik-Programmierung 2007
10 Institut fuer Visualisierung und Interaktive Systeme
11 Universitaet Stuttgart
12 */
13
14#ifndef _coVRDePee_H_
15#define _coVRDePee_H_
16
17#include <osg/Node>
18#include <osg/Camera>
19#include <osg/Group>
20#include <osg/Texture2D>
21#include <osgText/Text>
22#include <string>
23#include <stack>
24
25#include "coVRDePeePass.h"
26
27namespace opencover
28{
33class COVEREXPORT coVRDePee : public osg::Referenced
34{
35public:
39 coVRDePee(osg::Group* parent, osg::Node* subgraph, unsigned width=100, unsigned height=100);
44
49
53 void setSketchy(bool sketchy);
54
58 void setCrayon(bool crayon);
59
63 void setColored(bool colored);
64
68 void setEdgy(bool edgy);
69
73 void setSketchiness(double sketchiness);
74
78 void setFPS(double* fps);
79
84
89
90private:
99 bool createMap(MapMode mapMode, bool first=false);
100
104 bool createNoiseMap();
105
111 bool createNormalDepthColorMap(MapMode mapMode, bool first);
112
117 bool createEdgeMap(bool first);
118
123 bool createFinal();
124
128 bool createHUD();
129
130 /*
131 Returns the number of rendering passes of the depth peeling object
132 */
133 unsigned int getNumberOfRenderPasses();
134
135 /* Util methods
136 */
140 bool readFile(const char* fName, std::string& s);
141
145 std::string toString(double d);
146
151 osg::Program* createProgram(std::string vs, std::string fs);
152
157 double getNoise(unsigned x, unsigned y, unsigned random);
158
163 double smoothNoise(unsigned width, unsigned height, unsigned x, unsigned y, unsigned char* noise);
164
168 osg::Texture2D* newColorTexture2D(unsigned width, unsigned height, unsigned accuracy);
169
173 osg::Geode* getCanvasQuad(unsigned width, unsigned height, double depth=-1);
174
175
176 unsigned _texWidth;
177 unsigned _texHeight;
178 unsigned _width;
179 unsigned _height;
180
181 osg::ref_ptr<osg::Group> _parent;
182 osg::ref_ptr<osg::Node> _subgraph;
183 osg::ref_ptr<osg::Texture2D> _noiseMap;
184 osg::ref_ptr<osg::Texture2D> _normalDepthMap0;
185 osg::ref_ptr<osg::Texture2D> _normalDepthMap1;
186
187 osg::ref_ptr<osg::Texture2D> _edgeMap;
188
189 osg::ref_ptr<osg::Texture2D> _colorMap;
190
191 osg::ref_ptr<osg::Geode> _quadGeode;
192
193 osgText::Text* _hudText;
194 double* _fps;
195
196 std::vector<coVRDePeePass*> _coVRDePeePasses;
197
198 osg::Uniform* _sketchy;
199 osg::Uniform* _colored;
200 osg::Uniform* _edgy;
201 osg::Uniform* _sketchiness;
202
203 bool _isSketchy;
204 bool _isColored;
205 bool _isEdgy;
206 bool _isCrayon;
207
208 osg::Camera* _colorCamera;
209
210 //shader programs
211 osg::ref_ptr<osg::Program> _normalDepthMapProgram;
212 osg::ref_ptr<osg::Program> _colorMapProgram;
213 osg::ref_ptr<osg::Program> _edgeMapProgram;
214
215 bool _renderToFirst;
216};
217}
218
219#endif
Definition: ARToolKit.h:33
MapMode
Definition: coVRDePeePass.h:29
Definition: coVRDePee.h:34
coVRDePee(osg::Group *parent, osg::Node *subgraph, unsigned width=100, unsigned height=100)
void setSketchiness(double sketchiness)
void setFPS(double *fps)
void setCrayon(bool crayon)
void setColored(bool colored)
void setSketchy(bool sketchy)
void setEdgy(bool edgy)