|
|
|
|
@ -66,6 +66,11 @@ GL::Mesh compileInternal(const Trade::MeshData& meshData, GL::Buffer&& indices,
|
|
|
|
|
|
|
|
|
|
/* Vertex data */ |
|
|
|
|
GL::Buffer verticesRef = GL::Buffer::wrap(vertices.id(), GL::Buffer::TargetHint::Array); |
|
|
|
|
|
|
|
|
|
/* Ensure each known attribute gets bound only once. There's 16 generic
|
|
|
|
|
attribs at most. */ |
|
|
|
|
Math::BoolVector<16> boundAttributes; |
|
|
|
|
|
|
|
|
|
for(UnsignedInt i = 0; i != meshData.attributeCount(); ++i) { |
|
|
|
|
Containers::Optional<GL::DynamicAttribute> attribute; |
|
|
|
|
|
|
|
|
|
@ -131,6 +136,14 @@ GL::Mesh compileInternal(const Trade::MeshData& meshData, GL::Buffer&& indices,
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* Ensure each attribute gets bound only once -- so for example when
|
|
|
|
|
there are two texture coordinate sets, we don't bind them both to |
|
|
|
|
the same slot, effectively ignoring the first one */ |
|
|
|
|
/** @todo revisit when there are secondary generic texture coordinates */ |
|
|
|
|
if(boundAttributes[attribute->location()]) |
|
|
|
|
continue; |
|
|
|
|
boundAttributes.set(attribute->location(), true); |
|
|
|
|
|
|
|
|
|
/* For the first attribute move the buffer in, for all others use the
|
|
|
|
|
reference */ |
|
|
|
|
if(vertices.id()) mesh.addVertexBuffer(std::move(vertices), |
|
|
|
|
|