]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/SGReaderWriterXMLOptions.hxx
Merge branch 'next' of git.gitorious.org:fg/simgear into next
[simgear.git] / simgear / scene / model / SGReaderWriterXMLOptions.hxx
1 // Copyright (C) 2007 Tim Moore timoore@redhat.com
2 // Copyright (C) 2008 Till Busch buti@bux.at
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 //
18 #ifndef SGREADERWRITERXMLOPTIONS_HXX
19 #define SGREADERWRITERXMLOPTIONS_HXX 1
20
21 #include <osgDB/Registry>
22 #include <simgear/scene/model/modellib.hxx>
23 #include <simgear/props/props.hxx>
24
25 class SGPropertyNode;
26
27 namespace simgear
28 {
29 class SGModelData;
30
31 class SGReaderWriterXMLOptions : public osgDB::ReaderWriter::Options
32 {
33 public:
34     typedef osg::Node *(*panel_func)(SGPropertyNode *);
35     META_Object(simgear, SGReaderWriterXMLOptions);
36
37     SGReaderWriterXMLOptions():
38         osgDB::ReaderWriter::Options(),
39         _prop_root(0),
40         _load_panel(0),
41         _model_data(0),
42         _instantiateEffects(false)
43     {}
44
45     SGReaderWriterXMLOptions(const std::string& str):
46         osgDB::ReaderWriter::Options(str),
47         _prop_root(0),
48         _load_panel(0),
49         _model_data(0),
50         _instantiateEffects(false)        
51     {}
52
53     SGReaderWriterXMLOptions(const SGReaderWriterXMLOptions& options,
54                              const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
55         osgDB::ReaderWriter::Options(options, copyop),
56         _prop_root(options._prop_root),
57         _load_panel(options._load_panel),
58         _model_data(options._model_data),
59         _instantiateEffects(options._instantiateEffects)
60     {}
61
62     SGReaderWriterXMLOptions(const osgDB::ReaderWriter::Options& options,
63                              const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
64         osgDB::ReaderWriter::Options(options, copyop),
65         _prop_root(0),
66         _load_panel(0),
67         _model_data(0),
68         _instantiateEffects(false)
69     {}
70
71     SGPropertyNode *getPropRoot() const {
72         return _prop_root;
73     }
74     panel_func getLoadPanel() const {
75         return _load_panel;
76     }
77     SGModelData *getModelData() const {
78         return _model_data.get();
79     }
80     bool getInstantiateEffects() const
81     {
82         return _instantiateEffects;
83     }
84
85     void setPropRoot(SGPropertyNode *p) {
86         _prop_root=p;
87     }
88     void setLoadPanel(panel_func pf) {
89         _load_panel=pf;
90     }
91     void setModelData(SGModelData *d) {
92         _model_data=d;
93     }
94     void setInstantiateEffects(bool doit)
95     {
96         _instantiateEffects = doit;
97     }
98     
99     
100 protected:
101     virtual ~SGReaderWriterXMLOptions() {}
102
103     SGPropertyNode_ptr _prop_root;
104     osg::Node *(*_load_panel)(SGPropertyNode *);
105     osg::ref_ptr<SGModelData> _model_data;
106     bool _instantiateEffects;
107 };
108
109 }
110 #endif