Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-03 18:31:13 +0000
committerStijn Buys <ingar@osirion.org>2008-05-03 18:31:13 +0000
commit5388c37bdc040ba50d21ec16a01f399d20592a90 (patch)
tree9c43947b1b25d7d7e40e5c3cada5ff1f48cd8d61 /src/render/draw.cc
parent5d1e18b796d41e035d0d3e828cc6db54ed21a4b6 (diff)
server frame time, rotation snap, flares
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r--src/render/draw.cc24
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;