Merge branch 'GameClient' of https://github.com/dean11/Danbias into GameClient

This commit is contained in:
Pontus Fransson 2014-02-20 11:47:32 +01:00
commit 84d2c4eb56
3 changed files with 17 additions and 8 deletions

View File

@ -5,7 +5,7 @@ C_Object::C_Object()
world = Oyster::Math::Float4x4::identity; world = Oyster::Math::Float4x4::identity;
position = Oyster::Math::Float3::null; position = Oyster::Math::Float3::null;
rotation = Oyster::Math::Quaternion::identity; rotation = Oyster::Math::Quaternion::identity;
scale = Oyster::Math::Float3::null; scale = Oyster::Math::Float3(1);
id = 0; id = 0;
model = NULL; model = NULL;
@ -88,9 +88,12 @@ int C_Object::GetId() const
return id; return id;
} }
void C_Object::Render() void C_Object::Render()
{
if( this->model )
{ {
Oyster::Graphics::API::RenderModel(model); Oyster::Graphics::API::RenderModel(model);
} }
}
void C_Object::Release() void C_Object::Release()
{ {
if( this->model ) if( this->model )
@ -113,14 +116,16 @@ bool C_Object::InitRB(RBInitData RBInit)
type = RBInit.type; type = RBInit.type;
return true; return true;
} }
void C_Object::updateRBWorld()
{
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->position);
Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(this->rotation);
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(this->scale);
RBworld = translation * rot * scale;
}
Oyster::Math::Float4x4 C_Object::getRBWorld() const Oyster::Math::Float4x4 C_Object::getRBWorld() const
{ {
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->RBposition); return RBworld;
Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(this->RBrotation);
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(this->RBscale);
Oyster::Math3D::Float4x4 world = translation * rot * scale;
return world;
} }
void C_Object::setRBPos(Oyster::Math::Float3 newPos) void C_Object::setRBPos(Oyster::Math::Float3 newPos)
{ {

View File

@ -40,6 +40,7 @@ namespace DanBias
Oyster::Math::Float3 scale; Oyster::Math::Float3 scale;
// RB DEBUG // RB DEBUG
Oyster::Math::Float4x4 RBworld;
Oyster::Math::Float3 RBposition; Oyster::Math::Float3 RBposition;
Oyster::Math::Quaternion RBrotation; Oyster::Math::Quaternion RBrotation;
Oyster::Math::Float3 RBscale; Oyster::Math::Float3 RBscale;
@ -67,6 +68,7 @@ namespace DanBias
Oyster::Math::Float3 getScale() const; Oyster::Math::Float3 getScale() const;
// RB DEBUG // RB DEBUG
void updateRBWorld();
bool InitRB(RBInitData modelInit); bool InitRB(RBInitData modelInit);
Oyster::Math::Float4x4 getRBWorld() const; Oyster::Math::Float4x4 getRBWorld() const;
void setRBPos(Oyster::Math::Float3 newPos); void setRBPos(Oyster::Math::Float3 newPos);

View File

@ -508,9 +508,11 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
{ {
object->setPos( position ); object->setPos( position );
object->setRot( rotation ); object->setRot( rotation );
object->updateWorld();
// RB DEBUG // RB DEBUG
object->setRBPos ( position ); object->setRBPos ( position );
object->setRBRot ( rotation ); object->setRBRot ( rotation );
object->updateRBWorld();
// !RB DEBUG // !RB DEBUG
} }
} }