Skip to content

Commit

Permalink
MeshTools: handle the ObjectId attribute in compile().
Browse files Browse the repository at this point in the history
And that's the last warning fixed.
  • Loading branch information
mosra committed Mar 30, 2020
1 parent 0252552 commit ea3bcb6
Show file tree
Hide file tree
Showing 2 changed files with 302 additions and 60 deletions.
20 changes: 15 additions & 5 deletions src/Magnum/MeshTools/Compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,24 @@ GL::Mesh compileInternal(const Trade::MeshData& meshData, GL::Buffer&& indices,
case Trade::MeshAttribute::Normal:
attribute.emplace(Shaders::Generic3D::Normal{}, format);
break;

/* So it doesn't yell that we didn't handle a known attribute */
case Trade::MeshAttribute::Custom: break; /* LCOV_EXCL_LINE */
#ifndef MAGNUM_TARGET_GLES2
case Trade::MeshAttribute::ObjectId:
attribute.emplace(Shaders::Generic3D::ObjectId{}, format);
break;
#endif

/* To avoid the compiler warning that we didn't handle an enum
value. For these a runtime warning is printed below. */
#ifdef MAGNUM_TARGET_GLES2
case Trade::MeshAttribute::ObjectId:
#endif
case Trade::MeshAttribute::Custom:
break; /* LCOV_EXCL_LINE */
}

if(!attribute) {
if(!(flags & CompileFlag::NoWarnOnCustomAttributes))
Warning{} << "MeshTools::compile(): ignoring unknown attribute" << meshData.attributeName(i);
if(!Trade::isMeshAttributeCustom(meshData.attributeName(i)) || !(flags & CompileFlag::NoWarnOnCustomAttributes))
Warning{} << "MeshTools::compile(): ignoring unknown/unsupported attribute" << meshData.attributeName(i);
continue;
}

Expand Down
Loading

0 comments on commit ea3bcb6

Please sign in to comment.