Skip to content

Commit

Permalink
add warning msg
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed Dec 18, 2020
1 parent 70813a2 commit bcdac31
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions graphics/src/SubMesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,16 @@ bool SubMesh::HasTexCoord(const unsigned int _index) const
{
if (this->dataPtr->texCoords.empty())
return false;

unsigned firstSetIndex = this->dataPtr->texCoords.begin()->first;

if (this->dataPtr->texCoords.size() > 1u)
{
ignwarn << "Multiple texture coordinate sets exist in submesh: "
<< this->dataPtr->name << ". Checking first set with index: "
<< firstSetIndex << std::endl;
}

return this->HasTexCoordBySet(_index, firstSetIndex);
}

Expand Down Expand Up @@ -287,6 +296,14 @@ ignition::math::Vector2d SubMesh::TexCoord(const unsigned int _index) const
return math::Vector2d::Zero;
}
unsigned firstSetIndex = this->dataPtr->texCoords.begin()->first;

if (this->dataPtr->texCoords.size() > 1u)
{
ignwarn << "Multiple texture coordinate sets exist in submesh: "
<< this->dataPtr->name << ". Checking first set with index: "
<< firstSetIndex << std::endl;
}

return this->TexCoordBySet(_index, firstSetIndex);
}

Expand Down Expand Up @@ -318,6 +335,14 @@ void SubMesh::SetTexCoord(const unsigned int _index,
unsigned firstSetIndex = 0u;
if (!this->dataPtr->texCoords.empty())
firstSetIndex = this->dataPtr->texCoords.begin()->first;

if (this->dataPtr->texCoords.size() > 1u)
{
ignwarn << "Multiple texture coordinate sets exist in submesh: "
<< this->dataPtr->name << ". Checking first set with index: "
<< firstSetIndex << std::endl;
}

this->SetTexCoordBySet(_index, _t, firstSetIndex);
}

Expand Down Expand Up @@ -447,6 +472,14 @@ unsigned int SubMesh::TexCoordCount() const
if (this->dataPtr->texCoords.empty())
return 0u;
unsigned firstSetIndex = this->dataPtr->texCoords.begin()->first;

if (this->dataPtr->texCoords.size() > 1u)
{
ignwarn << "Multiple texture coordinate sets exist in submesh: "
<< this->dataPtr->name << ". Checking first set with index: "
<< firstSetIndex << std::endl;
}

return this->TexCoordCountBySet(firstSetIndex);
}

Expand Down

0 comments on commit bcdac31

Please sign in to comment.