Added: #1469 Implementation of the GoTo step

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 12 years ago
parent f5912260b2
commit c2770d9ae5

@ -123,7 +123,7 @@ void ICameraAnimationStepPlayer::stopStepAndModifiers()
}
}
NLMISC::CVector ICameraAnimationStepPlayer::computeCurrentLookAtDir(float ratio, const NLMISC::CVector& currPos, const NLMISC::CVector& startLookAtDir,
NLMISC::CVector ICameraAnimationStepPlayer::computeCurrentLookAtDir(float ratio, const NLMISC::CVector& startLookAtDir,
const NLMISC::CVector& endLookAtDir)
{
// We normalize the start look at direction

@ -59,10 +59,10 @@ public:
protected:
/// Compute the current look at direction depending on the current position, the starting look at direction,
/// Compute the current look at direction depending on the starting look at direction,
/// the ending look at direction and the progression expressed as a ratio (value between 0 and 1 that expresses the
/// progression)
NLMISC::CVector computeCurrentLookAtDir(float ratio, const NLMISC::CVector& currPos, const NLMISC::CVector& startLookAtDir,
NLMISC::CVector computeCurrentLookAtDir(float ratio, const NLMISC::CVector& startLookAtDir,
const NLMISC::CVector& endLookAtDir);
// The list of modifiers

@ -83,10 +83,10 @@ public:
float ratio = currCamInfo.ElapsedTimeSinceStartStep / getDuration();
// We compute the final look at direction
NLMISC::CVector finalDir = resolvePositionOrEntityPosition(LookAtPos) - currCamInfo.CamPos;
NLMISC::CVector finalDir = resolvePositionOrEntityPosition(LookAtPos) - camInfo.CamPos;
// We get the current look at direction
camInfo.CamLookAtDir = computeCurrentLookAtDir(ratio, camInfo.CamPos, currCamInfo.CamLookAtDir, finalDir);
camInfo.CamLookAtDir = computeCurrentLookAtDir(ratio, currCamInfo.CamLookAtDir, finalDir);
return camInfo;
}
@ -123,7 +123,24 @@ public:
/// Function that plays the step
virtual TCameraAnimationInfo updateStep(const TCameraAnimationInfo& currCamInfo)
{
return currCamInfo;
TCameraAnimationInfo camInfo;
float ratio = currCamInfo.ElapsedTimeSinceStartStep / getDuration();
// We compute the current position between the starting position and the final position
NLMISC::CVector movementVector = resolvePositionOrEntityPosition(EndPos) - currCamInfo.CamPos;
// We current position is computed using the ratio and the starting position
NLMISC::CVector offset = movementVector * ratio;
camInfo.CamPos = currCamInfo.CamPos + offset;
// Now we compute the current look at direction
NLMISC::CVector finalDir = resolvePositionOrEntityPosition(LookAtPos) - camInfo.CamPos;
// We get the current look at direction
camInfo.CamLookAtDir = computeCurrentLookAtDir(ratio, currCamInfo.CamLookAtDir, finalDir);
return camInfo;
}
virtual void stopStep()

Loading…
Cancel
Save