diff --git a/Code/Game/GameClient/GameClientState/C_Object.cpp b/Code/Game/GameClient/GameClientState/C_Object.cpp index 50664a92..22820850 100644 --- a/Code/Game/GameClient/GameClientState/C_Object.cpp +++ b/Code/Game/GameClient/GameClientState/C_Object.cpp @@ -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() { - Oyster::Graphics::API::RenderModel(model); + 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) { diff --git a/Code/Game/GameClient/GameClientState/C_Object.h b/Code/Game/GameClient/GameClientState/C_Object.h index dcc2731c..c0784436 100644 --- a/Code/Game/GameClient/GameClientState/C_Object.h +++ b/Code/Game/GameClient/GameClientState/C_Object.h @@ -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); diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index a4e22bbc..45246fb3 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -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 } }