/usr/share/openscenegraph/examples/osgdepthpeeling/DePee.h is in openscenegraph-examples 3.2.0~rc1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | /*
Steffen Frey
Fachpraktikum Graphik-Programmierung 2007
Institut fuer Visualisierung und Interaktive Systeme
Universitaet Stuttgart
*/
#ifndef _DEPEE_H_
#define _DEPEE_H_
#include <osg/Node>
#include <osg/Camera>
#include <osg/Group>
#include <osg/Texture2D>
#include <osgText/Text>
#include <string>
#include <stack>
#include "DePeePass.h"
/*!
The DePee class is main class for setting up and managing depth peeling.
A DePee object can be seen as a virtual node, that has one parent and one child. The rendering of every child and subchil of this child is managed by the the DePee node. Besides that, it handles a head up display.
*/
class DePee : public osg::Referenced
{
public:
/*!
The constructor is initialized by giving it a parent and child node (subgraph), as well as the width and height in pixels of the output window. Additionally a subgraph can be added whose children aren't depth peeled but combined with de depth peeled scene
*/
DePee(osg::Group* parent, osg::Group* subgraph, unsigned width, unsigned height);
/*!
Takes care of clean removal of DePee
*/
~DePee();
/*!
The head up display shows information like internal status and current frames per second. This function needs to be called in the rendering loop to keep the information updated.
*/
bool updateHUDText();
/*!
Sets whether sketchiness is activated or deactivated
*/
void setSketchy(bool sketchy);
/*!
If sketchiness is enabled, sets whether a crayon should be used
*/
void setCrayon(bool crayon);
/*!
Sets whether color display is activated or deactivated
*/
void setColored(bool colored);
/*!
Sets whether edges are displayed or not
*/
void setEdgy(bool edgy);
/*!
Sets how sketchy lines and colors should be displayed (standard is 1.0)
*/
void setSketchiness(double sketchiness);
/*!
Set the pointer to the double variable containing the current fps for displaying it on the head up display
*/
void setFPS(double* fps);
/*!
Add a depth peeling pass and adjust the render passes accordingly
*/
bool addDePeePass();
/*!
Remove a depth peeling pass and adjust the render passes accordingly
*/
bool remDePeePass();
private:
/*!
Create a map. This is a function for convenience and calls either
createNoiseMap(), createEdgeMap() or createNormalDepthColorMap().
Apart from NOISE_MAP, for every texture generation
one rendering pass is needed.
The boolean first is used to indicate whether this rendering pass
belongs to the first depth peeling pass.
*/
bool createMap(MapMode mapMode, bool first=false);
/*!
Creates a two dimensional noise map and initalizes _noiseMap with it
*/
bool createNoiseMap();
/*!
Depending on the chosen MapMode, it either creates a new rendering
pass for creaeting a normal, depth or color map. The created rendering
pass is added to the current depth peeling pass.
*/
bool createNormalDepthColorMap(MapMode mapMode, bool first);
/*!
Create an edge map. A previous depth and normal rendering pass in this
depth peeling pass is required for that.
*/
bool createEdgeMap(bool first);
/*!
Creates the final rendering pass for depth peeling. Color and edge map are
added up here and sketchiness is applied.
*/
bool createFinal();
/*!
Create the rendering pass for the head up display
*/
bool createHUD();
/*
Returns the number of rendering passes of the depth peeling object
*/
unsigned int getNumberOfRenderPasses();
unsigned _texWidth;
unsigned _texHeight;
unsigned _width;
unsigned _height;
osg::ref_ptr<osg::Group> _parent;
osg::ref_ptr<osg::Group> _subgraph;
osg::ref_ptr<osg::Texture2D> _noiseMap;
osg::ref_ptr<osg::Texture2D> _normalDepthMap0;
osg::ref_ptr<osg::Texture2D> _normalDepthMap1;
osg::ref_ptr<osg::Texture2D> _edgeMap;
osg::ref_ptr<osg::Texture2D> _colorMap;
osg::ref_ptr<osg::Geode> _quadGeode;
osgText::Text* _hudText;
double* _fps;
std::vector<DePeePass*> _dePeePasses;
osg::Uniform* _sketchy;
osg::Uniform* _colored;
osg::Uniform* _edgy;
osg::Uniform* _sketchiness;
bool _isSketchy;
bool _isColored;
bool _isEdgy;
bool _isCrayon;
osg::Camera* _colorCamera;
//shader programs
osg::ref_ptr<osg::Program> _normalDepthMapProgram;
osg::ref_ptr<osg::Program> _colorMapProgram;
osg::ref_ptr<osg::Program> _edgeMapProgram;
bool _renderToFirst;
};
#endif
|