mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 21:41:04 +00:00
batch debug colours
Signed-off-by: Bret Curtis <psi29a@gmail.com>
This commit is contained in:
parent
8a624e5a71
commit
00e56ae862
@ -6,6 +6,7 @@
|
||||
#include <osg/LOD>
|
||||
#include <osg/Switch>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Material>
|
||||
#include <osgUtil/IncrementalCompileOperation>
|
||||
|
||||
#include <components/esm/esmreader.hpp>
|
||||
@ -20,6 +21,7 @@
|
||||
#include <components/sceneutil/morphgeometry.hpp>
|
||||
#include <components/sceneutil/riggeometry.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <components/misc/rng.hpp>
|
||||
|
||||
#include "apps/openmw/mwworld/esmstore.hpp"
|
||||
#include "apps/openmw/mwbase/environment.hpp"
|
||||
@ -279,10 +281,31 @@ namespace MWRender
|
||||
StateSetCounter mGlobalStateSetCounter;
|
||||
};
|
||||
|
||||
class DebugVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
DebugVisitor() : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) {}
|
||||
virtual void apply(osg::Drawable& node)
|
||||
{
|
||||
osg::ref_ptr<osg::Material> m (new osg::Material);
|
||||
osg::Vec4f color(Misc::Rng::rollProbability(), Misc::Rng::rollProbability(), Misc::Rng::rollProbability(), 0.f);
|
||||
color.normalize();
|
||||
m->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.1f,0.1f,0.1f,1.f));
|
||||
m->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.1f,0.1f,0.1f,1.f));
|
||||
m->setColorMode(osg::Material::OFF);
|
||||
m->setEmission(osg::Material::FRONT_AND_BACK, osg::Vec4f(color));
|
||||
osg::ref_ptr<osg::StateSet> stateset = node.getStateSet() ? osg::clone(node.getStateSet(), osg::CopyOp::SHALLOW_COPY) : new osg::StateSet;
|
||||
stateset->setAttribute(m);
|
||||
stateset->addUniform(new osg::Uniform("colorMode", 0));
|
||||
node.setStateSet(stateset);
|
||||
}
|
||||
};
|
||||
|
||||
ObjectPaging::ObjectPaging(Resource::SceneManager* sceneManager)
|
||||
: GenericResourceManager<ChunkId>(nullptr)
|
||||
, mSceneManager(sceneManager)
|
||||
{
|
||||
mDebugBatches = Settings::Manager::getBool("object paging debug batches", "Terrain");
|
||||
mMergeFactor = Settings::Manager::getFloat("object paging merge factor", "Terrain");
|
||||
mMinSize = Settings::Manager::getFloat("object paging min size", "Terrain");
|
||||
mMinSizeMergeFactor = Settings::Manager::getFloat("object paging min size merge factor", "Terrain");
|
||||
@ -518,6 +541,12 @@ namespace MWRender
|
||||
stateToCompile._mode = osgUtil::GLObjectsVisitor::COMPILE_DISPLAY_LISTS;
|
||||
mergeGroup->accept(stateToCompile);
|
||||
}
|
||||
|
||||
if (mDebugBatches)
|
||||
{
|
||||
DebugVisitor dv;
|
||||
mergeGroup->accept(dv);
|
||||
}
|
||||
}
|
||||
|
||||
auto ico = mSceneManager->getIncrementalCompileOperation();
|
||||
|
@ -40,6 +40,7 @@ namespace MWRender
|
||||
|
||||
private:
|
||||
Resource::SceneManager* mSceneManager;
|
||||
bool mDebugBatches;
|
||||
float mMergeFactor;
|
||||
float mMinSize;
|
||||
float mMinSizeMergeFactor;
|
||||
|
@ -109,7 +109,7 @@ max composite geometry size = 4.0
|
||||
# Load far objects on terrain
|
||||
object paging = true
|
||||
|
||||
# Affects the likelyhood of objects being merged. A higher value means merging is more likely and improves FPS at the cost of memory.
|
||||
# Affects the likelyhood of objects being merged. A higher value means merging is more likely and may improve FPS at the cost of memory.
|
||||
object paging merge factor = 1500
|
||||
|
||||
# Cull objects smaller than this size divided by distance
|
||||
@ -121,6 +121,9 @@ object paging min size merge factor = 0.6
|
||||
# Controls how inexpensive an object needs to be to utilize 'min size merge factor'.
|
||||
object paging min size cost multiplier = 4
|
||||
|
||||
# Assign a random color to merged batches.
|
||||
object paging debug batches = false
|
||||
|
||||
[Fog]
|
||||
|
||||
# If true, use extended fog parameters for distant terrain not controlled by
|
||||
|
Loading…
x
Reference in New Issue
Block a user