Ok. It looks a little more intelligent now:
void EFFECTMESH::PrimeRenderVB(void){
unsigned int stride;
unsigned int offset;
// Set vertex buffer stride and offset.
stride = sizeof(NMVertex);
offset = 0;
// Set the vertex buffer to active in the input assembler so it can be rendered.
GE->devcon->IASetVertexBuffers(0, 1, &VB, &stride, &offset);
// Set the index buffer to active in the input assembler so it can be rendered.
// GE->devcon->IASetIndexBuffer(IB, DXGI_FORMAT_R32_UINT, 0);//this will be done in PrimeRenderIB(..)
// Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.
GE->devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
}
void EFFECTMESH::PrimeRenderIB(int index){
if (index>=NumSubsets) return;
GE->devcon->IASetIndexBuffer(IB, DXGI_FORMAT_R32_UINT, indexInfo[index].iStart*sizeof(UINT));
GE->devcon->DrawIndexed(indexInfo[index].iCount,indexInfo[index].iStart,0);
}
and to render the two subsets:
EffectMesh[testMesh].PrimeRenderVB();
EffectMesh[testMesh].PrimeRenderIB(0);
worldMatrix=EffectMesh[testMesh].indexInfo[0].KeyframeMatrix[int(float((GE->Timer.TotalTime/1000)%500)/100.0f)];
worldMatrix(3,2)+=190-camloc.z;
worldMatrix(3,1)+=-40-camloc.y;
worldMatrix(3,0)+=-camloc.x;
if (!NMShader.Render(GE->devcon,EffectMesh[testMesh].indexInfo[0].iCount, worldMatrix, m_Camera->m_viewMatrix, projectionMatrix,TA)) tp1++;
EffectMesh[testMesh].PrimeRenderIB(1);
worldMatrix=EffectMesh[testMesh].indexInfo[1].KeyframeMatrix[int(float((GE->Timer.TotalTime/1000)%500)/100.0f)];
worldMatrix(3,2)+=190-camloc.z;
worldMatrix(3,1)+=-40-camloc.y;
worldMatrix(3,0)+=-camloc.x;
if (!NMShader.Render(GE->devcon,EffectMesh[testMesh].indexInfo[1].iCount, worldMatrix, m_Camera->m_viewMatrix, projectionMatrix,TA)) tp1++;
This works nicely for my purposes. I only "setup" the common stuff once with PrimeRenderVB() and then I render each subset with PrimeRenderIB() and the appropriate shader.