1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-02 23:39:41 +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
apps/openmw/mwrender

View file

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

View file

@ -167,6 +167,8 @@ namespace MWRender
int mDay; int mDay;
int mMonth; int mMonth;
float mHourDiff;
BillboardObject* mSun; BillboardObject* mSun;
BillboardObject* mSunGlare; BillboardObject* mSunGlare;
Moon* mMasser; Moon* mMasser;