MultipassTechnique
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGVOLUME_MULTIPASSTECHNIQUE
#define OSGVOLUME_MULTIPASSTECHNIQUE 1
#include <osgVolume/VolumeTechnique>
#include <osg/MatrixTransform>
#include <osg/Texture2D>
namespace osgVolume {
class OSGVOLUME_EXPORT MultipassTechnique : public VolumeTechnique
{
public:
MultipassTechnique();
MultipassTechnique(const MultipassTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgVolume, MultipassTechnique);
virtual void init();
virtual void update(osgUtil::UpdateVisitor* nv);
virtual void backfaceSubgraphCullTraversal(osgUtil::CullVisitor* cv);
virtual void cull(osgUtil::CullVisitor* cv);
virtual void cleanSceneGraph();
virtual void traverse(osg::NodeVisitor& nv);
enum RenderingMode
{
CUBE,
HULL,
CUBE_AND_HULL
};
RenderingMode computeRenderingMode();
struct OSGVOLUME_EXPORT MultipassTileData : public TileData
{
MultipassTileData(osgUtil::CullVisitor* cv, MultipassTechnique* mpt);
virtual void update(osgUtil::CullVisitor* cv);
void setUp(osg::ref_ptr<osg::Camera>& camera, osg::ref_ptr<osg::Texture2D>& texture2D, int width, int height);
osg::observer_ptr<MultipassTechnique> multipassTechnique;
RenderingMode currentRenderingMode;
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> eyeToTileUniform;
osg::ref_ptr<osg::Uniform> tileToImageUniform;
};
virtual TileData* createTileData(osgUtil::CullVisitor* cv) { return new MultipassTileData(cv, this); }
protected:
virtual ~MultipassTechnique();
osg::ref_ptr<osg::MatrixTransform> _transform;
typedef std::map<osgUtil::CullVisitor::Identifier*, osg::Matrix> ModelViewMatrixMap;
OpenThreads::Mutex _mutex;
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);
enum ShaderMask
{
CUBE_SHADERS = 1,
HULL_SHADERS = 2,
CUBE_AND_HULL_SHADERS = 4,
STANDARD_SHADERS = 8,
LIT_SHADERS = 16,
ISO_SHADERS = 32,
MIP_SHADERS = 64,
TF_SHADERS = 128
};
typedef std::map<int, osg::ref_ptr<osg::StateSet> > StateSetMap;
StateSetMap _stateSetMap;
osg::ref_ptr<osg::StateSet> _frontFaceStateSet;
};
}
#endif
MatrixTransform
Texture2D
VolumeTechnique
OpenThreads::Mutex
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
osgUtil::CullVisitor
Definition CullVisitor:49
osgUtil::UpdateVisitor
Definition UpdateVisitor:38
osgVolume::MultipassTechnique::backfaceSubgraphCullTraversal
virtual void backfaceSubgraphCullTraversal(osgUtil::CullVisitor *cv)
osgVolume::MultipassTechnique::init
virtual void init()
osgVolume::MultipassTechnique::ModelViewMatrixMap
std::map< osgUtil::CullVisitor::Identifier *, osg::Matrix > ModelViewMatrixMap
Definition MultipassTechnique:91
osgVolume::MultipassTechnique::cull
virtual void cull(osgUtil::CullVisitor *cv)
osgVolume::MultipassTechnique::createTileData
virtual TileData * createTileData(osgUtil::CullVisitor *cv)
Definition MultipassTechnique:83
osgVolume::MultipassTechnique::_transform
osg::ref_ptr< osg::MatrixTransform > _transform
Definition MultipassTechnique:89
osgVolume::MultipassTechnique::META_Object
META_Object(osgVolume, MultipassTechnique)
osgVolume::MultipassTechnique::cleanSceneGraph
virtual void cleanSceneGraph()
osgVolume::MultipassTechnique::createStateSet
osg::StateSet * createStateSet(osg::StateSet *statesetPrototype, osg::Program *programPrototype, osg::Shader *shaderToAdd1=0, osg::Shader *shaderToAdd2=0)
osgVolume::MultipassTechnique::_volumeRenderStateSet
osg::ref_ptr< osg::StateSet > _volumeRenderStateSet
Definition MultipassTechnique:97
osgVolume::MultipassTechnique::_mutex
OpenThreads::Mutex _mutex
Definition MultipassTechnique:93
osgVolume::MultipassTechnique::update
virtual void update(osgUtil::UpdateVisitor *nv)
osgVolume::MultipassTechnique::_modelViewMatrixMap
ModelViewMatrixMap _modelViewMatrixMap
Definition MultipassTechnique:94
osgVolume::MultipassTechnique::~MultipassTechnique
virtual ~MultipassTechnique()
osgVolume::MultipassTechnique::StateSetMap
std::map< int, osg::ref_ptr< osg::StateSet > > StateSetMap
Definition MultipassTechnique:113
osgVolume::MultipassTechnique::_whenMovingStateSet
osg::ref_ptr< osg::StateSet > _whenMovingStateSet
Definition MultipassTechnique:96
osgVolume::MultipassTechnique::traverse
virtual void traverse(osg::NodeVisitor &nv)
osgVolume::MultipassTechnique::ShaderMask
ShaderMask
Definition MultipassTechnique:102
osgVolume::MultipassTechnique::ISO_SHADERS
@ ISO_SHADERS
Definition MultipassTechnique:108
osgVolume::MultipassTechnique::CUBE_SHADERS
@ CUBE_SHADERS
Definition MultipassTechnique:103
osgVolume::MultipassTechnique::CUBE_AND_HULL_SHADERS
@ CUBE_AND_HULL_SHADERS
Definition MultipassTechnique:105
osgVolume::MultipassTechnique::TF_SHADERS
@ TF_SHADERS
Definition MultipassTechnique:110
osgVolume::MultipassTechnique::HULL_SHADERS
@ HULL_SHADERS
Definition MultipassTechnique:104
osgVolume::MultipassTechnique::STANDARD_SHADERS
@ STANDARD_SHADERS
Definition MultipassTechnique:106
osgVolume::MultipassTechnique::LIT_SHADERS
@ LIT_SHADERS
Definition MultipassTechnique:107
osgVolume::MultipassTechnique::MIP_SHADERS
@ MIP_SHADERS
Definition MultipassTechnique:109
osgVolume::MultipassTechnique::MultipassTechnique
MultipassTechnique(const MultipassTechnique &, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgVolume::MultipassTechnique::RenderingMode
RenderingMode
Definition MultipassTechnique:50
osgVolume::MultipassTechnique::CUBE_AND_HULL
@ CUBE_AND_HULL
Definition MultipassTechnique:53
osgVolume::MultipassTechnique::HULL
@ HULL
Definition MultipassTechnique:52
osgVolume::MultipassTechnique::CUBE
@ CUBE
Definition MultipassTechnique:51
osgVolume::MultipassTechnique::MultipassTechnique
MultipassTechnique()
osgVolume::MultipassTechnique::computeRenderingMode
RenderingMode computeRenderingMode()
osgVolume::MultipassTechnique::_stateSetMap
StateSetMap _stateSetMap
Definition MultipassTechnique:114
osgVolume::MultipassTechnique::_frontFaceStateSet
osg::ref_ptr< osg::StateSet > _frontFaceStateSet
Definition MultipassTechnique:116
osgVolume::VolumeTechnique::VolumeTechnique
VolumeTechnique()
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::NodeVisitor
Definition NodeVisitor:82
osg::Program
Definition osg/Program:52
osg::Shader
Definition Shader:89
osg::StateSet
Definition StateSet:46
osg::observer_ptr
Definition observer_ptr:39
osg::ref_ptr
Definition ref_ptr:32
osgVolume
OSGVOLUME_EXPORT
#define OSGVOLUME_EXPORT
Definition osgVolume/Export:39
osgVolume::MultipassTechnique::MultipassTileData
Definition MultipassTechnique:60
osgVolume::MultipassTechnique::MultipassTileData::update
virtual void update(osgUtil::CullVisitor *cv)
osgVolume::MultipassTechnique::MultipassTileData::frontFaceRttCamera
osg::ref_ptr< osg::Camera > frontFaceRttCamera
Definition MultipassTechnique:72
osgVolume::MultipassTechnique::MultipassTileData::tileToImageUniform
osg::ref_ptr< osg::Uniform > tileToImageUniform
Definition MultipassTechnique:78
osgVolume::MultipassTechnique::MultipassTileData::MultipassTileData
MultipassTileData(osgUtil::CullVisitor *cv, MultipassTechnique *mpt)
osgVolume::MultipassTechnique::MultipassTileData::setUp
void setUp(osg::ref_ptr< osg::Camera > &camera, osg::ref_ptr< osg::Texture2D > &texture2D, int width, int height)
osgVolume::MultipassTechnique::MultipassTileData::backFaceDepthTexture
osg::ref_ptr< osg::Texture2D > backFaceDepthTexture
Definition MultipassTechnique:74
osgVolume::MultipassTechnique::MultipassTileData::multipassTechnique
osg::observer_ptr< MultipassTechnique > multipassTechnique
Definition MultipassTechnique:68
osgVolume::MultipassTechnique::MultipassTileData::eyeToTileUniform
osg::ref_ptr< osg::Uniform > eyeToTileUniform
Definition MultipassTechnique:77
osgVolume::MultipassTechnique::MultipassTileData::backFaceRttCamera
osg::ref_ptr< osg::Camera > backFaceRttCamera
Definition MultipassTechnique:75
osgVolume::MultipassTechnique::MultipassTileData::frontFaceDepthTexture
osg::ref_ptr< osg::Texture2D > frontFaceDepthTexture
Definition MultipassTechnique:71
osgVolume::MultipassTechnique::MultipassTileData::currentRenderingMode
RenderingMode currentRenderingMode
Definition MultipassTechnique:69
osgVolume::TileData
Definition VolumeTechnique:30
osgVolume::TileData::TileData
TileData()
Definition VolumeTechnique:31