Danbias/Code/GameLogic/Object.cpp

53 lines
1.0 KiB
C++
Raw Normal View History

2013-11-19 18:35:35 +01:00
#include "Object.h"
2013-11-21 12:05:39 +01:00
#include "OysterMath.h"
2013-11-28 08:33:29 +01:00
#include "DllInterfaces\GFXAPI.h"
#include "CollisionManager.h"
2013-11-21 12:05:39 +01:00
2013-11-19 18:35:35 +01:00
using namespace GameLogic;
2013-11-21 12:05:39 +01:00
using namespace Oyster::Math;
using namespace Oyster::Graphics::Model;
2013-11-21 12:05:39 +01:00
using namespace Utility::DynamicMemory;
using namespace Oyster::Physics;
2013-11-19 18:35:35 +01:00
Object::Object(void)
{
2013-11-21 12:05:39 +01:00
model = new Model();
model = Oyster::Graphics::API::CreateModel(L"bth.obj");
ICustomBody* temp = rigidBody = API::Instance().CreateSimpleRigidBody().Release();
rigidBody->SetCenter(Float3(50,0,0));
rigidBody->SetMass_KeepMomentum(30);
rigidBody->SetSize(Float3(2,2,2));
rigidBody->SetSubscription(true);
rigidBody->SetMomentOfInertiaTensor_KeepMomentum(Float4x4(MomentOfInertia::CreateCuboidMatrix(30, 2, 2, 2)));
GameLogic::RefManager::getInstance()->AddMapping(*rigidBody, *this);
2013-11-21 12:05:39 +01:00
2013-11-19 18:35:35 +01:00
}
Object::~Object(void)
{
Oyster::Graphics::API::DeleteModel(model);
2013-11-28 08:33:29 +01:00
2013-11-21 12:05:39 +01:00
}
2013-11-28 08:33:29 +01:00
void Object::Render()
{
this->rigidBody->GetOrientation(model->WorldMatrix);
Oyster::Graphics::API::RenderScene(model, 1);
2013-11-19 18:35:35 +01:00
}
2013-11-26 11:30:49 +01:00
Object::OBJECT_TYPE Object::GetType()
{
return this->type;
}