X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
Revision | 358 (tree) |
---|---|
Zeit | 2023-07-01 22:53:49 |
Autor | xops-mikan |
DirectXのシェーダーにおける2D描画処理を変更
@@ -59,12 +59,12 @@ | ||
59 | 59 | pPixelShader = NULL; |
60 | 60 | pPSConstantTable = NULL; |
61 | 61 | hPSViewPos = NULL; |
62 | + hPSEnable2DRendering = NULL; | |
62 | 63 | hPSEnableTexture = NULL; |
63 | 64 | hPSEnableFog = NULL; |
64 | 65 | hPSFogColor = NULL; |
65 | 66 | hPSFogStart = NULL; |
66 | 67 | hPSFogEnd = NULL; |
67 | - hPSEnable2DRender = NULL; | |
68 | 68 | #endif |
69 | 69 | |
70 | 70 | BlockDataIF = NULL; |
@@ -245,6 +245,8 @@ | ||
245 | 245 | //ピクセルシェーダーの関連変数 |
246 | 246 | hPSViewPos = pPSConstantTable->GetConstantByName(NULL, "ViewPos"); |
247 | 247 | //if( hPSViewPos == NULL ){ return 1; } |
248 | + hPSEnable2DRendering = pPSConstantTable->GetConstantByName(NULL, "Enable2DRendering"); | |
249 | + //if( hPSEnable2DRendering == NULL ){ return 1; } | |
248 | 250 | hPSEnableTexture = pPSConstantTable->GetConstantByName(NULL, "EnableTexture"); |
249 | 251 | if( hPSEnableTexture == NULL ){ return 1; } |
250 | 252 | hPSEnableFog = pPSConstantTable->GetConstantByName(NULL, "EnableFog"); |
@@ -255,8 +257,6 @@ | ||
255 | 257 | if( hPSFogStart == NULL ){ return 1; } |
256 | 258 | hPSFogEnd = pPSConstantTable->GetConstantByName(NULL, "FogEnd"); |
257 | 259 | if( hPSFogEnd == NULL ){ return 1; } |
258 | - hPSEnable2DRender = pPSConstantTable->GetConstantByName(NULL, "Enable2DRender"); | |
259 | - //if( hPSEnable2DRender == NULL ){ return 1; } | |
260 | 260 | |
261 | 261 | D3DXMatrixIdentity(&VSWorldPosMatrix); |
262 | 262 | D3DXMatrixIdentity(&VSViewPosMatrix); |
@@ -1542,6 +1542,7 @@ | ||
1542 | 1542 | pd3dDevice->SetTexture(0, ptextures[mapTextureID[textureID]] ); |
1543 | 1543 | } |
1544 | 1544 | #else |
1545 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, false); } | |
1545 | 1546 | if( mapTextureID[textureID] == -1 ){ |
1546 | 1547 | pd3dDevice->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE); |
1547 | 1548 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, false); |
@@ -1594,6 +1595,7 @@ | ||
1594 | 1595 | pd3dDevice->SetTexture(0, ptextures[mapTextureID[textureID]] ); |
1595 | 1596 | } |
1596 | 1597 | #else |
1598 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, false); } | |
1597 | 1599 | if( mapTextureID[textureID] == -1 ){ |
1598 | 1600 | pd3dDevice->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE); |
1599 | 1601 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, false); |
@@ -1727,6 +1729,7 @@ | ||
1727 | 1729 | pd3dDevice->SetTexture( 0, ptextures[id_texture] ); |
1728 | 1730 | } |
1729 | 1731 | #else |
1732 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, false); } | |
1730 | 1733 | if( id_texture == -1 ){ |
1731 | 1734 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, false); |
1732 | 1735 | pd3dDevice->SetTexture(0, NULL); |
@@ -1799,6 +1802,7 @@ | ||
1799 | 1802 | |
1800 | 1803 | //テクスチャとデータ形式を設定し描画 |
1801 | 1804 | #if GRAPHIC_ENGINE == 1 |
1805 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, false); } | |
1802 | 1806 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, true); |
1803 | 1807 | #endif |
1804 | 1808 | pd3dDevice->SetTexture(0, ptextures[id_texture]); |
@@ -1861,6 +1865,7 @@ | ||
1861 | 1865 | } |
1862 | 1866 | |
1863 | 1867 | #if GRAPHIC_ENGINE == 1 |
1868 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, false); } | |
1864 | 1869 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, false); |
1865 | 1870 | #endif |
1866 | 1871 | pd3dDevice->SetTexture(0, NULL); |
@@ -2021,12 +2026,6 @@ | ||
2021 | 2026 | #else |
2022 | 2027 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableFog, false); |
2023 | 2028 | #endif |
2024 | - | |
2025 | -#if GRAPHIC_ENGINE == 1 | |
2026 | - if( hPSEnable2DRender != NULL ){ | |
2027 | - pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRender, true); | |
2028 | - } | |
2029 | -#endif | |
2030 | 2029 | } |
2031 | 2030 | |
2032 | 2031 | //! @brief テクスチャフォントサイズ計算 |
@@ -2083,6 +2082,7 @@ | ||
2083 | 2082 | |
2084 | 2083 | //テクスチャをフォントテクスチャに設定 |
2085 | 2084 | #if GRAPHIC_ENGINE == 1 |
2085 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, true); } | |
2086 | 2086 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, true); |
2087 | 2087 | #endif |
2088 | 2088 | pd3dDevice->SetTexture( 0, ptextures[TextureFont] ); |
@@ -2220,6 +2220,7 @@ | ||
2220 | 2220 | |
2221 | 2221 | //テクスチャをフォントテクスチャに設定 |
2222 | 2222 | #if GRAPHIC_ENGINE == 1 |
2223 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, true); } | |
2223 | 2224 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, true); |
2224 | 2225 | #endif |
2225 | 2226 | pd3dDevice->SetTexture( 0, ptextures[TextureDebugFont] ); |
@@ -2302,6 +2303,7 @@ | ||
2302 | 2303 | } |
2303 | 2304 | |
2304 | 2305 | #if GRAPHIC_ENGINE == 1 |
2306 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, true); } | |
2305 | 2307 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, false); |
2306 | 2308 | #endif |
2307 | 2309 | pd3dDevice->SetTexture(0, NULL); |
@@ -2342,6 +2344,7 @@ | ||
2342 | 2344 | } |
2343 | 2345 | |
2344 | 2346 | #if GRAPHIC_ENGINE == 1 |
2347 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, true); } | |
2345 | 2348 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, false); |
2346 | 2349 | #endif |
2347 | 2350 | pd3dDevice->SetTexture(0, NULL); |
@@ -2388,6 +2391,7 @@ | ||
2388 | 2391 | } |
2389 | 2392 | |
2390 | 2393 | #if GRAPHIC_ENGINE == 1 |
2394 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, true); } | |
2391 | 2395 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, false); |
2392 | 2396 | #endif |
2393 | 2397 | pd3dDevice->SetTexture(0, NULL); |
@@ -2460,6 +2464,7 @@ | ||
2460 | 2464 | |
2461 | 2465 | //テクスチャとデータ形式を設定し、描画 |
2462 | 2466 | #if GRAPHIC_ENGINE == 1 |
2467 | + if( hPSEnable2DRendering != NULL ){ pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRendering, true); } | |
2463 | 2468 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableTexture, true); |
2464 | 2469 | #endif |
2465 | 2470 | pd3dDevice->SetTexture( 0, ptextures[id] ); |
@@ -2503,12 +2508,6 @@ | ||
2503 | 2508 | pPSConstantTable->SetBool(pd3dDevice, hPSEnableFog, true); |
2504 | 2509 | #endif |
2505 | 2510 | } |
2506 | - | |
2507 | -#if GRAPHIC_ENGINE == 1 | |
2508 | - if( hPSEnable2DRender != NULL ){ | |
2509 | - pPSConstantTable->SetBool(pd3dDevice, hPSEnable2DRender, false); | |
2510 | - } | |
2511 | -#endif | |
2512 | 2511 | } |
2513 | 2512 | |
2514 | 2513 | //! @brief 画面のスクリーンショットを保存 |
@@ -197,12 +197,12 @@ | ||
197 | 197 | LPDIRECT3DPIXELSHADER9 pPixelShader; //!< ピクセルシェーダー |
198 | 198 | LPD3DXCONSTANTTABLE pPSConstantTable; //!< ピクセルシェーダーの定数テーブル |
199 | 199 | D3DXHANDLE hPSViewPos; //!< ピクセルシェーダーのカメラ座標 |
200 | + D3DXHANDLE hPSEnable2DRendering; //!< ピクセルシェーダーの2D描画フラグ | |
200 | 201 | D3DXHANDLE hPSEnableTexture; //!< ピクセルシェーダーのテクスチャフラグ |
201 | 202 | D3DXHANDLE hPSEnableFog; //!< ピクセルシェーダーのフォグ有効フラグ |
202 | 203 | D3DXHANDLE hPSFogColor; //!< ピクセルシェーダーのフォグ色 |
203 | 204 | D3DXHANDLE hPSFogStart; //!< ピクセルシェーダーのフォグの開始深度 |
204 | 205 | D3DXHANDLE hPSFogEnd; //!< ピクセルシェーダーのフォグの終了深度 |
205 | - D3DXHANDLE hPSEnable2DRender; //!< ピクセルシェーダーの2D描画フラグ | |
206 | 206 | D3DXMATRIX VSWorldPosMatrix; //!< 頂点シェーダーに与えた変換行列 |
207 | 207 | D3DXMATRIX VSViewPosMatrix; //!< 頂点シェーダーに与えた変換行列 |
208 | 208 | D3DXMATRIX VSViewProjMatrix; //!< 頂点シェーダーに与えた変換行列 |