Commit 4ca2d2d3 authored by Janis Born's avatar Janis Born
Browse files

add loadArrayBufferFromATB function

parent b5f08a3f
......@@ -14,10 +14,14 @@
namespace ACGL{
namespace OpenGL{
//! Loads an array buffer from the given file (e.g. a *.opj file).
//! Loads an ArrayBuffer from the given file (e.g. a *.obj file).
//! Often not an ArrayBuffer but a complete VAO is needed, in that case,
//! see VertexArrayObjectLoadStore.hh !
SharedArrayBuffer loadArrayBuffer(const std::string& _filename);
//! Loads an ArrayBuffer from the given ATB (attribute) file.
//! An attribute name can be specified, otherwise it is guessed from the filename.
SharedArrayBuffer loadArrayBufferFromATB(const std::string& _filename, const std::string& _attributeName = "");
}
}
......@@ -16,18 +16,26 @@ namespace OpenGL{
SharedArrayBuffer loadArrayBuffer(const std::string &_filename)
{
SharedGeometryData data = loadGeometryData(_filename);
ACGL::OpenGL::SharedGeometryData data = loadGeometryData(_filename);
if(data)
{
SharedArrayBuffer ab(new ArrayBuffer);
for(ArrayBuffer::AttributeVec::const_iterator it = data->mAttributes.begin();
it != data->mAttributes.end();
++it)
{
ab->defineAttribute(*it);
}
ab->setStride(data->getStrideSize());
ab->setData(data->getSize(), data->getData());
ab->setGeometryData(data);
return ab;
}
else
{
return SharedArrayBuffer();
}
}
SharedArrayBuffer loadArrayBufferFromATB(const std::string& _filename, const std::string& _attributeName)
{
ACGL::OpenGL::SharedGeometryData data = loadGeometryDataFromATB(_filename, _attributeName);
if(data)
{
SharedArrayBuffer ab(new ArrayBuffer);
ab->setGeometryData(data);
return ab;
}
else
......
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