Created
March 1, 2015 21:16
-
-
Save shorttermmem/cec0c5aefde9c435230a to your computer and use it in GitHub Desktop.
Example snippet for drawing all subsets.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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