root/OpenSceneGraph/trunk/include/osgVolume/MultipassTechnique @ 13949

Revision 13949, 2.3 kB (checked in by robert, 2 days ago)

Added shaders to support experimental shader based displacement mapping technique osgTerrain::ShaderTerrain?.

Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGVOLUME_MULTIPASSTECHNIQUE
15#define OSGVOLUME_MULTIPASSTECHNIQUE 1
16
17#include <osgVolume/VolumeTechnique>
18#include <osg/MatrixTransform>
19
20namespace osgVolume {
21
22class OSGVOLUME_EXPORT MultipassTechnique : public VolumeTechnique
23{
24    public:
25
26        MultipassTechnique();
27
28        MultipassTechnique(const MultipassTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
29
30        META_Object(osgVolume, MultipassTechnique);
31
32        virtual void init();
33
34        virtual void update(osgUtil::UpdateVisitor* nv);
35
36        virtual void cull(osgUtil::CullVisitor* nv);
37
38        /** Clean scene graph from any terrain technique specific nodes.*/
39        virtual void cleanSceneGraph();
40
41        /** Traverse the terrain subgraph.*/
42        virtual void traverse(osg::NodeVisitor& nv);
43
44    protected:
45
46        virtual ~MultipassTechnique();
47
48        osg::ref_ptr<osg::MatrixTransform> _transform;
49
50        typedef std::map<osgUtil::CullVisitor::Identifier*, osg::Matrix> ModelViewMatrixMap;
51
52        OpenThreads::Mutex _mutex;
53        ModelViewMatrixMap _modelViewMatrixMap;
54
55        osg::ref_ptr<osg::StateSet> _whenMovingStateSet;
56
57        osg::StateSet* createStateSet(osg::StateSet* statesetPrototype, osg::Program* programPrototype, osg::Shader* shaderToAdd1=0, osg::Shader* shaderToAdd2=0);
58
59        enum ShaderMask
60        {
61            FRONT_SHADERS = 1,
62            BACK_SHADERS = 2,
63            STANDARD_SHADERS = 4,
64            LIT_SHADERS = 8,
65            ISO_SHADERS = 16,
66            MIP_SHADERS = 32,
67            TF_SHADERS = 64
68        };
69
70        typedef std::map<int, osg::ref_ptr<osg::StateSet> > StateSetMap;
71        StateSetMap _stateSetMap;
72};
73
74}
75
76#endif
Note: See TracBrowser for help on using the browser.