From c3b2c1e912ed377950bb8f9e66e2d3d1dd06d19e Mon Sep 17 00:00:00 2001 From: Dander7BD Date: Tue, 11 Feb 2014 14:13:24 +0100 Subject: [PATCH] premerge --- .../DanBiasGame/GameClientState/GameState.cpp | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 51e9ae39..05ccd23f 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -566,6 +566,9 @@ void GameState::Protocol(ProtocolStruct* pos) void GameState::Protocol( PlayerPos* pos ) { + camera.SetPosition( pos->position ); + camera.SetAngular( pos->angularAxis ); + //Float4x4 world, translate; //world = Float4x4::identity; @@ -581,26 +584,32 @@ void GameState::Protocol( PlayerPos* pos ) void GameState::Protocol( ObjPos* pos ) { - Float4x4 world; - for(int i = 0; i<16; i++) - { - world[i] = pos->worldPos[i]; - } + //Float4x4 world; + //for(int i = 0; i<16; i++) + //{ + // world[i] = pos->worldPos[i]; + //} + //printf("pos for obj %d, ",pos->object_ID ); + for (unsigned int i = 0; i < dynamicObjects.Size(); i++) { if(dynamicObjects[i]->GetId() == pos->object_ID) { + dynamicObjects[i]->setPos( pos->position ); + dynamicObjects[i]->setRot( Quaternion(Float3(pos->rotation), pos->rotation[3]) ); - dynamicObjects[i]->setPos(Float3(world[12], world[13], world[14])); - + //dynamicObjects[i]->setPos(Float3(world[12], world[13], world[14])); if(dynamicObjects[i]->GetId() == myId) // playerobj { - Float3 right = Float3(world[0], world[1], world[2]); - Float3 up = Float3(world[4], world[5], world[6]); - Float3 objForward = Float3(world[8], world[9], world[10]); - Float3 pos = Float3(world[12], world[13], world[14]); + camera.SetPosition( pos->position ); + camera.SetAngular( pos->angularAxis ); + + //Float3 right = Float3(world[0], world[1], world[2]); + //Float3 up = Float3(world[4], world[5], world[6]); + //Float3 objForward = Float3(world[8], world[9], world[10]); + //Float3 pos = Float3(world[12], world[13], world[14]); //Float3 cameraLook = camera->GetLook(); //Float3 cameraUp = camera->GetUp(); @@ -616,9 +625,9 @@ void GameState::Protocol( ObjPos* pos ) //camera->setUp(up); //camera->setLook(objForward); - up *= 1; - objForward *= -2; - Float3 cameraPos = pos + up + objForward; + //up *= 1; + //objForward *= -2; + //Float3 cameraPos = pos + up + objForward; //camera->SetPosition(cameraPos); //camera->UpdateViewMatrix();