Skip to content

Commit

Permalink
Merge 027c5a7 into f80f9c3
Browse files Browse the repository at this point in the history
  • Loading branch information
iche033 authored Feb 24, 2023
2 parents f80f9c3 + 027c5a7 commit ebd366e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ogre/src/OgreNode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <gz/common/Console.hh>

#include "gz/rendering/ogre/OgreCamera.hh"
#include "gz/rendering/ogre/OgreNode.hh"
#include "gz/rendering/ogre/OgreConversions.hh"
#include "gz/rendering/ogre/OgreIncludes.hh"
Expand Down Expand Up @@ -99,6 +100,16 @@ void OgreNode::SetRawLocalPosition(const math::Vector3d &_position)
if (nullptr == this->ogreNode)
return;

// ogre crashes in the shadow (PSSM) render pass with an
// Ogre::AxisAlignedBox::setExtents assertion error when the camera scene node
// position has large values. Added a workaround that places a max limit on
// the length of the position vector.
if (dynamic_cast<OgreCamera *>(this) && _position.Length() > 1e8)
{
ignerr << "Unable to set camera node position to a distance larger than "
<< "1e8 from origin" << std::endl;
return;
}
this->ogreNode->setPosition(OgreConversions::Convert(_position));
}

Expand Down
11 changes: 11 additions & 0 deletions ogre2/src/Ogre2Node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <gz/common/Console.hh>

#include "gz/rendering/ogre2/Ogre2Camera.hh"
#include "gz/rendering/ogre2/Ogre2Node.hh"
#include "gz/rendering/ogre2/Ogre2Conversions.hh"
#include "gz/rendering/ogre2/Ogre2Scene.hh"
Expand Down Expand Up @@ -109,6 +110,16 @@ void Ogre2Node::SetRawLocalPosition(const math::Vector3d &_position)
if (nullptr == this->ogreNode)
return;

// ogre crashes in the compositor shadow pass with an
// Ogre::AxisAlignedBox::setExtents assertion error when the camera scene node
// position has large values. Added a workaround that places a max limit on
// the length of the position vector.
if (dynamic_cast<Ogre2Camera *>(this) && _position.Length() > 1e10)
{
ignerr << "Unable to set camera node position to a distance larger than "
<< "1e10 from origin" << std::endl;
return;
}
this->ogreNode->setPosition(Ogre2Conversions::Convert(_position));
}

Expand Down

0 comments on commit ebd366e

Please sign in to comment.