Restructured the handling of TileData to make it more extensible and flexible.
This commit is contained in:
@@ -19,6 +19,24 @@
|
||||
|
||||
namespace osgVolume {
|
||||
|
||||
/** Container for render to texture objects used when doing multi-pass volume rendering techniques.*/
|
||||
struct OSGVOLUME_EXPORT MultipassTileData : public TileData
|
||||
{
|
||||
MultipassTileData(osgUtil::CullVisitor* cv);
|
||||
|
||||
virtual void update(osgUtil::CullVisitor* cv);
|
||||
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> frontFaceDepthTexture;
|
||||
osg::ref_ptr<osg::Camera> frontFaceRttCamera;
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> backFaceDepthTexture;
|
||||
osg::ref_ptr<osg::Camera> backFaceRttCamera;
|
||||
|
||||
osg::ref_ptr<osg::Uniform> texgenUniform;
|
||||
};
|
||||
|
||||
|
||||
class OSGVOLUME_EXPORT MultipassTechnique : public VolumeTechnique
|
||||
{
|
||||
public:
|
||||
@@ -43,6 +61,10 @@ class OSGVOLUME_EXPORT MultipassTechnique : public VolumeTechnique
|
||||
/** Traverse the terrain subgraph.*/
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
/** Called from VolumeScene to create the TileData container when a multi-pass technique is being used.
|
||||
* The TileData container caches any render to texture objects that are required. */
|
||||
virtual TileData* createTileData(osgUtil::CullVisitor* cv) { return new MultipassTileData(cv); }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~MultipassTechnique();
|
||||
|
||||
@@ -36,24 +36,8 @@ class OSGVOLUME_EXPORT VolumeScene : public osg::Group
|
||||
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
struct TileData : public osg::Referenced
|
||||
{
|
||||
TileData() : active(false) {}
|
||||
|
||||
bool active;
|
||||
|
||||
osg::NodePath nodePath;
|
||||
osg::ref_ptr<osg::RefMatrix> projectionMatrix;
|
||||
osg::ref_ptr<osg::RefMatrix> modelviewMatrix;
|
||||
|
||||
osg::ref_ptr<osg::Texture2D> depthTexture;
|
||||
osg::ref_ptr<osg::Camera> rttCamera;
|
||||
osg::ref_ptr<osg::StateSet> stateset;
|
||||
osg::ref_ptr<osg::Uniform> texgenUniform;
|
||||
};
|
||||
|
||||
TileData* tileVisited(osgUtil::CullVisitor* cv, osgVolume::VolumeTile* tile);
|
||||
TileData* getTileData(osgUtil::CullVisitor* cv, osgVolume::VolumeTile* tile);
|
||||
TileData* tileVisited(osgUtil::CullVisitor* cv, VolumeTile* tile);
|
||||
TileData* getTileData(osgUtil::CullVisitor* cv, VolumeTile* tile);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -25,6 +25,23 @@ namespace osgVolume {
|
||||
|
||||
class VolumeTile;
|
||||
|
||||
/** Container for render to texture objects used when doing multi-pass volume rendering techniques.*/
|
||||
struct TileData : public osg::Referenced
|
||||
{
|
||||
TileData() : active(false) {}
|
||||
|
||||
virtual void update(osgUtil::CullVisitor* cv) = 0;
|
||||
|
||||
bool active;
|
||||
|
||||
osg::NodePath nodePath;
|
||||
osg::ref_ptr<osg::RefMatrix> projectionMatrix;
|
||||
osg::ref_ptr<osg::RefMatrix> modelviewMatrix;
|
||||
|
||||
osg::ref_ptr<osg::StateSet> stateset;
|
||||
};
|
||||
|
||||
|
||||
class OSGVOLUME_EXPORT VolumeTechnique : public osg::Object
|
||||
{
|
||||
public:
|
||||
@@ -53,6 +70,10 @@ class OSGVOLUME_EXPORT VolumeTechnique : public osg::Object
|
||||
/** Traverse the terrain subgraph.*/
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
/** Called from VolumeScene to create the TileData container when a multi-pass technique is being used.
|
||||
* The TileData container caches any render to texture objects that are required. */
|
||||
virtual TileData* createTileData(osgUtil::CullVisitor* cv) { return 0; }
|
||||
|
||||
protected:
|
||||
|
||||
void setDirty(bool dirty);
|
||||
|
||||
Reference in New Issue
Block a user