From e5cc9adbb02938809938f3ea8a0fe222372d82af Mon Sep 17 00:00:00 2001 From: scrawl Date: Mon, 2 Apr 2012 15:30:29 +0200 Subject: [PATCH] added settings for rendering distance of small objects --- apps/openmw/mwrender/objects.cpp | 12 +++++------- files/settings-default.cfg | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index eb79581aa..dd211f8e9 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -89,18 +89,16 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) NifOgre::NIFLoader::load(mesh); Ogre::Entity *ent = mRenderer.getScene()->createEntity(mesh); -/* + Ogre::Vector3 extents = ent->getBoundingBox().getSize(); extents *= insert->getScale(); -// float size = std::max(std::max(extents.x, extents.y), extents.z); + float size = std::max(std::max(extents.x, extents.y), extents.z); - bool small = (size < 250); /// \todo config value + bool small = (size < Settings::Manager::getInt("small object size", "Objects")) && Settings::Manager::getBool("limit small object distance", "Objects"); // do not fade out doors. that will cause holes and look stupid if (ptr.getTypeName().find("Door") != std::string::npos) small = false; -*/ - const bool small = false; if (mBounds.find(ptr.getCell()) == mBounds.end()) mBounds[ptr.getCell()] = Ogre::AxisAlignedBox::BOX_NULL; @@ -118,7 +116,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) { insert->attachObject(ent); - ent->setRenderingDistance(small ? 2500 : 0); /// \todo config value + ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Objects") : 0); /// \todo config value } else { @@ -132,7 +130,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID)); mStaticGeometrySmall[ptr.getCell()] = sg; - sg->setRenderingDistance(2500); /// \todo config value + sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Objects")); /// \todo config value } else sg = mStaticGeometrySmall[ptr.getCell()]; diff --git a/files/settings-default.cfg b/files/settings-default.cfg index bf471e111..1e8be450e 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -1,7 +1,24 @@ [Objects] + shaders = true + +# Max. number of lights that affect objects. Setting to 1 will only reflect sunlight +# Note: has no effect when shaders are turned off num lights = 8 + +# Use static geometry for static objects. Improves rendering speed. use static geometry = true +# Limit the rendering distance of small objects +limit small object distance = false + +# Size below which an object is considered as small +small object size = 250 + +# Rendering distance for small objects +small object distance = 3500 + [Terrain] + +# Max. number of lights that affect the terrain. Setting to 1 will only reflect sunlight num lights = 8