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-10 10:19:16 +0000
committerStijn Buys <ingar@osirion.org>2008-05-10 10:19:16 +0000
commit930db4020b9af2ccd999cb3a8c980cc9d527f8cf (patch)
tree1767c67dbe94615c02d529f3ed04e614cb948921 /src/core/entity.cc
parent421fc71813f08bfe359f9ac7596933a7e4cea6e0 (diff)
client-side axis interpolation
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r--src/core/entity.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index cc956b0..46231d8 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -115,7 +115,11 @@ Entity::Entity(std::istream & is)
is >> entity_color;
is >> s; // shape
is >> entity_radius;
- is >> entity_axis;
+
+ is >> entity_axis[0];
+ is >> entity_axis[1];
+ entity_axis[2] = math::crossproduct(entity_axis.forward(), entity_axis.left());
+
entity_shape = (Shape) s ;
char c;
@@ -135,7 +139,9 @@ Entity::Entity(std::istream & is)
entity_destroyed = false;
entity_dirty = false;
+ // this entity is created clientside
entity_clientstate = 0;
+
add(this, entity_id);
}
@@ -156,7 +162,8 @@ void Entity::serialize(std::ostream & os) const
<< entity_color << " "
<< entity_shape << " "
<< entity_radius << " "
- << entity_axis << " "
+ << entity_axis.forward() << " "
+ << entity_axis.left() << " "
<< "\"" << entity_name << "\" "
<< "\"" << entity_modelname << "\"";
}
@@ -232,16 +239,16 @@ void EntityDynamic::serialize_server_update(std::ostream & os) const
os << entity_location << " ";
os << entity_axis.forward() << " ";
os << entity_axis.left() << " ";
- os << entity_axis.up() << " ";
os << entity_speed;
}
void EntityDynamic::recieve_server_update(std::istream &is)
{
is >> entity_location;
+ // axis up vector is the crossproduct of forward and left
is >> entity_axis[0];
is >> entity_axis[1];
- is >> entity_axis[2];
+ entity_axis[2] = math::crossproduct(entity_axis.forward(), entity_axis.left());
is >> entity_speed;
}