From a3cfb9c4634e3ce7e052e72ce564d25e5367a430 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 15 Aug 2009 13:25:37 +0000 Subject: API cleanups, const optimizations, submodel lights/flares/particles import --- src/model/parts.h | 64 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 17 deletions(-) (limited to 'src/model/parts.h') diff --git a/src/model/parts.h b/src/model/parts.h index c3a0401..5c90efb 100644 --- a/src/model/parts.h +++ b/src/model/parts.h @@ -41,10 +41,18 @@ public: { } + /** + * @brief copy constructor + */ + inline Part(const Part& other) : part_location(other.location()) + { + } + /** * @brief constructor with location + * @param location location of this part within the parent model */ - inline Part(const math::Vector3f &location) : part_location(location) + inline Part(const math::Vector3f& location) : part_location(location) { } @@ -53,7 +61,7 @@ public: /** * @brief location of this part within the parent model */ - inline const math::Vector3f &location() const + inline const math::Vector3f& location() const { return part_location; } @@ -62,7 +70,7 @@ public: /** * @brief set the location within the parent model */ - inline void set_location(const math::Vector3f location) { part_location.assign(location); } + inline void set_location(const math::Vector3f& location) { part_location.assign(location); } /** * @brief set the location within the parent model @@ -74,7 +82,7 @@ public: /** * @brief mutable reference to the location of this part within the parent model */ - inline math::Vector3f &get_location() + inline math::Vector3f& get_location() { return part_location; } @@ -94,6 +102,11 @@ public: */ Light(); + /** + * @brief copy constructor + */ + Light(const Light& other); + /** * @brief destructor */ @@ -102,7 +115,7 @@ public: /* ---- inspectors ----------------------------------------- */ /// light color - inline const math::Color & color() const + inline const math::Color& color() const { return light_color; }; @@ -237,6 +250,11 @@ class Flare : public Light public: Flare(); + /** + * @brief copy constructor + */ + Flare(const Flare& other); + ~Flare(); /* ---- inspectors ----------------------------------------- */ @@ -282,7 +300,7 @@ public: return particles_axis; } - inline const std::string & script() const + inline const std::string& script() const { return particles_script; } @@ -323,14 +341,14 @@ public: inline void set_cull(const Cull cull) { particles_cull = cull; } - inline void set_script(const std::string &script) { particles_script.assign(script); } + inline void set_script(const std::string& script) { particles_script.assign(script); } /* ---- actors --------------------------------------------- */ /** * @brief mutable reference to the axis */ - inline math::Axis &get_axis() { return particles_axis; } + inline math::Axis& get_axis() { return particles_axis; } private: bool particles_entity; @@ -351,6 +369,12 @@ class Dock : public Part { public: Dock(); + + /** + * @brief copy constructor + */ + Dock(const Dock& other); + ~Dock(); /// dock radius, default is 0.01f @@ -369,32 +393,38 @@ private: /* ---- class SubModel --------------------------------------------- */ /// a submodel -class SubModel +class SubModel : public Part { public: SubModel(); + + SubModel(const SubModel& other); + ~SubModel(); - inline const std::string &name() const { return submodel_name; } + inline const std::string& name() const { return submodel_name; } inline const float scale() const { return submodel_scale; } - inline const math::Vector3f &location() const { return submodel_location; } + inline const math::Axis& axis() const { return submodel_axis; } - inline math::Axis &axis() { return submodel_axis; } inline void set_scale(const float scale) { submodel_scale = scale; } - inline void set_name(const std::string &name) { submodel_name.assign(name); } + inline void set_name(const std::string& name) { submodel_name.assign(name); } + + inline void set_axis(const math::Axis& axis) { submodel_axis.assign(axis); } - inline void set_location(const math::Vector3f &location) { submodel_location.assign(location); } + /* ---- actors --------------------------------------------- */ - inline void set_axis(const math::Axis &axis) { submodel_axis.assign(axis); } + /** + * @brief mutable reference to the axis + */ + inline math::Axis& get_axis() { return submodel_axis; } private: - std::string submodel_name; float submodel_scale; - math::Vector3f submodel_location; + std::string submodel_name; math::Axis submodel_axis; }; -- cgit v1.2.3