GL - testing
This commit is contained in:
parent
7d9d8e4615
commit
323b7322fa
|
@ -313,5 +313,6 @@ Global
|
||||||
{8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {20720CA7-795C-45AD-A302-9383A6DD503A}
|
{8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {20720CA7-795C-45AD-A302-9383A6DD503A}
|
||||||
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78} = {20720CA7-795C-45AD-A302-9383A6DD503A}
|
{DA2AA800-ED64-4649-8B3B-E7F1E3968B78} = {20720CA7-795C-45AD-A302-9383A6DD503A}
|
||||||
{060B1890-CBF3-4808-BA99-A4776222093B} = {20720CA7-795C-45AD-A302-9383A6DD503A}
|
{060B1890-CBF3-4808-BA99-A4776222093B} = {20720CA7-795C-45AD-A302-9383A6DD503A}
|
||||||
|
{666FEA52-975F-41CD-B224-B19AF3C0ABBA} = {20720CA7-795C-45AD-A302-9383A6DD503A}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -48,17 +48,17 @@ bool GameState::Init(Oyster::Network::NetworkClient* nwClient)
|
||||||
GameState::gameStateState GameState::LoadGame()
|
GameState::gameStateState GameState::LoadGame()
|
||||||
{
|
{
|
||||||
Oyster::Graphics::Definitions::Pointlight plight;
|
Oyster::Graphics::Definitions::Pointlight plight;
|
||||||
plight.Pos = Oyster::Math::Float3(0,15,5);
|
plight.Pos = Oyster::Math::Float3(0,175,5);
|
||||||
plight.Color = Oyster::Math::Float3(0,1,0);
|
plight.Color = Oyster::Math::Float3(0,1,0);
|
||||||
plight.Radius = 50;
|
plight.Radius = 50;
|
||||||
plight.Bright = 2;
|
plight.Bright = 2;
|
||||||
Oyster::Graphics::API::AddLight(plight);
|
Oyster::Graphics::API::AddLight(plight);
|
||||||
plight.Pos = Oyster::Math::Float3(10,15,5);
|
plight.Pos = Oyster::Math::Float3(10,175,5);
|
||||||
plight.Color = Oyster::Math::Float3(1,0,0);
|
plight.Color = Oyster::Math::Float3(1,0,0);
|
||||||
plight.Radius = 50;
|
plight.Radius = 50;
|
||||||
plight.Bright = 2;
|
plight.Bright = 2;
|
||||||
Oyster::Graphics::API::AddLight(plight);
|
Oyster::Graphics::API::AddLight(plight);
|
||||||
plight.Pos = Oyster::Math::Float3(10,-15,5);
|
plight.Pos = Oyster::Math::Float3(10,-175,5);
|
||||||
plight.Color = Oyster::Math::Float3(0,0,1);
|
plight.Color = Oyster::Math::Float3(0,0,1);
|
||||||
plight.Radius = 50;
|
plight.Radius = 50;
|
||||||
plight.Bright = 2;
|
plight.Bright = 2;
|
||||||
|
@ -84,8 +84,8 @@ bool GameState::LoadModels(std::wstring mapFile)
|
||||||
scale.v[0].x = 8;
|
scale.v[0].x = 8;
|
||||||
scale.v[1].y = 8;
|
scale.v[1].y = 8;
|
||||||
scale.v[2].z = 8;
|
scale.v[2].z = 8;
|
||||||
modelData.world = scale; //modelData.world * translate
|
modelData.world = translate; //modelData.world * translate
|
||||||
modelData.modelPath = L"ball.dan";
|
modelData.modelPath = L"world_earth.dan";
|
||||||
modelData.id = 0;
|
modelData.id = 0;
|
||||||
|
|
||||||
obj = new C_Player();
|
obj = new C_Player();
|
||||||
|
@ -94,7 +94,7 @@ bool GameState::LoadModels(std::wstring mapFile)
|
||||||
|
|
||||||
// add box model
|
// add box model
|
||||||
modelData.world = Oyster::Math3D::Float4x4::identity;
|
modelData.world = Oyster::Math3D::Float4x4::identity;
|
||||||
translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-5,15,0));
|
translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(-5,175,0));
|
||||||
modelData.world = modelData.world * translate;
|
modelData.world = modelData.world * translate;
|
||||||
modelData.modelPath = L"box.dan";
|
modelData.modelPath = L"box.dan";
|
||||||
modelData.id = 1;
|
modelData.id = 1;
|
||||||
|
@ -351,8 +351,8 @@ void GameState::Protocol( ObjPos* pos )
|
||||||
//camera->setLook((Oyster::Math::Float3(world[8], world[9], world[10])));
|
//camera->setLook((Oyster::Math::Float3(world[8], world[9], world[10])));
|
||||||
if(i == 2) // playerobj
|
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();
|
camera->UpdateViewMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace DanBias
|
||||||
scale.v[0].x = 8;
|
scale.v[0].x = 8;
|
||||||
scale.v[1].y = 8;
|
scale.v[1].y = 8;
|
||||||
scale.v[2].z = 8;
|
scale.v[2].z = 8;
|
||||||
world = world * scale;
|
//world = world * scale;
|
||||||
Protocol_ObjectPosition p(world, 0);
|
Protocol_ObjectPosition p(world, 0);
|
||||||
GameSession::gameSession->Send(p.GetProtocol());
|
GameSession::gameSession->Send(p.GetProtocol());
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,39 +24,11 @@ using namespace GameLogic;
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
//TEST SHIT
|
|
||||||
GameAPI *game = &GameAPI::Instance();
|
|
||||||
DynamicArray<IPlayerData*> players;
|
|
||||||
|
|
||||||
//TEST SHIT
|
|
||||||
|
|
||||||
bool GameSession::DoWork( )
|
bool GameSession::DoWork( )
|
||||||
{
|
{
|
||||||
if(this->isRunning)
|
if(this->isRunning)
|
||||||
{
|
{
|
||||||
//TEST SHIT
|
|
||||||
//player creation and testing
|
|
||||||
//players.Resize(10);
|
|
||||||
|
|
||||||
//for(int i = 0; i < 10; i++)
|
|
||||||
//{
|
|
||||||
// players[i] = game->CreatePlayer();WWW
|
|
||||||
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_BACKWARD);
|
|
||||||
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_FORWARD);
|
|
||||||
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_JUMP);
|
|
||||||
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_LEFT);
|
|
||||||
// players[i]->Move(GameLogic::PLAYER_MOVEMENT::PLAYER_MOVEMENT_RIGHT);
|
|
||||||
|
|
||||||
// //using weapon testing
|
|
||||||
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS);
|
|
||||||
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_PRIMARY_RELEASE);
|
|
||||||
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS);
|
|
||||||
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_SECONDARY_RELEASE);
|
|
||||||
// players[i]->UseWeapon(GameLogic::WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
//TEST SHIT
|
|
||||||
double dt = this->timer.getElapsedSeconds();
|
double dt = this->timer.getElapsedSeconds();
|
||||||
gameInstance.SetFrameTimeLength((float)dt);
|
gameInstance.SetFrameTimeLength((float)dt);
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,12 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
|
||||||
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float dt)
|
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float dt)
|
||||||
{
|
{
|
||||||
//Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500 * dt);
|
//Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500 * dt);
|
||||||
Oyster::Math::Float3 weaponPos;
|
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition());
|
||||||
weaponPos = owner->GetPosition() + 5 * owner->GetLookDir();
|
|
||||||
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), weaponPos);
|
|
||||||
Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/4,1,1,20);
|
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));
|
Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace));
|
||||||
|
int arg = 0;
|
||||||
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,NULL, ForcePushAction);
|
|
||||||
|
|
||||||
|
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&arg,ForcePushAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
|
|
|
@ -20,6 +20,7 @@ using namespace GameLogic;
|
||||||
Player *player = ((Game::PlayerData*)(rigidBodyPlayer->GetCustomTag()))->player;
|
Player *player = ((Game::PlayerData*)(rigidBodyPlayer->GetCustomTag()))->player;
|
||||||
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
|
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
|
||||||
|
|
||||||
|
return;
|
||||||
switch (realObj->GetType())
|
switch (realObj->GetType())
|
||||||
{
|
{
|
||||||
case OBJECT_TYPE::OBJECT_TYPE_GENERIC:
|
case OBJECT_TYPE::OBJECT_TYPE_GENERIC:
|
||||||
|
@ -78,12 +79,12 @@ using namespace GameLogic;
|
||||||
return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
return Physics::ICustomBody::SubscriptMessage_ignore_collision_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void* args)
|
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void *args)
|
||||||
{
|
{
|
||||||
Oyster::Math::Float3 pushForce = Oyster::Math::Float4(1,0,0) * (20);
|
Oyster::Math::Float3 pushForce = Oyster::Math::Float4(1,0,0) * (1);
|
||||||
Oyster::Physics::ICustomBody::State state;
|
Oyster::Physics::ICustomBody::State state;
|
||||||
state = obj->GetState();
|
state = obj->GetState();
|
||||||
state.ApplyLinearImpulse(pushForce);
|
state.ApplyLinearImpulse(pushForce);
|
||||||
obj->SetState(state);
|
obj->SetState(state);
|
||||||
//((Object*)obj->GetCustomTag())->ApplyLinearImpulse(pushForce);
|
//((Object*)obj->GetCustomTag())->ApplyLinearImpulse(pushForce);
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ Game::PlayerData::PlayerData()
|
||||||
{
|
{
|
||||||
//set some stats that are appropriate to a player
|
//set some stats that are appropriate to a player
|
||||||
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
||||||
sbDesc.centerPosition = Oyster::Math::Float3(0,15,0);
|
sbDesc.centerPosition = Oyster::Math::Float3(0,165,0);
|
||||||
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
||||||
|
|
||||||
//create rigid body
|
//create rigid body
|
||||||
|
|
|
@ -25,7 +25,7 @@ void Level::InitiateLevel(float radius)
|
||||||
API::SphericalBodyDescription sbDesc;
|
API::SphericalBodyDescription sbDesc;
|
||||||
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
|
sbDesc.centerPosition = Oyster::Math::Float4(0,0,0,1);
|
||||||
sbDesc.ignoreGravity = true;
|
sbDesc.ignoreGravity = true;
|
||||||
sbDesc.radius = 8;
|
sbDesc.radius = 150;
|
||||||
sbDesc.mass = 10e12f;
|
sbDesc.mass = 10e12f;
|
||||||
|
|
||||||
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
|
||||||
|
@ -59,7 +59,7 @@ void Level::InitiateLevel(float radius)
|
||||||
// add gravitation
|
// add gravitation
|
||||||
API::Gravity gravityWell;
|
API::Gravity gravityWell;
|
||||||
gravityWell.gravityType = API::Gravity::GravityType_Well;
|
gravityWell.gravityType = API::Gravity::GravityType_Well;
|
||||||
gravityWell.well.mass = 10e12f;
|
gravityWell.well.mass = 10e16f;
|
||||||
gravityWell.well.position = Oyster::Math::Float4(0,0,0,1);
|
gravityWell.well.position = Oyster::Math::Float4(0,0,0,1);
|
||||||
API::Instance().AddGravity(gravityWell);
|
API::Instance().AddGravity(gravityWell);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,16 +95,14 @@ void Player::MoveBackwards()
|
||||||
void Player::MoveRight()
|
void Player::MoveRight()
|
||||||
{
|
{
|
||||||
//Do cross product with forward vector and negative gravity vector
|
//Do cross product with forward vector and negative gravity vector
|
||||||
Oyster::Math::Float3 r = Oyster::Math::Float4(1, 0, 0);
|
Oyster::Math::Float3 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir);
|
||||||
//Oyster::Math::Float4 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir);
|
|
||||||
setState.ApplyLinearImpulse(r * 20 * this->gameInstance->GetFrameTime());
|
setState.ApplyLinearImpulse(r * 20 * this->gameInstance->GetFrameTime());
|
||||||
|
|
||||||
}
|
}
|
||||||
void Player::MoveLeft()
|
void Player::MoveLeft()
|
||||||
{
|
{
|
||||||
//Do cross product with forward vector and negative gravity vector
|
//Do cross product with forward vector and negative gravity vector
|
||||||
Oyster::Math::Float3 r = Oyster::Math::Float4(1, 0, 0 );
|
Oyster::Math::Float3 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero
|
||||||
//Oyster::Math::Float4 r1 = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero
|
|
||||||
setState.ApplyLinearImpulse(-r * 20 * this->gameInstance->GetFrameTime());
|
setState.ApplyLinearImpulse(-r * 20 * this->gameInstance->GetFrameTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue