Skip to content

Commit 7af8c63

Browse files
authored
refactor(view): Fix variable names in View::getScreenCornerWorldPointsAtZ() (#2201)
1 parent 5c4df79 commit 7af8c63

6 files changed

Lines changed: 29 additions & 20 deletions

File tree

Core/GameEngine/Include/GameClient/View.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class View : public Snapshot
118118
/** project the 4 corners of this view into the world and return each point as a parameter,
119119
the world points are at the requested Z */
120120
virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
121-
Coord3D *bottomLeft, Coord3D *bottomRight,
121+
Coord3D *bottomRight, Coord3D *bottomLeft,
122122
Real z );
123123

124124
virtual void setWidth( Int width ) { m_width = width; }

Core/GameEngine/Source/GameClient/View.cpp

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -226,35 +226,38 @@ void View::setLocation( const ViewLocation *location )
226226
the world points are at the requested Z */
227227
//-------------------------------------------------------------------------------------------------
228228
void View::getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
229-
Coord3D *bottomLeft, Coord3D *bottomRight,
229+
Coord3D *bottomRight, Coord3D *bottomLeft,
230230
Real z )
231231
{
232-
ICoord2D screenTopLeft, screenTopRight, screenBottomLeft, screenBottomRight;
233-
ICoord2D origin;
234-
Int viewWidth = getWidth();
235-
Int viewHeight = getHeight();
236-
237232
// sanity
238-
if( topLeft == nullptr || topRight == nullptr || bottomLeft == nullptr || bottomRight == nullptr )
233+
if( topLeft == nullptr || topRight == nullptr || bottomRight == nullptr || bottomLeft == nullptr)
239234
return;
240235

236+
ICoord2D screenTopLeft;
237+
ICoord2D screenTopRight;
238+
ICoord2D screenBottomRight;
239+
ICoord2D screenBottomLeft;
240+
ICoord2D origin;
241+
const Int viewWidth = getWidth();
242+
const Int viewHeight = getHeight();
243+
241244
// setup the screen coords for the 4 corners of the viewable display
242245
getOrigin( &origin.x, &origin.y );
243-
screenTopLeft.x = origin.x; // upper left
244-
screenTopLeft.y = origin.y; // upper left
245-
screenTopRight.x = origin.x + viewWidth; // upper right
246-
screenTopRight.y = origin.y; // upper right
247-
screenBottomLeft.x = origin.x + viewWidth; // lower right
248-
screenBottomLeft.y = origin.y + viewHeight; // lower right
249-
screenBottomRight.x = origin.x; // lower left
250-
screenBottomRight.y = origin.y + viewHeight; // lower left
246+
247+
screenTopLeft.x = origin.x;
248+
screenTopLeft.y = origin.y;
249+
screenTopRight.x = origin.x + viewWidth;
250+
screenTopRight.y = origin.y;
251+
screenBottomRight.x = origin.x + viewWidth;
252+
screenBottomRight.y = origin.y + viewHeight;
253+
screenBottomLeft.x = origin.x;
254+
screenBottomLeft.y = origin.y + viewHeight;
251255

252256
// project
253257
screenToWorldAtZ( &screenTopLeft, topLeft, z );
254258
screenToWorldAtZ( &screenTopRight, topRight, z );
255-
screenToWorldAtZ( &screenBottomLeft, bottomLeft, z );
256259
screenToWorldAtZ( &screenBottomRight, bottomRight, z );
257-
260+
screenToWorldAtZ( &screenBottomLeft, bottomLeft, z );
258261
}
259262

260263
// ------------------------------------------------------------------------------------------------

Core/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ void W3DRadar::reconstructViewBox( void )
183183
Int i;
184184

185185
// get the 4 points of the view corners in the 3D world at the average Z height in the map
186+
// 1-------2
187+
// \ /
188+
// 4---3
186189
TheTacticalView->getScreenCornerWorldPointsAtZ( &world[ 0 ],
187190
&world[ 1 ],
188191
&world[ 2 ],

Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,9 @@ void W3DView::getAxisAlignedViewRegion(Region3D &axisAlignedRegion)
14181418
// get the 4 points in 3D space of the 4 corners of the view, we will use a z = 0.0f
14191419
// value so that we can get everything ... even stuff below the terrain
14201420
//
1421+
// 1-------2
1422+
// \ /
1423+
// 4---3
14211424
Coord3D box[ 4 ];
14221425
getScreenCornerWorldPointsAtZ( &box[ 0 ], &box[ 1 ], &box[ 2 ], &box[ 3 ], 0.0f );
14231426

Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class PlaceholderView : public View
178178
virtual void screenToTerrain( const ICoord2D *screen, Coord3D *world ) {}; ///< transform screen coord to a point on the 3D terrain
179179
virtual void screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) {}; ///< transform screen point to world point at the specified world Z value
180180
virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
181-
Coord3D *bottomLeft, Coord3D *bottomRight,
181+
Coord3D *bottomRight, Coord3D *bottomLeft,
182182
Real z ){};
183183

184184
virtual void drawView( void ) {}; ///< Render the world visible in this view.

GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class PlaceholderView : public View
178178
virtual void screenToTerrain( const ICoord2D *screen, Coord3D *world ) {}; ///< transform screen coord to a point on the 3D terrain
179179
virtual void screenToWorldAtZ( const ICoord2D *s, Coord3D *w, Real z ) {}; ///< transform screen point to world point at the specified world Z value
180180
virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
181-
Coord3D *bottomLeft, Coord3D *bottomRight,
181+
Coord3D *bottomRight, Coord3D *bottomLeft,
182182
Real z ){};
183183

184184
virtual void drawView( void ) {}; ///< Render the world visible in this view.

0 commit comments

Comments
 (0)