Since a file's channels are already sorted alphabetically, it
would not be a lot of work to add a method to class ChannelList
that finds all channels whose names begin with with a given
prefix, e.g. "layername.":
void
ChannelList::channelsWithPrefix
(const char prefix[],
ConstIterator &first,
ConstIterator &last) const
{
first = last = _map.lower_bound (prefix);
int n = strlen (prefix);
while (last != end() && strncmp (last.name(), prefix, n) <= 0)
++last;
}
The function might be used like this:
ChannelList::ConstIterator first, last;
channels.channelsWithPrefix ("diffuse.", first, last);
for (ChannelList::constIterator i = first; i != last; ++i)
doSomethingWithChannel (i.channel());
In one single string attribute. I llike that idea. And this would
certainly save file space.
What about something like this :
"diffuse{R,G,B},ambiance{R,G,B},Z,tangent{X,Y},normal{X,Y}"
I would prefer:
"diffuse,ambiance,Z,tangent,normal"