Closed adbrown85 closed 12 years ago
Maybe want to have BufferLayout be immutable, like this...
BufferLayout
+ BufferLayout(regions : range<BufferRegion>, interleaved : bool)
+ interleaved() : bool
+ names() : range<string>
+ offset(name : string) : GLuint
+ type(name : string) : GLenum
+ normalized(name : string) : bool
+ stride() : GLuint
If the interleaved argument to the constructor was false, BufferLayout would have to throw an exception if the counts of the regions weren't the same. Considering it would have to throw one for the same reason on the interleaved setter in the mutable version, there's not really a big different though.
Probably just implement it using std::vector first, then can investigate using boost::range later.
Since our wrapper for buffer objects will be very general and lightweight, as opposed to having specialized implementations for each use of a buffer, e.g. VertexBufferObject, we may want to have a utility to keep track of what's in a buffer. You would give it a number of regions, where a region is a essentially a name, data type, and count, and then it would compute the stride and offset of those regions for you. If the counts for all of the regions were the same, the layout could be set to interleaved, which would change the offsets.