本文整理汇总了C++中CShader::Use方法的典型用法代码示例。如果您正苦于以下问题:C++ CShader::Use方法的具体用法?C++ CShader::Use怎么用?C++ CShader::Use使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CShader
的用法示例。
在下文中一共展示了CShader::Use方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderScene
// -----------------------------------------------------
void CGraphicsRenderer::RenderScene()
{
// render scene to diffuse RT
CRenderer::cGraphicsDevice()->BeginRendering(1, m_mrt_diffuse);
//CRenderer::cGraphicsDevice()->Clear(ColorRGB(0,1,1));
for (unsigned int i=0; i<m_chunks.Size(); i++)
{
const GeometryChunk& chunk = m_chunks[i];
CIndexBuffer* ib = CRenderer::cGraphicsManager()->GetCachedIndexBuffer(chunk.Data->ibId);
CVertexBuffer* vb = CRenderer::cGraphicsManager()->GetCachedVertexBuffer(chunk.Data->vbId);
ib->Use();
vb->Use();
// OPTIM: if we ensure valid pointer every time, remove this if-s
if (chunk.Subset->materialPtr)
{
CShader *vs = (CShader*)chunk.Subset->materialPtr->vsPtr;
CShader *ps = (CShader*)chunk.Subset->materialPtr->psPtr;
if (ps)
ps->Use();
if (vs)
{
vs->Use();
}
}
vb->RenderIndexed(P3DPT_TRIANGLELIST, chunk.Subset->StartIndex, chunk.Subset->NumTriangles);
}
CRenderer::cGraphicsDevice()->EndRendering();
// render diffuse RT on standard backbuffer
CRenderer::cGraphicsDevice()->BeginRendering();
CRenderer::cPrimitiveRenderer()->AddRectangleRel(Vec2(0.0f, 0.0f), Vec2(1.0f, -1.0f), ColorRGBA(1.0f, 1.0f, 1.0f, 1.0f), m_mrt_diffuse);
CRenderer::cPrimitiveRenderer()->Render();
CRenderer::cGraphicsDevice()->EndRendering();
}