コード例 #1
0
ファイル: task.cpp プロジェクト: wcremeika/thesis
void Task::setDateSleep(const QString &s)
{
    date_sleep=QDate().fromString (s,Qt::ISODate);
    if (getDaysSleep()>0) 
	setAwake(Sleeping);
    else
	setAwake (Morning);
}
コード例 #2
0
ファイル: task.cpp プロジェクト: wcremeika/thesis
void Task::setAwake(const QString &s)
{
    if (s=="Sleeping")
	setAwake(Sleeping);
    else if (s=="Morning")
	setAwake(Morning);
    else if (s=="WideAwake")
	setAwake(WideAwake);
    else
	qWarning()<<"Task::setAwake Unknown value: "<<s;
}
コード例 #3
0
void jfRigidBody_x86::integrate(jfReal timeStep)
{
	//Linear Accel
	if(!m_IsAwake)
	{
	    return;
	}

    jfVector3_x86 angularAccel;
	(*m_LastFrameAccel) = (*m_Accel);
	(*m_LastFrameAccel).addScaledVector((*m_ForceAccum), m_InverseMass);

	m_InverseInertiaTensorWorld->transform(*m_TorqueAccum, &angularAccel);

	//Update velocity and rotation
	m_Velocity->addScaledVector((*m_LastFrameAccel), timeStep);
	m_Rotation->addScaledVector(angularAccel, timeStep);

	//Drag
	(*m_Velocity) *= jfRealPow(m_LinearDamping, timeStep);
	(*m_Rotation) *= jfRealPow(m_AngularDamping, timeStep);

	//Adjust position and orientation
	m_Pos->addScaledVector((*m_Velocity), timeStep);
	m_Orientation->addScaledVector((*m_Rotation), timeStep);

	//Drag
	(*m_Velocity) *= jfRealPow(m_LinearDamping, timeStep);
	(*m_Rotation) *= jfRealPow(m_AngularDamping, timeStep);

	calculateDerivedData();

	clearAccumulators();

    // Update the kinetic energy store, and possibly put the body to
    // sleep.
    if (m_CanSleep) {
        jfReal currentMotion = m_Velocity->dotProduct(*m_Velocity) +
                                m_Rotation->dotProduct(*m_Rotation);

        jfReal bias = jfRealPow(0.05, timeStep);
        m_Motion = bias*m_Motion + (1-bias)*currentMotion;

        if (m_Motion < SleepEpsilon)
        {
            setAwake(false);
        }
        else if (m_Motion > (10 * SleepEpsilon))
        {
            //Limit Motion
            m_Motion = (10 * SleepEpsilon);
        }
    }
}
コード例 #4
0
ファイル: task.cpp プロジェクト: wcremeika/thesis
void Task::cycleStatus(bool reverse)
{
    if (awake==Morning)
    {
	setAwake (WideAwake);
	return;
    }
    int i=status;
    reverse ?  i-- : i++;

    if (i<0) i=2;
    if (i>2) i=0;

    setStatus ( (Task::Status) i );

    if (branch) branch->updateTaskFlag ();
}
コード例 #5
0
int PropertiesManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 3)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 3;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = intermittentPeriod(); break;
        case 1: *reinterpret_cast< bool*>(_v) = autoStart(); break;
        case 2: *reinterpret_cast< bool*>(_v) = awake(); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setIntermittentPeriod(*reinterpret_cast< int*>(_v)); break;
        case 1: setAutoStart(*reinterpret_cast< bool*>(_v)); break;
        case 2: setAwake(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #6
0
ファイル: task.cpp プロジェクト: wcremeika/thesis
void Task::recalcAwake()
{
    if ( getDaysSleep() <= 0 && awake==Task::Sleeping)
	setAwake(Task::Morning);
}