Merge with GL
This commit is contained in:
commit
21cb7731b7
|
@ -131,7 +131,7 @@ namespace DanBias
|
|||
|
||||
HRESULT DanBiasGame::Update(float deltaTime)
|
||||
{
|
||||
m_data->recieverObj->Update();
|
||||
|
||||
m_data->recieverObj->Update();
|
||||
m_data->inputObj->Update();
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -129,6 +129,7 @@ bool Game::NewFrame()
|
|||
}
|
||||
|
||||
gameInstance.onMoveFnc(this->level);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
@ -8,5 +8,7 @@ RWTexture2D<float4> 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];
|
||||
}
|
Loading…
Reference in New Issue