Skip to content

Commit

Permalink
Prevent console warnings when multiple texture coordinates are present
Browse files Browse the repository at this point in the history
Signed-off-by: Nate Koenig <[email protected]>
  • Loading branch information
Nate Koenig committed Apr 6, 2021
1 parent ccdf27e commit f5bd820
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions ogre/src/OgreMeshFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ bool OgreMeshFactory::LoadImpl(const MeshDescriptor &_desc)
// see `https://ogrecave.github.io/ogre/api/1.11/_animation.html` under,
// `Vertex buffer arrangements`.
currOffset = 0;
if (subMesh.TexCoordCount() > 0)
if (subMesh.TexCoordCountBySet(0) > 0)
{
vertexDecl->addElement(1, currOffset, Ogre::VET_FLOAT2,
Ogre::VES_TEXTURE_COORDINATES, 0);
Expand All @@ -297,7 +297,7 @@ bool OgreMeshFactory::LoadImpl(const MeshDescriptor &_desc)
Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY,
false);

if (subMesh.TexCoordCount() > 0)
if (subMesh.TexCoordCountBySet(0) > 0)
{
texBuf = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer(
vertexDecl->getVertexSize(1),
Expand All @@ -310,7 +310,7 @@ bool OgreMeshFactory::LoadImpl(const MeshDescriptor &_desc)
vertices = static_cast<float *>(vBuf->lock(
Ogre::HardwareBuffer::HBL_DISCARD));

if (subMesh.TexCoordCount() > 0)
if (subMesh.TexCoordCountBySet(0) > 0)
{
vertexData->vertexBufferBinding->setBinding(1, texBuf);
texMappings = static_cast<float *>(texBuf->lock(
Expand Down Expand Up @@ -378,10 +378,10 @@ bool OgreMeshFactory::LoadImpl(const MeshDescriptor &_desc)
*vertices++ = subMesh.Normal(j).Z();
}

if (subMesh.TexCoordCount() > 0)
if (subMesh.TexCoordCountBySet(0) > 0)
{
*texMappings++ = subMesh.TexCoord(j).X();
*texMappings++ = subMesh.TexCoord(j).Y();
*texMappings++ = subMesh.TexCoordBySet(j, 0).X();
*texMappings++ = subMesh.TexCoordBySet(j, 0).Y();
}
}

Expand Down
8 changes: 4 additions & 4 deletions ogre2/src/Ogre2MeshFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ bool Ogre2MeshFactory::LoadImpl(const MeshDescriptor &_desc)
// TODO(anyone): specular colors

// two dimensional texture coordinates
if (subMesh.TexCoordCount() > 0)
if (subMesh.TexCoordCountBySet(0) > 0)
{
vertexDecl->addElement(0, currOffset, Ogre::VET_FLOAT2,
Ogre::VES_TEXTURE_COORDINATES, 0);
Expand Down Expand Up @@ -382,10 +382,10 @@ bool Ogre2MeshFactory::LoadImpl(const MeshDescriptor &_desc)
*vertices++ = subMesh.Normal(j).Z();
}

if (subMesh.TexCoordCount() > 0)
if (subMesh.TexCoordCountBySet(0) > 0)
{
*vertices++ = subMesh.TexCoord(j).X();
*vertices++ = subMesh.TexCoord(j).Y();
*vertices++ = subMesh.TexCoordBySet(j, 0).X();
*vertices++ = subMesh.TexCoordBySet(j, 0).Y();
}
}

Expand Down

0 comments on commit f5bd820

Please sign in to comment.