Commit 25a5a23b authored by Philip Trettner's avatar Philip Trettner

VAO::draw now also works with attribute buffers that have higher divisor...

VAO::draw now also works with attribute buffers that have higher divisor (though primcount has to be provided manually)
parent de07fd66
Pipeline #764 passed with stage
......@@ -241,7 +241,7 @@ public:
//! returns the number of vertices in one of the array buffers. NOTE: only useful if all array buffer have the same number of elements!
inline GLsizei getArrayVertexCount() const {
int firstAttribute = getFirstAttributeIndex(); // will be -1 if no attribte is set.
int firstAttribute = getFirstAttributeIndexWithDivisorZero(); // will be -1 if no attribte is set.
return ( (firstAttribute == -1)?0:mAttributes[firstAttribute].arrayBuffer->getElements());
}
......@@ -392,6 +392,19 @@ private:
return -1;
}
//! Returns the first attribute that has a non-NULL ArrayBuffer attached and divisor = 0
inline int_t getFirstAttributeIndexWithDivisorZero() const
{
// TODO: cache this value?
for (unsigned int index = 0; index < mAttributes.size(); ++index)
{
Attribute const& a = mAttributes[index];
if (a.arrayBuffer && a.arrayBuffer->getAttribute(a.attributeID).divisor == 0)
return index;
}
return -1;
}
// =================================================================================================== \/
// ============================================================================================ FIELDS \/
// =================================================================================================== \/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment