Mercurial > mm7
changeset 1378:1fb9f4b9b6a7
Fixed portal culling at extreme angles.
author | Nomad |
---|---|
date | Tue, 16 Jul 2013 11:05:52 +0200 |
parents | 437d4ed49f26 |
children | 635500df9320 |
files | Indoor.cpp |
diffstat | 1 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Tue Jul 16 11:55:46 2013 +0600 +++ b/Indoor.cpp Tue Jul 16 11:05:52 2013 +0200 @@ -6831,6 +6831,7 @@ check_event_triggers(); } //----- (00424829) -------------------------------------------------------- +// Finds out if current portal can be seen through the previous portal bool PortalFrustrum(int pNumVertices, BspRenderer_PortalViewportData *far_portal, BspRenderer_PortalViewportData *near_portal, int uFaceID) { int min_y; // esi@5 @@ -6887,16 +6888,15 @@ //get min and max y for portal(дать минимальное и максимальное значение y для портала) for ( uint i = 1; i < pNumVertices; ++i ) { - if ( PortalFace._screen_space_y[i] >= min_y ) - { - if ( PortalFace._screen_space_y[i] > max_y ) - max_y = PortalFace._screen_space_y[i]; - } - else + if (PortalFace._screen_space_y[i] < min_y) { min_y_ID = i; min_y = PortalFace._screen_space_y[i]; } + else if (PortalFace._screen_space_y[i] > max_y) + { + max_y = PortalFace._screen_space_y[i]; + } } if ( max_y == min_y ) return false; @@ -6937,8 +6937,9 @@ if ( PortalFace._screen_space_y[v13] != PortalFace._screen_space_y[min_y_ID2] ) { v62 = PortalFace._screen_space_x[min_y_ID2] << 16; - v54 = ((PortalFace._screen_space_x[v13] - PortalFace._screen_space_x[min_y_ID2]) << 16) / (PortalFace._screen_space_y[v13] - PortalFace._screen_space_y[min_y_ID2]); - far_portal->viewport_left_side[min_y] = PortalFace._screen_space_x[min_y_ID2]; + v54 = ((PortalFace._screen_space_x[v13] - PortalFace._screen_space_x[min_y_ID2]) << 16) / + (PortalFace._screen_space_y[v13] - PortalFace._screen_space_y[min_y_ID2]); + far_portal->viewport_left_side[min_y] = (short)PortalFace._screen_space_x[min_y_ID2]; } //**************************************************************************************************************************************** // @@ -6975,8 +6976,9 @@ if ( PortalFace._screen_space_y[v19] != PortalFace._screen_space_y[v61] ) { v61 = PortalFace._screen_space_x[v20] << 16; - v53 = ((PortalFace._screen_space_x[v19] - PortalFace._screen_space_x[v20]) << 16) / PortalFace._screen_space_y[v19] - PortalFace._screen_space_y[v20]; - far_portal->viewport_right_side[max_y] = PortalFace._screen_space_x[v20]; + v53 = ((PortalFace._screen_space_x[v19] - PortalFace._screen_space_x[v20]) << 16) / + (PortalFace._screen_space_y[v19] - PortalFace._screen_space_y[v20]); + far_portal->viewport_right_side[max_y] = (short)PortalFace._screen_space_x[v20]; } //**************************************************************************************************************************************** v22 = min_y; @@ -6998,7 +7000,7 @@ v26 = v13; if ( PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24] > 0 ) { - v54 = ((PortalFace._screen_space_x[v26] - PortalFace._screen_space_x[v24]) << 16) / PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]; + v54 = ((PortalFace._screen_space_x[v26] - PortalFace._screen_space_x[v24]) << 16) / (PortalFace._screen_space_y[v26] - PortalFace._screen_space_y[v24]); v62 = PortalFace._screen_space_x[v24] << 16; } } @@ -7016,7 +7018,7 @@ v31 = v18; if ( PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29] > 0 ) { - v53 = ((PortalFace._screen_space_x[v31] - PortalFace._screen_space_x[v29]) << 16) / PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]; + v53 = ((PortalFace._screen_space_x[v31] - PortalFace._screen_space_x[v29]) << 16) / (PortalFace._screen_space_y[v31] - PortalFace._screen_space_y[v29]); v61 = PortalFace._screen_space_x[v29] << 16; } }