diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 18e587a..2938442 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -4,6 +4,9 @@ the terms and conditions of the GNU General Public License version 2 */ +#include <sstream> +#include <iomanip> + #include "core/core.h" #include "core/model.h" #include "render/render.h" @@ -259,8 +262,18 @@ void pass_visibility() if (!entity->model() && entity->modelname().size()) { entity->entity_model = core::Model::get(entity->modelname()); - if (!entity->model()) + if (!entity->model()) { entity->entity_modelname.clear(); + } else { + for (std::list<core::Light *>::iterator lit = entity->model()->model_light.begin(); lit != entity->model()->model_light.end(); lit++) { + core::Light *light = (*lit); + + // load flare texture + std::stringstream flarename; + flarename << "bitmaps/fx/flare" << std::setfill('0') << std::setw(2) << light->flare(); + light->render_texture = Textures::load(flarename.str()); + } + } } if (entity->model()) { @@ -385,7 +398,7 @@ void draw_pass_model_fx() { void draw_pass_model_lights() { //glPointSize(10); - Textures::bind("bitmaps/fx/flare00"); + size_t flare_texture = Textures::bind("bitmaps/fx/flare00"); gl::enable(GL_TEXTURE_2D); gl::begin(gl::Quads); @@ -404,7 +417,12 @@ void draw_pass_model_lights() if (!(*lit)->strobe() || (( t - floorf(t)) <= (*lit)->time())) { math::Vector3f location = entity->location() + (entity->axis() * (*lit)->location()); float light_size = 0.0625 * (*lit)->radius(); - + + if ((*lit)->render_texture != flare_texture) { + gl::end(); + flare_texture = Textures::bind((*lit)->render_texture); + gl::begin(gl::Quads); + } math::Color color((*lit)->color()); color.a = 0.8; |