mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 10:09:39 +00:00
Cleanup
Move static variable declaration out of the loop Remove redundant boolean argument from applyDrawableProperties() Improve HeightCullCallback class formatting
This commit is contained in:
parent
12833d66af
commit
1bf2ddac4d
3 changed files with 40 additions and 30 deletions
|
@ -1111,7 +1111,7 @@ namespace NifOsg
|
||||||
|
|
||||||
std::vector<const Nif::Property*> drawableProps;
|
std::vector<const Nif::Property*> drawableProps;
|
||||||
collectDrawableProperties(nifNode, drawableProps);
|
collectDrawableProperties(nifNode, drawableProps);
|
||||||
applyDrawableProperties(parentNode, drawableProps, composite, true, animflags, true);
|
applyDrawableProperties(parentNode, drawableProps, composite, true, animflags);
|
||||||
|
|
||||||
// particle system updater (after the emitters and affectors in the scene graph)
|
// particle system updater (after the emitters and affectors in the scene graph)
|
||||||
// I think for correct culling needs to be *before* the ParticleSystem, though osg examples do it the other way
|
// I think for correct culling needs to be *before* the ParticleSystem, though osg examples do it the other way
|
||||||
|
@ -1203,7 +1203,7 @@ namespace NifOsg
|
||||||
// above the actual renderable would be tedious.
|
// above the actual renderable would be tedious.
|
||||||
std::vector<const Nif::Property*> drawableProps;
|
std::vector<const Nif::Property*> drawableProps;
|
||||||
collectDrawableProperties(nifNode, drawableProps);
|
collectDrawableProperties(nifNode, drawableProps);
|
||||||
applyDrawableProperties(parentNode, drawableProps, composite, vertexColorsPresent, animflags, false);
|
applyDrawableProperties(parentNode, drawableProps, composite, vertexColorsPresent, animflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTriShape(const Nif::Node* nifNode, osg::Group* parentNode, SceneUtil::CompositeStateSetUpdater* composite, const std::vector<unsigned int>& boundTextures, int animflags)
|
void handleTriShape(const Nif::Node* nifNode, osg::Group* parentNode, SceneUtil::CompositeStateSetUpdater* composite, const std::vector<unsigned int>& boundTextures, int animflags)
|
||||||
|
@ -1755,7 +1755,7 @@ namespace NifOsg
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyDrawableProperties(osg::Node* node, const std::vector<const Nif::Property*>& properties, SceneUtil::CompositeStateSetUpdater* composite,
|
void applyDrawableProperties(osg::Node* node, const std::vector<const Nif::Property*>& properties, SceneUtil::CompositeStateSetUpdater* composite,
|
||||||
bool hasVertexColors, int animflags, bool particleMaterial)
|
bool hasVertexColors, int animflags)
|
||||||
{
|
{
|
||||||
osg::StateSet* stateset = node->getOrCreateStateSet();
|
osg::StateSet* stateset = node->getOrCreateStateSet();
|
||||||
|
|
||||||
|
|
|
@ -323,6 +323,7 @@ void updateWaterCullingView(HeightCullCallback* callback, ViewData* vd, osgUtil:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cv->pushCurrentMask();
|
cv->pushCurrentMask();
|
||||||
|
static bool debug = getenv("OPENMW_WATER_CULLING_DEBUG") != nullptr;
|
||||||
for (unsigned int i=0; i<vd->getNumEntries(); ++i)
|
for (unsigned int i=0; i<vd->getNumEntries(); ++i)
|
||||||
{
|
{
|
||||||
ViewData::Entry& entry = vd->getEntry(i);
|
ViewData::Entry& entry = vd->getEntry(i);
|
||||||
|
@ -337,7 +338,6 @@ void updateWaterCullingView(HeightCullCallback* callback, ViewData* vd, osgUtil:
|
||||||
continue;
|
continue;
|
||||||
lowZ = bb._min.z();
|
lowZ = bb._min.z();
|
||||||
|
|
||||||
static bool debug = getenv("OPENMW_WATER_CULLING_DEBUG") != nullptr;
|
|
||||||
if (!debug)
|
if (!debug)
|
||||||
break;
|
break;
|
||||||
osg::Box* b = new osg::Box;
|
osg::Box* b = new osg::Box;
|
||||||
|
|
|
@ -40,36 +40,46 @@ namespace Terrain
|
||||||
class ChunkManager;
|
class ChunkManager;
|
||||||
class CompositeMapRenderer;
|
class CompositeMapRenderer;
|
||||||
|
|
||||||
class HeightCullCallback : public osg::NodeCallback
|
class HeightCullCallback : public osg::NodeCallback
|
||||||
{
|
|
||||||
public:
|
|
||||||
HeightCullCallback() : mLowZ(-std::numeric_limits<float>::max()), mHighZ(std::numeric_limits<float>::max()), mMask(~0) {}
|
|
||||||
|
|
||||||
void setLowZ(float z)
|
|
||||||
{
|
{
|
||||||
mLowZ = z;
|
public:
|
||||||
}
|
void setLowZ(float z)
|
||||||
float getLowZ() const { return mLowZ; }
|
{
|
||||||
|
mLowZ = z;
|
||||||
|
}
|
||||||
|
float getLowZ() const
|
||||||
|
{
|
||||||
|
return mLowZ;
|
||||||
|
}
|
||||||
|
|
||||||
void setHighZ(float highZ)
|
void setHighZ(float highZ)
|
||||||
{
|
{
|
||||||
mHighZ = highZ;
|
mHighZ = highZ;
|
||||||
}
|
}
|
||||||
float getHighZ() const { return mHighZ; }
|
float getHighZ() const
|
||||||
|
{
|
||||||
|
return mHighZ;
|
||||||
|
}
|
||||||
|
|
||||||
void setCullMask(unsigned int mask) { mMask = mask; }
|
void setCullMask(unsigned int mask)
|
||||||
unsigned int getCullMask() const { return mMask; }
|
{
|
||||||
|
mMask = mask;
|
||||||
|
}
|
||||||
|
unsigned int getCullMask() const
|
||||||
|
{
|
||||||
|
return mMask;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
if (mLowZ <= mHighZ)
|
if (mLowZ <= mHighZ)
|
||||||
traverse(node, nv);
|
traverse(node, nv);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
float mLowZ;
|
float mLowZ{-std::numeric_limits<float>::max()};
|
||||||
float mHighZ;
|
float mHighZ{std::numeric_limits<float>::max()};
|
||||||
unsigned int mMask;
|
unsigned int mMask{~0u};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A View is a collection of rendering objects that are visible from a given camera/intersection.
|
* @brief A View is a collection of rendering objects that are visible from a given camera/intersection.
|
||||||
|
|
Loading…
Reference in a new issue