From 5388c37bdc040ba50d21ec16a01f399d20592a90 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 3 May 2008 18:31:13 +0000 Subject: server frame time, rotation snap, flares --- src/render/draw.cc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/render/draw.cc') 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 +#include + #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::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; -- cgit v1.2.3