9898
9999#include " W3DDevice/GameClient/CameraShakeSystem.h"
100100
101- constexpr const Real NearZ = MAP_XY_FACTOR ; // /< Set the near to MAP_XY_FACTOR. Improves z buffer resolution.
102-
103101// 30 fps
104102Real TheW3DFrameLengthInMsec = MSEC_PER_LOGICFRAME_REAL ; // default is 33msec/frame == 30fps. but we may change it depending on sys config.
105103static const Int MAX_REQUEST_CACHE_SIZE = 40 ; // Any size larger than 10, or examine code below for changes. jkmcd.
106104static const Real DRAWABLE_OVERSCAN = 75 .0f ; // /< 3D world coords of how much to overscan in the 3D screen region
107105
106+ constexpr const Real NearZ = MAP_XY_FACTOR ; // /< Set the near to MAP_XY_FACTOR. Improves z buffer resolution.
107+
108108// =================================================================================================
109109inline Real minf (Real a, Real b) { if (a < b) return a; else return b; }
110110inline Real maxf (Real a, Real b) { if (a > b) return a; else return b; }
@@ -1234,22 +1234,21 @@ void W3DView::update(void)
12341234 if (cameraLockObj->isUsingAirborneLocomotor () && cameraLockObj->isAboveTerrainOrWater ())
12351235 {
12361236 Matrix3D camXForm;
1237- Real oldZRot = m_angle;
12381237 Real idealZRot = cameraLockObj->getOrientation () - M_PI_2 ;
1239- normAngle (oldZRot);
1240- normAngle (idealZRot);
1241- Real diff = idealZRot - oldZRot;
1242- normAngle (diff);
12431238
12441239 if (m_snapImmediate)
12451240 {
1246- m_angle = idealZRot;
1241+ View::setAngle ( idealZRot) ;
12471242 }
12481243 else
12491244 {
1250- m_angle += diff * 0 .1f ;
1245+ normAngle (idealZRot);
1246+ Real oldZRot = m_angle;
1247+ normAngle (oldZRot);
1248+ Real diffRot = idealZRot - oldZRot;
1249+ normAngle (diffRot);
1250+ View::setAngle (m_angle + diffRot * 0 .1f );
12511251 }
1252- normAngle (m_angle);
12531252 }
12541253 }
12551254 if (m_snapImmediate)
@@ -1816,12 +1815,9 @@ void W3DView::forceRedraw()
18161815// -------------------------------------------------------------------------------------------------
18171816/* * Rotate the view around the up axis to the given angle. */
18181817// -------------------------------------------------------------------------------------------------
1819- void W3DView::setAngle ( Real angle )
1818+ void W3DView::setAngle ( Real radians )
18201819{
1821- // Normalize to +-PI.
1822- normAngle (angle);
1823- // call our base class, we are adding functionality
1824- View::setAngle ( angle );
1820+ View::setAngle ( radians );
18251821
18261822 m_doingMoveCameraOnWaypointPath = false ;
18271823 m_CameraArrivedAtWaypointOnPathFlag = false ;
@@ -1837,10 +1833,9 @@ void W3DView::setAngle( Real angle )
18371833// -------------------------------------------------------------------------------------------------
18381834/* * Rotate the view around the horizontal (X) axis to the given angle. */
18391835// -------------------------------------------------------------------------------------------------
1840- void W3DView::setPitch ( Real angle )
1836+ void W3DView::setPitch ( Real radians )
18411837{
1842- // call our base class, we are extending functionality
1843- View::setPitch ( angle );
1838+ View::setPitch ( radians );
18441839
18451840 m_doingMoveCameraOnWaypointPath = false ;
18461841 m_doingRotateCamera = false ;
@@ -2730,7 +2725,7 @@ void W3DView::resetCamera(const Coord3D *location, Int milliseconds, Real easeIn
27302725 moveCameraTo (location, milliseconds, 0 , false , easeIn, easeOut);
27312726 m_mcwpInfo.cameraAngle [2 ] = 0 .0f ; // default angle.
27322727 // m_mcwpInfo.cameraAngle[2] = m_defaultAngle;
2733- m_angle = m_mcwpInfo.cameraAngle [0 ];
2728+ View::setAngle ( m_mcwpInfo.cameraAngle [0 ]) ;
27342729
27352730 // terrain height + desired height offset == cameraOffset * actual zoom
27362731 // find best approximation of max terrain height we can see
@@ -2944,22 +2939,21 @@ void W3DView::rotateCameraOneFrame(void)
29442939 Real angleDiff = angle - m_angle;
29452940 normAngle (angleDiff);
29462941 angleDiff *= factor;
2947- m_angle += angleDiff;
2948- normAngle (m_angle);
2942+ View::setAngle (m_angle + angleDiff);
29492943 m_timeMultiplier = m_rcInfo.startTimeMultiplier + REAL_TO_INT_FLOOR (0.5 + (m_rcInfo.endTimeMultiplier -m_rcInfo.startTimeMultiplier )*factor);
29502944 }
29512945 else
29522946 {
2953- m_angle = angle;
2947+ View::setAngle ( angle) ;
29542948 }
29552949 }
29562950 }
29572951 }
29582952 else if (m_rcInfo.curFrame <= m_rcInfo.numFrames )
29592953 {
29602954 Real factor = m_rcInfo.ease (((Real)m_rcInfo.curFrame )/m_rcInfo.numFrames );
2961- m_angle = WWMath::Lerp (m_rcInfo.angle .startAngle , m_rcInfo.angle .endAngle , factor);
2962- normAngle (m_angle );
2955+ Real angle = WWMath::Lerp (m_rcInfo.angle .startAngle , m_rcInfo.angle .endAngle , factor);
2956+ View::setAngle (angle );
29632957 m_timeMultiplier = m_rcInfo.startTimeMultiplier + REAL_TO_INT_FLOOR (0.5 + (m_rcInfo.endTimeMultiplier -m_rcInfo.startTimeMultiplier )*factor);
29642958 }
29652959
@@ -2969,7 +2963,7 @@ void W3DView::rotateCameraOneFrame(void)
29692963 m_freezeTimeForCameraMovement = false ;
29702964 if (! m_rcInfo.trackObject )
29712965 {
2972- m_angle = m_rcInfo.angle .endAngle ;
2966+ View::setAngle ( m_rcInfo.angle .endAngle ) ;
29732967 }
29742968 }
29752969}
@@ -3041,7 +3035,7 @@ void W3DView::moveAlongWaypointPath(Real milliseconds)
30413035 m_CameraArrivedAtWaypointOnPathFlag = false ;
30423036
30433037 m_freezeTimeForCameraMovement = false ;
3044- m_angle = m_mcwpInfo.cameraAngle [m_mcwpInfo.numWaypoints ];
3038+ View::setAngle ( m_mcwpInfo.cameraAngle [m_mcwpInfo.numWaypoints ]) ;
30453039
30463040 m_groundLevel = m_mcwpInfo.groundHeight [m_mcwpInfo.numWaypoints ];
30473041 // ///////////////////m_cameraOffset.z = m_groundLevel+TheGlobalData->m_cameraHeight;
@@ -3112,8 +3106,7 @@ void W3DView::moveAlongWaypointPath(Real milliseconds)
31123106 if (fabs (deltaAngle) > PI /10 ) {
31133107 DEBUG_LOG ((" Huh." ));
31143108 }
3115- m_angle += avgFactor*(deltaAngle);
3116- normAngle (m_angle);
3109+ View::setAngle (m_angle + (avgFactor*deltaAngle));
31173110
31183111 Real timeMultiplier = m_mcwpInfo.timeMultiplier [m_mcwpInfo.curSegment ]*factor1 +
31193112 m_mcwpInfo.timeMultiplier [m_mcwpInfo.curSegment +1 ]*factor2;
0 commit comments