GL - testing

This commit is contained in:
Erik Persson 2014-01-30 11:11:45 +01:00
parent 7d9d8e4615
commit 323b7322fa
9 changed files with 22 additions and 52 deletions

View File

@ -313,5 +313,6 @@ Global
{8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {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}
{666FEA52-975F-41CD-B224-B19AF3C0ABBA} = {20720CA7-795C-45AD-A302-9383A6DD503A}
EndGlobalSection
EndGlobal

View File

@ -48,17 +48,17 @@ bool GameState::Init(Oyster::Network::NetworkClient* nwClient)
GameState::gameStateState GameState::LoadGame()
{
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.Radius = 50;
plight.Bright = 2;
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.Radius = 50;
plight.Bright = 2;
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.Radius = 50;
plight.Bright = 2;
@ -84,8 +84,8 @@ bool GameState::LoadModels(std::wstring mapFile)
scale.v[0].x = 8;
scale.v[1].y = 8;
scale.v[2].z = 8;
modelData.world = scale; //modelData.world * translate
modelData.modelPath = L"ball.dan";
modelData.world = translate; //modelData.world * translate
modelData.modelPath = L"world_earth.dan";
modelData.id = 0;
obj = new C_Player();
@ -94,7 +94,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(-5,175,0));
modelData.world = modelData.world * translate;
modelData.modelPath = L"box.dan";
modelData.id = 1;
@ -351,8 +351,8 @@ 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->UpdateViewMatrix();
camera->SetPosition(Oyster::Math::Float3(world[12], world[13] + 2.2f, world[14]-1));
camera->UpdateViewMatrix();
}
}
}

View File

@ -132,7 +132,7 @@ namespace DanBias
scale.v[0].x = 8;
scale.v[1].y = 8;
scale.v[2].z = 8;
world = world * scale;
//world = world * scale;
Protocol_ObjectPosition p(world, 0);
GameSession::gameSession->Send(p.GetProtocol());
}

View File

@ -24,39 +24,11 @@ using namespace GameLogic;
namespace DanBias
{
//TEST SHIT
GameAPI *game = &GameAPI::Instance();
DynamicArray<IPlayerData*> players;
//TEST SHIT
bool GameSession::DoWork( )
{
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();
gameInstance.SetFrameTimeLength((float)dt);

View File

@ -46,14 +46,12 @@ 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::Float3 weaponPos;
weaponPos = owner->GetPosition() + 5 * owner->GetLookDir();
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), weaponPos);
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_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;
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,NULL, ForcePushAction);
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&arg,ForcePushAction);
}
/********************************************************

View File

@ -20,6 +20,7 @@ using namespace GameLogic;
Player *player = ((Game::PlayerData*)(rigidBodyPlayer->GetCustomTag()))->player;
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
return;
switch (realObj->GetType())
{
case OBJECT_TYPE::OBJECT_TYPE_GENERIC:
@ -78,9 +79,9 @@ using namespace GameLogic;
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;
state = obj->GetState();
state.ApplyLinearImpulse(pushForce);

View File

@ -7,7 +7,7 @@ Game::PlayerData::PlayerData()
{
//set some stats that are appropriate to a player
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);
//create rigid body

View File

@ -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 = 150;
sbDesc.mass = 10e12f;
ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release();
@ -59,7 +59,7 @@ void Level::InitiateLevel(float radius)
// add gravitation
API::Gravity gravityWell;
gravityWell.gravityType = API::Gravity::GravityType_Well;
gravityWell.well.mass = 10e12f;
gravityWell.well.mass = 10e16f;
gravityWell.well.position = Oyster::Math::Float4(0,0,0,1);
API::Instance().AddGravity(gravityWell);
}

View File

@ -95,16 +95,14 @@ void Player::MoveBackwards()
void Player::MoveRight()
{
//Do cross product with forward vector and negative gravity vector
Oyster::Math::Float3 r = Oyster::Math::Float4(1, 0, 0);
//Oyster::Math::Float4 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir);
Oyster::Math::Float3 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir);
setState.ApplyLinearImpulse(r * 20 * this->gameInstance->GetFrameTime());
}
void Player::MoveLeft()
{
//Do cross product with forward vector and negative gravity vector
Oyster::Math::Float3 r = Oyster::Math::Float4(1, 0, 0 );
//Oyster::Math::Float4 r1 = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero
Oyster::Math::Float3 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)this->lookDir); //Still get zero
setState.ApplyLinearImpulse(-r * 20 * this->gameInstance->GetFrameTime());
}