Exemplo n.º 1
0
	void MeshRenderer::SubMeshRenderData::Render(Sys_GraphicsPtr pSysGraphics, MaterialPtr pMaterial)
	{
		pSysGraphics->SetVertexBuffer(m_pVertexBuffer, m_vertexOffset, m_vertexStride);
		pSysGraphics->SetPrimitiveType(m_primType);

		m_indexed ? pSysGraphics->SetIndexBuffer(m_pIndexBuffer, m_indexFormat) : 0;

		MaterialPtr pMat = pMaterial == nullptr ? m_pMaterial : pMaterial;

		pMat->ApplyVertexFormat();

		int nPass = 0;

		pMat->Begin(nPass);

		for(int i = 0; i < nPass; ++i)
		{
			if(m_iDepthPass == i)
			{
				continue;
			}
			pMat->ApplyPass(i);

			m_indexed ? 
				pSysGraphics->DrawIndexed(m_indexCount, m_startIndex, m_baseVertex) :
				pSysGraphics->Draw(m_vertexCount, m_baseVertex);
		}

		pMat->End();
	}