Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameLogic
This commit is contained in:
commit
10c0019c02
|
@ -21,17 +21,17 @@ namespace DanBias
|
|||
ButtonEllipse()
|
||||
: EventButtonGUI(), radius(0)
|
||||
{}
|
||||
ButtonEllipse(std::wstring textureName, Owner owner, float xPos, float yPos, float textureWidth, float textureHeight)
|
||||
: EventButtonGUI(textureName, owner, xPos, yPos, textureWidth, textureHeight)
|
||||
ButtonEllipse(std::wstring textureName, Owner owner, float xPos, float yPos, float textureWidth, float textureHeight, bool resizeToScreenAspectRatio = true)
|
||||
: EventButtonGUI(textureName, owner, xPos, yPos, textureWidth, textureHeight, resizeToScreenAspectRatio)
|
||||
{}
|
||||
ButtonEllipse(std::wstring textureName, EventFunc func, float xPos, float yPos, float textureWidth, float textureHeight)
|
||||
: EventButtonGUI(textureName, func, xPos, yPos, textureWidth, textureHeight)
|
||||
ButtonEllipse(std::wstring textureName, EventFunc func, float xPos, float yPos, float textureWidth, float textureHeight, bool resizeToScreenAspectRatio = true)
|
||||
: EventButtonGUI(textureName, func, xPos, yPos, textureWidth, textureHeight, resizeToScreenAspectRatio)
|
||||
{}
|
||||
ButtonEllipse(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float textureWidth, float textureHeight)
|
||||
: EventButtonGUI(textureName, func, owner, xPos, yPos, textureWidth, textureHeight)
|
||||
ButtonEllipse(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float textureWidth, float textureHeight, bool resizeToScreenAspectRatio = true)
|
||||
: EventButtonGUI(textureName, func, owner, xPos, yPos, textureWidth, textureHeight, resizeToScreenAspectRatio)
|
||||
{}
|
||||
ButtonEllipse(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float textureWidth, float textureHeight)
|
||||
: EventButtonGUI(textureName, func, owner, userData, xPos, yPos, textureWidth, textureHeight)
|
||||
ButtonEllipse(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float textureWidth, float textureHeight, bool resizeToScreenAspectRatio = true)
|
||||
: EventButtonGUI(textureName, func, owner, userData, xPos, yPos, textureWidth, textureHeight, resizeToScreenAspectRatio)
|
||||
{}
|
||||
virtual ~ButtonEllipse()
|
||||
{}
|
||||
|
@ -40,9 +40,9 @@ namespace DanBias
|
|||
bool Collision(InputClass* inputObject)
|
||||
{
|
||||
POINT p;
|
||||
RECT r;
|
||||
GetCursorPos(&p);
|
||||
ScreenToClient(WindowShell::GetHWND(), &p);
|
||||
RECT r;
|
||||
GetClientRect(WindowShell::GetHWND(), &r);
|
||||
|
||||
//Should come from the InputClass
|
||||
|
|
|
@ -21,17 +21,17 @@ namespace DanBias
|
|||
ButtonRectangle()
|
||||
: EventButtonGUI(), width(0), height(0)
|
||||
{}
|
||||
ButtonRectangle(std::wstring textureName, Owner owner, float xPos, float yPos, float width, float height)
|
||||
: EventButtonGUI(textureName, owner, xPos, yPos, width, height)
|
||||
ButtonRectangle(std::wstring textureName, Owner owner, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true)
|
||||
: EventButtonGUI(textureName, owner, xPos, yPos, width, height, resizeToScreenAspectRatio)
|
||||
{}
|
||||
ButtonRectangle(std::wstring textureName, EventFunc func, float xPos, float yPos, float width, float height)
|
||||
: EventButtonGUI(textureName, func, xPos, yPos, width, height)
|
||||
ButtonRectangle(std::wstring textureName, EventFunc func, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true)
|
||||
: EventButtonGUI(textureName, func, xPos, yPos, width, height, resizeToScreenAspectRatio)
|
||||
{}
|
||||
ButtonRectangle(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float width, float height)
|
||||
: EventButtonGUI(textureName, func, owner, xPos, yPos, width, height)
|
||||
ButtonRectangle(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true)
|
||||
: EventButtonGUI(textureName, func, owner, xPos, yPos, width, height, resizeToScreenAspectRatio)
|
||||
{}
|
||||
ButtonRectangle(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float width, float height)
|
||||
: EventButtonGUI(textureName, func, owner, userData, xPos, yPos, width, height)
|
||||
ButtonRectangle(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true)
|
||||
: EventButtonGUI(textureName, func, owner, userData, xPos, yPos, width, height, resizeToScreenAspectRatio)
|
||||
{}
|
||||
virtual ~ButtonRectangle()
|
||||
{}
|
||||
|
|
|
@ -19,49 +19,44 @@ namespace DanBias
|
|||
EventButtonGUI()
|
||||
: EventButton(), xPos(0), yPos(0), width(0), height(0), texture(NULL)
|
||||
{}
|
||||
EventButtonGUI(std::wstring textureName, Owner owner, float xPos, float yPos, float width, float height)
|
||||
EventButtonGUI(std::wstring textureName, Owner owner, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true)
|
||||
: EventButton(owner), xPos(xPos), yPos(yPos), width(width), height(height), texture(NULL)
|
||||
{
|
||||
CreateTexture(textureName);
|
||||
if(resizeToScreenAspectRatio) ResizeWithAspectRatio();
|
||||
}
|
||||
EventButtonGUI(std::wstring textureName, EventFunc func, float xPos, float yPos, float width, float height)
|
||||
EventButtonGUI(std::wstring textureName, EventFunc func, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true)
|
||||
: EventButton(func), xPos(xPos), yPos(yPos), width(width), height(height), texture(NULL)
|
||||
{
|
||||
CreateTexture(textureName);
|
||||
if(resizeToScreenAspectRatio) ResizeWithAspectRatio();
|
||||
}
|
||||
EventButtonGUI(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float width, float height)
|
||||
EventButtonGUI(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true)
|
||||
: EventButton(func, owner), xPos(xPos), yPos(yPos), width(width), height(height), texture(NULL)
|
||||
{
|
||||
CreateTexture(textureName);
|
||||
if(resizeToScreenAspectRatio) ResizeWithAspectRatio();
|
||||
}
|
||||
EventButtonGUI(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float width, float height)
|
||||
EventButtonGUI(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true)
|
||||
: EventButton(func, owner, userData), xPos(xPos), yPos(yPos), width(width), height(height), texture(NULL)
|
||||
{
|
||||
CreateTexture(textureName);
|
||||
if(resizeToScreenAspectRatio) ResizeWithAspectRatio();
|
||||
}
|
||||
virtual ~EventButtonGUI()
|
||||
{
|
||||
Oyster::Graphics::API::DeleteTexture(texture);
|
||||
Oyster::Graphics::API::DeleteTexture(texture2);
|
||||
Oyster::Graphics::API::DeleteTexture(texture3);
|
||||
texture = NULL;
|
||||
texture2 = NULL;
|
||||
texture3 = NULL;
|
||||
}
|
||||
|
||||
void CreateTexture(std::wstring textureName)
|
||||
{
|
||||
std::wstring file = L".png";
|
||||
|
||||
//Create texture
|
||||
texture = Oyster::Graphics::API::CreateTexture(textureName + std::wstring(L"none") + file);
|
||||
texture2 = Oyster::Graphics::API::CreateTexture(textureName + std::wstring(L"highlight") + file);
|
||||
texture3 = Oyster::Graphics::API::CreateTexture(textureName + std::wstring(L"down") + file);
|
||||
texture = Oyster::Graphics::API::CreateTexture(textureName);
|
||||
}
|
||||
|
||||
virtual void Render()
|
||||
{
|
||||
|
||||
if(EventButton<Owner>::Enabled())
|
||||
{
|
||||
//Render att xPos and yPos
|
||||
|
@ -69,27 +64,31 @@ namespace DanBias
|
|||
|
||||
if(EventButton<Owner>::GetState() == ButtonState_None)
|
||||
{
|
||||
Oyster::Graphics::API::RenderGuiElement(texture, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height));
|
||||
Oyster::Graphics::API::RenderGuiElement(texture, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height), Oyster::Math::Float3(1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
else if(EventButton<Owner>::GetState() == ButtonState_Hover)
|
||||
{
|
||||
Oyster::Graphics::API::RenderGuiElement(texture2, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height));
|
||||
Oyster::Graphics::API::RenderGuiElement(texture, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height), Oyster::Math::Float3(0.0f, 1.0f, 0.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
Oyster::Graphics::API::RenderGuiElement(texture3, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height));
|
||||
Oyster::Graphics::API::RenderGuiElement(texture, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height), Oyster::Math::Float3(1.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ResizeWithAspectRatio()
|
||||
{
|
||||
RECT r;
|
||||
GetClientRect(WindowShell::GetHWND(), &r);
|
||||
height *= (float)r.right/(float)r.bottom;
|
||||
}
|
||||
|
||||
protected:
|
||||
float xPos, yPos;
|
||||
float width, height;
|
||||
Oyster::Graphics::API::Texture texture;
|
||||
Oyster::Graphics::API::Texture texture2;
|
||||
Oyster::Graphics::API::Texture texture3;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ struct LoginState::myData
|
|||
|
||||
//Menu button collection
|
||||
EventButtonCollection* collection;
|
||||
|
||||
bool createGame;
|
||||
int testNumber;
|
||||
}privData;
|
||||
|
||||
|
@ -51,7 +51,7 @@ void LoginState::ButtonCallback(Oyster::Event::ButtonEvent<LoginState*>& e)
|
|||
switch(type)
|
||||
{
|
||||
case Create:
|
||||
/*if(e.state == ButtonState_None)
|
||||
if(e.state == ButtonState_None)
|
||||
{
|
||||
int a = 0;
|
||||
std::cout << "None" << std::endl;
|
||||
|
@ -76,7 +76,8 @@ void LoginState::ButtonCallback(Oyster::Event::ButtonEvent<LoginState*>& e)
|
|||
//Change to create state or something similar
|
||||
int a = 0;
|
||||
std::cout << "Released" << std::endl;
|
||||
}*/
|
||||
e.owner->privData->createGame = true;
|
||||
}
|
||||
break;
|
||||
case Options:
|
||||
break;
|
||||
|
@ -110,22 +111,23 @@ bool LoginState::Init(Oyster::Network::NetworkClient* nwClient)
|
|||
//Create menu buttons
|
||||
privData->collection = new EventButtonCollection;
|
||||
EventHandler::Instance().AddCollection(privData->collection);
|
||||
privData->collection->AddButton(new ButtonEllipse<LoginState*>(L"circle_", &LoginState::ButtonCallback, this, (void*)Create, 0.2f, 0.2f, 0.1f, 0.2f));
|
||||
privData->collection->AddButton(new ButtonEllipse<LoginState*>(L"circle_", &LoginState::ButtonCallback, this, (void*)Create, 0.2f, 0.3f, 0.1f, 0.2f));
|
||||
privData->collection->AddButton(new ButtonEllipse<LoginState*>(L"circle_", &LoginState::ButtonCallback, this, (void*)Create, 0.2f, 0.4f, 0.1f, 0.2f));
|
||||
privData->collection->AddButton(new ButtonEllipse<LoginState*>(L"circle_", &LoginState::ButtonCallback, this, (void*)Create, 0.2f, 0.5f, 0.1f, 0.2f));
|
||||
privData->collection->AddButton(new ButtonEllipse<LoginState*>(L"circle.png", &LoginState::ButtonCallback, this, (void*)Options, 0.2f, 0.2f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonEllipse<LoginState*>(L"circle.png", &LoginState::ButtonCallback, this, (void*)Options, 0.2f, 0.3f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonEllipse<LoginState*>(L"circle.png", &LoginState::ButtonCallback, this, (void*)Options, 0.2f, 0.4f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonEllipse<LoginState*>(L"circle.png", &LoginState::ButtonCallback, this, (void*)Options, 0.2f, 0.5f, 0.1f, 0.1f));
|
||||
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button_", &LoginState::ButtonCallback, this, (void*)Create, 0.15f, 0.05f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button_", &LoginState::ButtonCallback, this, (void*)Create, 0.25f, 0.05f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button_", &LoginState::ButtonCallback, this, (void*)Create, 0.35f, 0.05f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button_", &LoginState::ButtonCallback, this, (void*)Create, 0.45f, 0.05f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button.png", &LoginState::ButtonCallback, this, (void*)Options, 0.15f, 0.05f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button.png", &LoginState::ButtonCallback, this, (void*)Options, 0.25f, 0.05f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button.png", &LoginState::ButtonCallback, this, (void*)Options, 0.35f, 0.05f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button.png", &LoginState::ButtonCallback, this, (void*)Options, 0.45f, 0.05f, 0.1f, 0.1f));
|
||||
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button_", &LoginState::ButtonCallback, this, (void*)Create, 0.5f, 0.5f, 0.3f, 0.3f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button.png", &LoginState::ButtonCallback, this, (void*)Create, 0.5f, 0.5f, 0.3f, 0.3f));
|
||||
|
||||
//Incr/decr buttons
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button_", &LoginState::ButtonCallback, this, (void*)Incr, 0.85f, 0.2f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button_", &LoginState::ButtonCallback, this, (void*)Decr, 0.55f, 0.2f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button.png", &LoginState::ButtonCallback, this, (void*)Incr, 0.85f, 0.2f, 0.1f, 0.1f));
|
||||
privData->collection->AddButton(new ButtonRectangle<LoginState*>(L"button.png", &LoginState::ButtonCallback, this, (void*)Decr, 0.55f, 0.2f, 0.1f, 0.1f));
|
||||
|
||||
privData->createGame = false;
|
||||
privData->testNumber = 0;
|
||||
|
||||
return true;
|
||||
|
@ -182,7 +184,7 @@ GameClientState::ClientState LoginState::Update(float deltaTime, InputClass* Key
|
|||
// check data from server
|
||||
|
||||
// create game
|
||||
if( KeyInput->IsKeyPressed(DIK_C))
|
||||
if( KeyInput->IsKeyPressed(DIK_C) || privData->createGame)
|
||||
{
|
||||
DanBias::GameServerAPI::ServerInitDesc desc;
|
||||
|
||||
|
@ -218,7 +220,6 @@ GameClientState::ClientState LoginState::Update(float deltaTime, InputClass* Key
|
|||
}
|
||||
bool LoginState::Render(float dt)
|
||||
{
|
||||
|
||||
Oyster::Graphics::API::SetView(privData->view);
|
||||
Oyster::Graphics::API::SetProjection( privData->proj);
|
||||
|
||||
|
@ -241,8 +242,9 @@ bool LoginState::Render(float dt)
|
|||
wchar_t temp[10];
|
||||
_itow_s(privData->testNumber, temp, 10);
|
||||
number = temp;
|
||||
|
||||
Oyster::Graphics::API::StartTextRender();
|
||||
Oyster::Graphics::API::RenderText(number, Oyster::Math::Float2(0.7, 0.2), Oyster::Math::Float2(0.1, 0.1));
|
||||
Oyster::Graphics::API::RenderText(number, Oyster::Math::Float2(0.7f, 0.2f), Oyster::Math::Float2(0.1f, 0.1f*(1008.0f/730.0f)), Oyster::Math::Float3(1.0f, 0.0f, 0.0f));
|
||||
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
return true;
|
||||
|
@ -258,7 +260,6 @@ bool LoginState::Release()
|
|||
}
|
||||
|
||||
delete privData->collection;
|
||||
//EventHandler::Instance().DeleteCollection(privData->collection);
|
||||
|
||||
delete privData;
|
||||
privData = NULL;
|
||||
|
|
|
@ -95,19 +95,22 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
|
|||
heldObject = NULL;
|
||||
return;
|
||||
}
|
||||
Oyster::Math::Float3 up = owner->GetOrientation().v[1];
|
||||
Oyster::Math::Float3 look = owner->GetLookDir();
|
||||
Oyster::Math::Float3 pos = owner->GetPosition();
|
||||
|
||||
Oyster::Math::Float radius = 2;
|
||||
Oyster::Math::Float3 look = owner->GetLookDir().GetNormalized();
|
||||
Oyster::Math::Float lenght = 5;
|
||||
Oyster::Math::Float3 pos = owner->GetRigidBody()->GetState().centerPos;
|
||||
|
||||
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (200 * dt);
|
||||
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(look, up, pos);
|
||||
|
||||
Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/8,1,1,50);
|
||||
Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace));
|
||||
Oyster::Collision3D::Cone *hitCone = new Oyster::Collision3D::Cone(look*5,pos,radius);
|
||||
|
||||
|
||||
|
||||
forcePushData args;
|
||||
args.pushForce = pushForce;
|
||||
|
||||
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction);
|
||||
Oyster::Physics::API::Instance().ApplyEffect(hitCone,&args,ForcePushAction);
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
|
@ -126,7 +129,7 @@ void AttatchmentMassDriver::ForceZip(const WEAPON_FIRE &usage, float dt)
|
|||
|
||||
void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt)
|
||||
{
|
||||
if(hasObject) return; //this test checks if the weapon already has something picked up, if so then it cant use this function
|
||||
//if(hasObject) return; //this test checks if the weapon already has something picked up, if so then it cant use this function
|
||||
|
||||
PickUpObject(usage,dt); //first test if there is a nearby object to pickup
|
||||
|
||||
|
@ -142,19 +145,15 @@ void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt)
|
|||
forcePushData args;
|
||||
args.pushForce = -pushForce;
|
||||
|
||||
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction);
|
||||
//Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction);
|
||||
}
|
||||
|
||||
void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt)
|
||||
{
|
||||
Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized()*5;
|
||||
Oyster::Collision3D::Sphere hitSphere = Oyster::Collision3D::Sphere(pos,20);
|
||||
/*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));
|
||||
*/
|
||||
|
||||
Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,20);
|
||||
|
||||
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,this,AttemptPickUp);
|
||||
|
||||
delete hitSphere;
|
||||
}
|
||||
|
|
|
@ -124,19 +124,20 @@ using namespace GameLogic;
|
|||
|
||||
void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj, void *args)
|
||||
{
|
||||
Oyster::Physics::ICustomBody::State state;
|
||||
if(obj->GetState().mass == 0) return;
|
||||
|
||||
Object *realObj = (Object*)obj->GetCustomTag();
|
||||
|
||||
if(realObj->GetObjectType() == OBJECT_TYPE_PLAYER || realObj->GetObjectType() == OBJECT_TYPE_WORLD)
|
||||
return;
|
||||
|
||||
state = obj->GetState();
|
||||
//state.ApplyLinearImpulse(((forcePushData*)(args))->pushForce);
|
||||
obj->SetState(state);
|
||||
obj->ApplyImpulse(((forcePushData*)(args))->pushForce);
|
||||
}
|
||||
|
||||
void AttatchmentMassDriver::AttemptPickUp(Oyster::Physics::ICustomBody *obj, void* args)
|
||||
{
|
||||
if(obj->GetState().mass == 0) return;
|
||||
|
||||
AttatchmentMassDriver *weapon = ((AttatchmentMassDriver*)args);
|
||||
|
||||
if(weapon->hasObject)
|
||||
|
|
|
@ -18,17 +18,9 @@ Weapon::Weapon()
|
|||
|
||||
Weapon::Weapon(int MaxNrOfSockets,Player *owner)
|
||||
{
|
||||
if(MaxNrOfSockets > 1) return;
|
||||
|
||||
|
||||
attatchmentSockets.Resize(MaxNrOfSockets);
|
||||
attatchmentSockets[0] = new AttatchmentSocket();
|
||||
|
||||
for (int i = 0; i < MaxNrOfSockets; i++)
|
||||
{
|
||||
this->attatchmentSockets[i] = 0;
|
||||
}
|
||||
|
||||
weaponState = WEAPON_STATE_IDLE;
|
||||
currentNrOfAttatchments = 0;
|
||||
selectedAttatchment = 0;
|
||||
|
|
|
@ -12,6 +12,8 @@ using namespace ::Utility::Value;
|
|||
|
||||
API_Impl API_instance;
|
||||
|
||||
|
||||
|
||||
API & API::Instance()
|
||||
{
|
||||
return API_instance;
|
||||
|
@ -251,9 +253,73 @@ void API_Impl::ReleaseFromLimbo( const ICustomBody* objRef )
|
|||
|
||||
}
|
||||
|
||||
void API_Impl::ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void* args, void(hitAction)(ICustomBody*, void*) )
|
||||
void API_Impl::ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void* args, EventAction_ApplyEffect effect)
|
||||
{
|
||||
btRigidBody* body;
|
||||
btCollisionShape* shape;
|
||||
btMotionState* state;
|
||||
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI(0, NULL, NULL);
|
||||
|
||||
Sphere* sphere;
|
||||
Box* box;
|
||||
Cone* cone;
|
||||
|
||||
switch(collideable->type)
|
||||
{
|
||||
case ICollideable::Type::Type_sphere:
|
||||
sphere = dynamic_cast<Sphere*>(collideable);
|
||||
// Add collision shape
|
||||
shape = new btSphereShape(sphere->radius);
|
||||
|
||||
// Add motion state
|
||||
state = new btDefaultMotionState(btTransform(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f),btVector3(sphere->center.x, sphere->center.y, sphere->center.z)));
|
||||
|
||||
// Add rigid body
|
||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, state, shape);
|
||||
body = new btRigidBody(rigidBodyCI);
|
||||
|
||||
break;
|
||||
|
||||
case ICollideable::Type::Type_box:
|
||||
box = dynamic_cast<Box*>(collideable);
|
||||
// Add collision shape
|
||||
shape = new btBoxShape(btVector3(box->boundingOffset.x, box->boundingOffset.y, box->boundingOffset.z));
|
||||
|
||||
// Add motion state
|
||||
state = new btDefaultMotionState(btTransform(btQuaternion(0.0f, 0.0f, 0.0f, 1.0f),btVector3(box->center.x, box->center.y, box->center.z)));
|
||||
|
||||
// Add rigid body
|
||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo(0, state, shape);
|
||||
body = new btRigidBody(rigidBodyCI);
|
||||
|
||||
break;
|
||||
|
||||
case ICollideable::Type::Type_cone:
|
||||
cone = dynamic_cast<Cone*>(collideable);
|
||||
// Add collision shape
|
||||
shape = new btConeShape(cone->radius, cone->height.GetLength());
|
||||
|
||||
// Add motion state
|
||||
state = new btDefaultMotionState(btTransform(btQuaternion(btVector3(cone->height.x, cone->height.y, cone->height.z).normalized(), 0.0f),btVector3(cone->position.x, cone->position.y, cone->position.z)));
|
||||
|
||||
// Add rigid body
|
||||
rigidBodyCI = btRigidBody::btRigidBodyConstructionInfo (0, state, shape);
|
||||
body = new btRigidBody(rigidBodyCI);
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
ContactSensorCallback callback(*body, effect, args);
|
||||
|
||||
this->dynamicsWorld->contactTest(body, callback);
|
||||
|
||||
delete state;
|
||||
state = NULL;
|
||||
delete shape;
|
||||
shape = NULL;
|
||||
delete body;
|
||||
body = NULL;
|
||||
}
|
||||
|
||||
namespace Oyster
|
||||
|
|
|
@ -12,6 +12,42 @@ namespace Oyster
|
|||
class API_Impl : public API
|
||||
{
|
||||
public:
|
||||
struct ContactSensorCallback : public btCollisionWorld::ContactResultCallback
|
||||
{
|
||||
ContactSensorCallback(btRigidBody& contactBody, EventAction_ApplyEffect effect, void* args)
|
||||
: btCollisionWorld::ContactResultCallback(), body(contactBody), func(effect), args(args) {}
|
||||
|
||||
btRigidBody& body;
|
||||
EventAction_ApplyEffect func;
|
||||
void* args;
|
||||
|
||||
virtual bool needsCollision(btBroadphaseProxy* proxy) const
|
||||
{
|
||||
if(!btCollisionWorld::ContactResultCallback::needsCollision(proxy))
|
||||
return false;
|
||||
|
||||
return body.checkCollideWithOverride(static_cast<btCollisionObject*>(proxy->m_clientObject));
|
||||
}
|
||||
|
||||
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObjectWrapper* colObj0, int partId0, int index0, const btCollisionObjectWrapper* colObj1, int partId1, int index1)
|
||||
{
|
||||
btVector3 pt;
|
||||
if(colObj0->m_collisionObject == &body)
|
||||
{
|
||||
pt = cp.m_localPointA;
|
||||
this->func((ICustomBody*)(colObj1->getCollisionObject()->getUserPointer()), this->args);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(colObj1->m_collisionObject == &body && "Body does not match either collision object");
|
||||
pt = cp.m_localPointB;
|
||||
this->func((ICustomBody*)(colObj0->getCollisionObject()->getUserPointer()), this->args);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
API_Impl();
|
||||
virtual ~API_Impl();
|
||||
|
||||
|
@ -33,7 +69,7 @@ namespace Oyster
|
|||
|
||||
void UpdateWorld();
|
||||
|
||||
void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void* args, void(hitAction)(ICustomBody*, void*) );
|
||||
void ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void* args, EventAction_ApplyEffect effect);
|
||||
|
||||
private:
|
||||
btBroadphaseInterface* broadphase;
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace Oyster
|
|||
typedef Struct::Gravity Gravity;
|
||||
|
||||
typedef void (*EventAction_Destruction)( ::Utility::DynamicMemory::UniquePointer<ICustomBody> proto );
|
||||
typedef void (*EventAction_ApplyEffect)(ICustomBody* collidedBody, void* args);
|
||||
|
||||
/** Gets the Physics instance. */
|
||||
static API & Instance();
|
||||
|
@ -99,7 +100,7 @@ namespace Oyster
|
|||
* @param hitAction: A function that contains the effect. Parameterlist contains the custom body
|
||||
the collideable hits, and the arguments sent to the function.
|
||||
********************************************************/
|
||||
virtual void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void* args, void(hitAction)(ICustomBody*, void*) ) = 0;
|
||||
virtual void ApplyEffect(Oyster::Collision3D::ICollideable* collideable, void* args, EventAction_ApplyEffect effect) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~API() {}
|
||||
|
|
|
@ -155,15 +155,20 @@ namespace Oyster
|
|||
break;
|
||||
|
||||
case ButtonState_Hover:
|
||||
case ButtonState_Released:
|
||||
if(outside == false)
|
||||
{
|
||||
clicked = true;
|
||||
currentState = ButtonState_Pressed;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentState = ButtonState_Hover;
|
||||
}
|
||||
break;
|
||||
case ButtonState_Released:
|
||||
currentState = ButtonState_Hover;
|
||||
break;
|
||||
|
||||
|
||||
case ButtonState_Pressed:
|
||||
case ButtonState_Down:
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
using namespace Oyster::Event;
|
||||
|
||||
EventButtonCollection::EventButtonCollection()
|
||||
: collectionState(EventCollectionState_Enabled)
|
||||
EventButtonCollection::EventButtonCollection(EventCollectionState state)
|
||||
: collectionState(state)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,13 @@ void EventButtonCollection::SetState(const EventCollectionState state)
|
|||
|
||||
void EventButtonCollection::Clear()
|
||||
{
|
||||
int size = buttons.size();
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
delete buttons[i];
|
||||
buttons[i] = NULL;
|
||||
}
|
||||
buttons.clear();
|
||||
|
||||
collectionState = EventCollectionState_Enabled;
|
||||
}
|
|
@ -28,20 +28,20 @@ namespace Oyster
|
|||
};
|
||||
|
||||
/********************************
|
||||
This EventButtonCollection will handle the destruction of the buttons when they are added to the collection.
|
||||
|
||||
This EventButtonCollection will handle the destruction of the buttons when they are added to the collection
|
||||
********************************/
|
||||
class EventButtonCollection
|
||||
{
|
||||
public:
|
||||
EventButtonCollection();
|
||||
EventButtonCollection(EventCollectionState state = EventCollectionState_Enabled);
|
||||
~EventButtonCollection();
|
||||
|
||||
void Update(InputClass* inputObject);
|
||||
void Render();
|
||||
|
||||
template <typename Owner>
|
||||
void AddButton(EventButton<Owner>* button)
|
||||
/*Add a button to the collection when a button is added to the collection you are not allowed to delete it.
|
||||
*/
|
||||
template <typename Owner> void AddButton(EventButton<Owner>* button)
|
||||
{
|
||||
buttons.push_back(button);
|
||||
}
|
||||
|
@ -52,6 +52,11 @@ namespace Oyster
|
|||
//Clear all buttons and reset the state.
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
//Can't copy
|
||||
EventButtonCollection(const EventButtonCollection& obj);
|
||||
EventButtonCollection& operator =(const EventButtonCollection& obj);
|
||||
|
||||
protected:
|
||||
std::vector<IEventButton*> buttons;
|
||||
EventCollectionState collectionState;
|
||||
|
|
|
@ -23,6 +23,7 @@ EventHandler::~EventHandler()
|
|||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
delete collections[i];
|
||||
collections[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,6 +33,7 @@ void EventHandler::Clean()
|
|||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
delete collections[i];
|
||||
collections[i] = NULL;
|
||||
}
|
||||
collections.clear();
|
||||
}
|
||||
|
@ -54,6 +56,12 @@ void EventHandler::Render()
|
|||
|
||||
void EventHandler::AddCollection(EventButtonCollection* collection)
|
||||
{
|
||||
for(int i = 0; i < collections.size(); i++)
|
||||
{
|
||||
//Do not add the collection if it's already in the list.
|
||||
if(collections.at(i) == collection)
|
||||
return;
|
||||
}
|
||||
collections.push_back(collection);
|
||||
}
|
||||
|
||||
|
@ -64,6 +72,7 @@ void EventHandler::DeleteCollection(EventButtonCollection* collection)
|
|||
if(collections.at(i) == collection)
|
||||
{
|
||||
delete collection;
|
||||
collection = NULL;
|
||||
collections.erase(collections.begin() + i);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -29,11 +29,21 @@ namespace Oyster
|
|||
void Update(InputClass* inputObject);
|
||||
void Render();
|
||||
|
||||
/*Add a collection to the EventHandler will only add collections not already present in the list.
|
||||
|
||||
*/
|
||||
void AddCollection(EventButtonCollection* collection);
|
||||
void DeleteCollection(EventButtonCollection* collection);
|
||||
|
||||
private:
|
||||
//Can't copy this class.
|
||||
EventHandler(const EventHandler& obj);
|
||||
EventHandler& operator =(const EventHandler& obj);
|
||||
|
||||
private:
|
||||
std::vector<EventButtonCollection*> collections;
|
||||
|
||||
//EventButtonCollection is a firend so it can delete it self.
|
||||
friend class EventButtonCollection;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram />
|
|
@ -158,9 +158,9 @@ namespace Oyster
|
|||
Render::Gui::Begin2DRender();
|
||||
}
|
||||
|
||||
void API::RenderGuiElement(API::Texture tex, Math::Float2 pos, Math::Float2 size)
|
||||
void API::RenderGuiElement(API::Texture tex, Math::Float2 pos, Math::Float2 size, Math::Float3 color)
|
||||
{
|
||||
Render::Gui::Render((ID3D11ShaderResourceView*)tex,pos,size);
|
||||
Render::Gui::Render((ID3D11ShaderResourceView*)tex,pos,size,color);
|
||||
}
|
||||
|
||||
API::Texture API::CreateTexture(std::wstring filename)
|
||||
|
@ -191,9 +191,9 @@ namespace Oyster
|
|||
Render::Gui::Begin2DTextRender();
|
||||
}
|
||||
|
||||
void API::RenderText(std::wstring text, Math::Float2 Pos, Math::Float2 Size)
|
||||
void API::RenderText(std::wstring text, Math::Float2 Pos, Math::Float2 Size, Math::Float3 color)
|
||||
{
|
||||
Render::Gui::RenderText(text,Pos,Size);
|
||||
Render::Gui::RenderText(text,Pos,Size,color);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -57,13 +57,13 @@ namespace Oyster
|
|||
static void StartGuiRender();
|
||||
|
||||
//! @brief Renders a single GUI element using the texture provided and the Pos in the center, %based system
|
||||
static void RenderGuiElement(Texture, Math::Float2 Pos, Math::Float2 Size);
|
||||
static void RenderGuiElement(Texture, Math::Float2 Pos, Math::Float2 Size, Math::Float3 Color = Math::Float3(1,1,1));
|
||||
|
||||
//! @brief Configures Renderer to process 2D Text, data will be passed in to EndFrame()
|
||||
static void StartTextRender();
|
||||
|
||||
//! @brief Renders a single GUI string using the texture provided and the Pos in the center, %based system
|
||||
static void RenderText(std::wstring, Math::Float2 Pos, Math::Float2 Size);
|
||||
static void RenderText(std::wstring, Math::Float2 Pos, Math::Float2 Size, Math::Float3 Color = Math::Float3(1,1,1));
|
||||
|
||||
//! @brief Performs light calculations, post effects and presents the scene
|
||||
static void EndFrame();
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Core\Buffer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Core\Core.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Core\ShaderManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Core\Init.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<<<<<<< HEAD
|
||||
<ClCompile Include="Render\Rendering\BasicRender.cpp">
|
||||
=======
|
||||
<ClCompile Include="Resources\Resources.cpp">
|
||||
>>>>>>> f08e9491ed00b00aedba0eabf1caed33830fc0e2
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Render\Preparations\BasicPreparations.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<<<<<<< HEAD
|
||||
<ClCompile Include="Render\Resources\Resources.cpp">
|
||||
=======
|
||||
<ClCompile Include="Render\Rendering\BasicRender.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FileLoader\ObjReader.cpp">
|
||||
>>>>>>> f08e9491ed00b00aedba0eabf1caed33830fc0e2
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Core\Buffer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Core\Core.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Core\CoreIncludes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\Preparations\Preparations.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\Rendering\Render.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Model\ModelInfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Model\Model.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Render\Resources\Resources.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Definitions\GraphicalDefinition.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileLoader\ObjReader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl" />
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.hlsl" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,214 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0EC83E64-230E-48EF-B08C-6AC9651B4F82}</ProjectGuid>
|
||||
<RootNamespace>OysterGraphics</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\OysterPhysic3D\Collision;..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Core\Buffer.cpp" />
|
||||
<ClCompile Include="Core\Core.cpp" />
|
||||
<ClCompile Include="Core\Init.cpp" />
|
||||
<ClCompile Include="Core\ShaderManager.cpp" />
|
||||
<<<<<<< HEAD
|
||||
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
|
||||
<ClCompile Include="Render\Rendering\BasicRender.cpp" />
|
||||
<ClCompile Include="Render\Resources\Resources.cpp" />
|
||||
=======
|
||||
<ClCompile Include="FileLoader\ObjReader.cpp" />
|
||||
<ClCompile Include="Render\Preparations\BasicPreparations.cpp" />
|
||||
<ClCompile Include="Render\Rendering\BasicRender.cpp" />
|
||||
<ClCompile Include="Resources\Resources.cpp" />
|
||||
>>>>>>> f08e9491ed00b00aedba0eabf1caed33830fc0e2
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Core\Buffer.h" />
|
||||
<ClInclude Include="Core\Core.h" />
|
||||
<ClInclude Include="Core\CoreIncludes.h" />
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<ClInclude Include="EngineIncludes.h" />
|
||||
<ClInclude Include="FileLoader\ObjReader.h" />
|
||||
>>>>>>> f08e9491ed00b00aedba0eabf1caed33830fc0e2
|
||||
<ClInclude Include="Model\Model.h" />
|
||||
<ClInclude Include="Model\ModelInfo.h" />
|
||||
<ClInclude Include="Render\Preparations\Preparations.h" />
|
||||
<ClInclude Include="Render\Rendering\Render.h" />
|
||||
<ClInclude Include="Definitions\GraphicalDefinition.h" />
|
||||
<ClInclude Include="Render\Resources\Resources.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Misc\Misc.vcxproj">
|
||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OysterMath\OysterMath.vcxproj">
|
||||
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugCameraVertex.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugPixel.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
|
||||
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">main</EntryPointName>
|
||||
</FxCompile>
|
||||
<FxCompile Include="Shader\HLSL\SimpleDebug\DebugVertex.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">5.0</ShaderModel>
|
||||
<EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">main</EntryPointName>
|
||||
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
</AssemblerOutput>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -82,7 +82,7 @@ namespace Oyster
|
|||
}
|
||||
int b = 0;
|
||||
Model::Animation A = *models[i].Animation.AnimationPlaying;
|
||||
while(models[i].Animation.AnimationTime>A.duration)
|
||||
while(models[i].Animation.AnimationTime>A.duration && models[i].Animation.LoopAnimation)
|
||||
models[i].Animation.AnimationTime -= (float)A.duration;
|
||||
|
||||
float position = models[i].Animation.AnimationTime;
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Oyster
|
|||
Core::PipelineManager::SetRenderPass(Render::Resources::Gui::Pass);
|
||||
}
|
||||
|
||||
void Gui::Render(ID3D11ShaderResourceView* tex,Math::Float2 pos, Math::Float2 size)
|
||||
void Gui::Render(ID3D11ShaderResourceView* tex,Math::Float2 pos, Math::Float2 size, Math::Float3 color)
|
||||
{
|
||||
Core::deviceContext->PSSetShaderResources(0,1,&tex);
|
||||
|
||||
|
@ -34,6 +34,12 @@ namespace Oyster
|
|||
void* data = Render::Resources::Gui::Data.Map();
|
||||
memcpy(data,&gd,sizeof(Definitions::GuiData));
|
||||
Render::Resources::Gui::Data.Unmap();
|
||||
|
||||
data = Render::Resources::Gui::Color.Map();
|
||||
memcpy(data,&color,sizeof(Math::Float3));
|
||||
Render::Resources::Gui::Color.Unmap();
|
||||
|
||||
|
||||
Core::deviceContext->Draw(1,0);
|
||||
}
|
||||
|
||||
|
@ -43,7 +49,7 @@ namespace Oyster
|
|||
Core::PipelineManager::SetRenderPass(Resources::Gui::Text::Pass);
|
||||
}
|
||||
|
||||
void Gui::RenderText(std::wstring text, Math::Float2 pos, Math::Float2 size)
|
||||
void Gui::RenderText(std::wstring text, Math::Float2 pos, Math::Float2 size, Math::Float3 color)
|
||||
{
|
||||
|
||||
size.x = size.x / (text.length() * TEXT_SPACING /2);
|
||||
|
@ -70,6 +76,10 @@ namespace Oyster
|
|||
Render::Resources::Gui::Data.Unmap();
|
||||
Definitions::Text2D tmpInst;
|
||||
|
||||
data = Render::Resources::Gui::Color.Map();
|
||||
memcpy(data,&color,sizeof(Math::Float3));
|
||||
Render::Resources::Gui::Color.Unmap();
|
||||
|
||||
void* dest = Resources::Gui::Text::Vertex.Map();
|
||||
Definitions::Text2D* dataView = reinterpret_cast<Definitions::Text2D*>(dest);
|
||||
//tmpInst.charOffset=_pos;
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Oyster
|
|||
{
|
||||
public:
|
||||
static void Begin2DRender();
|
||||
static void Render(ID3D11ShaderResourceView* tex, Math::Float2 pos, Math::Float2 size);
|
||||
static void Render(ID3D11ShaderResourceView* tex, Math::Float2 pos, Math::Float2 size, Math::Float3 tint = Math::Float3(1,1,1));
|
||||
static void Begin2DTextRender();
|
||||
static void RenderText(std::wstring text, Math::Float2 pos, Math::Float2 size);
|
||||
static void RenderText(std::wstring text, Math::Float2 pos, Math::Float2 size, Math::Float3 tint = Math::Float3(1,1,1));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace Oyster
|
|||
Buffer Resources::Gather::AnimationData = Buffer();
|
||||
Buffer Resources::Light::LightConstantsData = Buffer();
|
||||
Buffer Resources::Gui::Data = Buffer();
|
||||
Buffer Resources::Gui::Color = Buffer();
|
||||
Buffer Resources::Gui::Text::Vertex = Buffer();
|
||||
Buffer Resources::Post::Data = Buffer();
|
||||
|
||||
|
@ -118,6 +119,10 @@ namespace Oyster
|
|||
desc.ElementSize = sizeof(Definitions::AnimationData);
|
||||
Gather::AnimationData.Init(desc);
|
||||
|
||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_PS;
|
||||
desc.ElementSize = sizeof(Math::Float3);
|
||||
Gui::Color.Init(desc);
|
||||
|
||||
desc.Type = Buffer::BUFFER_TYPE::CONSTANT_BUFFER_GS;
|
||||
desc.NumElements = 1;
|
||||
desc.ElementSize = sizeof(Definitions::GuiData);
|
||||
|
@ -378,6 +383,7 @@ namespace Oyster
|
|||
Gui::Pass.Shaders.Geometry = GetShader::Geometry(L"2D");
|
||||
Gui::Pass.RTV.push_back(GBufferRTV[2]);
|
||||
Gui::Pass.CBuffers.Geometry.push_back(Gui::Data);
|
||||
Gui::Pass.CBuffers.Pixel.push_back(Gui::Color);
|
||||
|
||||
D3D11_INPUT_ELEMENT_DESC indesc2D[] =
|
||||
{
|
||||
|
@ -421,6 +427,7 @@ namespace Oyster
|
|||
|
||||
Shader::CreateInputLayout(Text2Ddesc,3, GetShader::Vertex(L"2DText") ,Gui::Text::Pass.IAStage.Layout);
|
||||
Gui::Text::Pass.CBuffers.Geometry.push_back(Gui::Data);
|
||||
Gui::Text::Pass.CBuffers.Pixel.push_back(Gui::Color);
|
||||
Gui::Text::Pass.SRV.Pixel.push_back(Gui::Text::Font);
|
||||
Gui::Text::Pass.RTV.push_back(GBufferRTV[2]);
|
||||
Gui::Text::Pass.RenderStates.SampleCount = 1;
|
||||
|
@ -448,6 +455,7 @@ namespace Oyster
|
|||
Light::LightConstantsData.~Buffer();
|
||||
Light::PointLightsData.~Buffer();
|
||||
Gui::Data.~Buffer();
|
||||
Gui::Color.~Buffer();
|
||||
Gui::Text::Vertex.~Buffer();
|
||||
Post::Data.~Buffer();
|
||||
SAFE_RELEASE(Light::PointLightView);
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace Oyster
|
|||
{
|
||||
static Core::PipelineManager::RenderPass Pass;
|
||||
static Core::Buffer Data;
|
||||
static Core::Buffer Color;
|
||||
struct Text
|
||||
{
|
||||
static Core::PipelineManager::RenderPass Pass;
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
float4 main(Pixel2DIn input) : SV_Target0
|
||||
{
|
||||
return Material.Sample(LinearSampler,input.Uv);
|
||||
return Material.Sample(LinearSampler,input.Uv) * float4(Color,1);
|
||||
}
|
|
@ -3,11 +3,16 @@ struct Vertex2DIn
|
|||
float2 Pos : Position;
|
||||
};
|
||||
|
||||
cbuffer EveryObject2D : register(c0)
|
||||
cbuffer EveryObject2D : register(b0)
|
||||
{
|
||||
float4x4 Translation;
|
||||
};
|
||||
|
||||
cbuffer ColorData : register(b0)
|
||||
{
|
||||
float3 Color;
|
||||
};
|
||||
|
||||
struct Pixel2DIn
|
||||
{
|
||||
float4 Pos : SV_Position;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "../Header.hlsli"
|
||||
cbuffer TextPerObject : register(c0)
|
||||
cbuffer TextPerObject : register(b0)
|
||||
{
|
||||
float4x4 gWorld;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/////////////////////////////////////////////////////////////////////
|
||||
// Created by Erik Persson 2014
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Cone.h"
|
||||
#include "OysterCollision3D.h"
|
||||
|
||||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
|
||||
Cone::Cone( ) : ICollideable(Type_cone)
|
||||
{
|
||||
this->radius = 1;
|
||||
this->height = Oyster::Math::Float3(0,0,0);
|
||||
}
|
||||
|
||||
Cone::Cone( const ::Oyster::Math::Float3 &height, const Oyster::Math::Float3 &position, const ::Oyster::Math::Float &radius ) : ICollideable(Type_cone)
|
||||
{
|
||||
this->radius = radius;
|
||||
this->height = height;
|
||||
this->position = position;
|
||||
}
|
||||
|
||||
Cone::Cone( const ::Oyster::Math::Float4 &height, const Oyster::Math::Float4 &position, const ::Oyster::Math::Float &radius ) : ICollideable(Type_cone)
|
||||
{
|
||||
this->radius = radius;
|
||||
this->height = (Oyster::Math::Float3)height;
|
||||
this->position = (Oyster::Math::Float3)position;
|
||||
}
|
||||
|
||||
Cone::~Cone( )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Cone & Cone::operator = ( const Cone &cone )
|
||||
{
|
||||
this->radius = cone.radius;
|
||||
this->height = cone.height;
|
||||
this->position = cone.position;
|
||||
return *this;
|
||||
}
|
||||
|
||||
::Utility::DynamicMemory::UniquePointer<ICollideable> Cone::Clone( ) const
|
||||
{
|
||||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Cone(*this) );
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/////////////////////////////////////////////////////////////////////
|
||||
// Created by Erik Persson 2014
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#ifndef OYSTER_COLLISION_3D_CONE_H
|
||||
#define OYSTER_COLLISION_3D_CONE_H
|
||||
|
||||
|
||||
#include "OysterMath.h"
|
||||
#include "ICollideable.h"
|
||||
|
||||
namespace Oyster
|
||||
{
|
||||
namespace Collision3D
|
||||
{
|
||||
class Cone : public ICollideable
|
||||
{
|
||||
public:
|
||||
|
||||
Cone();
|
||||
Cone( const ::Oyster::Math::Float3 &height, const Oyster::Math::Float3 &position, const ::Oyster::Math::Float &radius );
|
||||
Cone( const ::Oyster::Math::Float4 &height, const Oyster::Math::Float4 &position, const ::Oyster::Math::Float &radius );
|
||||
virtual ~Cone( );
|
||||
|
||||
Cone & operator = ( const Cone &Cone );
|
||||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
|
||||
bool Intersects( const ICollideable &target ) const{return false;};
|
||||
bool Intersects( const ICollideable &target, ::Oyster::Math::Float4 &worldPointOfContact ) const{return false;};
|
||||
bool Contains( const ICollideable &target ) const{return false;};
|
||||
|
||||
::Oyster::Math::Float TimeOfContact( const ICollideable &deuterStart, const ICollideable &deuterEnd ) const{return 0;};
|
||||
|
||||
|
||||
Oyster::Math::Float3 height;
|
||||
Oyster::Math::Float3 position;
|
||||
Oyster::Math::Float radius;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -26,7 +26,8 @@ namespace Oyster { namespace Collision3D //! Contains a collection of 3D shapes
|
|||
Type_box_axis_aligned,
|
||||
Type_box,
|
||||
Type_frustrum,
|
||||
Type_line
|
||||
Type_line,
|
||||
Type_cone,
|
||||
};
|
||||
|
||||
const Type type;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "Box.h"
|
||||
#include "Frustrum.h"
|
||||
#include "Line.h"
|
||||
#include "Cone.h"
|
||||
|
||||
namespace Oyster { namespace Collision3D { namespace Utility
|
||||
{
|
||||
|
|
|
@ -154,6 +154,7 @@
|
|||
<ClInclude Include="BoxAxisAligned.h" />
|
||||
<ClInclude Include="FluidDrag.h" />
|
||||
<ClInclude Include="Frustrum.h" />
|
||||
<ClInclude Include="Cone.h" />
|
||||
<ClInclude Include="ICollideable.h" />
|
||||
<ClInclude Include="Inertia.h" />
|
||||
<ClInclude Include="Line.h" />
|
||||
|
@ -172,6 +173,7 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="Box.cpp" />
|
||||
<ClCompile Include="BoxAxisAligned.cpp" />
|
||||
<ClCompile Include="Cone.cpp" />
|
||||
<ClCompile Include="FluidDrag.cpp" />
|
||||
<ClCompile Include="Frustrum.cpp" />
|
||||
<ClCompile Include="ICollideable.cpp" />
|
||||
|
|
|
@ -81,6 +81,9 @@
|
|||
<ClInclude Include="Universe.h">
|
||||
<Filter>Header Files\Collision</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Cone.h">
|
||||
<Filter>Header Files\Collision</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Box.cpp">
|
||||
|
@ -131,5 +134,8 @@
|
|||
<ClCompile Include="Inertia.cpp">
|
||||
<Filter>Source Files\Physics</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Cone.cpp">
|
||||
<Filter>Source Files\Collision</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -176,7 +176,7 @@ HRESULT InitDirect3D()
|
|||
m->WorldMatrix.m[2][2] = 0.00000005f;
|
||||
m2 = Oyster::Graphics::API::CreateModel(L"char_temporary.dan");
|
||||
m2->WorldMatrix = Oyster::Math3D::OrientationMatrix(Oyster::Math::Float3::null,Oyster::Math::Float3(4,0,0),Oyster::Math::Float3::null);
|
||||
Oyster::Graphics::API::PlayAnimation(m2, L"movement",true);
|
||||
Oyster::Graphics::API::PlayAnimation(m2, L"movement",false);
|
||||
|
||||
t = Oyster::Graphics::API::CreateTexture(L"structure_corp_mdg.png");
|
||||
t2 = Oyster::Graphics::API::CreateTexture(L"whiteGui.png");
|
||||
|
@ -233,14 +233,14 @@ HRESULT Render(float deltaTime)
|
|||
Oyster::Graphics::API::RenderModel(m2);
|
||||
Oyster::Graphics::API::StartGuiRender();
|
||||
Oyster::Graphics::API::RenderGuiElement(t,Oyster::Math::Float2(0.5f,0.5f),Oyster::Math::Float2(1,1));
|
||||
Oyster::Graphics::API::RenderGuiElement(t2,Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float2(0.5f,0.1f));
|
||||
//Oyster::Graphics::API::RenderGuiElement(t2,Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float3(1,0,0));
|
||||
Oyster::Graphics::API::StartTextRender();
|
||||
std::wstring fps;
|
||||
float f = 1/deltaTime;
|
||||
fps = std::to_wstring(f);
|
||||
//Oyster::Graphics::API::RenderText(L"Lanariel",Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float2(0.5f,0.1f));
|
||||
//Oyster::Graphics::API::RenderText(L"Lanariel WAS HERE",Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float2(0.5f,0.1f));
|
||||
//Oyster::Graphics::API::RenderText(fps,Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float2(0.5f,0.1f));
|
||||
Oyster::Graphics::API::RenderText(fps,Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float2(0.5f,0.1f),Oyster::Math::Float3(0,1,0));
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
|
||||
return S_OK;
|
||||
|
|
Loading…
Reference in New Issue