]> git.mxchange.org Git - simgear.git/blob - simgear/scene/material/Effect.hxx
Dump texture attributes of StateSet into effect property tree
[simgear.git] / simgear / scene / material / Effect.hxx
1 // Copyright (C) 2008 - 2009  Tim Moore timoore@redhat.com
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Library General Public
5 // License as published by the Free Software Foundation; either
6 // version 2 of the License, or (at your option) any later version.
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 GNU
11 // Library General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
16
17 #ifndef SIMGEAR_EFFECT_HXX
18 #define SIMGEAR_EFFECT_HXX 1
19
20 #include <vector>
21 #include <string>
22
23 #include <osg/Object>
24 #include <osgDB/ReaderWriter>
25
26 #include <simgear/props/props.hxx>
27
28 namespace osg
29 {
30 class Drawable;
31 class StateSet;
32 class RenderInfo;
33 }
34
35 namespace osgUtil
36 {
37 class CullVisitor;
38 }
39
40 namespace simgear
41 {
42 class Technique;
43
44 class Effect : public osg::Object
45 {
46 public:
47     META_Object(simgear,Effect)
48     Effect();
49     Effect(const Effect& rhs,
50            const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
51     osg::StateSet* getDefaultStateSet();
52     std::vector<osg::ref_ptr<Technique> > techniques;
53     SGPropertyNode_ptr root;
54     // Pointer to the parameters node, if it exists
55     SGPropertyNode_ptr parametersProp;
56     Technique* chooseTechnique(osg::RenderInfo* renderInfo);
57     virtual void resizeGLObjectBuffers(unsigned int maxSize);
58     virtual void releaseGLObjects(osg::State* state = 0) const;
59     /*
60      * Build the techniques from the effect properties.
61      */
62     bool realizeTechniques(const osgDB::ReaderWriter::Options* options = 0);
63     
64 protected:
65     ~Effect();
66 };
67 Effect* makeEffect(const std::string& name,
68                    bool realizeTechniques,
69                    const osgDB::ReaderWriter::Options* options = 0);
70
71 Effect* makeEffect(SGPropertyNode* prop,
72                    bool realizeTechniques,
73                    const osgDB::ReaderWriter::Options* options = 0);
74
75 bool makeParametersFromStateSet(SGPropertyNode* paramRoot,
76                                 const osg::StateSet* ss);
77 }
78 #endif