Skip to content

Commit

Permalink
early out, check valid manual obj
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed Nov 5, 2024
1 parent 197b26a commit d54d604
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ogre/src/OgreWireBox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ void OgreWireBox::Create()
this->scene->OgreSceneManager()->createManualObject(this->name);
}

if (this->box == math::AxisAlignedBox())
return;

this->dataPtr->manualObject->clear();
this->dataPtr->manualObject->setCastShadows(false);

Expand All @@ -93,9 +96,6 @@ void OgreWireBox::Create()
this->dataPtr->manualObject->begin(materialName,
Ogre::RenderOperation::OT_LINE_LIST);

if (this->box == math::AxisAlignedBox())
return;

gz::math::Vector3d max = this->box.Max();
gz::math::Vector3d min = this->box.Min();

Expand Down Expand Up @@ -172,6 +172,10 @@ void OgreWireBox::SetMaterial(MaterialPtr _material, bool _unique)
//////////////////////////////////////////////////
void OgreWireBox::SetMaterialImpl(OgreMaterialPtr _material)
{
if (!this->dataPtr->manualObject ||
this->dataPtr->manualObject->getNumSections() == 0u)
return;

std::string materialName = _material->Name();
Ogre::MaterialPtr ogreMaterial = _material->Material();
this->dataPtr->manualObject->setMaterialName(0, materialName);
Expand Down

0 comments on commit d54d604

Please sign in to comment.