diff --git a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp index a22963a8..91bfaa1d 100644 --- a/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp +++ b/Code/Game/DanBiasGame/DanBiasGame_Impl.cpp @@ -131,7 +131,7 @@ namespace DanBias HRESULT DanBiasGame::Update(float deltaTime) { - m_data->recieverObj->Update(); + m_data->recieverObj->Update(); m_data->inputObj->Update(); diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index ee069919..43b25ba7 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -81,12 +81,8 @@ bool GameState::LoadModels(std::wstring mapFile) Oyster::Math3D::Float4x4 translate; C_Object* obj; translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(0,0,0)); - Oyster::Math3D::Float4x4 scale = Oyster::Math3D::Float4x4::identity; - scale.v[0].x = 8; - scale.v[1].y = 8; - scale.v[2].z = 8; - modelData.world = scale; //modelData.world * translate - modelData.modelPath = L"..\\Content\\Models\\ball.dan"; + modelData.world = translate ;//modelData.world * translate + modelData.modelPath = L"world_earth.dan"; modelData.id = 0; obj = new C_Player(); @@ -95,7 +91,7 @@ bool GameState::LoadModels(std::wstring mapFile) // add box model modelData.world = Oyster::Math3D::Float4x4::identity; - translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-5,15,0)); + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(4,320,0)); modelData.world = modelData.world * translate; modelData.modelPath = L"..\\Content\\Models\\box.dan"; modelData.id = 1; @@ -107,7 +103,7 @@ bool GameState::LoadModels(std::wstring mapFile) // add player model modelData.world = Oyster::Math3D::Float4x4::identity; - translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(0, 15, 0)); + translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(0, 320, 0)); modelData.world = modelData.world * translate; modelData.visible = true; @@ -124,14 +120,14 @@ bool GameState::LoadModels(std::wstring mapFile) } bool GameState::InitCamera(Oyster::Math::Float3 startPos) { - Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,-1); + Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,1); Oyster::Math::Float3 up =Oyster::Math::Float3(0,1,0); Oyster::Math::Float3 pos = Oyster::Math::Float3(0, 0, 20); camera->LookAt(pos, dir, up); camera->SetLens(3.14f/2, 1024/768, 1, 1000); - privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,1000); + privData->proj = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/4,1024.0f/768.0f,.1f,1000); //privData->proj = Oyster::Math3D::ProjectionMatrix_Orthographic(1024, 768, 1, 1000); Oyster::Graphics::API::SetProjection(privData->proj); camera->UpdateViewMatrix(); @@ -350,7 +346,7 @@ void GameState::Protocol( ObjPos* pos ) //camera->setLook((Oyster::Math::Float3(world[8], world[9], world[10]))); if(i == 2) // playerobj { - camera->SetPosition(Oyster::Math::Float3(world[12], world[13], world[14])); + camera->SetPosition(Oyster::Math::Float3(world[12], world[13]+2.2f, world[14]-1)); camera->UpdateViewMatrix(); } } diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index 7554c879..94efbb71 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -46,7 +46,11 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float dt) { //Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500 * dt); - Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition()); + + Oyster::Math::Float3 look = owner->GetLookDir(); + Oyster::Math::Float3 up = -owner->GetRigidBody()->GetGravityNormal(); + Oyster::Math::Float3 pos = owner->GetPosition(); + Oyster::Math::Float4x4 aim = Oyster::Math3D::OrientationMatrix_LookAtDirection(owner->GetLookDir(), -owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition()); Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/4,1,1,20); Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace)); int arg = 0; diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 116c9082..196aed09 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -20,7 +20,6 @@ using namespace GameLogic; Player *player = ((Game::PlayerData*)(rigidBodyPlayer->GetCustomTag()))->player; Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed? - return; switch (realObj->GetObjectType()) { case OBJECT_TYPE::OBJECT_TYPE_GENERIC: @@ -69,6 +68,10 @@ using namespace GameLogic; { return Physics::ICustomBody::SubscriptMessage_none; } + Oyster::Physics::ICustomBody::SubscriptMessage Object::DefaultCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) + { + return Physics::ICustomBody::SubscriptMessage_none; + } //Oyster::Physics::ICustomBody::SubscriptMessage Oyster::Physics::ICustomBody::SubscriptMessage Level::LevelCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj) { @@ -81,8 +84,18 @@ using namespace GameLogic; void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void *args) { - Oyster::Math::Float3 pushForce = Oyster::Math::Float4(1,0,0) * (1); + Oyster::Math::Float3 pushForce = Oyster::Math::Float4(1,0,0) * (500); Oyster::Physics::ICustomBody::State state; + Object *realObj = (Object*)obj->GetCustomTag(); + if(realObj->GetObjectType() == OBJECT_TYPE_BOX) + { + state = obj->GetState(); + state.SetOrientation(Oyster::Math::Float3(1,0.5,1),Oyster::Math::Float3(1,0.5,1)); + obj->SetState(state); + } + + if(realObj->GetObjectType() == OBJECT_TYPE_PLAYER || realObj->GetObjectType() == OBJECT_TYPE_WORLD) + return; state = obj->GetState(); state.ApplyLinearImpulse(pushForce); obj->SetState(state); diff --git a/Code/Game/GameLogic/Game.cpp b/Code/Game/GameLogic/Game.cpp index 12ca7237..d9973821 100644 --- a/Code/Game/GameLogic/Game.cpp +++ b/Code/Game/GameLogic/Game.cpp @@ -129,6 +129,7 @@ bool Game::NewFrame() } gameInstance.onMoveFnc(this->level); + return true; } diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index 78a1f05a..93fcfba6 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -7,9 +7,9 @@ Game::PlayerData::PlayerData() { //set some stats that are appropriate to a player Oyster::Physics::API::SimpleBodyDescription sbDesc; - sbDesc.centerPosition = Oyster::Math::Float3(0,16,0); + sbDesc.centerPosition = Oyster::Math::Float3(10,350,0); sbDesc.size = Oyster::Math::Float3(4,7,4); - + sbDesc.mass = 70; //create rigid body Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release(); diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 1fbc160e..e09f9bb0 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -25,7 +25,7 @@ void Level::InitiateLevel(float radius) API::SphericalBodyDescription sbDesc; sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1); sbDesc.ignoreGravity = true; - sbDesc.radius = 8; + sbDesc.radius = 300; sbDesc.mass = 10e12f; ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); @@ -39,27 +39,27 @@ void Level::InitiateLevel(float radius) rigidBody->SetCustomTag(levelObj); - // add box + // add box API::SimpleBodyDescription sbDesc_TestBox; - sbDesc_TestBox.centerPosition = Oyster::Math::Float4(-5,15,0,0); + sbDesc_TestBox.centerPosition = Oyster::Math::Float4(0,320,0,0); sbDesc_TestBox.ignoreGravity = false; - sbDesc_TestBox.mass = 10; - sbDesc_TestBox.size = Oyster::Math::Float4(0.5f,0.5f,0.5f,0); + sbDesc_TestBox.mass = 50; + sbDesc_TestBox.size = Oyster::Math::Float4(1,1,1,0); ICustomBody* rigidBody_TestBox = API::Instance().CreateRigidBody(sbDesc_TestBox).Release(); rigidBody_TestBox->SetSubscription(Level::PhysicsOnMoveLevel); - testBox = new DynamicObject(rigidBody_TestBox, OBJECT_TYPE::OBJECT_TYPE_BOX); + testBox = new DynamicObject(rigidBody_TestBox,Object::DefaultCollisionBefore, Object::DefaultCollisionAfter, OBJECT_TYPE::OBJECT_TYPE_BOX); rigidBody_TestBox->SetCustomTag(testBox); rigidBody_TestBox->GetState(state); - state.ApplyLinearImpulse(Oyster::Math::Float3(0,0,4)); + state.ApplyLinearImpulse(Oyster::Math::Float3(0,0,0)); rigidBody_TestBox->SetState(state); // add gravitation API::Gravity gravityWell; gravityWell.gravityType = API::Gravity::GravityType_Well; - gravityWell.well.mass = 10e14f; + gravityWell.well.mass = 1e15f; gravityWell.well.position = Oyster::Math::Float4(0,0,0,1); API::Instance().AddGravity(gravityWell); } diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h index 44b0ca48..d3a3690f 100644 --- a/Code/Game/GameLogic/Object.h +++ b/Code/Game/GameLogic/Object.h @@ -42,6 +42,7 @@ namespace GameLogic void setAfterCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss)); static Oyster::Physics::ICustomBody::SubscriptMessage DefaultCollisionBefore(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj); + static Oyster::Physics::ICustomBody::SubscriptMessage DefaultCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss); private: OBJECT_TYPE type; int objectID; diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index 45ae8f65..ea36b284 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -86,24 +86,24 @@ void Player::Move(const PLAYER_MOVEMENT &movement) void Player::MoveForward() { - setState.ApplyLinearImpulse(this->lookDir * (20 * this->gameInstance->GetFrameTime())); + setState.ApplyLinearImpulse(this->lookDir * (2000 * this->gameInstance->GetFrameTime())); } void Player::MoveBackwards() { - setState.ApplyLinearImpulse(-this->lookDir * 20 * this->gameInstance->GetFrameTime()); + setState.ApplyLinearImpulse(-this->lookDir * 2000 * this->gameInstance->GetFrameTime()); } void Player::MoveRight() { //Do cross product with forward vector and negative gravity vector Oyster::Math::Float3 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); - setState.ApplyLinearImpulse(r * 20 * this->gameInstance->GetFrameTime()); + setState.ApplyLinearImpulse(r * 2000 * this->gameInstance->GetFrameTime()); } void Player::MoveLeft() { //Do cross product with forward vector and negative gravity vector Oyster::Math::Float3 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero - setState.ApplyLinearImpulse(-r * 20 * this->gameInstance->GetFrameTime()); + setState.ApplyLinearImpulse(-r * 2000 * this->gameInstance->GetFrameTime()); } void Player::UseWeapon(const WEAPON_FIRE &usage) @@ -123,7 +123,7 @@ void Player::Rotate(const Oyster::Math3D::Float3 lookDir) { this->lookDir = lookDir; - Oyster::Math::Float4 up(0,1,0,0);//-setState.GetGravityNormal(); + Oyster::Math::Float4 up = -setState.GetGravityNormal(); Oyster::Math::Float4 pos = setState.GetCenterPosition(); Oyster::Math::Float4x4 world = Oyster::Math3D::OrientationMatrix_LookAtDirection(lookDir, up.xyz, pos.xyz); // cant set rotation diff --git a/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp b/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp index 6f164810..5fa3a982 100644 --- a/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp +++ b/Code/GamePhysics/Implementation/PhysicsAPI_Impl.cpp @@ -26,7 +26,7 @@ namespace ICustomBody::State protoState; proto->GetState( protoState ); ICustomBody::State deuterState; deuter->GetState( deuterState ); - Float4 protoG = protoState.GetLinearMomentum( worldPointOfContact.xyz ), + Float4 protoG = protoState.GetLinearMomentum(worldPointOfContact.xyz ), deuterG = deuterState.GetLinearMomentum( worldPointOfContact.xyz ); // calc from perspective of deuter diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl index 98b2887e..1efb94c6 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/LightPass.hlsl @@ -27,7 +27,9 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID ) Shaded.Specular += light.Specular; } - Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,1); + //Diffuse[DTid.xy] = float4(Shaded.Diffuse * DiffuseGlow[DTid.xy].xyz,1); + Diffuse[DTid.xy] = float4(DiffuseGlow[DTid.xy].xyz,1); + Specular[DTid.xy] = float4(Shaded.Specular, 1); diff --git a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl index 2aaf2051..3e03dfcd 100644 --- a/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl +++ b/Code/OysterGraphics/Shader/HLSL/Deffered Shaders/PostPass.hlsl @@ -8,5 +8,7 @@ RWTexture2D Output; void main( uint3 DTid : SV_DispatchThreadID ) { Output[DTid.xy] = Diffuse[DTid.xy] + Specular[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/4].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW + //Output[DTid.xy] = Diffuse[DTid.xy] + Diffuse[DTid.xy] * Ambient[DTid.xy/4].w;// + float4(Ambient[DTid.xy/4].xyz,1); GLOW + //Output[DTid.xy] = Diffuse[DTid.xy]; } \ No newline at end of file