Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/model/asefile.h5
-rw-r--r--src/model/mapfile.cc1
-rw-r--r--src/model/parts.cc1
-rw-r--r--src/model/parts.h9
-rw-r--r--src/render/draw.cc20
5 files changed, 33 insertions, 3 deletions
diff --git a/src/model/asefile.h b/src/model/asefile.h
index dc1516b..c792a9d 100644
--- a/src/model/asefile.h
+++ b/src/model/asefile.h
@@ -86,7 +86,10 @@ private:
inline const std::string &name() const { return asefile_name; }
- inline const bool is_open() const { return asefile_ifs.is_open(); }
+ inline bool is_open()
+ {
+ return asefile_ifs.is_open();
+ }
std::string asefile_name;
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index 385f986..271af06 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -1031,6 +1031,7 @@ Model * MapFile::load(std::string const &name)
} else if (mapfile.got_key_int("spawnflags", u)) {
light->light_strobe = spawnflag_isset(u, 1);
light->light_entity = spawnflag_isset(u, 2);
+ light->light_engine = spawnflag_isset(u, 4);
} else if (mapfile.got_key_float("light", light->light_radius)) {
light->light_radius *= LIGHTSCALE;
diff --git a/src/model/parts.cc b/src/model/parts.cc
index a4a2d1e..d4ff20b 100644
--- a/src/model/parts.cc
+++ b/src/model/parts.cc
@@ -21,6 +21,7 @@ Light::Light() :
light_offset = 0.0f;
light_time = 0.5f;
light_flare = 0;
+ light_engine = 0;
render_texture = 0;
}
diff --git a/src/model/parts.h b/src/model/parts.h
index 8593147..3e5e74f 100644
--- a/src/model/parts.h
+++ b/src/model/parts.h
@@ -31,7 +31,7 @@ class Light
public:
Light();
- Light(const math::Vector3f & location, const math::Color & color, bool strobe=false);
+ Light(const math::Vector3f & location, const math::Color & color, bool strobe=false, bool engine=false);
~Light();
@@ -86,6 +86,12 @@ public:
{
return light_flare;
}
+
+ /// true if this light has engine activation
+ inline const bool engine() const
+ {
+ return light_engine;
+ }
/// render texture number
inline size_t texture() const
@@ -97,6 +103,7 @@ public:
math::Color light_color;
bool light_strobe;
bool light_entity;
+ bool light_engine;
float light_radius;
float light_frequency;
float light_offset;
diff --git a/src/render/draw.cc b/src/render/draw.cc
index da8c8d3..150356c 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -904,6 +904,17 @@ void draw_pass_model_fx(float elapsed)
for (model::Model::Lights::iterator lit = entity->model()->lights().begin(); lit != entity->model()->lights().end(); lit++) {
light = (*lit);
+ // engine flares
+ thrust = 1.0f;
+ if (light->engine() && ( entity->type() == core::Entity::Controlable)) {
+ core::EntityControlable *ec = static_cast<core::EntityControlable *>(entity);
+ if ((ec->state() == core::Entity::ImpulseInitiate) || (ec->state() == core::Entity::Impulse)) {
+ thrust = 1.0f;
+ } else {
+ thrust = ec->thrust();
+ }
+ }
+
// strobe frequency
t = 1.0f;
if (light->strobe())
@@ -919,12 +930,17 @@ void draw_pass_model_fx(float elapsed)
gl::begin(gl::Quads);
}
+ // default alpha is 0.8
+ a = 0.8f;
if (light->entity()) {
color.assign(entity->color());
+ } else if (light->engine()) {
+ color.assign(entity->model()->enginecolor());
+ a *= thrust;
} else {
color.assign(light->color());
}
- color.a = 0.8;
+ color.a = a;
gl::color(color);
glTexCoord2f(0,1);
@@ -995,6 +1011,8 @@ void draw_pass_model_fx(float elapsed)
a = math::absf( dotproduct(flare_axis.forward(), Camera::axis().forward()));
if (a > 0.1f) {
+
+ // alpha decreases as the viewing angle increases
a = a - 0.1f;
if (flare->entity()) {
color.assign(entity->color());