]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/SGReaderWriterXMLOptions.hxx
Improved tile cache priority scheme.
[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
36     SGReaderWriterXMLOptions():
37         osgDB::ReaderWriter::Options(),
38         _prop_root(0),
39         _load_panel(0),
40         _model_data(0),
41         _instantiateEffects(false)
42     {}
43
44     SGReaderWriterXMLOptions(const std::string& str):
45         osgDB::ReaderWriter::Options(str),
46         _prop_root(0),
47         _load_panel(0),
48         _model_data(0),
49         _instantiateEffects(false)        
50     {}
51
52     SGReaderWriterXMLOptions(const SGReaderWriterXMLOptions& options,
53                              const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
54         osgDB::ReaderWriter::Options(options, copyop),
55         _prop_root(options._prop_root),
56         _load_panel(options._load_panel),
57         _model_data(options._model_data),
58         _instantiateEffects(options._instantiateEffects)
59     {}
60
61     SGReaderWriterXMLOptions(const osgDB::ReaderWriter::Options& options,
62                              const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
63         osgDB::ReaderWriter::Options(options, copyop),
64         _prop_root(0),
65         _load_panel(0),
66         _model_data(0),
67         _instantiateEffects(false)
68     {}
69
70     SGPropertyNode *getPropRoot() const {
71         return _prop_root;
72     }
73     panel_func getLoadPanel() const {
74         return _load_panel;
75     }
76     SGModelData *getModelData() const {
77         return _model_data.get();
78     }
79     bool getInstantiateEffects() const
80     {
81         return _instantiateEffects;
82     }
83
84     void setPropRoot(SGPropertyNode *p) {
85         _prop_root=p;
86     }
87     void setLoadPanel(panel_func pf) {
88         _load_panel=pf;
89     }
90     void setModelData(SGModelData *d) {
91         _model_data=d;
92     }
93     void setInstantiateEffects(bool doit)
94     {
95         _instantiateEffects = doit;
96     }
97     
98     
99 protected:
100     virtual ~SGReaderWriterXMLOptions() {}
101
102     SGPropertyNode_ptr _prop_root;
103     osg::Node *(*_load_panel)(SGPropertyNode *);
104     osg::ref_ptr<SGModelData> _model_data;
105     bool _instantiateEffects;
106 };
107
108 }
109 #endif