From: curt Date: Tue, 13 May 2003 03:18:35 +0000 (+0000) Subject: Cosmetic changes for new code moved into simgear to make the naming scheme X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d8a75897526f2ba2a030225a22dfbd93c7c39a7e;p=simgear.git Cosmetic changes for new code moved into simgear to make the naming scheme better follow simgear conventions. --- diff --git a/simgear/props/condition.cxx b/simgear/props/condition.cxx index dc5a437a..b1314af4 100644 --- a/simgear/props/condition.cxx +++ b/simgear/props/condition.cxx @@ -1,4 +1,5 @@ -// condition.hxx - Declarations and inline methods for property conditions. +// condition.cxx - Declarations and inline methods for property conditions. +// // Written by David Megginson, started 2000. // CLO May 2003 - Split out condition specific code. // @@ -25,51 +26,51 @@ SG_USING_STD(ostream); //////////////////////////////////////////////////////////////////////// -// Implementation of FGCondition. +// Implementation of SGCondition. //////////////////////////////////////////////////////////////////////// -FGCondition::FGCondition () +SGCondition::SGCondition () { } -FGCondition::~FGCondition () +SGCondition::~SGCondition () { } //////////////////////////////////////////////////////////////////////// -// Implementation of FGPropertyCondition. +// Implementation of SGPropertyCondition. //////////////////////////////////////////////////////////////////////// -FGPropertyCondition::FGPropertyCondition ( SGPropertyNode *prop_root, +SGPropertyCondition::SGPropertyCondition ( SGPropertyNode *prop_root, const char *propname ) : _node( prop_root->getNode(propname, true) ) { } -FGPropertyCondition::~FGPropertyCondition () +SGPropertyCondition::~SGPropertyCondition () { } //////////////////////////////////////////////////////////////////////// -// Implementation of FGNotCondition. +// Implementation of SGNotCondition. //////////////////////////////////////////////////////////////////////// -FGNotCondition::FGNotCondition (FGCondition * condition) +SGNotCondition::SGNotCondition (SGCondition * condition) : _condition(condition) { } -FGNotCondition::~FGNotCondition () +SGNotCondition::~SGNotCondition () { delete _condition; } bool -FGNotCondition::test () const +SGNotCondition::test () const { return !(_condition->test()); } @@ -77,21 +78,21 @@ FGNotCondition::test () const //////////////////////////////////////////////////////////////////////// -// Implementation of FGAndCondition. +// Implementation of SGAndCondition. //////////////////////////////////////////////////////////////////////// -FGAndCondition::FGAndCondition () +SGAndCondition::SGAndCondition () { } -FGAndCondition::~FGAndCondition () +SGAndCondition::~SGAndCondition () { for (unsigned int i = 0; i < _conditions.size(); i++) delete _conditions[i]; } bool -FGAndCondition::test () const +SGAndCondition::test () const { int nConditions = _conditions.size(); for (int i = 0; i < nConditions; i++) { @@ -102,7 +103,7 @@ FGAndCondition::test () const } void -FGAndCondition::addCondition (FGCondition * condition) +SGAndCondition::addCondition (SGCondition * condition) { _conditions.push_back(condition); } @@ -110,21 +111,21 @@ FGAndCondition::addCondition (FGCondition * condition) //////////////////////////////////////////////////////////////////////// -// Implementation of FGOrCondition. +// Implementation of SGOrCondition. //////////////////////////////////////////////////////////////////////// -FGOrCondition::FGOrCondition () +SGOrCondition::SGOrCondition () { } -FGOrCondition::~FGOrCondition () +SGOrCondition::~SGOrCondition () { for (unsigned int i = 0; i < _conditions.size(); i++) delete _conditions[i]; } bool -FGOrCondition::test () const +SGOrCondition::test () const { int nConditions = _conditions.size(); for (int i = 0; i < nConditions; i++) { @@ -135,7 +136,7 @@ FGOrCondition::test () const } void -FGOrCondition::addCondition (FGCondition * condition) +SGOrCondition::addCondition (SGCondition * condition) { _conditions.push_back(condition); } @@ -143,7 +144,7 @@ FGOrCondition::addCondition (FGCondition * condition) //////////////////////////////////////////////////////////////////////// -// Implementation of FGComparisonCondition. +// Implementation of SGComparisonCondition. //////////////////////////////////////////////////////////////////////// static int @@ -154,55 +155,55 @@ doComparison (const SGPropertyNode * left, const SGPropertyNode *right) bool v1 = left->getBoolValue(); bool v2 = right->getBoolValue(); if (v1 < v2) - return FGComparisonCondition::LESS_THAN; + return SGComparisonCondition::LESS_THAN; else if (v1 > v2) - return FGComparisonCondition::GREATER_THAN; + return SGComparisonCondition::GREATER_THAN; else - return FGComparisonCondition::EQUALS; + return SGComparisonCondition::EQUALS; break; } case SGPropertyNode::INT: { int v1 = left->getIntValue(); int v2 = right->getIntValue(); if (v1 < v2) - return FGComparisonCondition::LESS_THAN; + return SGComparisonCondition::LESS_THAN; else if (v1 > v2) - return FGComparisonCondition::GREATER_THAN; + return SGComparisonCondition::GREATER_THAN; else - return FGComparisonCondition::EQUALS; + return SGComparisonCondition::EQUALS; break; } case SGPropertyNode::LONG: { long v1 = left->getLongValue(); long v2 = right->getLongValue(); if (v1 < v2) - return FGComparisonCondition::LESS_THAN; + return SGComparisonCondition::LESS_THAN; else if (v1 > v2) - return FGComparisonCondition::GREATER_THAN; + return SGComparisonCondition::GREATER_THAN; else - return FGComparisonCondition::EQUALS; + return SGComparisonCondition::EQUALS; break; } case SGPropertyNode::FLOAT: { float v1 = left->getFloatValue(); float v2 = right->getFloatValue(); if (v1 < v2) - return FGComparisonCondition::LESS_THAN; + return SGComparisonCondition::LESS_THAN; else if (v1 > v2) - return FGComparisonCondition::GREATER_THAN; + return SGComparisonCondition::GREATER_THAN; else - return FGComparisonCondition::EQUALS; + return SGComparisonCondition::EQUALS; break; } case SGPropertyNode::DOUBLE: { double v1 = left->getDoubleValue(); double v2 = right->getDoubleValue(); if (v1 < v2) - return FGComparisonCondition::LESS_THAN; + return SGComparisonCondition::LESS_THAN; else if (v1 > v2) - return FGComparisonCondition::GREATER_THAN; + return SGComparisonCondition::GREATER_THAN; else - return FGComparisonCondition::EQUALS; + return SGComparisonCondition::EQUALS; break; } case SGPropertyNode::STRING: @@ -211,11 +212,11 @@ doComparison (const SGPropertyNode * left, const SGPropertyNode *right) string v1 = left->getStringValue(); string v2 = right->getStringValue(); if (v1 < v2) - return FGComparisonCondition::LESS_THAN; + return SGComparisonCondition::LESS_THAN; else if (v1 > v2) - return FGComparisonCondition::GREATER_THAN; + return SGComparisonCondition::GREATER_THAN; else - return FGComparisonCondition::EQUALS; + return SGComparisonCondition::EQUALS; break; } } @@ -224,7 +225,7 @@ doComparison (const SGPropertyNode * left, const SGPropertyNode *right) } -FGComparisonCondition::FGComparisonCondition (Type type, bool reverse) +SGComparisonCondition::SGComparisonCondition (Type type, bool reverse) : _type(type), _reverse(reverse), _left_property(0), @@ -233,13 +234,13 @@ FGComparisonCondition::FGComparisonCondition (Type type, bool reverse) { } -FGComparisonCondition::~FGComparisonCondition () +SGComparisonCondition::~SGComparisonCondition () { delete _right_value; } bool -FGComparisonCondition::test () const +SGComparisonCondition::test () const { // Always fail if incompletely specified if (_left_property == 0 || @@ -257,14 +258,14 @@ FGComparisonCondition::test () const } void -FGComparisonCondition::setLeftProperty( SGPropertyNode *prop_root, +SGComparisonCondition::setLeftProperty( SGPropertyNode *prop_root, const char * propname ) { _left_property = prop_root->getNode(propname, true); } void -FGComparisonCondition::setRightProperty( SGPropertyNode *prop_root, +SGComparisonCondition::setRightProperty( SGPropertyNode *prop_root, const char * propname ) { delete _right_value; @@ -273,7 +274,7 @@ FGComparisonCondition::setRightProperty( SGPropertyNode *prop_root, } void -FGComparisonCondition::setRightValue (const SGPropertyNode *node) +SGComparisonCondition::setRightValue (const SGPropertyNode *node) { _right_property = 0; delete _right_value; @@ -287,65 +288,65 @@ FGComparisonCondition::setRightValue (const SGPropertyNode *node) //////////////////////////////////////////////////////////////////////// // Forward declaration -static FGCondition * readCondition( SGPropertyNode *prop_root, +static SGCondition * readCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ); -static FGCondition * +static SGCondition * readPropertyCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ) { - return new FGPropertyCondition( prop_root, node->getStringValue() ); + return new SGPropertyCondition( prop_root, node->getStringValue() ); } -static FGCondition * +static SGCondition * readNotCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ) { int nChildren = node->nChildren(); for (int i = 0; i < nChildren; i++) { const SGPropertyNode * child = node->getChild(i); - FGCondition * condition = readCondition(prop_root, child); + SGCondition * condition = readCondition(prop_root, child); if (condition != 0) - return new FGNotCondition(condition); + return new SGNotCondition(condition); } SG_LOG(SG_COCKPIT, SG_ALERT, "Panel: empty 'not' condition"); return 0; } -static FGCondition * +static SGCondition * readAndConditions( SGPropertyNode *prop_root, const SGPropertyNode *node ) { - FGAndCondition * andCondition = new FGAndCondition; + SGAndCondition * andCondition = new SGAndCondition; int nChildren = node->nChildren(); for (int i = 0; i < nChildren; i++) { const SGPropertyNode * child = node->getChild(i); - FGCondition * condition = readCondition(prop_root, child); + SGCondition * condition = readCondition(prop_root, child); if (condition != 0) andCondition->addCondition(condition); } return andCondition; } -static FGCondition * +static SGCondition * readOrConditions( SGPropertyNode *prop_root, const SGPropertyNode *node ) { - FGOrCondition * orCondition = new FGOrCondition; + SGOrCondition * orCondition = new SGOrCondition; int nChildren = node->nChildren(); for (int i = 0; i < nChildren; i++) { const SGPropertyNode * child = node->getChild(i); - FGCondition * condition = readCondition(prop_root, child); + SGCondition * condition = readCondition(prop_root, child); if (condition != 0) orCondition->addCondition(condition); } return orCondition; } -static FGCondition * +static SGCondition * readComparison( SGPropertyNode *prop_root, const SGPropertyNode *node, - FGComparisonCondition::Type type, + SGComparisonCondition::Type type, bool reverse) { - FGComparisonCondition * condition = new FGComparisonCondition(type, reverse); + SGComparisonCondition * condition = new SGComparisonCondition(type, reverse); condition->setLeftProperty(prop_root, node->getStringValue("property[0]")); if (node->hasValue("property[1]")) condition->setRightProperty(prop_root, node->getStringValue("property[1]")); @@ -355,7 +356,7 @@ readComparison( SGPropertyNode *prop_root, return condition; } -static FGCondition * +static SGCondition * readCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ) { const string &name = node->getName(); @@ -368,22 +369,22 @@ readCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ) else if (name == "or") return readOrConditions(prop_root, node); else if (name == "less-than") - return readComparison(prop_root, node, FGComparisonCondition::LESS_THAN, + return readComparison(prop_root, node, SGComparisonCondition::LESS_THAN, false); else if (name == "less-than-equals") - return readComparison(prop_root, node, FGComparisonCondition::GREATER_THAN, + return readComparison(prop_root, node, SGComparisonCondition::GREATER_THAN, true); else if (name == "greater-than") - return readComparison(prop_root, node, FGComparisonCondition::GREATER_THAN, + return readComparison(prop_root, node, SGComparisonCondition::GREATER_THAN, false); else if (name == "greater-than-equals") - return readComparison(prop_root, node, FGComparisonCondition::LESS_THAN, + return readComparison(prop_root, node, SGComparisonCondition::LESS_THAN, true); else if (name == "equals") - return readComparison(prop_root, node, FGComparisonCondition::EQUALS, + return readComparison(prop_root, node, SGComparisonCondition::EQUALS, false); else if (name == "not-equals") - return readComparison(prop_root, node, FGComparisonCondition::EQUALS, true); + return readComparison(prop_root, node, SGComparisonCondition::EQUALS, true); else return 0; } @@ -391,28 +392,28 @@ readCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ) //////////////////////////////////////////////////////////////////////// -// Implementation of FGConditional. +// Implementation of SGConditional. //////////////////////////////////////////////////////////////////////// -FGConditional::FGConditional () +SGConditional::SGConditional () : _condition (0) { } -FGConditional::~FGConditional () +SGConditional::~SGConditional () { delete _condition; } void -FGConditional::setCondition (FGCondition * condition) +SGConditional::setCondition (SGCondition * condition) { delete _condition; _condition = condition; } bool -FGConditional::test () const +SGConditional::test () const { return ((_condition == 0) || _condition->test()); } @@ -420,11 +421,11 @@ FGConditional::test () const // The top-level is always an implicit 'and' group -FGCondition * -fgReadCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ) +SGCondition * +sgReadCondition( SGPropertyNode *prop_root, const SGPropertyNode *node ) { return readAndConditions(prop_root, node); } -// end of fg_props.cxx +// end of condition.cxx diff --git a/simgear/props/condition.hxx b/simgear/props/condition.hxx index 3da63712..b314cc4e 100644 --- a/simgear/props/condition.hxx +++ b/simgear/props/condition.hxx @@ -1,8 +1,11 @@ -// condition.hxx - Declarations and inline methods for property conditions. -// Written by David Megginson, started 2000. -// CLO May 2003 - Split out condition specific code. -// -// This file is in the Public Domain, and comes with no warranty. +/** + * \file condition.hxx + * Declarations and inline methods for property conditions. + * Written by David Megginson, started 2000. + * CLO May 2003 - Split out condition specific code. + * + * This file is in the Public Domain, and comes with no warranty. + */ #ifndef __SG_CONDITION_HXX #define __SG_CONDITION_HXX @@ -25,11 +28,11 @@ * * This class should migrate to somewhere more general. */ -class FGCondition +class SGCondition { public: - FGCondition (); - virtual ~FGCondition (); + SGCondition (); + virtual ~SGCondition (); virtual bool test () const = 0; }; @@ -40,12 +43,12 @@ public: * This condition is true only if the property returns a boolean * true value. */ -class FGPropertyCondition : public FGCondition +class SGPropertyCondition : public SGCondition { public: - FGPropertyCondition ( SGPropertyNode *prop_root, + SGPropertyCondition ( SGPropertyNode *prop_root, const char * propname ); - virtual ~FGPropertyCondition (); + virtual ~SGPropertyCondition (); virtual bool test () const { return _node->getBoolValue(); } private: const SGPropertyNode * _node; @@ -57,15 +60,15 @@ private: * * This condition is true only if the child condition is false. */ -class FGNotCondition : public FGCondition +class SGNotCondition : public SGCondition { public: // transfer pointer ownership - FGNotCondition (FGCondition * condition); - virtual ~FGNotCondition (); + SGNotCondition (SGCondition * condition); + virtual ~SGNotCondition (); virtual bool test () const; private: - FGCondition * _condition; + SGCondition * _condition; }; @@ -75,16 +78,16 @@ private: * This condition is true only if all of the conditions * in the group are true. */ -class FGAndCondition : public FGCondition +class SGAndCondition : public SGCondition { public: - FGAndCondition (); - virtual ~FGAndCondition (); + SGAndCondition (); + virtual ~SGAndCondition (); virtual bool test () const; // transfer pointer ownership - virtual void addCondition (FGCondition * condition); + virtual void addCondition (SGCondition * condition); private: - vector _conditions; + vector _conditions; }; @@ -94,23 +97,23 @@ private: * This condition is true if at least one of the conditions in the * group is true. */ -class FGOrCondition : public FGCondition +class SGOrCondition : public SGCondition { public: - FGOrCondition (); - virtual ~FGOrCondition (); + SGOrCondition (); + virtual ~SGOrCondition (); virtual bool test () const; // transfer pointer ownership - virtual void addCondition (FGCondition * condition); + virtual void addCondition (SGCondition * condition); private: - vector _conditions; + vector _conditions; }; /** * Abstract base class for property comparison conditions. */ -class FGComparisonCondition : public FGCondition +class SGComparisonCondition : public SGCondition { public: enum Type { @@ -118,8 +121,8 @@ public: GREATER_THAN, EQUALS }; - FGComparisonCondition (Type type, bool reverse = false); - virtual ~FGComparisonCondition (); + SGComparisonCondition (Type type, bool reverse = false); + virtual ~SGComparisonCondition (); virtual bool test () const; virtual void setLeftProperty( SGPropertyNode *prop_root, const char * propname ); @@ -143,17 +146,17 @@ private: * invoke the test() method whenever it needs to decide whether to * active itself, draw itself, and so on. */ -class FGConditional +class SGConditional { public: - FGConditional (); - virtual ~FGConditional (); + SGConditional (); + virtual ~SGConditional (); // transfer pointer ownership - virtual void setCondition (FGCondition * condition); - virtual const FGCondition * getCondition () const { return _condition; } + virtual void setCondition (SGCondition * condition); + virtual const SGCondition * getCondition () const { return _condition; } virtual bool test () const; private: - FGCondition * _condition; + SGCondition * _condition; }; @@ -168,8 +171,8 @@ private: * responsibility of the caller to delete the condition when * it is no longer needed. */ -FGCondition * fgReadCondition( SGPropertyNode *prop_root, - const SGPropertyNode *node ); +SGCondition *sgReadCondition( SGPropertyNode *prop_root, + const SGPropertyNode *node ); #endif // __SG_CONDITION_HXX diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index bcf6df5a..a0c4557d 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -1,4 +1,4 @@ -// newmat.cxx -- class to handle material properties +// mat.cxx -- class to handle material properties // // Written by Curtis Olson, started May 1998. // @@ -68,10 +68,10 @@ local_file_exists( const string& path ) { //////////////////////////////////////////////////////////////////////// -// Implementation of FGNewMat::Object. +// Implementation of SGMaterial::Object. //////////////////////////////////////////////////////////////////////// -FGNewMat::Object::Object (const SGPropertyNode * node, double range_m) +SGMaterial::Object::Object (const SGPropertyNode * node, double range_m) : _models_loaded(false), _coverage_m2(node->getDoubleValue("coverage-m2", 1000000)), _range_m(range_m) @@ -106,7 +106,7 @@ FGNewMat::Object::Object (const SGPropertyNode * node, double range_m) // load_models(); } -FGNewMat::Object::~Object () +SGMaterial::Object::~Object () { for (unsigned int i = 0; i < _models.size(); i++) { if (_models[i] != 0) { @@ -117,7 +117,7 @@ FGNewMat::Object::~Object () } int -FGNewMat::Object::get_model_count( FGModelLoader *loader, +SGMaterial::Object::get_model_count( SGModelLoader *loader, const string &fg_root, SGPropertyNode *prop_root, double sim_time_sec ) @@ -127,7 +127,7 @@ FGNewMat::Object::get_model_count( FGModelLoader *loader, } inline void -FGNewMat::Object::load_models ( FGModelLoader *loader, +SGMaterial::Object::load_models ( SGModelLoader *loader, const string &fg_root, SGPropertyNode *prop_root, double sim_time_sec ) @@ -163,8 +163,8 @@ FGNewMat::Object::load_models ( FGModelLoader *loader, } ssgEntity * -FGNewMat::Object::get_model( int index, - FGModelLoader *loader, +SGMaterial::Object::get_model( int index, + SGModelLoader *loader, const string &fg_root, SGPropertyNode *prop_root, double sim_time_sec ) @@ -174,7 +174,7 @@ FGNewMat::Object::get_model( int index, } ssgEntity * -FGNewMat::Object::get_random_model( FGModelLoader *loader, +SGMaterial::Object::get_random_model( SGModelLoader *loader, const string &fg_root, SGPropertyNode *prop_root, double sim_time_sec ) @@ -188,13 +188,13 @@ FGNewMat::Object::get_random_model( FGModelLoader *loader, } double -FGNewMat::Object::get_coverage_m2 () const +SGMaterial::Object::get_coverage_m2 () const { return _coverage_m2; } -FGNewMat::Object::HeadingType -FGNewMat::Object::get_heading_type () const +SGMaterial::Object::HeadingType +SGMaterial::Object::get_heading_type () const { return _heading_type; } @@ -202,10 +202,10 @@ FGNewMat::Object::get_heading_type () const //////////////////////////////////////////////////////////////////////// -// Implementation of FGNewMat::ObjectGroup. +// Implementation of SGMaterial::ObjectGroup. //////////////////////////////////////////////////////////////////////// -FGNewMat::ObjectGroup::ObjectGroup (SGPropertyNode * node) +SGMaterial::ObjectGroup::ObjectGroup (SGPropertyNode * node) : _range_m(node->getDoubleValue("range-m", 2000)) { // Load the object subnodes @@ -220,7 +220,7 @@ FGNewMat::ObjectGroup::ObjectGroup (SGPropertyNode * node) } } -FGNewMat::ObjectGroup::~ObjectGroup () +SGMaterial::ObjectGroup::~ObjectGroup () { for (unsigned int i = 0; i < _objects.size(); i++) { delete _objects[i]; @@ -229,19 +229,19 @@ FGNewMat::ObjectGroup::~ObjectGroup () } double -FGNewMat::ObjectGroup::get_range_m () const +SGMaterial::ObjectGroup::get_range_m () const { return _range_m; } int -FGNewMat::ObjectGroup::get_object_count () const +SGMaterial::ObjectGroup::get_object_count () const { return _objects.size(); } -FGNewMat::Object * -FGNewMat::ObjectGroup::get_object (int index) const +SGMaterial::Object * +SGMaterial::ObjectGroup::get_object (int index) const { return _objects[index]; } @@ -253,7 +253,7 @@ FGNewMat::ObjectGroup::get_object (int index) const //////////////////////////////////////////////////////////////////////// -FGNewMat::FGNewMat( const string &fg_root, +SGMaterial::SGMaterial( const string &fg_root, const SGPropertyNode *props, bool smooth_shading, bool use_textures ) @@ -263,7 +263,7 @@ FGNewMat::FGNewMat( const string &fg_root, build_ssg_state( false, smooth_shading, use_textures ); } -FGNewMat::FGNewMat( const string &texpath, +SGMaterial::SGMaterial( const string &texpath, bool smooth_shading, bool use_textures ) { @@ -272,7 +272,7 @@ FGNewMat::FGNewMat( const string &texpath, build_ssg_state( true, smooth_shading, use_textures ); } -FGNewMat::FGNewMat( ssgSimpleState *s, +SGMaterial::SGMaterial( ssgSimpleState *s, bool smooth_shading, bool use_textures ) { @@ -280,7 +280,7 @@ FGNewMat::FGNewMat( ssgSimpleState *s, set_ssg_state( s, smooth_shading, use_textures ); } -FGNewMat::~FGNewMat (void) +SGMaterial::~SGMaterial (void) { for (unsigned int i = 0; i < object_groups.size(); i++) { delete object_groups[i]; @@ -295,7 +295,7 @@ FGNewMat::~FGNewMat (void) //////////////////////////////////////////////////////////////////////// void -FGNewMat::read_properties( const string &fg_root, const SGPropertyNode * props ) +SGMaterial::read_properties( const string &fg_root, const SGPropertyNode * props ) { // Get the path to the texture string tname = props->getStringValue("texture", "unknown.rgb"); @@ -351,7 +351,7 @@ FGNewMat::read_properties( const string &fg_root, const SGPropertyNode * props ) //////////////////////////////////////////////////////////////////////// void -FGNewMat::init () +SGMaterial::init () { texture_path = ""; state = 0; @@ -372,7 +372,7 @@ FGNewMat::init () } bool -FGNewMat::load_texture () +SGMaterial::load_texture () { if (texture_loaded) { return false; @@ -388,7 +388,7 @@ FGNewMat::load_texture () void -FGNewMat::build_ssg_state( bool defer_tex_load, +SGMaterial::build_ssg_state( bool defer_tex_load, bool smooth_shading, bool use_textures ) { @@ -473,7 +473,7 @@ FGNewMat::build_ssg_state( bool defer_tex_load, } -void FGNewMat::set_ssg_state( ssgSimpleState *s, +void SGMaterial::set_ssg_state( ssgSimpleState *s, bool smooth_shading, bool use_textures ) { GLenum shade_model = ( smooth_shading ? GL_SMOOTH : GL_FLAT); diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx index 82772890..4bdd42fa 100644 --- a/simgear/scene/material/mat.hxx +++ b/simgear/scene/material/mat.hxx @@ -1,4 +1,4 @@ -// newmat.hxx -- a material in the scene graph. +// mat.hxx -- a material in the scene graph. // TODO: this class needs to be renamed. // // Written by Curtis Olson, started May 1998. @@ -23,8 +23,8 @@ // $Id$ -#ifndef _NEWMAT_HXX -#define _NEWMAT_HXX +#ifndef _SG_MAT_HXX +#define _SG_MAT_HXX #ifndef __cplusplus # error This library requires C++ @@ -52,7 +52,7 @@ SG_USING_STD(string); * defined in the $FG_ROOT/materials.xml file, and can be changed * at runtime. */ -class FGNewMat { +class SGMaterial { public: @@ -66,7 +66,7 @@ public: /** * A randomly-placeable object. * - * FGNewMat uses this class to keep track of the model(s) and + * SGMaterial uses this class to keep track of the model(s) and * parameters for a single instance of a randomly-placeable object. * The object can have more than one variant model (i.e. slightly * different shapes of trees), but they are considered equivalent @@ -91,7 +91,7 @@ public: * * @return The number of variant models. */ - int get_model_count( FGModelLoader *loader, + int get_model_count( SGModelLoader *loader, const string &fg_root, SGPropertyNode *prop_root, double sim_time_sec ); @@ -104,7 +104,7 @@ public: * @return The model. */ ssgEntity *get_model( int index, - FGModelLoader *loader, + SGModelLoader *loader, const string &fg_root, SGPropertyNode *prop_root, double sim_time_sec ); @@ -115,7 +115,7 @@ public: * * @return A randomly select model from the variants. */ - ssgEntity *get_random_model( FGModelLoader *loader, + ssgEntity *get_random_model( SGModelLoader *loader, const string &fg_root, SGPropertyNode *prop_root, double sim_time_sec ); @@ -152,7 +152,7 @@ public: * This class uses lazy loading so that models won't be held * in memory for materials that are never referenced. */ - void load_models( FGModelLoader *loader, + void load_models( SGModelLoader *loader, const string &fg_root, SGPropertyNode *prop_root, double sim_time_sec ); @@ -171,7 +171,7 @@ public: * * Grouping objects with the same range together significantly * reduces the memory requirements of randomly-placed objects. - * Each FGNewMat instance keeps a (possibly-empty) list of + * Each SGMaterial instance keeps a (possibly-empty) list of * object groups for placing randomly on the scenery. */ class ObjectGroup @@ -206,7 +206,7 @@ public: protected: - friend class FGNewMat; + friend class SGMaterial; ObjectGroup (SGPropertyNode * node); @@ -231,7 +231,7 @@ public: * state information for the material. This node is usually * loaded from the $FG_ROOT/materials.xml file. */ - FGNewMat( const string &fg_root, const SGPropertyNode *props, + SGMaterial( const string &fg_root, const SGPropertyNode *props, bool smooth_shading, bool use_textures ); @@ -241,7 +241,7 @@ public: * @param texture_path A string containing an absolute path * to a texture file (usually RGB). */ - FGNewMat( const string &texpath, bool smooth_shading, bool use_textures ); + SGMaterial( const string &texpath, bool smooth_shading, bool use_textures ); /** @@ -253,12 +253,12 @@ public: * * @param s The SSG state for this material. */ - FGNewMat( ssgSimpleState *s, bool smooth_shading, bool use_textures ); + SGMaterial( ssgSimpleState *s, bool smooth_shading, bool use_textures ); /** * Destructor. */ - virtual ~FGNewMat( void ); + virtual ~SGMaterial( void ); @@ -404,7 +404,7 @@ private: // Internal constructors and methods. //////////////////////////////////////////////////////////////////// - FGNewMat( const string &fg_root, const FGNewMat &mat ); // unimplemented + SGMaterial( const string &fg_root, const SGMaterial &mat ); // unimplemented void read_properties( const string &fg_root, const SGPropertyNode *props ); void build_ssg_state( bool defer_tex_load, @@ -416,4 +416,4 @@ private: }; -#endif // _NEWMAT_HXX +#endif // _SG_MAT_HXX diff --git a/simgear/scene/material/matlib.cxx b/simgear/scene/material/matlib.cxx index b13817e5..3a8d102b 100644 --- a/simgear/scene/material/matlib.cxx +++ b/simgear/scene/material/matlib.cxx @@ -56,11 +56,11 @@ SG_USING_STD(string); // global material management class -FGMaterialLib material_lib; +SGMaterialLib material_lib; // Constructor -FGMaterialLib::FGMaterialLib ( void ) { +SGMaterialLib::SGMaterialLib ( void ) { set_step(0); } @@ -227,7 +227,7 @@ static int gen_vasi_light_map() { // Load a library of material properties -bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { +bool SGMaterialLib::load( const string &fg_root, const string& mpath ) { SGPropertyNode materials; @@ -244,7 +244,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { for (int i = 0; i < nMaterials; i++) { const SGPropertyNode * node = materials.getChild(i); if (!strcmp(node->getName(), "material")) { - FGNewMat *m = new FGNewMat( fg_root, node, true, true ); + SGMaterial *m = new SGMaterial( fg_root, node, true, true ); vectornames = node->getChildren("name"); for ( unsigned int j = 0; j < names.size(); j++ ) { @@ -273,7 +273,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { gnd_lights->enable( GL_BLEND ); gnd_lights->disable( GL_ALPHA_TEST ); gnd_lights->disable( GL_LIGHTING ); - matlib["GROUND_LIGHTS"] = new FGNewMat( gnd_lights, true, true ); + matlib["GROUND_LIGHTS"] = new SGMaterial( gnd_lights, true, true ); GLuint tex_name; @@ -292,10 +292,10 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_white_lights->setMaterial ( GL_SPECULAR, 0.0, 0.0, 0.0, 0.0 ); rwy_white_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_white_lights->setTexture( tex_name ); - matlib["RWY_WHITE_LIGHTS"] = new FGNewMat( rwy_white_lights, true, true ); + matlib["RWY_WHITE_LIGHTS"] = new SGMaterial( rwy_white_lights, true, true ); // For backwards compatibility ... remove someday - matlib["RUNWAY_LIGHTS"] = new FGNewMat( rwy_white_lights, true, true ); - matlib["RWY_LIGHTS"] = new FGNewMat( rwy_white_lights, true, true ); + matlib["RUNWAY_LIGHTS"] = new SGMaterial( rwy_white_lights, true, true ); + matlib["RWY_LIGHTS"] = new SGMaterial( rwy_white_lights, true, true ); // end of backwards compatitibilty // hard coded runway medium intensity white light state @@ -314,7 +314,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_white_medium_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_white_medium_lights->setTexture( tex_name ); matlib["RWY_WHITE_MEDIUM_LIGHTS"] - = new FGNewMat( rwy_white_medium_lights, true, true ); + = new SGMaterial( rwy_white_medium_lights, true, true ); // hard coded runway low intensity white light state tex_name = gen_standard_dir_light_map( 235, 235, 195, 155 ); @@ -332,7 +332,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_white_low_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_white_low_lights->setTexture( tex_name ); matlib["RWY_WHITE_LOW_LIGHTS"] - = new FGNewMat( rwy_white_low_lights, true, true ); + = new SGMaterial( rwy_white_low_lights, true, true ); // hard coded runway yellow light state tex_name = gen_standard_dir_light_map( 235, 215, 20, 255 ); @@ -349,7 +349,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_yellow_lights->setMaterial ( GL_SPECULAR, 0.0, 0.0, 0.0, 0.0 ); rwy_yellow_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_yellow_lights->setTexture( tex_name ); - matlib["RWY_YELLOW_LIGHTS"] = new FGNewMat( rwy_yellow_lights, true, true ); + matlib["RWY_YELLOW_LIGHTS"] = new SGMaterial( rwy_yellow_lights, true, true ); // hard coded runway medium intensity yellow light state tex_name = gen_standard_dir_light_map( 235, 215, 20, 205 ); @@ -367,7 +367,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_yellow_medium_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_yellow_medium_lights->setTexture( tex_name ); matlib["RWY_YELLOW_MEDIUM_LIGHTS"] - = new FGNewMat( rwy_yellow_medium_lights, true, true ); + = new SGMaterial( rwy_yellow_medium_lights, true, true ); // hard coded runway low intensity yellow light state tex_name = gen_standard_dir_light_map( 235, 215, 20, 155 ); @@ -385,7 +385,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_yellow_low_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_yellow_low_lights->setTexture( tex_name ); matlib["RWY_YELLOW_LOW_LIGHTS"] - = new FGNewMat( rwy_yellow_low_lights, true, true ); + = new SGMaterial( rwy_yellow_low_lights, true, true ); // hard coded runway red light state tex_name = gen_standard_dir_light_map( 235, 90, 90, 255 ); @@ -403,7 +403,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_red_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_red_lights->setTexture( tex_name ); matlib["RWY_RED_LIGHTS"] - = new FGNewMat( rwy_red_lights, true, true ); + = new SGMaterial( rwy_red_lights, true, true ); // hard coded medium intensity runway red light state tex_name = gen_standard_dir_light_map( 235, 90, 90, 205 ); @@ -421,7 +421,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_red_medium_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_red_medium_lights->setTexture( tex_name ); matlib["RWY_RED_MEDIUM_LIGHTS"] - = new FGNewMat( rwy_red_medium_lights, true, true ); + = new SGMaterial( rwy_red_medium_lights, true, true ); // hard coded low intensity runway red light state tex_name = gen_standard_dir_light_map( 235, 90, 90, 205 ); @@ -439,7 +439,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_red_low_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_red_low_lights->setTexture( tex_name ); matlib["RWY_RED_LOW_LIGHTS"] - = new FGNewMat( rwy_red_low_lights, true, true ); + = new SGMaterial( rwy_red_low_lights, true, true ); // hard coded runway green light state tex_name = gen_standard_dir_light_map( 20, 235, 20, 255 ); @@ -457,7 +457,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_green_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_green_lights->setTexture( tex_name ); matlib["RWY_GREEN_LIGHTS"] - = new FGNewMat( rwy_green_lights, true, true ); + = new SGMaterial( rwy_green_lights, true, true ); // hard coded medium intensity runway green light state tex_name = gen_standard_dir_light_map( 20, 235, 20, 205 ); @@ -475,7 +475,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_green_medium_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_green_medium_lights->setTexture( tex_name ); matlib["RWY_GREEN_MEDIUM_LIGHTS"] - = new FGNewMat( rwy_green_medium_lights, true, true ); + = new SGMaterial( rwy_green_medium_lights, true, true ); // hard coded low intensity runway green light state tex_name = gen_standard_dir_light_map( 20, 235, 20, 205 ); @@ -493,7 +493,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_green_low_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_green_low_lights->setTexture( tex_name ); matlib["RWY_GREEN_LOW_LIGHTS"] - = new FGNewMat( rwy_green_low_lights, true, true ); + = new SGMaterial( rwy_green_low_lights, true, true ); // hard coded low intensity taxiway blue light state tex_name = gen_taxiway_dir_light_map( 90, 90, 235, 205 ); @@ -511,7 +511,7 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { taxiway_blue_low_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); taxiway_blue_low_lights->setTexture( tex_name ); matlib["RWY_BLUE_TAXIWAY_LIGHTS"] - = new FGNewMat( taxiway_blue_low_lights, true, true ); + = new SGMaterial( taxiway_blue_low_lights, true, true ); // hard coded runway vasi light state ssgSimpleState *rwy_vasi_lights = new ssgSimpleState(); @@ -527,14 +527,14 @@ bool FGMaterialLib::load( const string &fg_root, const string& mpath ) { rwy_vasi_lights->setMaterial ( GL_SPECULAR, 0.0, 0.0, 0.0, 0.0 ); rwy_vasi_lights->setMaterial ( GL_EMISSION, 0.0, 0.0, 0.0, 0.0 ); rwy_vasi_lights->setTexture( gen_vasi_light_map() ); - matlib["RWY_VASI_LIGHTS"] = new FGNewMat( rwy_vasi_lights, true, true ); + matlib["RWY_VASI_LIGHTS"] = new SGMaterial( rwy_vasi_lights, true, true ); return true; } // Load a library of material properties -bool FGMaterialLib::add_item ( const string &tex_path ) +bool SGMaterialLib::add_item ( const string &tex_path ) { string material_name = tex_path; int pos = tex_path.rfind( "/" ); @@ -545,7 +545,7 @@ bool FGMaterialLib::add_item ( const string &tex_path ) // Load a library of material properties -bool FGMaterialLib::add_item ( const string &mat_name, const string &full_path ) +bool SGMaterialLib::add_item ( const string &mat_name, const string &full_path ) { int pos = full_path.rfind( "/" ); string tex_name = full_path.substr( pos + 1 ); @@ -554,16 +554,16 @@ bool FGMaterialLib::add_item ( const string &mat_name, const string &full_path ) SG_LOG( SG_TERRAIN, SG_INFO, " Loading material " << mat_name << " (" << full_path << ")"); - material_lib.matlib[mat_name] = new FGNewMat( full_path, true, true ); + material_lib.matlib[mat_name] = new SGMaterial( full_path, true, true ); return true; } // Load a library of material properties -bool FGMaterialLib::add_item ( const string &mat_name, ssgSimpleState *state ) +bool SGMaterialLib::add_item ( const string &mat_name, ssgSimpleState *state ) { - FGNewMat *m = new FGNewMat( state, true, true ); + SGMaterial *m = new SGMaterial( state, true, true ); SG_LOG( SG_TERRAIN, SG_INFO, " Loading material given a premade " << "ssgSimpleState = " << mat_name ); @@ -575,8 +575,8 @@ bool FGMaterialLib::add_item ( const string &mat_name, ssgSimpleState *state ) // find a material record by material name -FGNewMat *FGMaterialLib::find( const string& material ) { - FGNewMat *result = NULL; +SGMaterial *SGMaterialLib::find( const string& material ) { + SGMaterial *result = NULL; material_map_iterator it = matlib.find( material ); if ( it != end() ) { result = it->second; @@ -588,10 +588,10 @@ FGNewMat *FGMaterialLib::find( const string& material ) { // Destructor -FGMaterialLib::~FGMaterialLib ( void ) { +SGMaterialLib::~SGMaterialLib ( void ) { // Free up all the material entries first for ( material_map_iterator it = begin(); it != end(); it++ ) { - FGNewMat *slot = it->second; + SGMaterial *slot = it->second; slot->deRef(); if ( slot->getRef() <= 0 ) { delete slot; @@ -601,21 +601,21 @@ FGMaterialLib::~FGMaterialLib ( void ) { // Set the step for all of the state selectors in the material slots -void FGMaterialLib::set_step ( int step ) +void SGMaterialLib::set_step ( int step ) { // container::iterator it = begin(); for ( material_map_iterator it = begin(); it != end(); it++ ) { const string &key = it->first; SG_LOG( SG_GENERAL, SG_INFO, "Updating material " << key << " to step " << step ); - FGNewMat *slot = it->second; + SGMaterial *slot = it->second; slot->get_state()->selectStep(step); } } // Get the step for the state selectors -int FGMaterialLib::get_step () +int SGMaterialLib::get_step () { material_map_iterator it = begin(); return it->second->get_state()->getSelectStep(); @@ -624,12 +624,12 @@ int FGMaterialLib::get_step () // Load one pending "deferred" texture. Return true if a texture // loaded successfully, false if no pending, or error. -void FGMaterialLib::load_next_deferred() { +void SGMaterialLib::load_next_deferred() { // container::iterator it = begin(); for ( material_map_iterator it = begin(); it != end(); it++ ) { /* we don't need the key, but here's how we'd get it if we wanted it. */ // const string &key = it->first; - FGNewMat *slot = it->second; + SGMaterial *slot = it->second; if (slot->load_texture()) return; } diff --git a/simgear/scene/material/matlib.hxx b/simgear/scene/material/matlib.hxx index 93d2492b..ccebc686 100644 --- a/simgear/scene/material/matlib.hxx +++ b/simgear/scene/material/matlib.hxx @@ -38,7 +38,7 @@ #include // plib include -class FGNewMat; +class SGMaterial; SG_USING_STD(string); SG_USING_STD(map); @@ -47,12 +47,12 @@ SG_USING_STD(less); // Material management class -class FGMaterialLib { +class SGMaterialLib { private: // associative array of materials - typedef map < string, FGNewMat *, less > material_map; + typedef map < string, SGMaterial *, less > material_map; typedef material_map::iterator material_map_iterator; typedef material_map::const_iterator const_material_map_iterator; @@ -61,7 +61,7 @@ private: public: // Constructor - FGMaterialLib ( void ); + SGMaterialLib ( void ); // Load a library of material properties bool load( const string &fg_root, const string& mpath ); @@ -72,7 +72,7 @@ public: bool add_item( const string &mat_name, ssgSimpleState *state ); // find a material record by material name - FGNewMat *find( const string& material ); + SGMaterial *find( const string& material ); void set_step (int step); int get_step (); @@ -89,12 +89,12 @@ public: const_material_map_iterator end() const { return matlib.end(); } // Destructor - ~FGMaterialLib ( void ); + ~SGMaterialLib ( void ); }; // global material management class -extern FGMaterialLib material_lib; +extern SGMaterialLib material_lib; #endif // _MATLIB_HXX diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index e20b597b..a258a1c7 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -101,55 +101,55 @@ read_interpolation_table (SGPropertyNode_ptr props) //////////////////////////////////////////////////////////////////////// -// Implementation of Animation +// Implementation of SGAnimation //////////////////////////////////////////////////////////////////////// // Initialize the static data member -double Animation::sim_time_sec = 0.0; +double SGAnimation::sim_time_sec = 0.0; -Animation::Animation (SGPropertyNode_ptr props, ssgBranch * branch) +SGAnimation::SGAnimation (SGPropertyNode_ptr props, ssgBranch * branch) : _branch(branch) { _branch->setName(props->getStringValue("name", 0)); } -Animation::~Animation () +SGAnimation::~SGAnimation () { } void -Animation::init () +SGAnimation::init () { } void -Animation::update() +SGAnimation::update() { } //////////////////////////////////////////////////////////////////////// -// Implementation of NullAnimation +// Implementation of SGNullAnimation //////////////////////////////////////////////////////////////////////// -NullAnimation::NullAnimation (SGPropertyNode_ptr props) - : Animation(props, new ssgBranch) +SGNullAnimation::SGNullAnimation (SGPropertyNode_ptr props) + : SGAnimation(props, new ssgBranch) { } -NullAnimation::~NullAnimation () +SGNullAnimation::~SGNullAnimation () { } //////////////////////////////////////////////////////////////////////// -// Implementation of RangeAnimation +// Implementation of SGRangeAnimation //////////////////////////////////////////////////////////////////////// -RangeAnimation::RangeAnimation (SGPropertyNode_ptr props) - : Animation(props, new ssgRangeSelector) +SGRangeAnimation::SGRangeAnimation (SGPropertyNode_ptr props) + : SGAnimation(props, new ssgRangeSelector) { float ranges[] = { props->getFloatValue("min-m", 0), props->getFloatValue("max-m", 5000) }; @@ -157,48 +157,48 @@ RangeAnimation::RangeAnimation (SGPropertyNode_ptr props) } -RangeAnimation::~RangeAnimation () +SGRangeAnimation::~SGRangeAnimation () { } //////////////////////////////////////////////////////////////////////// -// Implementation of BillboardAnimation +// Implementation of SGBillboardAnimation //////////////////////////////////////////////////////////////////////// -BillboardAnimation::BillboardAnimation (SGPropertyNode_ptr props) - : Animation(props, new ssgCutout(props->getBoolValue("spherical", true))) +SGBillboardAnimation::SGBillboardAnimation (SGPropertyNode_ptr props) + : SGAnimation(props, new ssgCutout(props->getBoolValue("spherical", true))) { } -BillboardAnimation::~BillboardAnimation () +SGBillboardAnimation::~SGBillboardAnimation () { } //////////////////////////////////////////////////////////////////////// -// Implementation of SelectAnimation +// Implementation of SGSelectAnimation //////////////////////////////////////////////////////////////////////// -SelectAnimation::SelectAnimation( SGPropertyNode *prop_root, +SGSelectAnimation::SGSelectAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props ) - : Animation(props, new ssgSelector), + : SGAnimation(props, new ssgSelector), _condition(0) { SGPropertyNode_ptr node = props->getChild("condition"); if (node != 0) - _condition = fgReadCondition(prop_root, node); + _condition = sgReadCondition(prop_root, node); } -SelectAnimation::~SelectAnimation () +SGSelectAnimation::~SGSelectAnimation () { delete _condition; } void -SelectAnimation::update() +SGSelectAnimation::update() { if (_condition != 0 && _condition->test()) ((ssgSelector *)_branch)->select(0xffff); @@ -209,13 +209,13 @@ SelectAnimation::update() //////////////////////////////////////////////////////////////////////// -// Implementation of SpinAnimation +// Implementation of SGSpinAnimation //////////////////////////////////////////////////////////////////////// -SpinAnimation::SpinAnimation( SGPropertyNode *prop_root, +SGSpinAnimation::SGSpinAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props, double sim_time_sec ) - : Animation(props, new ssgTransform), + : SGAnimation(props, new ssgTransform), _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)), _factor(props->getDoubleValue("factor", 1.0)), _position_deg(props->getDoubleValue("starting-position-deg", 0)), @@ -230,12 +230,12 @@ SpinAnimation::SpinAnimation( SGPropertyNode *prop_root, sgNormalizeVec3(_axis); } -SpinAnimation::~SpinAnimation () +SGSpinAnimation::~SGSpinAnimation () { } void -SpinAnimation::update() +SGSpinAnimation::update() { double dt = sim_time_sec - _last_time_sec; _last_time_sec = sim_time_sec; @@ -253,23 +253,23 @@ SpinAnimation::update() //////////////////////////////////////////////////////////////////////// -// Implementation of TimedAnimation +// Implementation of SGTimedAnimation //////////////////////////////////////////////////////////////////////// -TimedAnimation::TimedAnimation (SGPropertyNode_ptr props) - : Animation(props, new ssgSelector), +SGTimedAnimation::SGTimedAnimation (SGPropertyNode_ptr props) + : SGAnimation(props, new ssgSelector), _duration_sec(props->getDoubleValue("duration-sec", 1.0)), _last_time_sec(0), _step(-1) { } -TimedAnimation::~TimedAnimation () +SGTimedAnimation::~SGTimedAnimation () { } void -TimedAnimation::update() +SGTimedAnimation::update() { if ((sim_time_sec - _last_time_sec) >= _duration_sec) { _last_time_sec = sim_time_sec; @@ -283,12 +283,12 @@ TimedAnimation::update() //////////////////////////////////////////////////////////////////////// -// Implementation of RotateAnimation +// Implementation of SGRotateAnimation //////////////////////////////////////////////////////////////////////// -RotateAnimation::RotateAnimation( SGPropertyNode *prop_root, +SGRotateAnimation::SGRotateAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props ) - : Animation(props, new ssgTransform), + : SGAnimation(props, new ssgTransform), _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)), _offset_deg(props->getDoubleValue("offset-deg", 0.0)), _factor(props->getDoubleValue("factor", 1.0)), @@ -308,13 +308,13 @@ RotateAnimation::RotateAnimation( SGPropertyNode *prop_root, sgNormalizeVec3(_axis); } -RotateAnimation::~RotateAnimation () +SGRotateAnimation::~SGRotateAnimation () { delete _table; } void -RotateAnimation::update() +SGRotateAnimation::update() { if (_table == 0) { _position_deg = _prop->getDoubleValue() * _factor + _offset_deg; @@ -332,12 +332,12 @@ RotateAnimation::update() //////////////////////////////////////////////////////////////////////// -// Implementation of TranslateAnimation +// Implementation of SGTranslateAnimation //////////////////////////////////////////////////////////////////////// -TranslateAnimation::TranslateAnimation( SGPropertyNode *prop_root, +SGTranslateAnimation::SGTranslateAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props ) - : Animation(props, new ssgTransform), + : SGAnimation(props, new ssgTransform), _prop((SGPropertyNode *)prop_root->getNode(props->getStringValue("property", "/null"), true)), _offset_m(props->getDoubleValue("offset-m", 0.0)), _factor(props->getDoubleValue("factor", 1.0)), @@ -354,13 +354,13 @@ TranslateAnimation::TranslateAnimation( SGPropertyNode *prop_root, sgNormalizeVec3(_axis); } -TranslateAnimation::~TranslateAnimation () +SGTranslateAnimation::~SGTranslateAnimation () { delete _table; } void -TranslateAnimation::update() +SGTranslateAnimation::update() { if (_table == 0) { _position_m = (_prop->getDoubleValue() + _offset_m) * _factor; diff --git a/simgear/scene/model/animation.hxx b/simgear/scene/model/animation.hxx index 76cf8233..4bbdf829 100644 --- a/simgear/scene/model/animation.hxx +++ b/simgear/scene/model/animation.hxx @@ -23,7 +23,7 @@ SG_USING_STD(vector); // Don't pull in the headers, since we don't need them here. class SGInterpTable; -class FGCondition; +class SGCondition; // Has anyone done anything *really* stupid, like making min and max macros? @@ -43,13 +43,13 @@ class FGCondition; /** * Abstract base class for all animations. */ -class Animation : public ssgBase +class SGAnimation : public ssgBase { public: - Animation (SGPropertyNode_ptr props, ssgBranch * branch); + SGAnimation (SGPropertyNode_ptr props, ssgBranch * branch); - virtual ~Animation (); + virtual ~SGAnimation (); /** * Get the SSG branch holding the animation. @@ -84,48 +84,48 @@ protected: /** * A no-op animation. */ -class NullAnimation : public Animation +class SGNullAnimation : public SGAnimation { public: - NullAnimation (SGPropertyNode_ptr props); - virtual ~NullAnimation (); + SGNullAnimation (SGPropertyNode_ptr props); + virtual ~SGNullAnimation (); }; /** * A range, or level-of-detail (LOD) animation. */ -class RangeAnimation : public Animation +class SGRangeAnimation : public SGAnimation { public: - RangeAnimation (SGPropertyNode_ptr props); - virtual ~RangeAnimation (); + SGRangeAnimation (SGPropertyNode_ptr props); + virtual ~SGRangeAnimation (); }; /** * Animation to turn and face the screen. */ -class BillboardAnimation : public Animation +class SGBillboardAnimation : public SGAnimation { public: - BillboardAnimation (SGPropertyNode_ptr props); - virtual ~BillboardAnimation (); + SGBillboardAnimation (SGPropertyNode_ptr props); + virtual ~SGBillboardAnimation (); }; /** * Animation to select alternative versions of the same object. */ -class SelectAnimation : public Animation +class SGSelectAnimation : public SGAnimation { public: - SelectAnimation( SGPropertyNode *prop_root, + SGSelectAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props ); - virtual ~SelectAnimation (); + virtual ~SGSelectAnimation (); virtual void update(); private: - FGCondition * _condition; + SGCondition * _condition; }; @@ -134,13 +134,13 @@ private: * * This animation rotates at a specific velocity. */ -class SpinAnimation : public Animation +class SGSpinAnimation : public SGAnimation { public: - SpinAnimation( SGPropertyNode *prop_root, + SGSpinAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props, double sim_time_sec ); - virtual ~SpinAnimation (); + virtual ~SGSpinAnimation (); virtual void update(); private: SGPropertyNode_ptr _prop; @@ -156,11 +156,11 @@ private: /** * Animation to draw objects for a specific amount of time each. */ -class TimedAnimation : public Animation +class SGTimedAnimation : public SGAnimation { public: - TimedAnimation (SGPropertyNode_ptr props); - virtual ~TimedAnimation (); + SGTimedAnimation (SGPropertyNode_ptr props); + virtual ~SGTimedAnimation (); virtual void update(); private: double _duration_sec; @@ -174,11 +174,11 @@ private: * * This animation rotates to a specific position. */ -class RotateAnimation : public Animation +class SGRotateAnimation : public SGAnimation { public: - RotateAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props ); - virtual ~RotateAnimation (); + SGRotateAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props ); + virtual ~SGRotateAnimation (); virtual void update(); private: SGPropertyNode_ptr _prop; @@ -199,12 +199,12 @@ private: /** * Animation to slide along an axis. */ -class TranslateAnimation : public Animation +class SGTranslateAnimation : public SGAnimation { public: - TranslateAnimation( SGPropertyNode *prop_root, + SGTranslateAnimation( SGPropertyNode *prop_root, SGPropertyNode_ptr props ); - virtual ~TranslateAnimation (); + virtual ~SGTranslateAnimation (); virtual void update(); private: SGPropertyNode_ptr _prop; diff --git a/simgear/scene/model/loader.cxx b/simgear/scene/model/loader.cxx index e43b02f3..bf833fc4 100644 --- a/simgear/scene/model/loader.cxx +++ b/simgear/scene/model/loader.cxx @@ -9,15 +9,15 @@ //////////////////////////////////////////////////////////////////////// -// Implementation of FGSSGLoader. +// Implementation of SGssgLoader. //////////////////////////////////////////////////////////////////////// -FGSSGLoader::FGSSGLoader () +SGssgLoader::SGssgLoader () { // no op } -FGSSGLoader::~FGSSGLoader () +SGssgLoader::~SGssgLoader () { std::map::iterator it = _table.begin(); while (it != _table.end()) { @@ -27,7 +27,7 @@ FGSSGLoader::~FGSSGLoader () } void -FGSSGLoader::flush () +SGssgLoader::flush () { std::map::iterator it = _table.begin(); while (it != _table.end()) { @@ -45,19 +45,19 @@ FGSSGLoader::flush () //////////////////////////////////////////////////////////////////////// -// Implementation of FGModelLoader. +// Implementation of SGModelLoader. //////////////////////////////////////////////////////////////////////// -FGModelLoader::FGModelLoader () +SGModelLoader::SGModelLoader () { } -FGModelLoader::~FGModelLoader () +SGModelLoader::~SGModelLoader () { } ssgEntity * -FGModelLoader::load_model( const string &fg_root, +SGModelLoader::load_model( const string &fg_root, const string &path, SGPropertyNode *prop_root, double sim_time_sec ) @@ -66,7 +66,7 @@ FGModelLoader::load_model( const string &fg_root, // avoid duplicates. std::map::iterator it = _table.find(path); if (it == _table.end()) { - _table[path] = fgLoad3DModel( fg_root, path, prop_root, sim_time_sec ); + _table[path] = sgLoad3DModel( fg_root, path, prop_root, sim_time_sec ); it = _table.find(path); it->second->ref(); // add one reference to keep it around } diff --git a/simgear/scene/model/loader.hxx b/simgear/scene/model/loader.hxx index 293d651f..cd2da075 100644 --- a/simgear/scene/model/loader.hxx +++ b/simgear/scene/model/loader.hxx @@ -21,11 +21,11 @@ SG_USING_STD(string); /** * Base class for loading and managing SSG things. */ -class FGSSGLoader +class SGssgLoader { public: - FGSSGLoader (); - virtual ~FGSSGLoader (); + SGssgLoader (); + virtual ~SGssgLoader (); virtual void flush (); protected: std::map _table; @@ -35,11 +35,11 @@ protected: /** * Class for loading and managing models with XML wrappers. */ -class FGModelLoader : public FGSSGLoader +class SGModelLoader : public SGssgLoader { public: - FGModelLoader (); - virtual ~FGModelLoader (); + SGModelLoader (); + virtual ~SGModelLoader (); virtual ssgEntity *load_model( const string &fg_root, const string &path, diff --git a/simgear/scene/model/location.cxx b/simgear/scene/model/location.cxx index 033cf613..57c2975e 100644 --- a/simgear/scene/model/location.cxx +++ b/simgear/scene/model/location.cxx @@ -101,11 +101,11 @@ static void MakeTRANS( sgMat4 dst, const double Theta, //////////////////////////////////////////////////////////////////////// -// Implementation of FGLocation. +// Implementation of SGLocation. //////////////////////////////////////////////////////////////////////// // Constructor -FGLocation::FGLocation( void ): +SGLocation::SGLocation( void ): _dirty(true), _lon_deg(0), _lat_deg(0), @@ -125,26 +125,26 @@ FGLocation::FGLocation( void ): // Destructor -FGLocation::~FGLocation( void ) { +SGLocation::~SGLocation( void ) { } void -FGLocation::init () +SGLocation::init () { } void -FGLocation::bind () +SGLocation::bind () { } void -FGLocation::unbind () +SGLocation::unbind () { } void -FGLocation::setPosition (double lon_deg, double lat_deg, double alt_ft) +SGLocation::setPosition (double lon_deg, double lat_deg, double alt_ft) { _dirty = true; _lon_deg = lon_deg; @@ -153,7 +153,7 @@ FGLocation::setPosition (double lon_deg, double lat_deg, double alt_ft) } void -FGLocation::setOrientation (double roll_deg, double pitch_deg, double heading_deg) +SGLocation::setOrientation (double roll_deg, double pitch_deg, double heading_deg) { _dirty = true; _roll_deg = roll_deg; @@ -162,7 +162,7 @@ FGLocation::setOrientation (double roll_deg, double pitch_deg, double heading_de } double * -FGLocation::get_absolute_view_pos( const Point3D scenery_center ) +SGLocation::get_absolute_view_pos( const Point3D scenery_center ) { if ( _dirty ) { recalc( scenery_center ); @@ -171,7 +171,7 @@ FGLocation::get_absolute_view_pos( const Point3D scenery_center ) } float * -FGLocation::getRelativeViewPos( const Point3D scenery_center ) +SGLocation::getRelativeViewPos( const Point3D scenery_center ) { if ( _dirty ) { recalc( scenery_center ); @@ -180,7 +180,7 @@ FGLocation::getRelativeViewPos( const Point3D scenery_center ) } float * -FGLocation::getZeroElevViewPos( const Point3D scenery_center ) +SGLocation::getZeroElevViewPos( const Point3D scenery_center ) { if ( _dirty ) { recalc( scenery_center ); @@ -193,7 +193,7 @@ FGLocation::getZeroElevViewPos( const Point3D scenery_center ) // cached data "dirty") on the next "get". It calculates all the outputs // for viewer. void -FGLocation::recalc( const Point3D scenery_center ) +SGLocation::recalc( const Point3D scenery_center ) { recalcPosition( _lon_deg, _lat_deg, _alt_ft, scenery_center ); @@ -231,7 +231,7 @@ FGLocation::recalc( const Point3D scenery_center ) } void -FGLocation::recalcPosition( double lon_deg, double lat_deg, double alt_ft, +SGLocation::recalcPosition( double lon_deg, double lat_deg, double alt_ft, const Point3D scenery_center ) const { double sea_level_radius_m; @@ -278,6 +278,6 @@ FGLocation::recalcPosition( double lon_deg, double lat_deg, double alt_ft, } void -FGLocation::update (int dt) +SGLocation::update (int dt) { } diff --git a/simgear/scene/model/location.hxx b/simgear/scene/model/location.hxx index f7b141d0..4c2ac30f 100644 --- a/simgear/scene/model/location.hxx +++ b/simgear/scene/model/location.hxx @@ -37,16 +37,16 @@ // Define a structure containing view information -class FGLocation +class SGLocation { public: // Constructor - FGLocation( void ); + SGLocation( void ); // Destructor - virtual ~FGLocation( void ); + virtual ~SGLocation( void ); ////////////////////////////////////////////////////////////////////// // Part 1: standard FGSubsystem implementation. diff --git a/simgear/scene/model/model.cxx b/simgear/scene/model/model.cxx index db5a37e5..b6394fb7 100644 --- a/simgear/scene/model/model.cxx +++ b/simgear/scene/model/model.cxx @@ -39,7 +39,7 @@ SG_USING_STD(vector); static int animation_callback (ssgEntity * entity, int mask) { - ((Animation *)entity->getUserData())->update(); + ((SGAnimation *)entity->getUserData())->update(); return true; } @@ -83,7 +83,7 @@ splice_branch (ssgBranch * branch, ssgEntity * child) * Make an offset matrix from rotations and position offset. */ void -fgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot, +sgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot, double x_off, double y_off, double z_off ) { sgMat4 rot_matrix; @@ -95,33 +95,33 @@ fgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot, void -fgMakeAnimation( ssgBranch * model, +sgMakeAnimation( ssgBranch * model, const char * name, vector &name_nodes, SGPropertyNode *prop_root, SGPropertyNode_ptr node, double sim_time_sec ) { - Animation * animation = 0; + SGAnimation * animation = 0; const char * type = node->getStringValue("type", "none"); if (!strcmp("none", type)) { - animation = new NullAnimation(node); + animation = new SGNullAnimation(node); } else if (!strcmp("range", type)) { - animation = new RangeAnimation(node); + animation = new SGRangeAnimation(node); } else if (!strcmp("billboard", type)) { - animation = new BillboardAnimation(node); + animation = new SGBillboardAnimation(node); } else if (!strcmp("select", type)) { - animation = new SelectAnimation(prop_root, node); + animation = new SGSelectAnimation(prop_root, node); } else if (!strcmp("spin", type)) { - animation = new SpinAnimation(prop_root, node, sim_time_sec ); + animation = new SGSpinAnimation(prop_root, node, sim_time_sec ); } else if (!strcmp("timed", type)) { - animation = new TimedAnimation(node); + animation = new SGTimedAnimation(node); } else if (!strcmp("rotate", type)) { - animation = new RotateAnimation(prop_root, node); + animation = new SGRotateAnimation(prop_root, node); } else if (!strcmp("translate", type)) { - animation = new TranslateAnimation(prop_root, node); + animation = new SGTranslateAnimation(prop_root, node); } else { - animation = new NullAnimation(node); + animation = new SGNullAnimation(node); SG_LOG(SG_INPUT, SG_WARN, "Unknown animation type " << type); } @@ -170,7 +170,7 @@ fgMakeAnimation( ssgBranch * model, //////////////////////////////////////////////////////////////////////// ssgBranch * -fgLoad3DModel( const string &fg_root, const string &path, +sgLoad3DModel( const string &fg_root, const string &path, SGPropertyNode *prop_root, double sim_time_sec ) { @@ -213,7 +213,7 @@ fgLoad3DModel( const string &fg_root, const string &path, ssgTransform * alignmainmodel = new ssgTransform; alignmainmodel->addKid(model); sgMat4 res_matrix; - fgMakeOffsetsMatrix(&res_matrix, + sgMakeOffsetsMatrix(&res_matrix, props.getFloatValue("/offsets/heading-deg", 0.0), props.getFloatValue("/offsets/roll-deg", 0.0), props.getFloatValue("/offsets/pitch-deg", 0.0), @@ -230,7 +230,7 @@ fgLoad3DModel( const string &fg_root, const string &path, const char * name = animation_nodes[i]->getStringValue("name", 0); vector name_nodes = animation_nodes[i]->getChildren("object-name"); - fgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i], + sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i], sim_time_sec); } @@ -240,7 +240,7 @@ fgLoad3DModel( const string &fg_root, const string &path, SGPropertyNode_ptr node = model_nodes[i]; ssgTransform * align = new ssgTransform; sgMat4 res_matrix; - fgMakeOffsetsMatrix(&res_matrix, + sgMakeOffsetsMatrix(&res_matrix, node->getFloatValue("offsets/heading-deg", 0.0), node->getFloatValue("offsets/roll-deg", 0.0), node->getFloatValue("offsets/pitch-deg", 0.0), @@ -249,7 +249,7 @@ fgLoad3DModel( const string &fg_root, const string &path, node->getFloatValue("offsets/z-m", 0.0)); align->setTransform(res_matrix); - ssgBranch * kid = fgLoad3DModel( fg_root, node->getStringValue("path"), + ssgBranch * kid = sgLoad3DModel( fg_root, node->getStringValue("path"), prop_root, sim_time_sec ); align->addKid(kid); model->addKid(align); diff --git a/simgear/scene/model/model.hxx b/simgear/scene/model/model.hxx index 4102460d..8cf417b5 100644 --- a/simgear/scene/model/model.hxx +++ b/simgear/scene/model/model.hxx @@ -41,22 +41,23 @@ SG_USING_STD(vector); * Subsystems should not normally invoke this function directly; * instead, they should use the FGModelLoader declared in loader.hxx. */ -ssgBranch * fgLoad3DModel( const string& fg_root, const string &path, - SGPropertyNode *prop_root, double sim_time_sec ); +ssgBranch * +sgLoad3DModel( const string& fg_root, const string &path, + SGPropertyNode *prop_root, double sim_time_sec ); /** * Make an offset matrix from rotations and position offset. */ void -fgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot, +sgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot, double x_off, double y_off, double z_off ); /** * Make the animation */ void -fgMakeAnimation( ssgBranch * model, +sgMakeAnimation( ssgBranch * model, const char * name, vector &name_nodes, SGPropertyNode *prop_root, diff --git a/simgear/scene/model/placement.cxx b/simgear/scene/model/placement.cxx index 1669e38b..b408062b 100644 --- a/simgear/scene/model/placement.cxx +++ b/simgear/scene/model/placement.cxx @@ -26,10 +26,10 @@ SG_USING_STD(vector); //////////////////////////////////////////////////////////////////////// -// Implementation of FGModelPlacement. +// Implementation of SGModelPlacement. //////////////////////////////////////////////////////////////////////// -FGModelPlacement::FGModelPlacement () +SGModelPlacement::SGModelPlacement () : _lon_deg(0), _lat_deg(0), _elev_ft(0), @@ -38,16 +38,16 @@ FGModelPlacement::FGModelPlacement () _heading_deg(0), _selector(new ssgSelector), _position(new ssgTransform), - _location(new FGLocation) + _location(new SGLocation) { } -FGModelPlacement::~FGModelPlacement () +SGModelPlacement::~SGModelPlacement () { } void -FGModelPlacement::init( ssgBranch * model ) +SGModelPlacement::init( ssgBranch * model ) { if (model != 0) { _position->addKid(model); @@ -57,7 +57,7 @@ FGModelPlacement::init( ssgBranch * model ) } void -FGModelPlacement::update( const Point3D scenery_center ) +SGModelPlacement::update( const Point3D scenery_center ) { _location->setPosition( _lon_deg, _lat_deg, _elev_ft ); _location->setOrientation( _roll_deg, _pitch_deg, _heading_deg ); @@ -77,37 +77,37 @@ FGModelPlacement::update( const Point3D scenery_center ) } bool -FGModelPlacement::getVisible () const +SGModelPlacement::getVisible () const { return (_selector->getSelect() != 0); } void -FGModelPlacement::setVisible (bool visible) +SGModelPlacement::setVisible (bool visible) { _selector->select(visible); } void -FGModelPlacement::setLongitudeDeg (double lon_deg) +SGModelPlacement::setLongitudeDeg (double lon_deg) { _lon_deg = lon_deg; } void -FGModelPlacement::setLatitudeDeg (double lat_deg) +SGModelPlacement::setLatitudeDeg (double lat_deg) { _lat_deg = lat_deg; } void -FGModelPlacement::setElevationFt (double elev_ft) +SGModelPlacement::setElevationFt (double elev_ft) { _elev_ft = elev_ft; } void -FGModelPlacement::setPosition (double lon_deg, double lat_deg, double elev_ft) +SGModelPlacement::setPosition (double lon_deg, double lat_deg, double elev_ft) { _lon_deg = lon_deg; _lat_deg = lat_deg; @@ -115,25 +115,25 @@ FGModelPlacement::setPosition (double lon_deg, double lat_deg, double elev_ft) } void -FGModelPlacement::setRollDeg (double roll_deg) +SGModelPlacement::setRollDeg (double roll_deg) { _roll_deg = roll_deg; } void -FGModelPlacement::setPitchDeg (double pitch_deg) +SGModelPlacement::setPitchDeg (double pitch_deg) { _pitch_deg = pitch_deg; } void -FGModelPlacement::setHeadingDeg (double heading_deg) +SGModelPlacement::setHeadingDeg (double heading_deg) { _heading_deg = heading_deg; } void -FGModelPlacement::setOrientation (double roll_deg, double pitch_deg, +SGModelPlacement::setOrientation (double roll_deg, double pitch_deg, double heading_deg) { _roll_deg = roll_deg; diff --git a/simgear/scene/model/placement.hxx b/simgear/scene/model/placement.hxx index 453353b8..cf399676 100644 --- a/simgear/scene/model/placement.hxx +++ b/simgear/scene/model/placement.hxx @@ -23,7 +23,7 @@ SG_USING_STD(vector); // Don't pull in the headers, since we don't need them here. -class FGLocation; +class SGLocation; // Has anyone done anything *really* stupid, like making min and max macros? @@ -42,14 +42,14 @@ class FGLocation; /** * A wrapper for a model with a definite placement. */ -class FGModelPlacement +class SGModelPlacement { public: - FGModelPlacement (); - virtual ~FGModelPlacement (); + SGModelPlacement (); + virtual ~SGModelPlacement (); - virtual void FGModelPlacement::init( ssgBranch * model ); + virtual void SGModelPlacement::init( ssgBranch * model ); /* virtual void init( const string &fg_root, const string &path, SGPropertyNode *prop_root, @@ -58,7 +58,7 @@ public: virtual ssgEntity * getSceneGraph () { return (ssgEntity *)_selector; } - virtual FGLocation * getFGLocation () { return _location; } + virtual SGLocation * getSGLocation () { return _location; } virtual bool getVisible () const; virtual void setVisible (bool visible); @@ -102,7 +102,7 @@ private: ssgTransform * _position; // Location - FGLocation * _location; + SGLocation * _location; // Addition by Diarmuid Tyson for Multiplayer Support diff --git a/simgear/scene/sky/sky.cxx b/simgear/scene/sky/sky.cxx index 5ce06fe2..012fdd92 100644 --- a/simgear/scene/sky/sky.cxx +++ b/simgear/scene/sky/sky.cxx @@ -119,7 +119,9 @@ bool SGSky::repaint( sgVec4 sky_color, sgVec4 fog_color, stars->repaint( sun_angle, nstars, star_data ); for ( int i = 0; i < (int)cloud_layers.size(); ++i ) { - cloud_layers[i]->repaint( fog_color ); + if (cloud_layers[i]->getCoverage() != SGCloudLayer::SG_CLOUD_CLEAR){ + cloud_layers[i]->repaint( fog_color ); + } } } else { // turn off sky @@ -151,7 +153,9 @@ bool SGSky::reposition( sgVec3 view_pos, sgVec3 zero_elev, sgVec3 view_up, stars->reposition( view_pos, angle ); for ( int i = 0; i < (int)cloud_layers.size(); ++i ) { - cloud_layers[i]->reposition( zero_elev, view_up, lon, lat, alt ); + if ( cloud_layers[i]->getCoverage() != SGCloudLayer::SG_CLOUD_CLEAR ) { + cloud_layers[i]->reposition( zero_elev, view_up, lon, lat, alt ); + } } return true; diff --git a/simgear/sound/sound.cxx b/simgear/sound/sound.cxx index a5ac675b..366016cd 100644 --- a/simgear/sound/sound.cxx +++ b/simgear/sound/sound.cxx @@ -119,7 +119,7 @@ SGSound::init(SGPropertyNode *root, SGPropertyNode *node, SGSoundMgr *sndmgr, _property = root->getNode(node->getStringValue("property", ""), true); SGPropertyNode *condition = node->getChild("condition"); if (condition != NULL) - _condition = fgReadCondition(root, condition); + _condition = sgReadCondition(root, condition); if (!_property && !_condition) SG_LOG(SG_GENERAL, SG_WARN, diff --git a/simgear/sound/sound.hxx b/simgear/sound/sound.hxx index 539d172c..463c86e4 100644 --- a/simgear/sound/sound.hxx +++ b/simgear/sound/sound.hxx @@ -76,7 +76,7 @@ private: SGSoundMgr * _mgr; SGSimpleSound * _sample; - FGCondition * _condition; + SGCondition * _condition; SGPropertyNode * _property; bool _active; diff --git a/simgear/threads/SGQueue.hxx b/simgear/threads/SGQueue.hxx index 7a040be4..25fa2ca5 100644 --- a/simgear/threads/SGQueue.hxx +++ b/simgear/threads/SGQueue.hxx @@ -197,7 +197,7 @@ private: /** * Condition to signal when queue not empty. */ - SGCondition not_empty; + SGPthreadCond not_empty; private: // Prevent copying. diff --git a/simgear/threads/SGThread.cxx b/simgear/threads/SGThread.cxx index 6c5fe682..c6d016a0 100644 --- a/simgear/threads/SGThread.cxx +++ b/simgear/threads/SGThread.cxx @@ -75,7 +75,7 @@ int gettimeofday(struct timeval* tp, void* tzp) { #endif bool -SGCondition::wait( SGMutex& mutex, unsigned long ms ) +SGPthreadCond::wait( SGMutex& mutex, unsigned long ms ) { struct timeval now; ::gettimeofday( &now, 0 ); diff --git a/simgear/threads/SGThread.hxx b/simgear/threads/SGThread.hxx index e22f559a..fd7d4e66 100644 --- a/simgear/threads/SGThread.hxx +++ b/simgear/threads/SGThread.hxx @@ -157,7 +157,7 @@ SGThread::cancel() */ class SGMutex { - friend class SGCondition; + friend class SGPthreadCond; public: @@ -239,18 +239,18 @@ inline void SGMutex::unlock() * A condition variable is always associated with a mutex to avoid race * conditions. */ -class SGCondition +class SGPthreadCond { public: /** * Create a new condition variable. */ - SGCondition(); + SGPthreadCond(); /** * Destroy the condition object. */ - ~SGCondition(); + ~SGPthreadCond(); /** * Wait for this condition variable to be signaled. @@ -286,8 +286,8 @@ public: private: // Disable copying. - SGCondition(const SGCondition& ); - SGCondition& operator=(const SGCondition& ); + SGPthreadCond(const SGPthreadCond& ); + SGPthreadCond& operator=(const SGPthreadCond& ); private: @@ -297,31 +297,31 @@ private: pthread_cond_t cond; }; -inline SGCondition::SGCondition() +inline SGPthreadCond::SGPthreadCond() { int status = pthread_cond_init( &cond, 0 ); assert( status == 0 ); } -inline SGCondition::~SGCondition() +inline SGPthreadCond::~SGPthreadCond() { int status = pthread_cond_destroy( &cond ); assert( status == 0 ); } -inline void SGCondition::signal() +inline void SGPthreadCond::signal() { int status = pthread_cond_signal( &cond ); assert( status == 0 ); } -inline void SGCondition::broadcast() +inline void SGPthreadCond::broadcast() { int status = pthread_cond_broadcast( &cond ); assert( status == 0 ); } -inline void SGCondition::wait( SGMutex& mutex ) +inline void SGPthreadCond::wait( SGMutex& mutex ) { int status = pthread_cond_wait( &cond, &mutex.mutex ); assert( status == 0 );