From ea18c25aef4aa0104852f314dd76e4ce446673f3 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 12 Aug 2009 20:22:20 +0000 Subject: triangle/quad code cleanup,corrects submodel origin, enable quad rendering again --- src/model/model.h | 55 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'src/model/model.h') diff --git a/src/model/model.h b/src/model/model.h index 2ca2734..af3b1dc 100644 --- a/src/model/model.h +++ b/src/model/model.h @@ -52,13 +52,13 @@ public: typedef std::list Groups; /// create a model with a name - Model(std::string const & name); + Model(const std::string & name); /// delete the model, and all fragments, lights, etc ~Model(); /// the name of the model - inline std::string const & name() const + inline const std::string & name() const { return model_name; } @@ -100,13 +100,13 @@ public: } /// maximum values of the bounding box - inline math::Vector3f const & maxbbox() const + inline const math::Vector3f & maxbbox() const { return model_maxbbox; } /// minimum values of the bounding box - inline math::Vector3f const & minbbox() const + inline const math::Vector3f & minbbox() const { return model_minbbox; } @@ -124,7 +124,16 @@ public: } /// engine color for this model - inline math::Color const & enginecolor() const { return model_enginecolor; } + inline const math::Color & enginecolor() const + { + return model_enginecolor; + } + + /// original origin + inline const math::Vector3f & origin() const + { + return model_origin; + } /// add a light to the model void add_light(Light *light); @@ -140,8 +149,10 @@ public: /// add a fragment group to the model void add_group(FragmentGroup *group); - - float model_radius; + + void set_radius(const float radius); + + void set_origin(const math::Vector3f &origin); math::Vector3f model_maxbbox; math::Vector3f model_minbbox; @@ -151,6 +162,15 @@ public: math::Color model_enginecolor; + /// 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; + /* ---- static functions for the Model registry -------------------- */ /// the model registry @@ -160,10 +180,10 @@ public: } /// get name model, returns 0 if not found - static Model *find(std::string const & name); + static Model *find(const std::string & name); /// get named model from the registry and load it if necessary - static Model *load(std::string const & name); + static Model *load(const std::string & name); /// clear the model registry static void clear(); @@ -173,19 +193,9 @@ public: /// 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; Docks model_docks; @@ -193,6 +203,11 @@ private: Lights model_lights; ParticleSystems model_particles; Groups model_groups; + + math::Vector3f model_origin; + float model_radius; + + static Registry model_registry; }; } -- cgit v1.2.3