X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fvertexformat.cpp;fp=source%2Fvertexformat.cpp;h=02410857bff6e8873570055499b4be71800a6c02;hp=e3f8bf97a5c49e5fe245975d09308de0e57295c9;hb=e06ee659c66c92065dbd767475ac9bf9f0f14846;hpb=b392a49f4079cd3db859f9eaa51f651115a09c1d diff --git a/source/vertexformat.cpp b/source/vertexformat.cpp index e3f8bf97..02410857 100644 --- a/source/vertexformat.cpp +++ b/source/vertexformat.cpp @@ -54,7 +54,7 @@ unsigned VertexFormat::stride() const { unsigned s = 0; for(const unsigned char *i=begin(); i!=end(); ++i) - s += (*i&3)+1; + s += get_component_size(*i); return s; } @@ -63,20 +63,20 @@ int VertexFormat::offset(VertexComponent comp, unsigned index) const if((comp0) || (comp=8) || index>=53) throw out_of_range("VertexFormat::offset"); - unsigned type = (comp>>2)+index; - unsigned size = comp&3; + unsigned type = get_component_type(comp)+index; + unsigned size = get_component_size(comp); unsigned offs = 0; for(const unsigned char *i=begin(); i!=end(); ++i) { - if(static_cast(*i>>2)==type) + if(get_component_type(*i)==type) { - if((*i&3)>=size) + if(get_component_size(*i)>=size) return offs; else return -1; } else - offs += (*i&3)+1; + offs += get_component_size(*i); } return -1;