mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 13:41:32 +00:00
add settings for viewing distance and fog
This commit is contained in:
parent
e5cc9adbb0
commit
fd662f937a
3 changed files with 19 additions and 11 deletions
|
@ -94,7 +94,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
|
||||||
extents *= insert->getScale();
|
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 < Settings::Manager::getInt("small object size", "Objects")) && Settings::Manager::getBool("limit small object distance", "Objects");
|
bool small = (size < Settings::Manager::getInt("small object size", "View distance")) && Settings::Manager::getBool("limit small object distance", "Objects");
|
||||||
|
|
||||||
// do not fade out doors. that will cause holes and look stupid
|
// do not fade out doors. that will cause holes and look stupid
|
||||||
if (ptr.getTypeName().find("Door") != std::string::npos)
|
if (ptr.getTypeName().find("Door") != std::string::npos)
|
||||||
|
@ -116,7 +116,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
|
||||||
{
|
{
|
||||||
insert->attachObject(ent);
|
insert->attachObject(ent);
|
||||||
|
|
||||||
ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "Objects") : 0); /// \todo config value
|
ent->setRenderingDistance(small ? Settings::Manager::getInt("small object distance", "View distance") : 0); /// \todo config value
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
|
||||||
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
||||||
mStaticGeometrySmall[ptr.getCell()] = sg;
|
mStaticGeometrySmall[ptr.getCell()] = sg;
|
||||||
|
|
||||||
sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "Objects")); /// \todo config value
|
sg->setRenderingDistance(Settings::Manager::getInt("small object distance", "View distance")); /// \todo config value
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sg = mStaticGeometrySmall[ptr.getCell()];
|
sg = mStaticGeometrySmall[ptr.getCell()];
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
|
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include <components/esm/loadstat.hpp>
|
#include <components/esm/loadstat.hpp>
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
|
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
|
@ -273,18 +274,14 @@ void RenderingManager::configureFog(ESMS::CellStore<MWWorld::RefData> &mCell)
|
||||||
|
|
||||||
void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour)
|
void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour)
|
||||||
{
|
{
|
||||||
/// \todo make the viewing distance and fog start/end configurable
|
float max = Settings::Manager::getFloat("max viewing distance", "Viewing distance");
|
||||||
|
|
||||||
// right now we load 3x3 cells, so the maximum viewing distance we
|
float low = max / (density) * Settings::Manager::getFloat("fog start factor", "Viewing distance");
|
||||||
// can allow (to prevent objects suddenly popping up) equals:
|
float high = max / (density) * Settings::Manager::getFloat("fog end factor", "Viewing distance");
|
||||||
// 8192 * 0.69
|
|
||||||
// ^ cell size ^ minimum density value used (clear weather)
|
|
||||||
float low = 5652.48 / density / 2.f;
|
|
||||||
float high = 5652.48 / density;
|
|
||||||
|
|
||||||
mRendering.getScene()->setFog (FOG_LINEAR, colour, 0, low, high);
|
mRendering.getScene()->setFog (FOG_LINEAR, colour, 0, low, high);
|
||||||
|
|
||||||
mRendering.getCamera()->setFarClipDistance ( high );
|
mRendering.getCamera()->setFarClipDistance ( max / density );
|
||||||
mRendering.getViewport()->setBackgroundColour (colour);
|
mRendering.getViewport()->setBackgroundColour (colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ num lights = 8
|
||||||
# Use static geometry for static objects. Improves rendering speed.
|
# Use static geometry for static objects. Improves rendering speed.
|
||||||
use static geometry = true
|
use static geometry = true
|
||||||
|
|
||||||
|
[Viewing distance]
|
||||||
|
|
||||||
# Limit the rendering distance of small objects
|
# Limit the rendering distance of small objects
|
||||||
limit small object distance = false
|
limit small object distance = false
|
||||||
|
|
||||||
|
@ -18,6 +20,15 @@ small object size = 250
|
||||||
# Rendering distance for small objects
|
# Rendering distance for small objects
|
||||||
small object distance = 3500
|
small object distance = 3500
|
||||||
|
|
||||||
|
# Max viewing distance at clear weather conditions
|
||||||
|
max viewing distance = 5600
|
||||||
|
|
||||||
|
# Distance at which fog starts (proportional to viewing distance)
|
||||||
|
fog start factor = 0.5
|
||||||
|
|
||||||
|
# Distance at which fog ends (proportional to viewing distance)
|
||||||
|
fog end factor = 1.0
|
||||||
|
|
||||||
[Terrain]
|
[Terrain]
|
||||||
|
|
||||||
# Max. number of lights that affect the terrain. Setting to 1 will only reflect sunlight
|
# Max. number of lights that affect the terrain. Setting to 1 will only reflect sunlight
|
||||||
|
|
Loading…
Reference in a new issue