Merge branch 'GameClient' of https://github.com/dean11/Danbias into GameLogic

This commit is contained in:
dean11 2014-02-20 15:43:09 +01:00
commit a53b1deb0a
31 changed files with 553 additions and 101 deletions

View File

@ -166,6 +166,7 @@ namespace DanBias
DanBiasGame::Result DanBiasGame::Update(float deltaTime) DanBiasGame::Result DanBiasGame::Update(float deltaTime)
{ {
{ // updating mouse input { // updating mouse input
// TODO: Is obosolete when Dennis's input system is wired in
POINT mousePos; POINT mousePos;
GetCursorPos( &mousePos ); GetCursorPos( &mousePos );

View File

@ -5,7 +5,7 @@ C_Object::C_Object()
world = Oyster::Math::Float4x4::identity; world = Oyster::Math::Float4x4::identity;
position = Oyster::Math::Float3::null; position = Oyster::Math::Float3::null;
rotation = Oyster::Math::Quaternion::identity; rotation = Oyster::Math::Quaternion::identity;
scale = Oyster::Math::Float3::null; scale = Oyster::Math::Float3(1);
id = 0; id = 0;
model = NULL; model = NULL;
@ -88,9 +88,12 @@ int C_Object::GetId() const
return id; return id;
} }
void C_Object::Render() void C_Object::Render()
{
if( this->model )
{ {
Oyster::Graphics::API::RenderModel(model); Oyster::Graphics::API::RenderModel(model);
} }
}
void C_Object::Release() void C_Object::Release()
{ {
if( this->model ) if( this->model )
@ -100,6 +103,26 @@ void C_Object::Release()
} }
} }
Oyster::Math::Float3 C_Object::GetTint()
{
return model->Tint;
}
Oyster::Math::Float3 C_Object::GetGlowTint()
{
return model->GlowTint;
}
void C_Object::SetTint(Oyster::Math::Float3 tint)
{
model->Tint = tint;
}
void C_Object::SetGlowTint(Oyster::Math::Float3 tint)
{
model->GlowTint = tint;
}
//////////////////////////////////////////////// ////////////////////////////////////////////////
@ -113,14 +136,16 @@ bool C_Object::InitRB(RBInitData RBInit)
type = RBInit.type; type = RBInit.type;
return true; return true;
} }
Oyster::Math::Float4x4 C_Object::getRBWorld() const void C_Object::updateRBWorld()
{ {
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->RBposition); Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(this->RBposition);
Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(this->RBrotation); Oyster::Math3D::Float4x4 rot = Oyster::Math3D::RotationMatrix(this->RBrotation);
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(this->RBscale); Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(this->RBscale);
Oyster::Math3D::Float4x4 world = translation * rot * scale; RBworld = translation * rot * scale;
}
return world; Oyster::Math::Float4x4 C_Object::getRBWorld() const
{
return RBworld;
} }
void C_Object::setRBPos(Oyster::Math::Float3 newPos) void C_Object::setRBPos(Oyster::Math::Float3 newPos)
{ {

View File

@ -40,6 +40,7 @@ namespace DanBias
Oyster::Math::Float3 scale; Oyster::Math::Float3 scale;
// RB DEBUG // RB DEBUG
Oyster::Math::Float4x4 RBworld;
Oyster::Math::Float3 RBposition; Oyster::Math::Float3 RBposition;
Oyster::Math::Quaternion RBrotation; Oyster::Math::Quaternion RBrotation;
Oyster::Math::Float3 RBscale; Oyster::Math::Float3 RBscale;
@ -66,7 +67,15 @@ namespace DanBias
void addScale(Oyster::Math::Float3 deltaScale); void addScale(Oyster::Math::Float3 deltaScale);
Oyster::Math::Float3 getScale() const; Oyster::Math::Float3 getScale() const;
Oyster::Math::Float3 GetTint();
Oyster::Math::Float3 GetGlowTint();
void SetTint(Oyster::Math::Float3);
void SetGlowTint(Oyster::Math::Float3);
// RB DEBUG // RB DEBUG
void updateRBWorld();
bool InitRB(RBInitData modelInit); bool InitRB(RBInitData modelInit);
Oyster::Math::Float4x4 getRBWorld() const; Oyster::Math::Float4x4 getRBWorld() const;
void setRBPos(Oyster::Math::Float3 newPos); void setRBPos(Oyster::Math::Float3 newPos);

View File

@ -89,7 +89,9 @@ bool GameState::Init( SharedStateContent &shared )
Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y; Float aspectRatio = gfxOp.Resolution.x / gfxOp.Resolution.y;
this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f ); this->privData->camera.SetPerspectiveProjection( Utility::Value::Radian(90.0f), aspectRatio, 0.1f, 1000.0f );
Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() ); Graphics::API::SetProjection( this->privData->camera.GetProjectionMatrix() );
gfxOp.AmbientValue = 1.0f; gfxOp.AmbientValue = 0.5f;
gfxOp.GlobalGlowTint = Math::Float3(2,1,1);
gfxOp.GlobalTint = Math::Float3(1,1,1);
Graphics::API::SetOptions(gfxOp); Graphics::API::SetOptions(gfxOp);
//tell server ready //tell server ready
@ -126,6 +128,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
RBData.position = position; RBData.position = position;
RBData.rotation = ArrayToQuaternion( rotation ); RBData.rotation = ArrayToQuaternion( rotation );
RBData.scale = scale; RBData.scale = scale;
RBData.type = RB_Type_Cube;
// !RB DEBUG // !RB DEBUG
if( isMyPlayer ) if( isMyPlayer )
{ {
@ -138,7 +141,10 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
this->privData->myId = id; this->privData->myId = id;
this->privData->camera.SetPosition( this->privData->player.getPos() ); this->privData->camera.SetPosition( this->privData->player.getPos() );
Float3 offset = Float3( 0.0f ); Float3 offset = Float3( 0.0f );
offset.y = this->privData->player.getScale().y * 0.9f; // DEBUG position of camera so we can see the player model
//offset.y = this->privData->player.getScale().y * 5.0f;
//offset.z = this->privData->player.getScale().z * -5.0f;
// !DEBUG
this->privData->camera.SetHeadOffset( offset ); this->privData->camera.SetHeadOffset( offset );
this->privData->camera.UpdateOrientation(); this->privData->camera.UpdateOrientation();
} }
@ -182,8 +188,10 @@ bool GameState::Render()
for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject ) for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject )
{ {
if( dynamicObject->second ) if( dynamicObject->second )
{
dynamicObject->second->Render(); dynamicObject->second->Render();
} }
}
/*auto light = this->privData->lights->begin(); /*auto light = this->privData->lights->begin();
@ -327,7 +335,11 @@ void GameState::ReadKeyInput()
{ {
static const float mouseSensitivity = Radian( 1.0f ); static const float mouseSensitivity = Radian( 1.0f );
this->privData->camera.PitchDown( this->privData->input->GetPitch() * mouseSensitivity ); this->privData->camera.PitchDown( this->privData->input->GetPitch() * mouseSensitivity );
this->privData->nwClient->Send( Protocol_PlayerLeftTurn(this->privData->input->GetYaw() * mouseSensitivity) ); float yaw = this->privData->input->GetYaw();
//if( yaw != 0.0f ) //This made the camera reset to a specific rotation.
{
this->privData->nwClient->Send( Protocol_PlayerLeftTurn(yaw * mouseSensitivity) );
}
} }
// shoot // shoot
@ -496,6 +508,12 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
this->privData->camera.SetRotation( rotation ); this->privData->camera.SetRotation( rotation );
this->privData->player.setPos( position ); this->privData->player.setPos( position );
this->privData->player.setRot( rotation ); this->privData->player.setRot( rotation );
this->privData->player.updateWorld();
// RB DEBUG
this->privData->player.setRBPos ( position );
this->privData->player.setRBRot ( rotation );
this->privData->player.updateRBWorld();
// !RB DEBUG
} }
C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID]; C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID];
@ -504,9 +522,11 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
{ {
object->setPos( position ); object->setPos( position );
object->setRot( rotation ); object->setRot( rotation );
object->updateWorld();
// RB DEBUG // RB DEBUG
object->setRBPos ( position ); object->setRBPos ( position );
object->setRBRot ( rotation ); object->setRBRot ( rotation );
object->updateRBWorld();
// !RB DEBUG // !RB DEBUG
} }
} }

View File

@ -79,9 +79,10 @@ GameClientState::ClientState MainState::Update( float deltaTime )
{ {
bool test = this->privData->input->IsMousePressed(); bool test = this->privData->input->IsMousePressed();
if(test) if(test)
{ { // HACK: debug trap still in use?
int i = 0; int i = 0;
}; };
this->privData->input->GetMousePos( mouseState.x, mouseState.y ); this->privData->input->GetMousePos( mouseState.x, mouseState.y );
mouseState.mouseButtonPressed = this->privData->input->IsMousePressed(); mouseState.mouseButtonPressed = this->privData->input->IsMousePressed();
} }

View File

@ -157,6 +157,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2; RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2;
RBData.type = RB_Type_Cube; RBData.type = RB_Type_Cube;
staticObject->InitRB( RBData ); staticObject->InitRB( RBData );
staticObject->updateRBWorld();
} }
if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere) if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere)
@ -166,6 +167,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2; RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2;
RBData.type = RB_Type_Sphere; RBData.type = RB_Type_Sphere;
staticObject->InitRB( RBData ); staticObject->InitRB( RBData );
staticObject->updateRBWorld();
} }
// !RB DEBUG // !RB DEBUG

View File

@ -5,7 +5,7 @@ using namespace GameLogic;
Game::PlayerData::PlayerData() Game::PlayerData::PlayerData()
{ {
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,250,0); Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0);
Oyster::Math::Float height = 2.0f; Oyster::Math::Float height = 2.0f;
Oyster::Math::Float radius = 0.5f; Oyster::Math::Float radius = 0.5f;
Oyster::Math::Float mass = 40; Oyster::Math::Float mass = 40;
@ -24,7 +24,7 @@ Game::PlayerData::PlayerData()
Game::PlayerData::PlayerData(int playerID,int teamID) Game::PlayerData::PlayerData(int playerID,int teamID)
{ {
Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,250,0); Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0);
Oyster::Math::Float height = 2.0f; Oyster::Math::Float height = 2.0f;
Oyster::Math::Float radius = 0.5f; Oyster::Math::Float radius = 0.5f;
Oyster::Math::Float mass = 40; Oyster::Math::Float mass = 40;

View File

@ -300,6 +300,7 @@ bool Level::InitiateLevel(std::wstring levelPath)
Object* dynamicGameObj = CreateGameObj(dynamicObjData, rigidBody_Dynamic); Object* dynamicGameObj = CreateGameObj(dynamicObjData, rigidBody_Dynamic);
if (dynamicGameObj != NULL) if (dynamicGameObj != NULL)
{ {
dynamicGameObj->GetRigidBody()->SetSubscription(Level::PhysicsOnMoveLevel);
this->dynamicObjects.Push((DynamicObject*)dynamicGameObj); this->dynamicObjects.Push((DynamicObject*)dynamicGameObj);
} }
} }

View File

@ -79,99 +79,133 @@ void Player::BeginFrame()
Oyster::Math::Float maxSpeed = 30; Oyster::Math::Float maxSpeed = 30;
// Rotate player accordingly
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
Oyster::Math::Quaternion firstUp = this->rigidBody->GetState().quaternion;
this->rigidBody->SetRotationAsAngularAxis(Oyster::Math3D::Float4(this->rigidBody->GetState().centerPos.GetNormalized(), this->rotationUp));
Oyster::Math::Quaternion secondTurn = this->rigidBody->GetState().quaternion;
this->rigidBody->SetRotation(secondTurn*firstUp);
// Direction data
Oyster::Math::Float4x4 xform; Oyster::Math::Float4x4 xform;
xform = this->rigidBody->GetState().GetOrientation(); xform = this->rigidBody->GetState().GetOrientation();
/* Handle turning */
/*if (left)
m_turnAngle -= dt * m_turnVelocity;
if (right)
m_turnAngle += dt * m_turnVelocity;
xform.setRotation (btQuaternion (btVector3(0.0, 1.0, 0.0), m_turnAngle));*/
Oyster::Math::Float3 linearVelocity = this->rigidBody->GetLinearVelocity();
Oyster::Math::Float speed = this->rigidBody->GetLinearVelocity().GetLength();
Oyster::Math::Float3 forwardDir = xform.v[2]; Oyster::Math::Float3 forwardDir = xform.v[2];
Oyster::Math::Float3 upDir = xform.v[1];
Oyster::Math::Float3 rightDir = xform.v[0]; Oyster::Math::Float3 rightDir = xform.v[0];
forwardDir.Normalize(); forwardDir.Normalize();
upDir.Normalize();
rightDir.Normalize(); rightDir.Normalize();
// Previous velocities data
Oyster::Math::Float3 linearVelocity = this->rigidBody->GetLinearVelocity();
Oyster::Math::Float3 forwardVelocity = linearVelocity*Oyster::Math::Float3(fabs(forwardDir.x), fabs(forwardDir.y), fabs(forwardDir.z));
Oyster::Math::Float forwardSpeed = (linearVelocity*forwardDir).GetLength();
Oyster::Math::Float3 rightVelocity = linearVelocity*Oyster::Math::Float3(fabs(rightDir.x), fabs(rightDir.y), fabs(rightDir.z));
Oyster::Math::Float rightSpeed = (linearVelocity*rightDir).GetLength();
Oyster::Math::Float3 upVelocity = linearVelocity*Oyster::Math::Float3(fabs(upDir.x), fabs(upDir.y), fabs(upDir.z));
// Walking data
Oyster::Math::Float3 walkDirection = Oyster::Math::Float3(0.0, 0.0, 0.0); Oyster::Math::Float3 walkDirection = Oyster::Math::Float3(0.0, 0.0, 0.0);
Oyster::Math::Float walkSpeed = this->moveSpeed*0.2f; Oyster::Math::Float walkSpeed = this->moveSpeed*0.2f;
// Check for input
if(key_forward > 0.001) if(key_forward > 0.001)
{ {
key_forward -= gameInstance->GetFrameTime(); key_forward -= gameInstance->GetFrameTime();
walkDirection += forwardDir; walkDirection += forwardDir;
walkDirection.Normalize();
} }
if(key_backward > 0.001) if(key_backward > 0.001)
{ {
key_backward -= gameInstance->GetFrameTime(); key_backward -= gameInstance->GetFrameTime();
walkDirection -= forwardDir; walkDirection -= forwardDir;
walkDirection.Normalize();
} }
if(key_strafeRight > 0.001) if(key_strafeRight > 0.001)
{ {
key_strafeRight -= gameInstance->GetFrameTime(); key_strafeRight -= gameInstance->GetFrameTime();
walkDirection -= rightDir; walkDirection += rightDir;
walkDirection.Normalize();
} }
if(key_strafeLeft > 0.001) if(key_strafeLeft > 0.001)
{ {
key_strafeLeft -= gameInstance->GetFrameTime(); key_strafeLeft -= gameInstance->GetFrameTime();
walkDirection += rightDir; walkDirection -= rightDir;
}
// Dampen velocity if certain keys are not pressed
if(key_jump <= 0.001 && this->rigidBody->GetLambda() < 0.9f)
{
if(key_forward <= 0.001 && key_backward <= 0.001)
{
forwardVelocity *= Oyster::Math::Float3(0.2f*fabs(forwardDir.x), 0.2f*fabs(forwardDir.y), 0.2f*fabs(forwardDir.z));
}
if(key_strafeRight <= 0.001 && key_strafeLeft <= 0.001)
{
rightVelocity *= Oyster::Math::Float3(0.2f*fabs(rightDir.x), 0.2f*fabs(rightDir.y), 0.2f*fabs(rightDir.z));
}
}
// Walk if walkdirection is something
if(walkDirection != Oyster::Math::Float3::null)
{
walkDirection.Normalize(); walkDirection.Normalize();
maxSpeed = 40;
}
// If on the ground, accelerate normally
if (key_forward <= 0.001 && key_backward <= 0.001 && key_strafeRight <= 0.001 && key_strafeLeft <= 0.001 && key_jump <= 0.001 ) //&& this->rigidBody->GetLambda() < 0.7f) if(this->rigidBody->GetLambda() < 0.9f)
{ {
/* Dampen when on the ground and not being moved by the player */ if(forwardSpeed < maxSpeed)
linearVelocity *= 0.2f; {
this->rigidBody->SetLinearVelocity (linearVelocity); forwardVelocity += walkDirection*Oyster::Math::Float3(fabs(forwardDir.x), fabs(forwardDir.y), fabs(forwardDir.z)) * walkSpeed;
} }
else if(rightSpeed < maxSpeed)
{ {
if (speed < maxSpeed && this->rigidBody->GetLambda() < 1.0f) rightVelocity += walkDirection*Oyster::Math::Float3(fabs(rightDir.x), abs(rightDir.y), fabs(rightDir.z)) * walkSpeed;
{
Oyster::Math::Float3 velocity = linearVelocity + walkDirection * walkSpeed;
this->rigidBody->SetLinearVelocity(velocity);
} }
else if(speed < maxSpeed) }
// If in the air, accelerate slower
if(this->rigidBody->GetLambda() >= 0.9f)
{ {
Oyster::Math::Float3 velocity = linearVelocity + (walkDirection * walkSpeed)*0.2f; if(forwardSpeed < maxSpeed)
this->rigidBody->SetLinearVelocity(velocity); {
forwardVelocity += walkDirection*Oyster::Math::Float3(fabs(forwardDir.x), fabs(forwardDir.y), fabs(forwardDir.z)) * walkSpeed*0.2f;
}
if(rightSpeed < maxSpeed)
{
rightVelocity += walkDirection*Oyster::Math::Float3(fabs(rightDir.x), fabs(rightDir.y), fabs(rightDir.z)) * walkSpeed*0.2f;
}
} }
} }
// Adjust velocities so no squaring occurs
forwardVelocity *= Oyster::Math::Float3(fabs(forwardDir.x), fabs(forwardDir.y), fabs(forwardDir.z));
rightVelocity *= Oyster::Math::Float3(fabs(rightDir.x), fabs(rightDir.y), fabs(rightDir.z));
upVelocity *= Oyster::Math::Float3(fabs(upDir.x), fabs(upDir.y), fabs(upDir.z));
this->rigidBody->SetLinearVelocity(forwardVelocity+rightVelocity+upVelocity);
//Jump
if(key_jump > 0.001) if(key_jump > 0.001)
{ {
this->key_jump -= this->gameInstance->GetFrameTime(); this->key_jump -= this->gameInstance->GetFrameTime();
if(this->rigidBody->GetLambda() < 1.0f) if(this->rigidBody->GetLambda() < 0.9f)
{ {
Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1].GetNormalized(); Oyster::Math::Float3 up = this->rigidBody->GetState().centerPos.GetNormalized();
this->rigidBody->ApplyImpulse(up*this->rigidBody->GetState().mass*20); this->rigidBody->ApplyImpulse(up*this->rigidBody->GetState().mass*20);
this->playerState = PLAYER_STATE::PLAYER_STATE_JUMPING; this->playerState = PLAYER_STATE::PLAYER_STATE_JUMPING;
} }
} }
Oyster::Math::Float3 pos = this->rigidBody->GetState().centerPos;
if(pos == Oyster::Math::Float3(0,0,0))
int i =0;
//this->weapon->Update(0.01f); //this->weapon->Update(0.01f);
} }
void Player::EndFrame() void Player::EndFrame()
{ {
// snap to axis
Oyster::Math::Float4 rotation;
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
//Object::EndFrame(); //Object::EndFrame();
} }
void Player::Move(const PLAYER_MOVEMENT &movement) void Player::Move(const PLAYER_MOVEMENT &movement)
@ -235,13 +269,10 @@ void Player::Rotate(const Oyster::Math3D::Float3& lookDir, const Oyster::Math3D:
// this is the camera right vector // this is the camera right vector
this->lookDir = lookDir; this->lookDir = lookDir;
//Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1];
//this->rigidBody->SetUpAndRight(up, right);
} }
void Player::TurnLeft(Oyster::Math3D::Float deltaRadians) void Player::TurnLeft(Oyster::Math3D::Float deltaRadians)
{ {
this->rotationUp += deltaRadians; this->rotationUp += deltaRadians;
this->rigidBody->SetRotationAsAngularAxis(Oyster::Math3D::Float4(this->rigidBody->GetState().centerPos.GetNormalized(), this->rotationUp));
} }
void Player::Jump() void Player::Jump()

View File

@ -97,6 +97,8 @@ namespace GameLogic
{ {
this->protocol[0].value = protocol_Gameplay_PlayerLeftTurn; this->protocol[0].value = protocol_Gameplay_PlayerLeftTurn;
this->protocol[0].type = ::Oyster::Network::NetAttributeType_Short; this->protocol[0].type = ::Oyster::Network::NetAttributeType_Short;
// deltaRadian
this->protocol[1].type = ::Oyster::Network::NetAttributeType_Float;
this->deltaRadian = deltaRadian; this->deltaRadian = deltaRadian;
} }

View File

@ -0,0 +1,22 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dan Andersson] [2014]
/////////////////////////////////////////////////////////////////////
#ifndef INPUT_APPLICATION_KEBOARD_H
#define INPUT_APPLICATION_KEBOARD_H
#include "InputObject.h"
#include <vector>
namespace Input
{
class AplicationKeyboard : public InputObject
{
public:
protected:
AplicationKeyboard();
~AplicationKeyboard();
};
}
#endif // !INPUT_KEBOARD_H

View File

@ -0,0 +1,24 @@
/////////////////////////////////////////////////////////////////////
// Created by [Dan Andersson] [2014]
/////////////////////////////////////////////////////////////////////
#ifndef INPUT_WIN32_APPLICATION_KEBOARD_H
#define INPUT_WIN32_APPLICATION_KEBOARD_H
#include "..\ApplicationKeyboard.h"
//#include <Windows.h>
namespace Input
{
class Win32ApplicationKeyboard :public AplicationKeyboard
{
public:
Win32ApplicationKeyboard();
~Win32ApplicationKeyboard();
private:
};
}
#endif // !INPUT_WIN32_APPLICATION_KEBOARD_H

View File

@ -28,6 +28,7 @@
<ClCompile Include="Source\Win32\Win32Mouse.cpp" /> <ClCompile Include="Source\Win32\Win32Mouse.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Include\ApplicationKeyboard.h" />
<ClInclude Include="Include\Common.h" /> <ClInclude Include="Include\Common.h" />
<ClInclude Include="Include\Input.h" /> <ClInclude Include="Include\Input.h" />
<ClInclude Include="Include\InputManager.h" /> <ClInclude Include="Include\InputManager.h" />
@ -35,6 +36,7 @@
<ClInclude Include="Include\Keyboard.h" /> <ClInclude Include="Include\Keyboard.h" />
<ClInclude Include="Include\Mouse.h" /> <ClInclude Include="Include\Mouse.h" />
<ClInclude Include="Include\PreReq.h" /> <ClInclude Include="Include\PreReq.h" />
<ClInclude Include="Include\Win32\Win32ApplicationKeyboard.h" />
<ClInclude Include="Include\Win32\Win32Input.h" /> <ClInclude Include="Include\Win32\Win32Input.h" />
<ClInclude Include="Include\Win32\Win32Keyboard.h" /> <ClInclude Include="Include\Win32\Win32Keyboard.h" />
<ClInclude Include="Include\Win32\Win32Mouse.h" /> <ClInclude Include="Include\Win32\Win32Mouse.h" />

View File

@ -189,7 +189,7 @@ float InputClass::GetPitch( )
float InputClass::GetYaw( ) float InputClass::GetYaw( )
{ {
float dX = (static_cast<float>( m_mouseState.lX)/5); float dX = (static_cast<float>( m_mouseState.lX)/5);
return -dX; return dX;
} }
bool InputClass::IsMousePressed() bool InputClass::IsMousePressed()

View File

@ -0,0 +1,218 @@
#include "ConnectionUDP.h"
#include <WinSock2.h>
using namespace Oyster::Network;
ConnectionUDP::ConnectionUDP()
{
this->ipSize = 16;
this->socket = -1;
this->stillSending = false;
this->closed = true;
this->Address = NULL;
}
ConnectionUDP::ConnectionUDP( int socket )
{
this->ipSize = 16;
this->socket = socket;
this->stillSending = false;
this->closed = true;
this->Address = NULL;
}
ConnectionUDP::~ConnectionUDP()
{
closesocket( this->socket );
}
int ConnectionUDP::Connect(unsigned short port, const char serverName[])
{
this->port = port;
closed = false;
stillSending = true;
struct hostent *hostEnt;
if((hostEnt = gethostbyname(serverName)) == NULL)
{
return SOCKET_ERROR;
}
this->Address = *(unsigned long*)hostEnt->h_addr;
this->port = htons(this->port);
return 0;
}
int ConnectionUDP::Disconnect()
{
int result = closesocket(this->socket);
if(result == SOCKET_ERROR)
{
return result;
}
return 0;
}
int ConnectionUDP::InitiateServer(unsigned short port)
{
int errorCode = 0;
if((errorCode = InitiateSocket()) != 0)
{
return errorCode;
}
struct sockaddr_in server;
server.sin_family = AF_INET;
server.sin_addr.s_addr = INADDR_ANY;
server.sin_port = htons(port);
if(bind(this->socket, (sockaddr*)&server, sizeof(server)) == SOCKET_ERROR)
{
errorCode = SOCKET_ERROR;
closesocket(this->socket);
return errorCode;
}
closed = false;
stillSending = true;
return 0;
}
int ConnectionUDP::InitiateClient()
{
return InitiateSocket();
}
int ConnectionUDP::InitiateBroadcast(unsigned short port)
{
int result = InitiateSocket();
int flag = 1;
result = setsockopt(this->socket, /* socket affected */
SOL_SOCKET, /* set option at TCP level */
SO_BROADCAST, /* name of option */
(char *) &flag, /* the cast is historical cruft */
sizeof(flag)); /* length of option value */
if (result < 0)
return -1;
}
int ConnectionUDP::Send(OysterByte &bytes)
{
int nBytes;
struct sockaddr_in reciever;
reciever.sin_family = AF_INET;
reciever.sin_addr.s_addr = this->Address;
reciever.sin_port = port;
//printf("Send: %d\n", bytes.GetSize());
nBytes = sendto(this->socket,
bytes,
bytes.GetSize(),
0,
(sockaddr*)&reciever,
sizeof(sockaddr_in)
);
if ( nBytes != bytes.GetSize() )
{
return nBytes;
}
return 0;
}
int ConnectionUDP::Recieve(OysterByte &bytes)
{
int nBytes;
sockaddr_in from;
int fromLength = sizeof( from );
bytes.Resize(1000);
nBytes = recvfrom(this->socket,
bytes,
1000,
0,
(sockaddr*)&from,
&fromLength
);
if(nBytes <= 0)
{
bytes.SetSize(0);
return WSAGetLastError();
}
else
{
bytes.SetSize(nBytes);
}
//address and port of the client who sent the message
unsigned int from_address = ntohl( from.sin_addr.s_addr );
unsigned int from_port = ntohs( from.sin_port );
return 0;
}
bool ConnectionUDP::IsSending()
{
return stillSending;
}
bool ConnectionUDP::IsConnected()
{
if(closed)
{
return false;
}
return true;
}
int ConnectionUDP::SetBlockingMode( bool blocking )
{
DWORD nonBlocking;
if(blocking)
{
nonBlocking = 0;
}
else
{
nonBlocking = 1;
}
int result = ioctlsocket(this->socket, FIONBIO, &nonBlocking);
if(result != 0)
{
return result;
}
//Success
return 0;
}
//////////////////////////////////////
// Private Methods
//////////////////////////////////////
int ConnectionUDP::InitiateSocket()
{
this->socket = (int)::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if(this->socket == SOCKET_ERROR)
{
return socket;
}
return 0;
}

View File

@ -0,0 +1,57 @@
#ifndef NETWORK_DEPENDENCIES_CONNECTIONUDP_H
#define NETWORK_DEPENDENCIES_CONNECTIONUDP_H
//////////////////////////////////
// Created by Sam Svensson 2013 //
//////////////////////////////////
#include "IConnection.h"
#include "../NetworkDependencies/OysterByte.h"
namespace Oyster
{
namespace Network
{
class ConnectionUDP : public IConnection
{
public:
ConnectionUDP();
ConnectionUDP( int socket);
virtual ~ConnectionUDP();
virtual int InitiateServer( unsigned short port );
virtual int InitiateClient();
virtual int InitiateBroadcast(unsigned short port);
virtual int Send ( OysterByte &byte );
virtual int Recieve( OysterByte &byte );
virtual int Connect( unsigned short port, const char serverName[] );
virtual int Disconnect();
bool IsSending();
bool IsConnected();
int GetIpSize();
int SetBlockingMode( bool blocking );
private:
int InitiateSocket();
int socket;
//char ipAddress[16];
//unsigned short port;
int ipSize;
unsigned long Address;
unsigned short port;
bool stillSending;
bool closed;
};
}
}
#endif

View File

@ -147,6 +147,7 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Connection.cpp" /> <ClCompile Include="Connection.cpp" />
<ClCompile Include="ConnectionUDP.cpp" />
<ClCompile Include="Listener.cpp" /> <ClCompile Include="Listener.cpp" />
<ClCompile Include="Messages\MessageHeader.cpp" /> <ClCompile Include="Messages\MessageHeader.cpp" />
<ClCompile Include="Messages\MessagePlayerPos.cpp" /> <ClCompile Include="Messages\MessagePlayerPos.cpp" />
@ -157,6 +158,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Connection.h" /> <ClInclude Include="Connection.h" />
<ClInclude Include="ConnectionUDP.h" />
<ClInclude Include="IConnection.h" /> <ClInclude Include="IConnection.h" />
<ClInclude Include="IPostBox.h" /> <ClInclude Include="IPostBox.h" />
<ClInclude Include="Listener.h" /> <ClInclude Include="Listener.h" />

View File

@ -9,6 +9,7 @@
<ClCompile Include="OysterByte.cpp" /> <ClCompile Include="OysterByte.cpp" />
<ClCompile Include="ThreadedClient.cpp" /> <ClCompile Include="ThreadedClient.cpp" />
<ClCompile Include="WinsockFunctions.cpp" /> <ClCompile Include="WinsockFunctions.cpp" />
<ClCompile Include="ConnectionUDP.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="Connection.h" /> <ClInclude Include="Connection.h" />
@ -25,5 +26,6 @@
<ClInclude Include="Protocols.h" /> <ClInclude Include="Protocols.h" />
<ClInclude Include="ThreadedClient.h" /> <ClInclude Include="ThreadedClient.h" />
<ClInclude Include="WinsockFunctions.h" /> <ClInclude Include="WinsockFunctions.h" />
<ClInclude Include="ConnectionUDP.h" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -62,6 +62,9 @@ namespace Oyster
struct PostData struct PostData
{ {
float Amb; float Amb;
Math::Float3 Tint;
Math::Float3 GlowTint;
float PAD;
}; };
struct Text2D struct Text2D
@ -79,6 +82,14 @@ namespace Oyster
unsigned int StopY; unsigned int StopY;
Math::Float4 BlurMask; Math::Float4 BlurMask;
}; };
struct TintData
{
Math::Float3 Tint;
Math::Float PAD;
Math::Float3 GlowTint;
Math::Float PAD2;
};
} }
} }
} }

View File

@ -123,6 +123,8 @@ namespace Oyster
Definitions::PostData pd; Definitions::PostData pd;
pd.Amb = option.AmbientValue; pd.Amb = option.AmbientValue;
pd.Tint = option.GlobalTint;
pd.GlowTint = option.GlobalGlowTint;
void* data = Render::Resources::Post::Data.Map(); void* data = Render::Resources::Post::Data.Map();
memcpy(data,&pd,sizeof(Definitions::PostData)); memcpy(data,&pd,sizeof(Definitions::PostData));
@ -139,6 +141,7 @@ namespace Oyster
m->Visible = true; m->Visible = true;
m->Animation.AnimationPlaying = NULL; m->Animation.AnimationPlaying = NULL;
m->Tint = Math::Float3(1); m->Tint = Math::Float3(1);
m->GlowTint = Math::Float3(1);
m->info = (Model::ModelInfo*)Core::loader.LoadResource((Core::modelPath + filename).c_str(),Oyster::Graphics::Loading::LoadDAN, Oyster::Graphics::Loading::UnloadDAN); m->info = (Model::ModelInfo*)Core::loader.LoadResource((Core::modelPath + filename).c_str(),Oyster::Graphics::Loading::LoadDAN, Oyster::Graphics::Loading::UnloadDAN);
Model::ModelInfo* mi = (Model::ModelInfo*)m->info; Model::ModelInfo* mi = (Model::ModelInfo*)m->info;
@ -224,7 +227,7 @@ namespace Oyster
#else #else
API::State API::ReloadShaders() API::State API::ReloadShaders()
{ {
return API::State::Sucsess;
} }
void API::StartRenderWireFrame() void API::StartRenderWireFrame()

View File

@ -30,6 +30,9 @@ namespace Oyster
//between 0-1 //between 0-1
float AmbientValue; float AmbientValue;
Math::Float3 GlobalTint;
Math::Float3 GlobalGlowTint;
Math::Float2 Resolution; Math::Float2 Resolution;
//Bytes on the GPU //Bytes on the GPU
@ -38,7 +41,7 @@ namespace Oyster
typedef void* Texture; typedef void* Texture;
static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Option options); static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Option options);
#ifdef _DEBUG
static State ReloadShaders(); static State ReloadShaders();
//should be called after rendered normal models, before GUI or Text rendering //should be called after rendered normal models, before GUI or Text rendering
@ -51,7 +54,6 @@ namespace Oyster
static void RenderDebugSphere(Math::Matrix world); static void RenderDebugSphere(Math::Matrix world);
static void StartRenderFullModel(); static void StartRenderFullModel();
#endif
//! @todo Memory Leaks //! @todo Memory Leaks

View File

@ -24,6 +24,7 @@ namespace Oyster
ModelInfo* info; ModelInfo* info;
Oyster::Math::Float4x4 WorldMatrix; Oyster::Math::Float4x4 WorldMatrix;
Oyster::Math::Float3 Tint; Oyster::Math::Float3 Tint;
Oyster::Math::Float3 GlowTint;
bool Visible; bool Visible;
AnimationData Animation; AnimationData Animation;
}; };

View File

@ -136,8 +136,15 @@ namespace Oyster
memcpy(data,&(pm),sizeof(pm)); memcpy(data,&(pm),sizeof(pm));
Resources::Gather::ModelData.Unmap(); Resources::Gather::ModelData.Unmap();
Definitions::TintData td;
td.GlowTint = models[i].GlowTint;
td.Tint = models[i].Tint;
td.PAD = 0;
td.PAD2 = 0;
int s = sizeof(Definitions::TintData);
data = Render::Resources::Color.Map(); data = Render::Resources::Color.Map();
memcpy(data,&models[i].Tint,sizeof(Math::Float3)); memcpy(data,&td,sizeof(Definitions::TintData));
Render::Resources::Color.Unmap(); Render::Resources::Color.Unmap();
if(info->Material.size()) if(info->Material.size())

View File

@ -123,7 +123,7 @@ namespace Oyster
Gather::AnimationData.Init(desc); Gather::AnimationData.Init(desc);
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_PS; desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_PS;
desc.ElementSize = sizeof(Math::Float3); desc.ElementSize = sizeof(Definitions::TintData);
Color.Init(desc); Color.Init(desc);
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS; desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS;
@ -176,7 +176,7 @@ namespace Oyster
sdesc.Filter = D3D11_FILTER_ANISOTROPIC; sdesc.Filter = D3D11_FILTER_ANISOTROPIC;
sdesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; sdesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
sdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; sdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
sdesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; sdesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
sdesc.MipLODBias = 0; sdesc.MipLODBias = 0;
sdesc.MaxAnisotropy =4; sdesc.MaxAnisotropy =4;
sdesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL; sdesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL;

View File

@ -40,7 +40,10 @@ float3 perturb_normal( float3 N, float3 V, float2 texcoord )
PixelOut main(VertexOut input) PixelOut main(VertexOut input)
{ {
PixelOut output; PixelOut output;
output.DiffuseGlow = Diffuse.Sample(S1, input.UV) * float4(Color, 1); float4 DiffGlow = Diffuse.Sample(S1, input.UV);
float3 tint = Color*(1-DiffGlow.w) + GlowColor * DiffGlow.w;
tint = Color*(1-DiffGlow.w) + GlowColor * DiffGlow.w;
output.DiffuseGlow = DiffGlow * float4(tint,1);
//NORMALIZE //NORMALIZE
float3x3 CoTangentFrame = cotangent_frame(input.normal, normalize(input.ViewPos), input.UV); float3x3 CoTangentFrame = cotangent_frame(input.normal, normalize(input.ViewPos), input.UV);

View File

@ -42,4 +42,7 @@ cbuffer PerModel : register(b1)
cbuffer Tint : register(b0) cbuffer Tint : register(b0)
{ {
float3 Color; float3 Color;
float PAD;
float3 GlowColor;
float PAD2;
} }

View File

@ -47,7 +47,7 @@ void main( uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID )
DepthBase = DepthBase /4; DepthBase = DepthBase /4;
Ambient[DTid.xy/2] = float4(DiffBase.xyz, AmbValue); Ambient[DTid.xy/2] = float4(DiffBase.xyz, AmbValue);
Ambient[DTid.xy/2 + float2(Pixels.x/2, 0)] = GUI[DTid.xy]; Ambient[DTid.xy/2 + float2(Pixels.x/2, 0)] = GUI[DTid.xy];
Ambient[DTid.xy/2 + float2(0, Pixels.y/2)] = float4(DiffBase.xyz * DiffBase.w * 10 /* * (2-DepthBase) */,1); Ambient[DTid.xy/2 + float2(0, Pixels.y/2)] = float4(DiffBase.xyz * DiffBase.w /* * (2-DepthBase) */,DiffBase.w);
Ambient[DTid.xy/2 + Pixels/2] = float4(NormalSpec[DTid.xy].xyz * float3(1,1,-1),1); Ambient[DTid.xy/2 + Pixels/2] = float4(NormalSpec[DTid.xy].xyz * float3(1,1,-1),1);
} }

View File

@ -1,7 +1,7 @@
#include "Defines.hlsli" #include "Defines.hlsli"
#include "PosManipulation.hlsli" #include "PosManipulation.hlsli"
static float Radius = 10; static float Radius = 1;
float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID) float GetSSAO(float3 pos, float2 uv, int2 texCoord2, uint2 rndID)
{ {

View File

@ -9,6 +9,8 @@ SamplerState S1 : register(s0);
cbuffer Size : register(b0) cbuffer Size : register(b0)
{ {
float AmbFactor; float AmbFactor;
float3 Color;
float3 GlowColor;
} }
[numthreads(16, 16, 1)] [numthreads(16, 16, 1)]
@ -26,9 +28,10 @@ void main( uint3 DTid : SV_DispatchThreadID )
SSAO = SSAO / 16; SSAO = SSAO / 16;
float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]); float4 Light = Diffuse[DTid.xy] + saturate(Specular[DTid.xy]);
float3 Amb = Ambient[DTid.xy/2].xyz * SSAO; float3 Amb = Ambient[DTid.xy/2].xyz * SSAO * Color;
float3 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)].xyz; float4 Glow = Ambient[DTid.xy/2 + uint2(0,Output.Length.y/2)];
Glow = float4(Glow.xyz * GlowColor, 1);
float4 GUI; float4 GUI;
uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0); uint2 index = DTid.xy/2 + uint2((uint)Output.Length.x/(uint)2,0);

View File

@ -283,6 +283,11 @@ void API_Impl::UpdateWorld()
SimpleRigidBody* simpleBody = dynamic_cast<SimpleRigidBody*>(this->customBodies[i]); SimpleRigidBody* simpleBody = dynamic_cast<SimpleRigidBody*>(this->customBodies[i]);
this->customBodies[i]->SetGravity(-(this->customBodies[i]->GetState().centerPos - this->gravityPoint).GetNormalized()*this->gravity); this->customBodies[i]->SetGravity(-(this->customBodies[i]->GetState().centerPos - this->gravityPoint).GetNormalized()*this->gravity);
simpleBody->PreStep(this->dynamicsWorld); simpleBody->PreStep(this->dynamicsWorld);
if(simpleBody->GetRigidBody()->getActivationState() == ACTIVE_TAG)
{
this->customBodies[i]->CallSubscription_Move();
}
} }
this->dynamicsWorld->stepSimulation(this->timeStep, 1, this->timeStep); this->dynamicsWorld->stepSimulation(this->timeStep, 1, this->timeStep);
@ -296,11 +301,6 @@ void API_Impl::UpdateWorld()
trans = simpleBody->GetRigidBody()->getWorldTransform(); trans = simpleBody->GetRigidBody()->getWorldTransform();
this->customBodies[i]->SetPosition(Float3(trans.getOrigin().x(), trans.getOrigin().y(), trans.getOrigin().z())); this->customBodies[i]->SetPosition(Float3(trans.getOrigin().x(), trans.getOrigin().y(), trans.getOrigin().z()));
this->customBodies[i]->SetRotation(Quaternion(Float3(trans.getRotation().x(), trans.getRotation().y(), trans.getRotation().z()), trans.getRotation().w())); this->customBodies[i]->SetRotation(Quaternion(Float3(trans.getRotation().x(), trans.getRotation().y(), trans.getRotation().z()), trans.getRotation().w()));
if(simpleBody->GetRigidBody()->getActivationState() == ACTIVE_TAG)
{
this->customBodies[i]->CallSubscription_Move();
}
} }
int numManifolds = this->dynamicsWorld->getDispatcher()->getNumManifolds(); int numManifolds = this->dynamicsWorld->getDispatcher()->getNumManifolds();

View File

@ -168,9 +168,15 @@ void SimpleRigidBody::SetRotationAsAngularAxis(::Oyster::Math::Float4 angularAxi
return; return;
} }
float s = sin(angularAxis.w/2);
float x = angularAxis.x * s;
float y = angularAxis.y * s;
float z = angularAxis.z * s;
float w = cos(angularAxis.w/2);
btTransform trans; btTransform trans;
btVector3 vector(angularAxis.x, angularAxis.y, angularAxis.z); btVector3 vector(angularAxis.x, angularAxis.y, angularAxis.z);
btQuaternion quaternion(vector, angularAxis.w); btQuaternion quaternion(x,y,z,w);
trans = this->rigidBody->getWorldTransform(); trans = this->rigidBody->getWorldTransform();
trans.setRotation(quaternion); trans.setRotation(quaternion);
@ -263,22 +269,11 @@ Float4x4 SimpleRigidBody::GetRotation() const
Float4 SimpleRigidBody::GetRotationAsAngularAxis() Float4 SimpleRigidBody::GetRotationAsAngularAxis()
{ {
Float4 axis = Float4::null; Float4 axis = Float4::null;
Float s = sqrtf(1 - this->state.quaternion.real*this->state.quaternion.real); btTransform trans;
axis.w = 2*acos(this->state.quaternion.real*this->state.quaternion.real); trans = this->rigidBody->getWorldTransform();
axis.xyz = trans.getRotation().getAxis();
if(1 - this->state.quaternion.real > 0.001f) axis.w = trans.getRotation().getAngle();
{
axis.x = this->state.quaternion.imaginary.x/s;
axis.y = this->state.quaternion.imaginary.y/s;
axis.z = this->state.quaternion.imaginary.z/s;
}
else
{
axis.x = this->state.quaternion.imaginary.x;
axis.y = this->state.quaternion.imaginary.y;
axis.z = this->state.quaternion.imaginary.z;
}
return axis; return axis;
} }
@ -353,7 +348,8 @@ void SimpleRigidBody::PreStep (const btCollisionWorld* collisionWorld)
{ {
btTransform xform; btTransform xform;
xform = this->rigidBody->getWorldTransform (); xform = this->rigidBody->getWorldTransform ();
btVector3 down = -xform.getBasis()[1]; Float3 normalDown = -this->state.centerPos.GetNormalized();
btVector3 down(normalDown.x, normalDown.y, normalDown.z);
btVector3 forward = xform.getBasis()[2]; btVector3 forward = xform.getBasis()[2];
down.normalize (); down.normalize ();
forward.normalize(); forward.normalize();
@ -361,12 +357,17 @@ void SimpleRigidBody::PreStep (const btCollisionWorld* collisionWorld)
this->raySource[0] = xform.getOrigin(); this->raySource[0] = xform.getOrigin();
this->raySource[1] = xform.getOrigin(); this->raySource[1] = xform.getOrigin();
if(this->state.reach.y < 1.0f)
Float angle = acos(Float3(0, 1, 0).Dot(this->state.centerPos.GetNormalized())); Float angle = acos(Float3(0, 1, 0).Dot(this->state.centerPos.GetNormalized()));
down.setZ(-down.z()); //down.setZ(-down.z());
down.setX(-down.x());
btVector3 targetPlus = down * this->state.reach.y * btScalar(1.1); btVector3 targetPlus = down * this->state.reach.y * btScalar(1.1);
if(this->state.mass == 40)
{
const char* breakpoint = "STOP";
}
this->rayTarget[0] = this->raySource[0] + targetPlus; this->rayTarget[0] = this->raySource[0] + targetPlus;
this->rayTarget[1] = this->raySource[1] + forward * this->state.reach.y * btScalar(1.1); this->rayTarget[1] = this->raySource[1] + forward * this->state.reach.y * btScalar(1.1);
@ -383,7 +384,6 @@ void SimpleRigidBody::PreStep (const btCollisionWorld* collisionWorld)
{ {
if (rayResult.m_collisionObject == m_me) if (rayResult.m_collisionObject == m_me)
return 1.0; return 1.0;
return ClosestRayResultCallback::addSingleResult (rayResult, normalInWorldSpace); return ClosestRayResultCallback::addSingleResult (rayResult, normalInWorldSpace);
} }
protected: protected: