OpenSceneGraph/examples/osgoit/HeatMap.h
Robert Osfield ceb97fe230 From Christian Buchner, "Here is a strongly overhauled version of the original osgoit ("order independent transparency") by Mathias Fröhlich. I called this version myosgoit. It looks very nice, just build and run it!
This version adds:

- an encapsulation of the entire Depth Peeling procedure into a class (not currently a scene graph node) for easier integration in other projects.

- compositing with opaque (solid) geometry is possible and the opaque model is only rendered once. This needs to performs some depth buffer blitting between FBOs.

- mix and match with GLSL shaders in the transparent objects is possible, as demonstrated with a 3D heat map intersecting an opaque truck model.


Some Drawbacks:

- the display framebuffer does not receive any depth information from the compositing camera. This could be fixed by compositing with a GLSL shader and writing to FragDepth."

From Robert Osfield, ported the code to work under Linux and without the automatic ref_ptr to C* conversion.
2013-06-25 11:13:50 +00:00

34 lines
780 B
C++

#ifndef HEATMAP_H
#define HEATMAP_H
#include <osg/Geode>
#include <osg/Uniform>
#include <osg/Texture2D>
#include <osg/Texture1D>
class Heatmap : public osg::Geode
{
public:
Heatmap(float width, float depth, float maxheight, unsigned int K, unsigned int N, float maximum, float transparency);
~Heatmap();
void setData(float *buffer, float maxheight, float maximum, float transparency);
protected:
unsigned int m_K;
unsigned int m_N;
float *m_data;
osg::ref_ptr<osg::Image> m_img2;
osg::ref_ptr<osg::Texture2D> m_tex2;
osg::ref_ptr<osg::Image> colorimg;
osg::ref_ptr<osg::Texture1D> colortex;
osg::Uniform *maximumUniform;
osg::Uniform *maxheightUniform;
osg::Uniform *transparencyUniform;
};
#endif // #ifndef HEATMAP_H