From f416e6b792e5dda143f60b7a2724db6b3ec33d75 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 28 Dec 2012 22:55:35 +0000 Subject: Support for rendering globes with rings, removed hardcoded 'corona' prefix for corona textures, added support for projectile fire sounds. --- src/ui/modelview.cc | 14 ++++++++++++-- src/ui/modelview.h | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/ui') diff --git a/src/ui/modelview.cc b/src/ui/modelview.cc index 71fff6c..679c7b6 100755 --- a/src/ui/modelview.cc +++ b/src/ui/modelview.cc @@ -63,6 +63,7 @@ void ModelView::reset() modelview_globetexturename.clear(); modelview_globecoronaname.clear(); + modelview_globeringsname.clear(); modelview_globebright = false; } @@ -72,11 +73,12 @@ void ModelView::clear() modelview_mode = Model; } -void ModelView::set_globetexturename(const std::string & texturename, const bool bright, const std::string & coronaname) +void ModelView::set_globetexturename(const std::string & texturename, const std::string & coronaname, const std::string ringsname, const bool bright) { reset(); modelview_globetexturename.assign(texturename); modelview_globecoronaname.assign(coronaname); + modelview_globeringsname.assign(ringsname); modelview_globebright = bright; } @@ -231,7 +233,7 @@ void ModelView::draw_globe() gl::disable(GL_LIGHTING); if (modelview_globecoronaname.size()) { - size_t corona_id = render::Textures::load("textures/corona/" + modelview_globecoronaname); + size_t corona_id = render::Textures::load("textures/" + modelview_globecoronaname); render::draw_globe_corona(math::Vector3f(0.0f, 0.0f, 0.0f), modelview_color_primary, reference_radius, corona_id); } } @@ -246,6 +248,14 @@ void ModelView::draw_globe() render::draw_sphere(modelview_color_primary, reference_radius); + if (modelview_globeringsname.size()) { + size_t rings_id = render::Textures::load("textures/" + modelview_globeringsname); + if (!modelview_globetexturename.size()) { + gl::enable(GL_TEXTURE_2D); + } + render::draw_globe_rings(modelview_color_primary, rings_id); + } + gl::pop(); render::State::set_normalize(false); diff --git a/src/ui/modelview.h b/src/ui/modelview.h index 4642551..e23fd1c 100755 --- a/src/ui/modelview.h +++ b/src/ui/modelview.h @@ -45,7 +45,7 @@ public: /** * @brief show a textured globe with an optional corona * */ - void set_globetexturename(const std::string & texturename, const bool bright, const std::string & coronaname); + void set_globetexturename(const std::string & texturename, const std::string & coronaname, const std::string ringsname, const bool bright = false); /** * @brief show a model @@ -111,6 +111,7 @@ private: std::string modelview_modelname; std::string modelview_globetexturename; std::string modelview_globecoronaname; + std::string modelview_globeringsname; bool modelview_globebright; math::Color modelview_color_primary; -- cgit v1.2.3