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

GeometryDataControlFileOBJ: flatten OBJ indirection into linear ArrayBuffer

parent 95626ed1
......@@ -263,15 +263,21 @@ bool GeometryDataControlFileOBJ::load(SharedGeometryData& geometry) const
fileStream.close();
// flatten interleavedDataVector -> data
uint_t totalIndices = indexVector.size();
float *data = new float[ totalIndices * components ];
for(uint_t ind = 0; ind < totalIndices; ++ind)
{
for(uint_t comp = 0; comp < components; ++comp)
{
data[ind * components + comp] = interleavedDataVector[indexVector[ind] * components + comp];
}
}
geometry->setSize( index * components * sizeof(float) );
float *data = new float[ index * components ];
std::memcpy( data, &interleavedDataVector[0], index * components * sizeof(float) );
geometry->setSize( totalIndices * components * sizeof(float) );
geometry->setData( (GLubyte*)data );
geometry->setStrideSize( components*sizeof(float) );
geometry->setStrideSize( components * sizeof(float) );
ArrayBuffer::Attribute apos = { "aPosition", GL_FLOAT, 4, 0, GL_FALSE };
geometry->mAttributes.push_back( apos );
......
Supports Markdown
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