//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef _SG_MAT_MODEL_HXX
#define _SG_MAT_MODEL_HXX
-#ifndef __cplusplus
+#ifndef __cplusplus
# error This library requires C++
-#endif
+#endif
#include <simgear/compiler.h>
#include STL_STRING // Standard C++ string library
-#include <plib/sg.h>
-#include <plib/ssg.h>
+#include <osg/ref_ptr>
+#include <osg/Node>
+#include <osg/NodeVisitor>
+#include <osg/Billboard>
+#include <simgear/structure/SGReferenced.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/props/props.hxx>
SG_USING_STD(string);
* different shapes of trees), but they are considered equivalent
* and interchangeable.
*/
-class SGMatModel {
+class SGMatModel : public SGReferenced {
public:
* @param index The index of the model.
* @return The model.
*/
- ssgEntity *get_model( int index,
+ osg::Node *get_model( int index,
SGModelLib *modellib,
const string &fg_root,
SGPropertyNode *prop_root,
*
* @return A randomly select model from the variants.
*/
- ssgEntity *get_random_model( SGModelLib *modellib,
+ osg::Node *get_random_model( SGModelLib *modellib,
const string &fg_root,
SGPropertyNode *prop_root,
double sim_time_sec );
*/
HeadingType get_heading_type () const;
+ virtual ~SGMatModel ();
+
+
protected:
friend class SGMatModelGroup;
SGMatModel (const SGPropertyNode * node, double range_m);
- virtual ~SGMatModel ();
-
private:
/**
double sim_time_sec );
vector<string> _paths;
- mutable vector<ssgEntity *> _models;
+ mutable vector<osg::ref_ptr<osg::Node> > _models;
mutable bool _models_loaded;
double _coverage_m2;
double _range_m;
* Each SGMaterial instance keeps a (possibly-empty) list of
* object groups for placing randomly on the scenery.
*/
-class SGMatModelGroup {
+class SGMatModelGroup : public SGReferenced {
public:
private:
double _range_m;
- vector<SGMatModel *> _objects;
-
+ vector<SGSharedPtr<SGMatModel> > _objects;
};
-
#endif // _SG_MAT_MODEL_HXX