Skip to content

Instantly share code, notes, and snippets.

@shorttermmem
Created March 1, 2015 21:16
Show Gist options
  • Save shorttermmem/cec0c5aefde9c435230a to your computer and use it in GitHub Desktop.
Save shorttermmem/cec0c5aefde9c435230a to your computer and use it in GitHub Desktop.
Example snippet for drawing all subsets.
for (UINT subset = 0; subset < m_Mesh.GetNumSubsets(0); ++subset)
{
// Get the subset
auto pSubset = m_Mesh.GetSubset(0, subset);
auto PrimType = CDXUTSDKMesh::GetPrimitiveType11((SDKMESH_PRIMITIVE_TYPE)pSubset->PrimitiveType);
pd3dImmediateContext->IASetPrimitiveTopology(PrimType);
// Ignores most of the material information in them mesh to use only a simple shader
auto pDiffuseRV = m_Mesh.GetMaterial(pSubset->MaterialID)->pDiffuseRV11;
pd3dImmediateContext->PSSetShaderResources(0, 1, &pDiffuseRV);
pd3dImmediateContext->DrawIndexed((UINT)pSubset->IndexCount, 0, (UINT)pSubset->VertexStart);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment