Danbias/Code/OysterGraphics/Render/GuiRenderer.cpp

44 lines
925 B
C++
Raw Normal View History

2014-02-07 15:52:07 +01:00
#include "GuiRenderer.h"
#include "Resources.h"
#include "../Definitions/GraphicalDefinition.h"
2014-02-07 11:52:51 +01:00
namespace Oyster
{
namespace Graphics
{
namespace Render
{
namespace Rendering
{
void Gui::BeginRender()
{
2014-02-07 16:51:35 +01:00
Core::PipelineManager::SetRenderPass(Render::Resources::Gui::Pass);
2014-02-07 11:52:51 +01:00
}
2014-02-07 13:47:09 +01:00
void Gui::Render(ID3D11ShaderResourceView* tex,Math::Float2 pos, Math::Float2 size)
2014-02-07 11:52:51 +01:00
{
2014-02-07 13:47:09 +01:00
Core::deviceContext->PSSetShaderResources(0,1,&tex);
pos *= 2;
pos -= 1;
pos.y *= -1;
Definitions::GuiData gd;
gd.Translation = Math::Matrix::identity;
gd.Translation.m41 = pos.x;
gd.Translation.m42 = pos.y;
gd.Translation.m11 = size.x;
gd.Translation.m22 = size.y;
2014-02-07 15:52:07 +01:00
void* data = Render::Resources::Gui::Data.Map();
2014-02-07 16:51:35 +01:00
memcpy(data,&gd,sizeof(Definitions::GuiData));
2014-02-07 15:52:07 +01:00
Render::Resources::Gui::Data.Unmap();
2014-02-07 13:47:09 +01:00
Core::deviceContext->Draw(1,0);
2014-02-07 11:52:51 +01:00
}
}
}
}
}