X operations(XOPS)に非常に近いFPSゲームを制作・リメイクし、成果物をオープンソースとして公開することを目的としたプロジェクトです。
| Revision | 146 (tree) |
|---|---|
| Time | 2016-08-27 22:31:49 |
| Author | |
OpenGLにて、三人称視点でカメラが上方向へ回り込むと画面が逆さまになるバグの修正。
| @@ -619,7 +619,7 @@ | ||
| 619 | 619 | return nowformat; |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | -//! @brief テクスチャフォーマットを拡張子で判定 | |
| 622 | +//! @brief テクスチャフォーマットをファイルヘッダーで判定 | |
| 623 | 623 | //! @param filename ファイル名 |
| 624 | 624 | //! @param nowformat 現在の判別値 |
| 625 | 625 | //! @return 新たな判別値 |
| @@ -1365,6 +1365,15 @@ | ||
| 1365 | 1365 | //! @brief ワールド空間を原点(0,0,0)に戻す など |
| 1366 | 1366 | void D3DGraphics::ResetWorldTransform() |
| 1367 | 1367 | { |
| 1368 | + float camera_y_flag; | |
| 1369 | + | |
| 1370 | + if( fabs(camera_ry) <= (float)M_PI/2 ){ | |
| 1371 | + camera_y_flag = 1.0f; | |
| 1372 | + } | |
| 1373 | + else{ | |
| 1374 | + camera_y_flag = -1.0f; | |
| 1375 | + } | |
| 1376 | + | |
| 1368 | 1377 | glMatrixMode(GL_PROJECTION); |
| 1369 | 1378 | glLoadIdentity(); |
| 1370 | 1379 | gluPerspective(viewangle*(180.0f/(float)M_PI), (float)width/height, CLIPPINGPLANE_NEAR, CLIPPINGPLANE_FAR); |
| @@ -1371,7 +1380,7 @@ | ||
| 1371 | 1380 | |
| 1372 | 1381 | glMatrixMode(GL_MODELVIEW); |
| 1373 | 1382 | glLoadIdentity(); |
| 1374 | - gluLookAt(camera_x*-1, camera_y, camera_z, camera_x*-1 + cos(camera_rx*-1 + (float)M_PI)*cos(camera_ry), camera_y + sin(camera_ry), camera_z + sin(camera_rx*-1 + (float)M_PI)*cos(camera_ry), 0.0f, 1.0f, 0.0f); | |
| 1383 | + gluLookAt(camera_x*-1, camera_y, camera_z, camera_x*-1 + cos(camera_rx*-1 + (float)M_PI)*cos(camera_ry), camera_y + sin(camera_ry), camera_z + sin(camera_rx*-1 + (float)M_PI)*cos(camera_ry), 0.0f, camera_y_flag, 0.0f); | |
| 1375 | 1384 | } |
| 1376 | 1385 | |
| 1377 | 1386 | //! @brief ワールド空間の座標・角度・拡大率を設定 |
| @@ -1531,7 +1540,7 @@ | ||
| 1531 | 1540 | //! @param in_camera_y カメラのY座標 |
| 1532 | 1541 | //! @param in_camera_z カメラのZ座標 |
| 1533 | 1542 | //! @param in_camera_rx カメラの横軸角度 |
| 1534 | -//! @param in_camera_ry カメラの縦軸角度 | |
| 1543 | +//! @param in_camera_ry カメラの縦軸角度(-π〜π以内) | |
| 1535 | 1544 | //! @param in_viewangle 視野角 |
| 1536 | 1545 | void D3DGraphics::SetCamera(float in_camera_x, float in_camera_y, float in_camera_z, float in_camera_rx, float in_camera_ry, float in_viewangle) |
| 1537 | 1546 | { |