トップページ > 過去ログ > 記事閲覧
Use PyroParticles in DxLib
名前:gfam 日時: 2012/04/28 22:39

hi,I would like to use pyro particles system in dxlib. I follow the example (DirectX9 demo) write use dxlib,can successfully render particles effect.but find a strange problem,call DrawGraph dxlib api render texture is different texture (this texture is in particles file). Pyro Particles Website:pyro.fenomen-games.com/ use dxlib and have a bug test: (three w).raincoding.com/download/other/pyro.zip おかげで

Page: 1 |

Re: Use PyroParticles in DxLib ( No.1 )
名前:管理人 日時:2012/05/01 12:22

pyro内で Direct3D9 の設定が変更されてしまっているのが原因みたいです これに対処の為にDXライブラリが行う Direct3D9 の設定をやり直す関数 RefreshDxLibDirect3DSetting を追加しました // DXライブラリのDirect3D設定をしなおす int RefreshDxLibDirect3DSetting( void ) ; これを pyro の機能を使った後に呼ぶようにしてください g_pd3dDevice->SetRenderState(D_D3DRS_ZENABLE, FALSE); g_pd3dDevice->SetRenderState(D_D3DRS_LIGHTING, FALSE); g_pd3dDevice->SetRenderState(D_D3DRS_CULLMODE, D_D3DCULL_NONE); g_pd3dDevice->SetTextureStageState(0, D_D3DTSS_COLOROP, D_D3DTOP_MODULATE); g_pd3dDevice->SetTextureStageState(0, D_D3DTSS_ALPHAOP, D_D3DTOP_MODULATE); g_pd3dDevice->SetTextureStageState(0, D_D3DTSS_COLORARG1, D_D3DTA_TEXTURE); g_pd3dDevice->SetTextureStageState(0, D_D3DTSS_COLORARG2, D_D3DTA_DIFFUSE); g_pEmitters->Render(Time); g_pEmitters->RemoveInactive(Time, 0.1f); DxLib::RefreshDxLibDirect3DSetting(); // ←←←← Direct3Dの設定をし直す こちらに RefreshDxLibDirect3DSetting を追加したバージョンをアップしましたので、 よろしければお試しください m(_ _)m http://homepage2.nifty.com/natupaji/DxLib/DxLibVCTest.exe // VisualC++ 用 http://homepage2.nifty.com/natupaji/DxLib/DxLibBCCTest.exe // BorlandC++ 用 http://homepage2.nifty.com/natupaji/DxLib/DxLibGCC_DevCppTest.exe // Dev-C++ 用 http://homepage2.nifty.com/natupaji/DxLib/DxLibGCC_MinGWTest.exe // MinGW 用 http://homepage2.nifty.com/natupaji/DxLib/DxLibMakeTest.exe // ソース (中身を既存のライブラリのファイルに上書きして、BCCをお使いの 場合は『再構築』を、VCをお使いの場合は『リビルド』を、 Dev-C++をお使いの方は「Rebuild All(Ctrl+F11)」をして下さい)
Re: Use PyroParticles in DxLib ( No.2 )
名前:gfam 日時:2012/05/01 22:05

Thank you for your enthusiasm and help, now running without problems. おかげで
Re: Use PyroParticles in DxLib ( No.3 )
名前:gfam 日時:2012/05/02 21:36

I find a bug: //... //render texture before the particle. //this texture should be on top //of particles. //but is under particles. DxLib::DrawGraph(100,100,gHandle,1); g_pEmitters->Render(Time); g_pEmitters->RemoveInactive(Time, 0.1f); //if draw two graph,then is looks like //no problem. //DxLib::DrawGraph(100,200,gHandle2,1); DxLib::RefreshDxLibDirect3DSetting(); DxLib::ScreenFlip(); this bug looks zOrder rendering order and cannot be used to determine. おかげで
Re: Use PyroParticles in DxLib ( No.4 )
名前:管理人 日時:2012/05/03 01:10

以下のように RenderVertex を pyro の操作をする前に呼んでみてください //... //render texture before the particle. //this texture should be on top //of particles. //but is under particles. DxLib::DrawGraph(100,100,gHandle,1); DxLib::RenderVertex(); // ←←←これです g_pEmitters->Render(Time); g_pEmitters->RemoveInactive(Time, 0.1f); //if draw two graph,then is looks like //no problem. //DxLib::DrawGraph(100,200,gHandle2,1); DxLib::RefreshDxLibDirect3DSetting(); DxLib::ScreenFlip(); DXライブラリは高速描画の為に、DrawGraph をしても直ぐに描画せずに、 テクスチャが変更されたり描画ブレンドモードが変更されたりしたときに 一度に描画するようになっているので pyro のようなDXライブラリが感知できない 描画処理が入ってしまうと描画順番が意図しないものになってしまうというわけです。 例: DrawGraph( 0, 0, PlayerGraph, TRUE ) ; // stock0 DrawGraph( 10, 0, PlayerGraph, TRUE ) ; // stock1 DrawGraph( 20, 0, PlayerGraph, TRUE ) ; // stock2 DrawGraph( 30, 0, PlayerGraph, TRUE ) ; // stock3 DrawGraph( 40, 0, PlayerGraph, TRUE ) ; // stock4 DrawGraph( 50, 0, PlayerGraph, TRUE ) ; // stock5 DrawGraph( 60, 0, PlayerGraph, TRUE ) ; // stock6 DrawGraph( 70, 0, EnemyGraph, TRUE ) ; // ( Draw stock0〜6 ) stock0 DrawGraph( 80, 0, EnemyGraph, TRUE ) ; // stock1 DrawGraph( 90, 0, PlayerGraph, TRUE ) ; // ( Draw stock0〜1 ) stock0 DrawGraph( 100, 0, PlayerGraph, TRUE ) ; // stock1 DrawGraph( 110, 0, PlayerGraph, TRUE ) ; // stock2 DrawGraph( 120, 0, PlayerGraph, TRUE ) ; // stock3 g_pEmitters->Render( Time ) ; // Draw pyro DrawGraph( 130, 0, PlayerGraph, TRUE ) ; // stock4 DrawGraph( 140, 0, PlayerGraph, TRUE ) ; // stock5 DrawGraph( 150, 0, PlayerGraph, TRUE ) ; // stock6 DrawGraph( 160, 0, PlayerGraph, TRUE ) ; // stock7 ScreenFlip(); // ( Draw stock0〜7 ) なので、その「遅延描画」を以下の関数で強制的に描画することができます。 // 頂点バッファに溜まった頂点データを描画する int RenderVertex( void ) ; 例: DrawGraph( 90, 0, PlayerGraph, TRUE ) ; // stock0 DrawGraph( 100, 0, PlayerGraph, TRUE ) ; // stock1 DrawGraph( 110, 0, PlayerGraph, TRUE ) ; // stock2 DrawGraph( 120, 0, PlayerGraph, TRUE ) ; // stock3 RenderVertex() ; // Draw stock0〜3 g_pEmitters->Render( Time ) ; // Draw pyro DrawGraph( 130, 0, PlayerGraph, TRUE ) ; // stock0 DrawGraph( 140, 0, PlayerGraph, TRUE ) ; // stock1 ScreenFlip(); // ( Draw stock0〜1 ) よろしければお試しください m(_ _)m
Re: Use PyroParticles in DxLib ( No.5 )
名前:gfam 日時:2012/05/03 01:30

Thank you very much for your patience and expertise help.problem is solved. おかげで

Page: 1 |