From 0d58c4f8ab1d174c808c77bf94342c91f6e0c443 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 13 Oct 2012 10:51:48 +0000 Subject: Draw zone colors and background texture on the galactic map. --- src/core/zone.cc | 38 ++++++++++++++++++++++++++++++-------- src/core/zone.h | 23 ++++++++++++++++++++--- 2 files changed, 50 insertions(+), 11 deletions(-) (limited to 'src/core') diff --git a/src/core/zone.cc b/src/core/zone.cc index b038d82..dbd257e 100644 --- a/src/core/zone.cc +++ b/src/core/zone.cc @@ -122,11 +122,14 @@ void Zone ::clear() Zone::Zone(std::string const & label) : Label(label), - zone_ambient_color(0.1f, 0.1f, 0.1f) + zone_location(), + zone_color(1.0f), + zone_ambient_color(0.1f) { - zone_id = 0; + zone_id = 0; zone_defaultview = 0; - zone_info = 0 ; + zone_info = 0; + zone_flags = 0; btVector3 worldAabbMin(-10000, -10000, -10000); btVector3 worldAabbMax(10000, 10000, 10000); @@ -142,11 +145,14 @@ Zone::Zone(std::string const & label) : Zone::Zone(std::istream & is) : Label(), - zone_ambient_color(0.1f, 0.1f, 0.1f) + zone_location(), + zone_color(1.0f), + zone_ambient_color(0.1f) { zone_id = 0; zone_defaultview = 0; - zone_info = 0 ; + zone_info = 0; + zone_flags = 0; // client side does not setup a bullet physics environment zone_bullet_cache = 0; @@ -180,7 +186,16 @@ void Zone::set_info(const Info *info) zone_info = info; } - +void Zone::set_color(const math::Color & color) +{ + zone_color.assign(color); +} + +void Zone::set_color(float r, float g, float b) +{ + zone_color.assign(r, g, b); +} + void Zone::print() { con_print << " zone id ^B" << id() << " ^Nlabel ^B" << label() << " ^Nname ^B" << name() << std::endl; @@ -283,8 +298,11 @@ void Zone::serialize_server_update(std::ostream & os) const os << zone_ambient_color.b << " "; os << (zone_defaultview ? zone_defaultview->id() : 0) << " "; os << zone_location << " "; - os << zone_flags; - + os << zone_flags << " "; + os << zone_ambient_color.r << " "; + os << zone_ambient_color.g << " "; + os << zone_ambient_color.b; + } void Zone::receive_server_update(std::istream &is) @@ -326,6 +344,10 @@ void Zone::receive_server_update(std::istream &is) // flags is >> zone_flags; + + // zone color + is >> r >> g >> b; + zone_color.assign(r, g, b); } } diff --git a/src/core/zone.h b/src/core/zone.h index 22440c4..860c871 100644 --- a/src/core/zone.h +++ b/src/core/zone.h @@ -138,6 +138,14 @@ public: return zone_info; } + /** + * @brief return the zone's color + * This is the color used to represent the zone on the galactic map + * */ + const math::Color & color() const { + return zone_color; + } + /** * @brief returns the galactic location of this zone * */ @@ -222,7 +230,14 @@ public: * @brief set the information record for this zone * */ void set_info(const Info *info); - + + /** + * @brief set the zone color + * */ + void set_color(const math::Color & color); + + void set_color(float r, float g, float b); + /* ---- serializers ---------------------------------------- */ /** @@ -273,10 +288,12 @@ public: private: unsigned int zone_id; unsigned int zone_flags; - + math::Vector3f zone_location; + math::Color zone_color; + std::string zone_sky; math::Color zone_ambient_color; - math::Vector3f zone_location; + Content zone_content; Entity *zone_defaultview; -- cgit v1.2.3