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

This commit is contained in:
dean11 2014-02-20 11:48:09 +01:00
commit b570ca895e
3 changed files with 18 additions and 9 deletions

View File

@ -5,7 +5,7 @@ C_Object::C_Object()
world = Oyster::Math::Float4x4::identity;
position = Oyster::Math::Float3::null;
rotation = Oyster::Math::Quaternion::identity;
scale = Oyster::Math::Float3::null;
scale = Oyster::Math::Float3(1);
id = 0;
model = NULL;
@ -89,7 +89,10 @@ int C_Object::GetId() const
}
void C_Object::Render()
{
if( this->model )
{
Oyster::Graphics::API::RenderModel(model);
}
}
void C_Object::Release()
{
@ -113,14 +116,16 @@ bool C_Object::InitRB(RBInitData RBInit)
type = RBInit.type;
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::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->RBposition);
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;
return RBworld;
}
void C_Object::setRBPos(Oyster::Math::Float3 newPos)
{

View File

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

View File

@ -328,7 +328,7 @@ void GameState::ReadKeyInput()
static const float mouseSensitivity = Radian( 1.0f );
this->privData->camera.PitchDown( this->privData->input->GetPitch() * mouseSensitivity );
float yaw = this->privData->input->GetYaw();
if( yaw != 0.0f )
//if( yaw != 0.0f ) //This made the camera reset to a specific rotation.
{
this->privData->nwClient->Send( Protocol_PlayerLeftTurn(yaw * mouseSensitivity) );
}
@ -508,9 +508,11 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
{
object->setPos( position );
object->setRot( rotation );
object->updateWorld();
// RB DEBUG
object->setRBPos ( position );
object->setRBRot ( rotation );
object->updateRBWorld();
// !RB DEBUG
}
}