Added support for controlling the extents of the volume rendering by nesting the hull underneath VolumeTile. Currently only supported by the new osgVolume::MultipassTechnique

This commit is contained in:
Robert Osfield
2014-01-16 16:08:43 +00:00
parent a30ec25067
commit 1264ec736a
4 changed files with 544 additions and 349 deletions

View File

@@ -33,7 +33,9 @@ class OSGVOLUME_EXPORT MultipassTechnique : public VolumeTechnique
virtual void update(osgUtil::UpdateVisitor* nv);
virtual void cull(osgUtil::CullVisitor* nv);
virtual void backfaceSubgraphCullTraversal(osgUtil::CullVisitor* cv);
virtual void cull(osgUtil::CullVisitor* cv);
/** Clean scene graph from any terrain technique specific nodes.*/
virtual void cleanSceneGraph();
@@ -53,6 +55,7 @@ class OSGVOLUME_EXPORT MultipassTechnique : public VolumeTechnique
ModelViewMatrixMap _modelViewMatrixMap;
osg::ref_ptr<osg::StateSet> _whenMovingStateSet;
osg::ref_ptr<osg::StateSet> _volumeRenderStateSet;
osg::StateSet* createStateSet(osg::StateSet* statesetPrototype, osg::Program* programPrototype, osg::Shader* shaderToAdd1=0, osg::Shader* shaderToAdd2=0);
@@ -69,6 +72,8 @@ class OSGVOLUME_EXPORT MultipassTechnique : public VolumeTechnique
typedef std::map<int, osg::ref_ptr<osg::StateSet> > StateSetMap;
StateSetMap _stateSetMap;
osg::ref_ptr<osg::StateSet> _frontFaceStateSet;
};
}

View File

@@ -36,12 +36,6 @@ class OSGVOLUME_EXPORT VolumeScene : public osg::Group
virtual void traverse(osg::NodeVisitor& nv);
void tileVisited(osg::NodeVisitor* nv, osgVolume::VolumeTile* tile);
protected:
virtual ~VolumeScene();
struct TileData : public osg::Referenced
{
TileData() : active(false) {}
@@ -54,8 +48,17 @@ class OSGVOLUME_EXPORT VolumeScene : public osg::Group
osg::ref_ptr<osg::Texture2D> depthTexture;
osg::ref_ptr<osg::Camera> rttCamera;
osg::ref_ptr<osg::Camera> stateset;
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);
protected:
virtual ~VolumeScene();
typedef std::map< VolumeTile*, osg::ref_ptr<TileData> > Tiles;
class ViewData : public osg::Referenced