Commit b5f08a3f authored by Janis Born's avatar Janis Born
Browse files

add ArrayBuffer::setGeometryData

parent 99fcc3aa
......@@ -65,6 +65,9 @@
namespace ACGL{
namespace OpenGL{
class GeometryData;
ACGL_SMARTPOINTER_TYPEDEFS(GeometryData)
class ArrayBuffer : public Buffer
{
// ==================================================================================================== \/
......@@ -152,6 +155,9 @@ public:
//! Setting of the stride size explicitly is not needed if the attributes are defined correctly (with padding)
inline void setStride( GLsizei _stride ) { mStride = _stride; }
//! Sets all data (attributes, stride, size) to those specified in _geometryData. All previous data are overwritten.
void setGeometryData( SharedGeometryData _geometryData );
//! removes all attributes
inline void removeAttributes(void)
{
......
......@@ -5,6 +5,7 @@
**********************************************************************/
#include <ACGL/OpenGL/Objects/ArrayBuffer.hh>
#include <ACGL/OpenGL/Data/GeometryData.hh>
using namespace ACGL;
using namespace ACGL::OpenGL;
......@@ -114,3 +115,16 @@ int32_t ArrayBuffer::getAttributeIndexByName(const std::string& _nameInArray) co
return (int32_t) i;
return -1;
}
void ArrayBuffer::setGeometryData(SharedGeometryData _geometryData)
{
removeAttributes();
for(ArrayBuffer::AttributeVec::const_iterator it = _geometryData->mAttributes.begin();
it != _geometryData->mAttributes.end();
++it)
{
defineAttribute(*it);
}
setStride(_geometryData->getStrideSize());
setData(_geometryData->getSize(), _geometryData->getData());
}
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