From e354203c2110f70d2b7a831df959aa8b0f9387e1 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 15 Mar 2012 19:49:15 +0100 Subject: [PATCH] stars rotation --- apps/openmw/mwrender/sky.cpp | 9 ++++++++- apps/openmw/mwrender/sky.hpp | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 65d730df94..0b30cd45a4 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -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; } diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index c3ff00b509..22aaa96e79 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -166,7 +166,9 @@ namespace MWRender float mHour; int mDay; int mMonth; - + + float mHourDiff; + BillboardObject* mSun; BillboardObject* mSunGlare; Moon* mMasser;