mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-02 07:15:34 +00:00
Prevent accidental culling of first person meshes
This commit is contained in:
parent
cc23a968d1
commit
c38bf6757a
1 changed files with 22 additions and 0 deletions
|
@ -369,6 +369,21 @@ private:
|
||||||
float mFov;
|
float mFov;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Disable culling for all child nodes
|
||||||
|
class DisableCullingVisitor : public osg::NodeVisitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DisableCullingVisitor() : NodeVisitor(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) {};
|
||||||
|
|
||||||
|
virtual ~DisableCullingVisitor() {};
|
||||||
|
|
||||||
|
virtual void apply(osg::Node &node) override
|
||||||
|
{
|
||||||
|
node.setCullingActive(false);
|
||||||
|
traverse(node);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
void NpcAnimation::setRenderBin()
|
void NpcAnimation::setRenderBin()
|
||||||
{
|
{
|
||||||
if (mViewMode == VM_FirstPerson)
|
if (mViewMode == VM_FirstPerson)
|
||||||
|
@ -657,6 +672,13 @@ void NpcAnimation::updateParts()
|
||||||
|
|
||||||
if (mAlpha != 1.f)
|
if (mAlpha != 1.f)
|
||||||
mResourceSystem->getSceneManager()->recreateShaders(mObjectRoot);
|
mResourceSystem->getSceneManager()->recreateShaders(mObjectRoot);
|
||||||
|
|
||||||
|
if (mViewMode == VM_FirstPerson)
|
||||||
|
{
|
||||||
|
// Shadows made first-person meshes get erroneously culled. This stops that.
|
||||||
|
DisableCullingVisitor disableCullingVisitor;
|
||||||
|
mObjectRoot->accept(disableCullingVisitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue