2017-04-22 06:42:32 +00:00
|
|
|
#include "CMapSurfaceShader.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
CMapSurfaceShader::CMapSurfaceShader(boo::IGraphicsDataFactory::Context& ctx,
|
2017-11-05 06:17:12 +00:00
|
|
|
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)
|
|
|
|
{
|
2017-04-25 01:11:31 +00:00
|
|
|
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)
|
|
|
|
|
|
|
|
}
|