Skip to content

Commit 4eb43c0

Browse files
committed
refactor(view): Simplify code in W3DView (#1752)
1 parent 090d76b commit 4eb43c0

File tree

4 files changed

+111
-105
lines changed

4 files changed

+111
-105
lines changed

GeneralsMD/Code/GameEngine/Include/GameClient/View.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class View : public Snapshot
231231
virtual void shake( const Coord3D *epicenter, CameraShakeType shakeType ) { };
232232

233233
virtual Real getFXPitch( void ) const { return 1.0f; } ///< returns the FX pitch angle
234-
virtual void forceCameraConstraintRecalc(void) {}
234+
virtual void forceCameraAreaConstraintRecalc(void) {}
235235
virtual void setGuardBandBias( const Coord2D *gb ) = 0;
236236

237237
protected:

GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ void TerrainLogic::setActiveBoundary(Int newActiveBoundary)
26322632
// Don't do a newMap on the pathfinder - It uses the largest active boundary to start. jba.
26332633
//TheAI->pathfinder()->newMap();
26342634

2635-
TheTacticalView->forceCameraConstraintRecalc();
2635+
TheTacticalView->forceCameraAreaConstraintRecalc();
26362636
}
26372637

26382638
// ------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class W3DView : public View, public SubsystemInterface
226226
virtual void set3DWireFrameMode(Bool enable); ///<enables custom wireframe rendering of 3D viewport
227227

228228
Bool updateCameraMovements(void);
229-
virtual void forceCameraConstraintRecalc(void) { calcCameraConstraints(); }
229+
virtual void forceCameraAreaConstraintRecalc(void) { calcCameraAreaConstraints(); }
230230

231231
virtual void setGuardBandBias( const Coord2D *gb ) { m_guardBandBias.x = gb->x; m_guardBandBias.y = gb->y; }
232232

@@ -276,12 +276,13 @@ class W3DView : public View, public SubsystemInterface
276276

277277
Real m_groundLevel; ///< height of ground.
278278

279-
Region2D m_cameraConstraint; ///< m_pos should be constrained to be within this area
280-
Bool m_cameraConstraintValid; ///< if f, recalc cam constraints
279+
Region2D m_cameraAreaConstraints; ///< Camera should be constrained to be within this area
280+
Bool m_cameraAreaConstraintsValid; ///< If false, recalculates the camera area constraints in the next render update
281281

282282
void setCameraTransform( void ); ///< set the transform matrix of m_3DCamera, based on m_pos & m_angle
283-
void buildCameraTransform( Matrix3D *transform ) ; ///< calculate (but do not set) the transform matrix of m_3DCamera, based on m_pos & m_angle
284-
void calcCameraConstraints() ; ///< recalc m_cameraConstraint
283+
void buildCameraTransform( Matrix3D *transform ); ///< calculate (but do not set) the transform matrix of m_3DCamera, based on m_pos & m_angle
284+
void calcCameraAreaConstraints(); ///< Recalculates the camera area constraints
285+
Bool isWithinCameraHeightConstraints() const;
285286
void moveAlongWaypointPath(Real milliseconds); ///< Move camera along path.
286287
void getPickRay(const ICoord2D *screen, Vector3 *rayStart, Vector3 *rayEnd); ///<returns a line segment (ray) originating at the given screen position
287288
void setupWaypointPath(Bool orient); ///< Calculates distances & angles for moving along a waypoint path.

0 commit comments

Comments
 (0)