mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 10:23:53 +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;
|
||||
};
|
||||
|
||||
// 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()
|
||||
{
|
||||
if (mViewMode == VM_FirstPerson)
|
||||
|
@ -657,6 +672,13 @@ void NpcAnimation::updateParts()
|
|||
|
||||
if (mAlpha != 1.f)
|
||||
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