2013-11-26 13:44:58 +01:00
|
|
|
#include "GFXAPI.h"
|
|
|
|
#include "../Core/Core.h"
|
|
|
|
#include "../Render/Resources/Resources.h"
|
|
|
|
#include "../Render/Rendering/Render.h"
|
2013-11-26 15:33:05 +01:00
|
|
|
#include "../FileLoader/ObjReader.h"
|
2013-11-29 10:25:27 +01:00
|
|
|
#include "../../Misc/Resource/OysterResource.h"
|
2013-11-26 13:44:58 +01:00
|
|
|
|
|
|
|
namespace Oyster
|
|
|
|
{
|
|
|
|
namespace Graphics
|
|
|
|
{
|
2013-11-26 15:33:05 +01:00
|
|
|
API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion)
|
2013-11-26 13:44:58 +01:00
|
|
|
{
|
2013-11-26 15:33:05 +01:00
|
|
|
Core::resolution = resulotion;
|
|
|
|
|
2013-11-26 13:44:58 +01:00
|
|
|
if(Core::Init::FullInit(Window, MSAA_Quality, Fullscreen) == Core::Init::Fail)
|
|
|
|
{
|
|
|
|
return API::Fail;
|
|
|
|
}
|
|
|
|
if(Render::Resources::Init() == Core::Init::Fail)
|
|
|
|
{
|
|
|
|
return API::Fail;
|
|
|
|
}
|
2013-11-26 15:33:05 +01:00
|
|
|
|
|
|
|
Render::Preparations::Basic::SetViewPort();
|
2013-11-26 13:44:58 +01:00
|
|
|
return API::Sucsess;
|
|
|
|
}
|
|
|
|
|
|
|
|
void API::NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection)
|
|
|
|
{
|
|
|
|
Render::Rendering::Basic::NewFrame(View, Projection);
|
|
|
|
}
|
|
|
|
|
|
|
|
void API::RenderScene(Model::Model* models, int count)
|
|
|
|
{
|
|
|
|
Render::Rendering::Basic::RenderScene(models,count);
|
|
|
|
}
|
|
|
|
|
2013-11-26 15:33:05 +01:00
|
|
|
void API::EndFrame()
|
|
|
|
{
|
|
|
|
Render::Rendering::Basic::EndFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
API::State API::SetOptions(API::Option option)
|
|
|
|
{
|
|
|
|
return API::Sucsess;
|
|
|
|
}
|
|
|
|
|
|
|
|
Model::Model* API::CreateModel(std::wstring filename)
|
|
|
|
{
|
|
|
|
Model::Model* m = new Model::Model();
|
|
|
|
m->WorldMatrix = Oyster::Math::Float4x4::identity;
|
|
|
|
m->Visible = true;
|
|
|
|
|
|
|
|
OBJReader or;
|
|
|
|
or.readOBJFile(filename);
|
|
|
|
m->info = or.toModel();
|
|
|
|
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
|
|
|
void API::DeleteModel(Model::Model* model)
|
|
|
|
{
|
2013-11-29 10:25:27 +01:00
|
|
|
Model::ModelInfo* info = (Model::ModelInfo*)model->info;
|
2013-11-26 15:33:05 +01:00
|
|
|
delete model;
|
2013-11-29 10:25:27 +01:00
|
|
|
info->Vertices->~Buffer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void API::Clean()
|
|
|
|
{
|
|
|
|
SAFE_DELETE(Core::viewPort);
|
|
|
|
Oyster::Resource::OysterResource::Clean();
|
|
|
|
Oyster::Graphics::Core::ShaderManager::Clean();
|
|
|
|
Oyster::Graphics::Render::Resources::Clean();
|
2013-11-26 15:33:05 +01:00
|
|
|
}
|
2013-11-26 13:44:58 +01:00
|
|
|
}
|
|
|
|
}
|