|
|
void RenderMirror()
{
//上面的部分看懂了,省略
// Finally, draw the reflected teapot
Device->SetTransform(D3DTS_WORLD, &W);
Device->SetMaterial(&TeapotMtrl);
Device->SetTexture(0, 0);
Device->SetRenderState(D3DRS_CULLMODE,D3DCULL_CW);
Teapot->DrawSubset(0);
// Restore render states.
Device->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
Device->SetRenderState( D3DRS_STENCILENABLE, false);
Device->SetRenderState(D3DRS_CULLMODE,D3DCULL_CCW);
}
Device->SetRenderState(D3DRS_CULLMODE,D3DCULL_CW);
Device->SetRenderState(D3DRS_CULLMODE,D3DCULL_CCW);
两句看不懂。
以前看书上说,D3DCULL_CW是渲染正面(顺时针的)D3DCULL_CCW是渲染背面(逆时针的)。而默认情况下是渲染正面的。
看例子中的意思好像是,渲染茶壶反射的时候渲染正面,之后其他的渲染背面。到底是什么意思啊,我看书上说是为了实现“物体被反射后正面和反面交换”的效果。这样就能实现么?
可是我注释掉这两句后,程序看起来没什么变化呀。
|
|