Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--osirion.kdevelop.pcsbin579707 -> 581115 bytes
-rw-r--r--osirion.kdevses16
-rw-r--r--src/core/entity.cc2
-rw-r--r--src/core/entity.h7
-rw-r--r--src/core/model.cc42
-rw-r--r--src/core/model.h9
-rw-r--r--src/render/draw.cc10
7 files changed, 75 insertions, 11 deletions
diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs
index ded2355..087b490 100644
--- a/osirion.kdevelop.pcs
+++ b/osirion.kdevelop.pcs
Binary files differ
diff --git a/osirion.kdevses b/osirion.kdevses
index a1c17a4..25c6235 100644
--- a/osirion.kdevses
+++ b/osirion.kdevses
@@ -2,17 +2,17 @@
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
<DocsAndViews NumberOfDocuments="4" >
- <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/camera.cc" >
- <View0 Encoding="" line="160" Type="Source" />
+ <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/view.cc" >
+ <View0 Encoding="" Type="Source" />
</Doc0>
- <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/entity.cc" >
- <View0 Encoding="" line="203" Type="Source" />
+ <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/video.cc" >
+ <View0 Encoding="" Type="Source" />
</Doc1>
- <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/game/ship.cc" >
- <View0 Encoding="" line="40" Type="Source" />
+ <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/client.cc" >
+ <View0 Encoding="" line="145" Type="Source" />
</Doc2>
- <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/netclient.cc" >
- <View0 Encoding="" line="0" Type="Source" />
+ <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/draw.cc" >
+ <View0 Encoding="" line="405" Type="Source" />
</Doc3>
</DocsAndViews>
<pluginList>
diff --git a/src/core/entity.cc b/src/core/entity.cc
index b186c64..ea5b9bc 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -102,6 +102,7 @@ Entity::Entity(unsigned int flags) :
entity_name.clear();
entity_renderstate = 0;
+ entity_renderfuzz = math::randomf();
add(this);
}
@@ -140,6 +141,7 @@ Entity::Entity(std::istream & is)
entity_dirty = false;
entity_renderstate = 0;
+ entity_renderfuzz = math::randomf();
add(this, entity_id);
}
diff --git a/src/core/entity.h b/src/core/entity.h
index 05ca641..e71b034 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -61,6 +61,12 @@ public:
/// core type id
virtual inline unsigned int type() const { return Default; }
+ /// client state
+ inline unsigned int state() const { return entity_renderstate; }
+
+ /// client render fuzz factor
+ inline float fuzz() const { return entity_renderfuzz; };
+
/// entity flags
inline unsigned int flags() const { return entity_flags; }
@@ -150,6 +156,7 @@ public:
bool entity_destroyed;
unsigned int entity_renderstate;
+ float entity_renderfuzz;
private:
/// add an entity to the registry
diff --git a/src/core/model.cc b/src/core/model.cc
index a09c7fd..e956612 100644
--- a/src/core/model.cc
+++ b/src/core/model.cc
@@ -181,6 +181,9 @@ Light::Light(math::Vector3f const & location, math::Color const & color, bool st
light_color(color)
{
light_strobe = strobe;
+ light_radius = 1.0f;
+ light_frequency = 1.0f;
+ light_offset = 0.0f;
}
Light::~Light()
@@ -245,6 +248,9 @@ Model::Model(std::string const & name) :
float class_angle = 0;
math::Color class_color;
unsigned int class_spawnflags = 0;
+ float class_light = 100;
+ float class_frequency = 1.0f;
+ float class_offset = 0;
bool brush_detail = false;
while (ifs) {
@@ -263,6 +269,9 @@ Model::Model(std::string const & name) :
class_origin = math::Vector3f(0,0,0);
class_color = math::Color(1, 1, 1);
class_spawnflags = 0;
+ class_light = 100;
+ class_offset = 0;
+ class_frequency = 1.0f;
brush_detail = false;
}
level ++;
@@ -290,7 +299,11 @@ Model::Model(std::string const & name) :
//con_debug << " engine at " << class_origin << "\n";
add_engine(new Engine(class_origin * model_scale));
} else if ((level == 1) && (class_name == "light")) {
- add_light(new Light(class_origin * model_scale, class_color, (class_spawnflags & 1) == 1));
+ Light *light = new Light(class_origin * model_scale, class_color, (class_spawnflags & 1) == 1);
+ light->light_radius = class_light / 100.0f;
+ light->light_offset = class_offset;
+ light->light_frequency = class_frequency;
+ add_light(light);
}
if (level == 1) {
@@ -360,6 +373,33 @@ Model::Model(std::string const & name) :
is >> class_spawnflags;
//con_debug << " spawnflags '" << class_spawnflags << "'" << std::endl;
+ } else if (firstword == "\"light\"") {
+ std::string tmp;
+ char c;
+ while ((linestream.get(c)) && (c != '"'));
+ while ((linestream.get(c)) && (c != '"'))
+ tmp += c;
+ std::istringstream is(tmp);
+ is >> class_light;
+
+ } else if (firstword == "\"frequency\"") {
+ std::string tmp;
+ char c;
+ while ((linestream.get(c)) && (c != '"'));
+ while ((linestream.get(c)) && (c != '"'))
+ tmp += c;
+ std::istringstream is(tmp);
+ is >> class_frequency;
+
+ } else if (firstword == "\"offset\"") {
+ std::string tmp;
+ char c;
+ while ((linestream.get(c)) && (c != '"'));
+ while ((linestream.get(c)) && (c != '"'))
+ tmp += c;
+ std::istringstream is(tmp);
+ is >> class_offset;
+
} else if (firstword == "(") {
if ((level == 2) && (class_name == "worldspawn")) {
//cout << " BRUSH PLANE" << std::endl;
diff --git a/src/core/model.h b/src/core/model.h
index 60746ae..1c56982 100644
--- a/src/core/model.h
+++ b/src/core/model.h
@@ -120,10 +120,19 @@ public:
inline math::Color const & color() const { return light_color; };
inline bool strobe() const { return light_strobe; }
+
+ inline float radius() const { return light_radius; }
+
+ inline float offset() const { return light_offset; }
+
+ inline float frequency() const { return light_frequency; }
math::Vector3f light_location;
math::Color light_color;
bool light_strobe;
+ float light_radius;
+ float light_frequency;
+ float light_offset;
};
diff --git a/src/render/draw.cc b/src/render/draw.cc
index d125420..741eb3d 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -392,7 +392,7 @@ void draw_pass_model_lights()
gl::begin(gl::Quads);
- const float light_size = 0.0625;
+
for (std::map<unsigned int, core::Entity *>::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
core::Entity *entity = (*it).second;
@@ -400,9 +400,15 @@ void draw_pass_model_lights()
if ( test_drawfx_distance(entity) && (entity->model()->model_light.size())) {
for (std::list<core::Light *>::iterator lit = entity->model()->model_light.begin(); lit != entity->model()->model_light.end(); lit++) {
- if (!(*lit)->strobe() || (( core::application()->time() - floorf(core::application()->time()) ) < 0.5f)) {
+ // strobe frequency
+ float t = 1.0f;
+ if ((*lit)->strobe())
+ t = (core::application()->time() + entity->fuzz() + (*lit)->offset()) * (*lit)->frequency();
+
+ if (!(*lit)->strobe() || (( t - floorf(t)) < 0.5f)) {
math::Vector3f location = entity->location() + (entity->axis() * (*lit)->location());
float n = dotproduct(camera_axis.forward(), (camera_eye-location));
+ float light_size = 0.0625 * (*lit)->radius();
if (n < 0) {
math::Color color((*lit)->color());