1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

stars rotation

This commit is contained in:
scrawl 2012-03-15 19:49:15 +01:00
parent e8eea03b4c
commit e354203c21
2 changed files with 11 additions and 2 deletions

View File

@ -59,7 +59,8 @@ void BillboardObject::setPosition(const Vector3& pPosition)
Vector3 BillboardObject::getPosition() const
{
return mNode->getPosition();
Vector3 p = mNode->_getDerivedPosition() - mNode->getParentSceneNode()->_getDerivedPosition();
return Vector3(p.x, -p.z, p.y);
}
void BillboardObject::setColour(const ColourValue& pColour)
@ -582,6 +583,9 @@ void SkyManager::update(float duration)
mSun->setVisible(mSunEnabled);
mMasser->setVisible(mMasserEnabled);
mSecunda->setVisible(mSecundaEnabled);
// rotate the whole sky by 360 degrees every 4 days
mRootNode->roll(Degree(mHourDiff*360/96.f));
}
void SkyManager::enable()
@ -759,6 +763,9 @@ void SkyManager::setSecundaFade(const float fade)
void SkyManager::setHour(double hour)
{
mHourDiff = mHour - hour;
if (mHourDiff > 0) mHourDiff -= 24;
mHour = hour;
}

View File

@ -166,7 +166,9 @@ namespace MWRender
float mHour;
int mDay;
int mMonth;
float mHourDiff;
BillboardObject* mSun;
BillboardObject* mSunGlare;
Moon* mMasser;