From a049638e7f86e83a8db6e04aaa6db022da6f2d15 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 14 Jul 2013 14:54:40 +0200 Subject: [PATCH 1/3] Fixes character previews getting shadowed randomly --- apps/openmw/mwrender/characterpreview.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index e9ecedc55..c6e6e158e 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -44,9 +44,14 @@ namespace MWRender { mSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); - /// \todo Read the fallback values from INIImporter (Inventory:Directional*) + // This is a dummy light to turn off shadows without having to use a separate set of shaders Ogre::Light* l = mSceneMgr->createLight(); l->setType (Ogre::Light::LT_DIRECTIONAL); + l->setDiffuseColour (Ogre::ColourValue(0,0,0)); + + /// \todo Read the fallback values from INIImporter (Inventory:Directional*) + l = mSceneMgr->createLight(); + l->setType (Ogre::Light::LT_DIRECTIONAL); l->setDirection (Ogre::Vector3(0.3, -0.7, 0.3)); l->setDiffuseColour (Ogre::ColourValue(1,1,1)); From 61661c865336eedf814be19ef4983ffe55c26331 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 14 Jul 2013 14:55:07 +0200 Subject: [PATCH 2/3] Fix first person meshes casting shadows --- apps/openmw/mwrender/npcanimation.cpp | 4 +--- apps/openmw/mwrender/renderconst.hpp | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 92218a3f2..f2df5ccd5 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -374,14 +374,12 @@ void NpcAnimation::updateParts(bool forceupdate) NifOgre::ObjectList NpcAnimation::insertBoundedPart(const std::string &model, int group, const std::string &bonename) { NifOgre::ObjectList objects = NifOgre::Loader::createObjects(mSkelBase, bonename, mInsert, model); - setRenderProperties(objects, mVisibilityFlags, RQG_Main, RQG_Alpha); + setRenderProperties(objects, (mViewMode == VM_FirstPerson) ? RV_FirstPerson : mVisibilityFlags, RQG_Main, RQG_Alpha); for(size_t i = 0;i < objects.mEntities.size();i++) { Ogre::Entity *ent = objects.mEntities[i]; ent->getUserObjectBindings().setUserAny(Ogre::Any(group)); - if(mViewMode == VM_FirstPerson) - ent->setCastShadows(false); } for(size_t i = 0;i < objects.mParticles.size();i++) objects.mParticles[i]->getUserObjectBindings().setUserAny(Ogre::Any(group)); diff --git a/apps/openmw/mwrender/renderconst.hpp b/apps/openmw/mwrender/renderconst.hpp index 1d2cdf1ea..44599ebee 100644 --- a/apps/openmw/mwrender/renderconst.hpp +++ b/apps/openmw/mwrender/renderconst.hpp @@ -59,6 +59,9 @@ enum VisibilityFlags // overlays, we only want these on the main render target RV_Overlay = 1024, + // First person meshes do not cast shadows + RV_FirstPerson = 2048, + RV_Map = RV_Terrain + RV_Statics + RV_StaticsSmall + RV_Misc + RV_Water }; From fa5198d7b24cc2f444d5379f20ca9b7c2873658a Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 14 Jul 2013 14:59:24 +0200 Subject: [PATCH 3/3] Fix an assertion --- apps/openmw/mwrender/animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index a5ca5b81c..f958b8286 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -73,7 +73,7 @@ Animation::~Animation() void Animation::setObjectRoot(Ogre::SceneNode *node, const std::string &model, bool baseonly) { - OgreAssert(mAnimSources.size() != 0, "Setting object root while animation sources are set!"); + OgreAssert(mAnimSources.size() == 0, "Setting object root while animation sources are set!"); if(!mInsert) mInsert = node->createChildSceneNode();