From 56d8ca8434d00d9c887d798bc78c1939e32e0bfb Mon Sep 17 00:00:00 2001 From: Axujen Date: Mon, 13 May 2013 11:40:50 +0000 Subject: [PATCH 1/4] Add link to Development Environment Setup in the readme. Point people who need to build this from source in the right direction. --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index c033f95475..f8361780c4 100644 --- a/readme.txt +++ b/readme.txt @@ -31,7 +31,7 @@ Open DMG file, copy OpenMW folder anywhere, for example in /Applications BUILD FROM SOURCE -TODO add description here +https://wiki.openmw.org/index.php?title=Development_Environment_Setup THE DATA PATH From ac4fa1941dccef021b08387e2b67a201e842ae3e Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 13 May 2013 20:08:12 +0200 Subject: [PATCH 2/4] Fix the frame update not getting called on the first frame --- apps/openmw/engine.cpp | 4 ++++ apps/openmw/mwrender/occlusionquery.cpp | 9 ++++++++- apps/openmw/mwrender/occlusionquery.hpp | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 39e1137ca0..125ef88035 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -428,6 +428,10 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) MWBase::Environment::get().getWorld()->changeToInteriorCell (mCellName, pos); } + Ogre::FrameEvent event; + event.timeSinceLastEvent = 0; + event.timeSinceLastFrame = 0; + frameRenderingQueued(event); mOgre->getRoot()->addFrameListener (this); // scripts diff --git a/apps/openmw/mwrender/occlusionquery.cpp b/apps/openmw/mwrender/occlusionquery.cpp index 5a4790b971..477e382154 100644 --- a/apps/openmw/mwrender/occlusionquery.cpp +++ b/apps/openmw/mwrender/occlusionquery.cpp @@ -18,7 +18,8 @@ OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNod mSunTotalAreaQuery(0), mSunVisibleAreaQuery(0), mActiveQuery(0), mDoQuery(0), mSunVisibility(0), mWasVisible(false), - mActive(false) + mActive(false), + mFirstFrame(true) { mRendering = renderer; mSunNode = sunNode; @@ -147,6 +148,12 @@ void OcclusionQuery::renderQueueEnded(uint8 queueGroupId, const String& invocati void OcclusionQuery::update(float duration) { + if (mFirstFrame) + { + // GLHardwareOcclusionQuery::isStillOutstanding doesn't seem to like getting called when nothing has been rendered yet + mFirstFrame = false; + return; + } if (!mSupported) return; mWasVisible = false; diff --git a/apps/openmw/mwrender/occlusionquery.hpp b/apps/openmw/mwrender/occlusionquery.hpp index 615ada532a..983361c187 100644 --- a/apps/openmw/mwrender/occlusionquery.hpp +++ b/apps/openmw/mwrender/occlusionquery.hpp @@ -59,6 +59,7 @@ namespace MWRender bool mWasVisible; bool mActive; + bool mFirstFrame; bool mSupported; bool mDoQuery; From 9fa2dd527718a23d6dd2412e78d2c930f39588e6 Mon Sep 17 00:00:00 2001 From: Glorf Date: Tue, 14 May 2013 19:58:08 +0200 Subject: [PATCH 3/4] Playing with moons part 2 --- apps/openmw/mwworld/weather.cpp | 49 +++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 2605e4a333..8b3c5f6ffa 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -66,14 +66,14 @@ void WeatherManager::setFallbackWeather(Weather& weather,const std::string& name float WeatherManager::calculateHourFade (const std::string& moonName) const { float fadeOutStart=mFallback->getFallbackFloat("Moons_"+moonName+"_Fade_Out_Start"); + float fadeOutFinish=mFallback->getFallbackFloat("Moons_"+moonName+"_Fade_Out_Finish"); float fadeInStart=mFallback->getFallbackFloat("Moons_"+moonName+"_Fade_In_Start"); float fadeInFinish=mFallback->getFallbackFloat("Moons_"+moonName+"_Fade_In_Finish"); - float fadeOutFinish=mFallback->getFallbackFloat("Moons_"+moonName+"_Fade_Out_Finish"); if (mHour >= fadeOutStart && mHour <= fadeOutFinish) - return (1 / (mHour - fadeOutStart)); - else if (mHour >= fadeInStart && mHour <= fadeInFinish) - return (1 / (mHour - fadeInStart)); + return (1 - ((mHour - fadeOutStart) / (fadeOutFinish - fadeOutStart))); + if (mHour >= fadeInStart && mHour <= fadeInFinish) + return (1 - ((mHour - fadeInStart) / (fadeInFinish - fadeInStart))); else return 1; } @@ -82,9 +82,9 @@ float WeatherManager::calculateAngleFade (const std::string& moonName, float ang { float endAngle=mFallback->getFallbackFloat("Moons_"+moonName+"_Fade_End_Angle"); float startAngle=mFallback->getFallbackFloat("Moons_"+moonName+"_Fade_Start_Angle"); - if (angle >= endAngle && angle <= startAngle) - return ((angle - endAngle)/(startAngle-endAngle)); - else if (angle < endAngle) + if (angle <= startAngle && angle >= endAngle) + return (1 - ((angle - endAngle)/(startAngle-endAngle))); + else if (angle > startAngle) return 0.f; else return 1.f; @@ -439,29 +439,36 @@ void WeatherManager::update(float duration) height); mRendering->setSunDirection(final); - // moon calculations - float night; - if (mHour >= 14) - night = mHour - 14; - else if (mHour <= 10) - night = mHour + 10; + /* + * TODO: import separated fadeInStart/Finish, fadeOutStart/Finish + * for masser and secunda + */ + + float fadeOutFinish=mFallback->getFallbackFloat("Moons_Masser_Fade_Out_Finish"); + float fadeInStart=mFallback->getFallbackFloat("Moons_Masser_Fade_In_Start"); + + //moon calculations + float moonHeight; + if (mHour >= fadeInStart) + moonHeight = mHour - fadeInStart; + else if (mHour <= fadeOutFinish) + moonHeight = mHour + fadeOutFinish; else - night = 0; + moonHeight = 0; - night /= 20.f; + moonHeight /= (24.f - (fadeInStart - fadeOutFinish)); - if (night != 0) + if (moonHeight != 0) { - float moonHeight = 1 - std::abs((night - 0.5) * 2); - int facing = (mHour > 0.f && mHour< 12.f) ? 1 : -1; + int facing = (moonHeight <= 1) ? 1 : -1; Vector3 masser( - (1 - moonHeight) * facing, + (moonHeight - 1) * facing, (1 - moonHeight) * facing, moonHeight); Vector3 secunda( + (moonHeight - 1) * facing * 1.25, (1 - moonHeight) * facing * 0.8, - (1 - moonHeight) * facing * 1.25, moonHeight); mRendering->getSkyManager()->setMasserDirection(masser); @@ -469,7 +476,7 @@ void WeatherManager::update(float duration) mRendering->getSkyManager()->masserEnable(); mRendering->getSkyManager()->secundaEnable(); - float angle = moonHeight * 90.f; + float angle = (1-moonHeight) * 90.f * facing; float masserHourFade = calculateHourFade("Masser"); float secundaHourFade = calculateHourFade("Secunda"); float masserAngleFade = calculateAngleFade("Masser", angle); From 39c7bc8363c607da72bfb4c391e789197ab6eee3 Mon Sep 17 00:00:00 2001 From: Glorf Date: Tue, 14 May 2013 20:34:40 +0200 Subject: [PATCH 4/4] Corrected celestical object sizes --- apps/openmw/mwrender/sky.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 0b9c7e250d..2912672b5c 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -57,7 +57,7 @@ BillboardObject::BillboardObject( const String& textureName, mNode = rootNode->createChildSceneNode(); mNode->setPosition(finalPosition); mNode->attachObject(mEntity); - mNode->setScale(Ogre::Vector3(550.f*initialSize)); + mNode->setScale(Ogre::Vector3(450.f*initialSize)); mNode->setOrientation(Ogre::Vector3::UNIT_Z.getRotationTo(-position.normalisedCopy())); sh::Factory::getInstance().getMaterialInstance ("BillboardMaterial"+StringConverter::toString(bodyCount))->setListener(this); @@ -86,7 +86,7 @@ void BillboardObject::setVisible(const bool visible) void BillboardObject::setSize(const float size) { - mNode->setScale(550.f*size, 550.f*size, 550.f*size); + mNode->setScale(450.f*size, 450.f*size, 450.f*size); } void BillboardObject::setVisibility(const float visibility) @@ -267,11 +267,11 @@ void SkyManager::create() mLightning->setDiffuseColour (ColourValue(3,3,3)); const MWWorld::Fallback* fallback=MWBase::Environment::get().getWorld()->getFallback(); - mSecunda = new Moon("secunda_texture", /*0.5*/fallback->getFallbackFloat("Moons_Secunda_Size")/100, Vector3(-0.4, 0.4, 0.5), mRootNode, "openmw_moon"); + mSecunda = new Moon("secunda_texture", fallback->getFallbackFloat("Moons_Secunda_Size")/100, Vector3(-0.4, 0.4, 0.5), mRootNode, "openmw_moon"); mSecunda->setType(Moon::Type_Secunda); mSecunda->setRenderQueue(RQG_SkiesEarly+4); - mMasser = new Moon("masser_texture", /*0.75*/fallback->getFallbackFloat("Moons_Masser_Size")/100, Vector3(-0.4, 0.4, 0.5), mRootNode, "openmw_moon"); + mMasser = new Moon("masser_texture", fallback->getFallbackFloat("Moons_Masser_Size")/100, Vector3(-0.4, 0.4, 0.5), mRootNode, "openmw_moon"); mMasser->setRenderQueue(RQG_SkiesEarly+3); mMasser->setType(Moon::Type_Masser);