1 // Copyright (C) 2007 Tim Moore timoore@redhat.com
2 // Copyright (C) 2008 Till Busch buti@bux.at
3 // Copyright (C) 2011 Mathias Froehlich
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef SGREADERWRITEROPTIONS_HXX
21 #define SGREADERWRITEROPTIONS_HXX 1
23 #include <osgDB/Options>
24 #include <simgear/scene/model/modellib.hxx>
25 #include <simgear/scene/material/matlib.hxx>
27 #include <simgear/props/props.hxx>
35 class SGReaderWriterOptions : public osgDB::Options {
37 SGReaderWriterOptions() :
41 _instantiateEffects(false)
43 SGReaderWriterOptions(const std::string& str) :
48 _instantiateEffects(false)
50 SGReaderWriterOptions(const osgDB::Options& options,
51 const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) :
52 osgDB::Options(options, copyop),
56 _instantiateEffects(false)
58 SGReaderWriterOptions(const SGReaderWriterOptions& options,
59 const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) :
60 osgDB::Options(options, copyop),
61 _propertyNode(options._propertyNode),
62 _materialLib(options._materialLib),
63 _load_panel(options._load_panel),
64 _model_data(options._model_data),
65 _instantiateEffects(options._instantiateEffects)
68 META_Object(simgear, SGReaderWriterOptions);
70 const SGSharedPtr<SGPropertyNode>& getPropertyNode() const
71 { return _propertyNode; }
72 void setPropertyNode(const SGSharedPtr<SGPropertyNode>& propertyNode)
73 { _propertyNode = propertyNode; }
75 SGMaterialLibPtr getMaterialLib() const
76 { return _materialLib; }
77 void setMaterialLib(SGMaterialLib* materialLib)
78 { _materialLib = materialLib; }
80 typedef osg::Node *(*panel_func)(SGPropertyNode *);
82 panel_func getLoadPanel() const
83 { return _load_panel; }
84 void setLoadPanel(panel_func pf)
87 SGModelData *getModelData() const
88 { return _model_data.get(); }
89 void setModelData(SGModelData *modelData)
90 { _model_data=modelData; }
92 bool getInstantiateEffects() const
93 { return _instantiateEffects; }
94 void setInstantiateEffects(bool instantiateEffects)
95 { _instantiateEffects = instantiateEffects; }
97 static SGReaderWriterOptions* copyOrCreate(const osgDB::Options* options);
98 static SGReaderWriterOptions* fromPath(const std::string& path);
101 virtual ~SGReaderWriterOptions();
104 SGSharedPtr<SGPropertyNode> _propertyNode;
105 SGSharedPtr<SGMaterialLib> _materialLib;
106 osg::Node *(*_load_panel)(SGPropertyNode *);
107 osg::ref_ptr<SGModelData> _model_data;
108 bool _instantiateEffects;