锘??xml version="1.0" encoding="utf-8" standalone="yes"?> m_pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); m_pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); //鍒涘緩瀵硅薄 m_pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE); //姝ゅ彲璁劇疆鎴愭簮澶勮創鍥劇殑alpha閫氶亾錛堝綋鍓嶆簮鑷潗璐級 m_pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); m_pDevice->SetLight(0, &m_DirLight);// 鐏厜涔熸槸闈炲繀欏葷殑銆傚鏋滄病鍔犮傞渶浣垮璞¤嚜鍙戝厜錛岃涓嶇湅涓嶅埌鏁堟灉銆?br /> m_pDevice->LightEnable(0, true); //set camera position and view&projection matrix. m_pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true); m_pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false);
m_pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
m_pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
寮鍏矨lpha娣峰悎鏁堟灉錛?br />m_pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true/*false*/);
this->InitTeapot();
this->InitTeapotMaterial();
this->InitBkGndQuad();
this->InitBkGndMaterial();
this->InitBkGndTexture();
this->InitDirLight();
//鏇存敼娓叉煋鐘舵?br /> m_pDevice->SetRenderState(D3DRS_NORMALIZENORMALS, true);
m_pDevice->SetRenderState(D3DRS_SPECULARENABLE, true);
//鍙傝僣ode錛?br /> //璁劇疆娓叉煋鐘舵?br /> m_pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
m_pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
m_pDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
m_pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
m_pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
...
// onrender event
m_pDevice->SetMaterial(&m_TeapotMtrl);
m_pDevice->SetTexture(0, 0);//榪欏彞搴旇鏄潪蹇呴』鐨勩備絾鏈濂藉姞銆?br /> m_pTeapot->DrawSubset(0);