主题:【源码编辑】飞飞多采样抗锯齿设置 作者:烛天丶 时间:2013-08-21 21:58 |
老外论坛的,不知道效果如何,我的电脑也看不出有啥变化- -8 U. [8 E( n) |8 l; m2 s2 G: P7 L 0 Q6 ?, P a, ^ -----------------------7 {5 r; q: G. O d3dapp.cpp ; k. B! L3 X' ]6 k- B' N+ V$ }3 L( p 4 D5 a2 W' s6 A: Y: i# } ----------------------- " H* j6 i/ f* M f2 ? 找到:3 e4 i" b, d/ V+ Q& f3 W' [6 m+ N$ ~ 6 z7 D5 P' j; S, G( v% } #ifdef __XUZHU #if 0 // Create the device hr = m_pD3D->CreateDevice( m_pD3D->GetAdapterCount()-1, D3DDEVTYPE_REF, m_hWndFocus, behaviorFlags, &m_d3dpp, &m_pd3dDevice );1 A x- f8 @# K" f" I9 A . M& X) }4 e7 B( m* c 在第二个#else 下面的代码 0 L& S+ z' Q9 f hr = m_pD3D->CreateDevice( m_d3dSettings.AdapterOrdinal(), pDeviceInfo->DevType, m_hWndFocus, behaviorFlags, &m_d3dpp, &m_pd3dDevice );; y1 e. A1 I) A. ]. R. J- B3 } 替换为:4 K: l* E: f7 C8 x; f# u DWORD MSQuality = 0;2 A% ]2 f* G& Y: G0 ]+ H D3DMULTISAMPLE_TYPE MSType = D3DMULTISAMPLE_NONE;- r) L2 r( y0 _! ] if( SUCCEEDED( m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_8_SAMPLES, &MSQuality) ))$ M/ A" J8 K, {2 `; E MSType = D3DMULTISAMPLE_8_SAMPLES;/ v7 X3 n5 u# C1 @# k else if( SUCCEEDED( m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_4_SAMPLES, &MSQuality) )) MSType = D3DMULTISAMPLE_4_SAMPLES;! v; @3 j; Z: b* m else if( SUCCEEDED( m_pD3D->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, &MSQuality) ))4 e# m2 W* F6 K' X MSType = D3DMULTISAMPLE_2_SAMPLES;- a! S/ G. ~* ^' d! P int MSQ = MSQuality - 1;7 q( y7 c" v' ?/ 4 M2 e ! q( ^' ]% v* H( ~ // --------------------------------------------------------------' [4 Q" ^4 N: I' ~) p/ K6 B // ... Below Will Display a message box on Start-Up with the AntiAliasing // ... Multisample level Your Graphics card can handle . // ---------------------------------------------------------------3 ~$ ?$ R1 I0 ^; m4 ?7 k p // char msaaText[128]; // sprintf( msaaText, "Multi Sample Type = x%d", MSType ); // MessageBox( NULL, msaaText, "MSAA AMOUNT", MB_OK );8 P/ z" ^+ _- |7 x( 5 ~ // ------------------------------------------------------------------- m_d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; m_d3dpp.MultiSampleType = MSType;$ P9 |2 i o- m* Q9 z4 I9 n m_d3dpp.MultiSampleQuality = MSQ; m_d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;; l" p. n, R! q m_d3dpp.EnableAutoDepthStencil = TRUE; m_d3dpp.AutoDepthStencilFormat = D3DFMT_D16; m_d3dpp.Flags = 0;6 J9 m4 x$ ^: B. k1 G m_d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; m_d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;; w4 S8 p! {8 y6 {( B3 ] 4 _+ d, v) H+ H+ P: B) Y hr = m_pD3D->CreateDevice( m_d3dSettings.AdapterOrdinal(), pDeviceInfo->DevType, m_hWndFocus, behaviorFlags, &m_d3dpp, &m_pd3dDevice );! p0 O' J: R& s6 O! P % E. m; h9 z3 S6 o9 g: Z2 ! J m_pd3dDevice->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);/ T, e5 W4 F. H J m_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + W) o9 I, T$ K. n1 M m_pd3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL); m_pd3dDevice->SetRenderState(D3DRS_ALPHAREF, (DWORD)8); . X7 e" R' U* W m_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE); 完了! |
1楼:lansky、(2013-08-21 21:59) |
这段代码有一部分会导致NEUZ因为显卡不兼容而导致掉线。所以,最好不要用! |
2楼:孤独灬寂寞(2013-08-22 11:19) |
完全看不懂啊···· |
3楼:lansky、(2013-08-23 17:03) |
完全看不懂么。。。这个帖子可以删掉了。看不懂的帖子是不需要留着的。。。 |