Game Development Reference
In-Depth Information
To conclude, we can render an ID3DXPMesh object the same way
that we render an ID3DXMesh object. In addition, we also outline the
mesh's triangles in yellow by drawing the mesh in wireframe mode
with a yellow material. We do this so that we can see the individual tri-
angles being added and removed by the progressive mesh when we
adjust the LOD.
Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
0xffffffff, 1.0f, 0);
Device->BeginScene();
for(inti=0;i<Mtrls.size(); i++)
{
Device->SetMaterial( &Mtrls[i] );
Device->SetTexture(0, Textures[i]);
PMesh->DrawSubset(i);
// draw wireframe outline
Device->SetMaterial(&d3d::YELLOW_MTRL);
Device->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
PMesh->DrawSubset(i);
Device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
}
Device->EndScene();
Device->Present(0, 0, 0, 0);
}
return true;
} // end Display
Figure 11.3: A
screen shot of the
Progressive Mesh
sample
Search WWH ::




Custom Search