metaforce/Runtime/Graphics/Shaders/CMapSurfaceShader.cpp

28 lines
900 B
C++
Raw Normal View History

2017-04-22 06:42:32 +00:00
#include "CMapSurfaceShader.hpp"
namespace urde
{
CMapSurfaceShader::CMapSurfaceShader(boo::IGraphicsDataFactory::Context& ctx,
const boo::ObjToken<boo::IGraphicsBufferS>& vbo,
const boo::ObjToken<boo::IGraphicsBufferS>& ibo)
2017-04-22 06:42:32 +00:00
: m_vbo(vbo), m_ibo(ibo)
{
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
m_dataBind = TShader<CMapSurfaceShader>::BuildShaderDataBinding(ctx, *this);
}
void CMapSurfaceShader::draw(const zeus::CColor& color, u32 start, u32 count)
{
Uniform uniform = {
CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f(), color
};
m_uniBuf->load(&uniform, sizeof(uniform));
2017-04-22 06:42:32 +00:00
CGraphics::SetShaderDataBinding(m_dataBind);
CGraphics::DrawArrayIndexed(start, count);
}
URDE_SPECIALIZE_SHADER(CMapSurfaceShader)
}