Rename matobj -> matmodel.

This commit is contained in:
curt
2003-05-15 16:19:56 +00:00
parent bb238c4106
commit 2ca4b30553
5 changed files with 42 additions and 45 deletions

View File

@@ -7,11 +7,11 @@ noinst_HEADERS =
include_HEADERS = \
mat.hxx \
matlib.hxx \
matobj.hxx
matmodel.hxx
libsgmaterial_a_SOURCES = \
mat.cxx \
matlib.cxx \
matobj.cxx
matmodel.cxx
INCLUDES = -I$(top_srcdir)

View File

@@ -153,7 +153,7 @@ SGMaterial::read_properties( const string &fg_root, const SGPropertyNode * props
vector<SGPropertyNode_ptr> object_group_nodes =
((SGPropertyNode *)props)->getChildren("object-group");
for (unsigned int i = 0; i < object_group_nodes.size(); i++)
object_groups.push_back(new SGMatObjectGroup(object_group_nodes[i]));
object_groups.push_back(new SGMatModelGroup(object_group_nodes[i]));
}

View File

@@ -40,7 +40,7 @@
#include <simgear/props/props.hxx>
#include <simgear/scene/model/loader.hxx>
#include "matobj.hxx"
#include "matmodel.hxx"
SG_USING_STD(string);
@@ -150,7 +150,7 @@ public:
/**
* Get a randomly-placed object for this material.
*/
virtual SGMatObjectGroup * get_object_group (int index) const {
virtual SGMatModelGroup * get_object_group (int index) const {
return object_groups[index];
}
@@ -222,7 +222,7 @@ private:
// true if texture loading deferred, and not yet loaded
bool texture_loaded;
vector<SGMatObjectGroup *> object_groups;
vector<SGMatModelGroup *> object_groups;
// ref count so we can properly delete if we have multiple
// pointers to this record

View File

@@ -1,4 +1,4 @@
// matobj.cxx -- class to handle material properties
// matmodel.cxx -- class to handle models tied to a material property
//
// Written by Curtis Olson, started May 1998.
//
@@ -42,7 +42,7 @@ SG_USING_STD(map);
#include <simgear/misc/sgstream.hxx>
#include <simgear/scene/model/loader.hxx>
#include "matobj.hxx"
#include "matmodel.hxx"
////////////////////////////////////////////////////////////////////////
@@ -68,10 +68,10 @@ local_file_exists( const string& path ) {
////////////////////////////////////////////////////////////////////////
// Implementation of SGMatObject.
// Implementation of SGMatModel.
////////////////////////////////////////////////////////////////////////
SGMatObject::SGMatObject (const SGPropertyNode * node, double range_m)
SGMatModel::SGMatModel (const SGPropertyNode * node, double range_m)
: _models_loaded(false),
_coverage_m2(node->getDoubleValue("coverage-m2", 1000000)),
_range_m(range_m)
@@ -106,7 +106,7 @@ SGMatObject::SGMatObject (const SGPropertyNode * node, double range_m)
// load_models();
}
SGMatObject::~SGMatObject ()
SGMatModel::~SGMatModel ()
{
for (unsigned int i = 0; i < _models.size(); i++) {
if (_models[i] != 0) {
@@ -117,7 +117,7 @@ SGMatObject::~SGMatObject ()
}
int
SGMatObject::get_model_count( SGModelLoader *loader,
SGMatModel::get_model_count( SGModelLoader *loader,
const string &fg_root,
SGPropertyNode *prop_root,
double sim_time_sec )
@@ -127,7 +127,7 @@ SGMatObject::get_model_count( SGModelLoader *loader,
}
inline void
SGMatObject::load_models ( SGModelLoader *loader,
SGMatModel::load_models ( SGModelLoader *loader,
const string &fg_root,
SGPropertyNode *prop_root,
double sim_time_sec )
@@ -163,7 +163,7 @@ SGMatObject::load_models ( SGModelLoader *loader,
}
ssgEntity *
SGMatObject::get_model( int index,
SGMatModel::get_model( int index,
SGModelLoader *loader,
const string &fg_root,
SGPropertyNode *prop_root,
@@ -174,7 +174,7 @@ SGMatObject::get_model( int index,
}
ssgEntity *
SGMatObject::get_random_model( SGModelLoader *loader,
SGMatModel::get_random_model( SGModelLoader *loader,
const string &fg_root,
SGPropertyNode *prop_root,
double sim_time_sec )
@@ -188,13 +188,13 @@ SGMatObject::get_random_model( SGModelLoader *loader,
}
double
SGMatObject::get_coverage_m2 () const
SGMatModel::get_coverage_m2 () const
{
return _coverage_m2;
}
SGMatObject::HeadingType
SGMatObject::get_heading_type () const
SGMatModel::HeadingType
SGMatModel::get_heading_type () const
{
return _heading_type;
}
@@ -202,10 +202,10 @@ SGMatObject::get_heading_type () const
////////////////////////////////////////////////////////////////////////
// Implementation of SGMatObjectGroup.
// Implementation of SGMatModelGroup.
////////////////////////////////////////////////////////////////////////
SGMatObjectGroup::SGMatObjectGroup (SGPropertyNode * node)
SGMatModelGroup::SGMatModelGroup (SGPropertyNode * node)
: _range_m(node->getDoubleValue("range-m", 2000))
{
// Load the object subnodes
@@ -214,13 +214,13 @@ SGMatObjectGroup::SGMatObjectGroup (SGPropertyNode * node)
for (unsigned int i = 0; i < object_nodes.size(); i++) {
const SGPropertyNode * object_node = object_nodes[i];
if (object_node->hasChild("path"))
_objects.push_back(new SGMatObject(object_node, _range_m));
_objects.push_back(new SGMatModel(object_node, _range_m));
else
SG_LOG(SG_INPUT, SG_ALERT, "No path supplied for object");
}
}
SGMatObjectGroup::~SGMatObjectGroup ()
SGMatModelGroup::~SGMatModelGroup ()
{
for (unsigned int i = 0; i < _objects.size(); i++) {
delete _objects[i];
@@ -229,22 +229,22 @@ SGMatObjectGroup::~SGMatObjectGroup ()
}
double
SGMatObjectGroup::get_range_m () const
SGMatModelGroup::get_range_m () const
{
return _range_m;
}
int
SGMatObjectGroup::get_object_count () const
SGMatModelGroup::get_object_count () const
{
return _objects.size();
}
SGMatObject *
SGMatObjectGroup::get_object (int index) const
SGMatModel *
SGMatModelGroup::get_object (int index) const
{
return _objects[index];
}
// end of matobj.cxx
// end of matmodel.cxx

View File

@@ -1,8 +1,6 @@
// matobj.hxx -- a material in the scene graph.
// TODO: this class needs to be renamed.
// matmodel.hxx -- class to handle models tied to a material property
//
// Written by Curtis Olson, started May 1998.
// Overhauled by David Megginson, December 2001
// Written by David Megginson, December 2001
//
// Copyright (C) 1998 - 2003 Curtis L. Olson - curt@flightgear.org
//
@@ -23,8 +21,8 @@
// $Id$
#ifndef _SG_MAT_OBJ_HXX
#define _SG_MAT_OBJ_HXX
#ifndef _SG_MAT_MODEL_HXX
#define _SG_MAT_MODEL_HXX
#ifndef __cplusplus
# error This library requires C++
@@ -43,7 +41,7 @@
SG_USING_STD(string);
class SGMatObjectGroup;
class SGMatModelGroup;
/**
@@ -55,7 +53,7 @@ class SGMatObjectGroup;
* different shapes of trees), but they are considered equivalent
* and interchangeable.
*/
class SGMatObject {
class SGMatModel {
public:
@@ -120,11 +118,11 @@ public:
protected:
friend class SGMatObjectGroup;
friend class SGMatModelGroup;
SGMatObject (const SGPropertyNode * node, double range_m);
SGMatModel (const SGPropertyNode * node, double range_m);
virtual ~SGMatObject ();
virtual ~SGMatModel ();
private:
@@ -156,11 +154,11 @@ private:
* Each SGMaterial instance keeps a (possibly-empty) list of
* object groups for placing randomly on the scenery.
*/
class SGMatObjectGroup {
class SGMatModelGroup {
public:
virtual ~SGMatObjectGroup ();
virtual ~SGMatModelGroup ();
/**
@@ -185,21 +183,20 @@ public:
* @param index The object's index, zero-based.
* @return The object selected.
*/
SGMatObject * get_object (int index) const;
SGMatModel * get_object (int index) const;
protected:
friend class SGMaterial;
SGMatObjectGroup (SGPropertyNode * node);
SGMatModelGroup (SGPropertyNode * node);
private:
double _range_m;
vector<SGMatObject *> _objects;
vector<SGMatModel *> _objects;
};
#endif // _SG_MAT_OBJ_HXX
#endif // _SG_MAT_MODEL_HXX