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-07 18:56:00 +0000
committerStijn Buys <ingar@osirion.org>2008-05-07 18:56:00 +0000
commit421fc71813f08bfe359f9ac7596933a7e4cea6e0 (patch)
tree15b3630488281280d6634804b4a1a41fc402ab0a /src/render/draw.cc
parent91d3a0352088611d3b78d3344b7a2bf2d4955a0a (diff)
client-side frame interpolation: network updates, interpolation of position
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r--src/render/draw.cc30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index b0671de..26655e0 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -238,12 +238,7 @@ void pass_prepare()
for (it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
core::Entity *entity = (*it).second;
- if (!entity->state()) {
- entity->entity_clientstate = new core::ClientState();
- }
- entity->state()->state_visible = false;
- entity->state()->state_detailvisible = false;
-
+
// load entity models and light flare textures
if (!entity->model() && entity->modelname().size()) {
entity->entity_model = model::Model::load(entity->modelname());
@@ -263,7 +258,14 @@ void pass_prepare()
}
// update client state
- if (entity->state() && flag_is_set(entity->flags(), core::Entity::Static)) {
+ if (!entity->state()) {
+ entity->entity_clientstate = new core::ClientState();
+ entity->state()->assign(entity);
+ }
+ entity->state()->state_visible = false;
+ entity->state()->state_detailvisible = false;
+
+ if (!flag_is_set(entity->flags(), core::Entity::Static)) {
entity->state()->state_location = entity->state()->previouslocation() +
(entity->location() - entity->state()->previouslocation()) * core::game()->timeoffset();
}
@@ -310,7 +312,7 @@ void draw_pass_default()
// draw entities without model
if (!entity->model()) {
gl::push();
- gl::translate(entity->location());
+ gl::translate(entity->state()->location());
gl::multmatrix(entity->axis());
if (flag_is_set(entity->flags(), core::Entity::Bright)) {
@@ -353,7 +355,7 @@ void draw_pass_model_vertex()
core::Entity *entity = (*it).second;
if (entity->model() && entity->state()->visible()) {
gl::push();
- gl::translate(entity->location());
+ gl::translate(entity->state()->location());
gl::multmatrix(entity->axis());
draw_model_vertex(entity);
@@ -373,7 +375,7 @@ void draw_pass_model_evertex()
if (entity->model() && entity->state()->visible()) {
gl::push();
- gl::translate(entity->location());
+ gl::translate(entity->state()->location());
gl::multmatrix(entity->axis());
draw_model_evertex(entity);
@@ -395,7 +397,7 @@ void draw_pass_model_shields() {
if (entity->type() == core::Entity::Controlable) {
gl::push();
- gl::translate(entity->location());
+ gl::translate(entity->state()->location());
gl::multmatrix(entity->axis());
draw_model_shield((core::EntityControlable *)entity);
@@ -432,7 +434,7 @@ void draw_pass_model_fx()
t = (core::application()->time() + entity->state()->fuzz() + (*lit)->offset()) * (*lit)->frequency();
if (!(*lit)->strobe() || (( t - floorf(t)) <= (*lit)->time())) {
- math::Vector3f location = entity->location() + (entity->axis() * (*lit)->location());
+ math::Vector3f location = entity->state()->location() + (entity->axis() * (*lit)->location());
float light_size = 0.0625 * (*lit)->radius();
if ((*lit)->render_texture != flare_texture) {
@@ -483,7 +485,7 @@ void draw_pass_model_fx()
t = 0.75f + t/2;
for(std::list<model::Engine*>::iterator eit = entity->model()->model_engine.begin(); eit != entity->model()->model_engine.end(); eit++) {
- math::Vector3f location = entity->location() + (entity->axis() * (*eit)->location());
+ math::Vector3f location = entity->state()->location() + (entity->axis() * (*eit)->location());
float engine_size = 0.0625 * (*eit)->radius() * t;
math::Color color(1.0f, 0.0f, 0.0f, 0.9f * u);
@@ -518,7 +520,7 @@ void draw_pass_model_corona()
if (entity->state()->visible() && (entity->shape() != core::Entity::Sphere)) {
gl::push();
- gl::translate(entity->location());
+ gl::translate(entity->state()->location());
math::Color color = entity->color();
color.a = 0.25f;
draw_sphere(color, entity->model()->radius());