1

我的 Skybox 是透视图,我走得越近它就越近。我也禁用了 D3DRS_ZWRITEENABLE。

Device->SetTransform(D3DTS_WORLD,GetTransform());

Device->SetRenderState( D3DRS_LIGHTING,FALSE);
Device->SetRenderState(D3DRS_ZWRITEENABLE,FALSE);
Device->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
Device->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );

Device->SetFVF(SKYBOX_VERTEX::FVF);

Device->SetStreamSource(0,m_pVertexBuffer,0,sizeof(SKYBOX_VERTEX));
Device->SetIndices(m_pIndexBuffer);

for(int i=0;i<6;i++)
{
    Device->SetTexture(0,m_skyTextures[i].TextureFile);
    Device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,4,i*6,2);
    //Device->DrawPrimitive(D3DPT_TRIANGLEFAN,i*4,2);
}

Device->SetRenderState(D3DRS_ZWRITEENABLE,TRUE);
Device->SetRenderState( D3DRS_LIGHTING,TRUE);
Device->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );
Device->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );

我希望它总是看起来很远。

4

0 回答 0