コード例 #1
0
void RenderingEngine1::UpdateAnimation(float timeStep)
{
    float direction = RotationDirection();
    if (direction == 0)
        return;
    
    float degrees = timeStep * 360 * RevolutionsPerSecond;
    m_currentAngle += degrees * direction;

    // Normalize the angle to [0, 360)
    if (m_currentAngle >= 360)
        m_currentAngle -= 360;
    else if (m_currentAngle < 0)
        m_currentAngle += 360;
    
    // If the rotation direction changed, then we overshot the desired angle.
    if (RotationDirection() != direction)
        m_currentAngle = m_desiredAngle;
}
コード例 #2
0
void RenderingEngine1::UpdateAniamtion(float timeStep)
{
    float direction = RotationDirection();
    if (direction == 0) {
        return;
    }
    
    float degrees = timeStep*360*RevolutionPerSecond;
    m_currenAngle += degrees*direction;
    
    if (m_currenAngle >= 360) {
        m_currenAngle -= 360;
    }else if (m_currenAngle < 0){
        m_currenAngle += 360;
    }
    
    if (RotationDirection() != direction) {
        m_currenAngle = m_desiredAngle;
    }
}
コード例 #3
0
ファイル: RenderingEngine1.cpp プロジェクト: vanb/HelloArrow
void RenderingEngine1::UpdateAnimation(float timeStep)
{
	float direction = RotationDirection();
	if (direction == 0)
		return;
	
	float degrees = timeStep * 360 * RevolutionsPerSecond;
	m_currentAngle += degrees * direction;
	
	//Ensure teh angle stays withing [0, 360)
	if (m_currentAngle >= 360) {
		m_currentAngle -= 360;
	} else if (m_currentAngle < 0) {
		m_currentAngle += 360;
	}
	
	//If rotation direction changed, then we overshot desired angle
	if (RotationDirection() != direction) {
		m_currentAngle = m_desiredAngle;
	}
}
コード例 #4
0
void RenderingEngine1::UpdateAnimation(float timeStep) {

    float direction = RotationDirection();
    if (direction == 0) {
        return;
    }
    
    float degrees = timeStep * 360 * RevolutionsPerSecond;
    m_currentAngle += degrees * direction;
    
    //Ensure that angle stays within [0, 360)
    if (m_currentAngle >= 360) {
        m_currentAngle -= 360;
    }
    if (m_currentAngle < 0) {
        m_currentAngle += 360;
    }
    
    if (RotationDirection() != direction) {
        m_currentAngle = m_desireAngle;
    }
}
コード例 #5
0
void RenderingEngine2::UpdateAnimation(float timeStep)
{
    
    //Debugger::Log()<<"FPS:"<<1/timeStep<<endl;
    
    float direction = RotationDirection();
    if (direction == 0)
        return;
    
    float degrees = timeStep * 360 * RevolutionsPerSecond;
    m_currentAngle += degrees * direction;
    
    // Ensure that the angle stays within [0, 360).
    if (m_currentAngle >= 360)
        m_currentAngle -= 360;
    else if (m_currentAngle < 0)
        m_currentAngle += 360;
    
    // If the rotation direction changed, then we overshot the desired angle.
    if (RotationDirection() != direction)
        m_currentAngle = m_desiredAngle;
}