/* model/model.h This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2 */ #ifndef __INCLUDED_MODEL_MODEL_H__ #define __INCLUDED_MODEL_MODEL_H__ #include #include #include #include "math/mathlib.h" #include "model/engine.h" #include "model/fragment.h" #include "model/light.h" #include "model/flare.h" /// classes representing 3D geometry namespace model { /// a 3D model contains a list of faces class Model { public: /// type definition for the model registry typedef std::map Registry; /// type definition for a list of model fragments typedef std::list Fragments; /// type definition for a list of model lights typedef std::list Lights; /// type definition for a list of model flares typedef std::list Flares; /// type definition for a list of model engines typedef std::list Engines; /// create a model with a name Model(std::string const & name); /// delete the model, and all fragments, lights, etc ~Model(); /// the name of the model inline std::string const & name() const { return model_name; } /// radius inline float radius() const { return model_radius; } /// list of fragments inline Fragments & fragments() { return model_fragments; } /// list of lights inline Lights & lights() { return model_lights; } /// list of flares inline Flares & flares() { return model_flares; } /// list of engines inline Engines & engines() { return model_engines; } /// maximum values of the bounding box inline math::Vector3f const & maxbbox() const { return model_maxbbox; } /// minimum values of the bounding box inline math::Vector3f const & minbbox() const { return model_minbbox; } /// engine sound loop for this model inline unsigned int & enginesound() { return model_enginesound; } /// add a light to the model void add_light(Light *light); /// add an engine to the model void add_engine(Engine *engine); /// add a flare to the model void add_flare(Flare *flare); float model_radius; math::Vector3f model_maxbbox; math::Vector3f model_minbbox; unsigned int model_enginesound; /* ---- static functions for the Model registry -------------------- */ /// the model registry static inline Registry & registry() { return model_registry; } /// get name model, returns 0 if not found static Model *find(std::string const & name); /// get named model from the registry and load it if necessary static Model *load(std::string const & name); /// clear the model registry static void clear(); /// list the content of the model registry static void list(); /// list one model static void list_model(Model *model); /// total number of triangles size_t model_tris_count; /// number of detail triangles size_t model_tris_detail_count; /// total number of quads size_t model_quad_count; /// number of detail quads size_t model_quad_detail_count; private: static Registry model_registry; std::string model_name; Fragments model_fragments; Flares model_flares; Engines model_engines; Lights model_lights; }; } #endif // __INCLUDED_MODEL_MODEL_H__