Danbias/Code/GameLogic/Object.cpp

71 lines
1.3 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-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;
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");
2013-11-21 12:05:39 +01:00
/*struct float4
2013-11-21 12:05:39 +01:00
{
float x,y,z,w;
};
float4 mesh[] =
{
{-1.0f,1.0f,0.0f,1.0f},
{1.0f,1.0f,0.0f,1.0f},
{1.0f,-1.0f,0.0f,1.0f},
};
Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc;
desc.ElementSize= sizeof(float4);
desc.NumElements = 3;
desc.InitData=mesh;
desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::VERTEX_BUFFER;
desc.Usage = Oyster::Graphics::Buffer::BUFFER_USAGE::BUFFER_USAGE_IMMUTABLE;
Oyster::Graphics::Buffer *b = new Oyster::Graphics::Buffer();
b->Init(desc);
ModelInfo* modelInfo = new ModelInfo();
modelInfo->Vertices = *b;
modelInfo->Indexed = false;
modelInfo->VertexCount = 3;
Float4x4 matrix = Float4x4::identity;
model->World = &matrix;
model->info = modelInfo;
model->Visible = true;*/
2013-11-19 18:35:35 +01:00
}
Object::~Object(void)
{
//SAFE_DELETE(model->info);
Oyster::Graphics::API::DeleteModel(model);
2013-11-21 12:05:39 +01:00
}
Model* Object::Render()
2013-11-21 12:05:39 +01:00
{
//model->info->Vertices.Apply(0);
this->rigidBody->GetOrientation(model->WorldMatrix);
return model;
2013-11-19 18:35:35 +01:00
}
2013-11-26 11:30:49 +01:00
Object::OBJECT_TYPE Object::GetType()
{
return this->type;
}