X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscene%2Fmaterial%2Fmatmodel.hxx;h=3e7d84a973ce06ec265104e5d3be947ee62ac637;hb=aef8f13290c74359c1a7a54bd5e6e375b3f0c49e;hp=a0fba3ada66ef7b365fa7fccad327e6e4d9001f7;hpb=f7a3dbc5ed76217e513ca4ab4da4f9ef0470c814;p=simgear.git diff --git a/simgear/scene/material/matmodel.hxx b/simgear/scene/material/matmodel.hxx index a0fba3ad..3e7d84a9 100644 --- a/simgear/scene/material/matmodel.hxx +++ b/simgear/scene/material/matmodel.hxx @@ -2,7 +2,7 @@ // // Written by David Megginson, December 2001 // -// Copyright (C) 1998 - 2003 Curtis L. Olson - curt@flightgear.org +// Copyright (C) 1998 - 2003 Curtis L. Olson - http://www.flightgear.org/~curt // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -16,7 +16,7 @@ // // 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$ @@ -24,24 +24,27 @@ #ifndef _SG_MAT_MODEL_HXX #define _SG_MAT_MODEL_HXX -#ifndef __cplusplus +#ifndef __cplusplus # error This library requires C++ -#endif +#endif #include -#include STL_STRING // Standard C++ string library +#include // Standard C++ string library +#include -#include -#include +#include +#include +#include +#include +#include +#include #include - -SG_USING_STD(string); +#include class SGMatModelGroup; -class SGModelLib; /** @@ -53,7 +56,7 @@ class SGModelLib; * different shapes of trees), but they are considered equivalent * and interchangeable. */ -class SGMatModel { +class SGMatModel : public SGReferenced { public: @@ -71,23 +74,7 @@ public: * * @return The number of variant models. */ - int get_model_count( SGModelLib *modellib, - const string &fg_root, - SGPropertyNode *prop_root, - double sim_time_sec ); - - - /** - * Get a specific variant model for the object. - * - * @param index The index of the model. - * @return The model. - */ - ssgEntity *get_model( int index, - SGModelLib *modellib, - const string &fg_root, - SGPropertyNode *prop_root, - double sim_time_sec ); + int get_model_count( SGPropertyNode *prop_root ); /** @@ -95,10 +82,7 @@ public: * * @return A randomly select model from the variants. */ - ssgEntity *get_random_model( SGModelLib *modellib, - const string &fg_root, - SGPropertyNode *prop_root, - double sim_time_sec ); + osg::Node *get_random_model( SGPropertyNode *prop_root, mt seed ); /** @@ -108,6 +92,19 @@ public: */ double get_coverage_m2 () const; + /** + * Get the visual range of the object in meters. + * + * @return The visual range. + */ + double get_range_m () const; + + /** + * Get a randomized visual range + * + * @return a randomized visual range + */ + double get_randomized_range_m(mt* seed) const; /** * Get the heading type for the object. @@ -116,14 +113,15 @@ public: */ HeadingType get_heading_type () const; + virtual ~SGMatModel (); + + protected: friend class SGMatModelGroup; SGMatModel (const SGPropertyNode * node, double range_m); - virtual ~SGMatModel (); - private: /** @@ -132,13 +130,10 @@ private: * This class uses lazy loading so that models won't be held * in memory for materials that are never referenced. */ - void load_models( SGModelLib *modellib, - const string &fg_root, - SGPropertyNode *prop_root, - double sim_time_sec ); + void load_models( SGPropertyNode *prop_root ); - vector _paths; - mutable vector _models; + std::vector _paths; + mutable std::vector > _models; mutable bool _models_loaded; double _coverage_m2; double _range_m; @@ -154,7 +149,7 @@ private: * Each SGMaterial instance keeps a (possibly-empty) list of * object groups for placing randomly on the scenery. */ -class SGMatModelGroup { +class SGMatModelGroup : public SGReferenced { public: @@ -194,9 +189,7 @@ protected: private: double _range_m; - vector _objects; - + std::vector > _objects; }; - #endif // _SG_MAT_MODEL_HXX