]> git.tdb.fi Git - libs/gl.git/blobdiff - source/builders/vertexarraybuilder.cpp
Rename VertexComponent to VertexAttribute
[libs/gl.git] / source / builders / vertexarraybuilder.cpp
index ddec548f6d1bc8868a55e93155226a1f5efd91d6..7bc31b22f9d50e3b11c2a4dbce22c9b4dfb0cfee 100644 (file)
@@ -12,24 +12,24 @@ void VertexArrayBuilder::vertex_(const Vector4 &vtx)
 {
        float *ptr = array.append();
        const VertexFormat &format = array.get_format();
 {
        float *ptr = array.append();
        const VertexFormat &format = array.get_format();
-       for(const unsigned char *c=format.begin(); c!=format.end(); ++c)
+       for(const unsigned char *a=format.begin(); a!=format.end(); ++a)
        {
        {
-               unsigned sz = get_component_size(*c);
-               unsigned t = get_component_type(*c);
-               if(t>=attr.size())
+               unsigned sem = get_attribute_semantic(*a);
+               unsigned sz = get_attribute_size(*a);
+               if(sem>=attr.size())
                        ptr += sz;
                        ptr += sz;
-               else if(*c==COLOR4_UBYTE)
+               else if(*a==COLOR4_UBYTE)
                {
                        union { unsigned char c[4]; float f; } u;
                {
                        union { unsigned char c[4]; float f; } u;
-                       u.c[0] = static_cast<unsigned char>(attr[t].x*255);
-                       u.c[1] = static_cast<unsigned char>(attr[t].y*255);
-                       u.c[2] = static_cast<unsigned char>(attr[t].z*255);
-                       u.c[3] = static_cast<unsigned char>(attr[t].w*255);
+                       u.c[0] = static_cast<unsigned char>(attr[sem].x*255);
+                       u.c[1] = static_cast<unsigned char>(attr[sem].y*255);
+                       u.c[2] = static_cast<unsigned char>(attr[sem].z*255);
+                       u.c[3] = static_cast<unsigned char>(attr[sem].w*255);
                        *ptr++ = u.f;
                }
                else
                {
                        *ptr++ = u.f;
                }
                else
                {
-                       const Vector4 &v = (t==0 ? vtx : attr[t]);
+                       const Vector4 &v = (sem==0 ? vtx : attr[sem]);
                        *ptr++ = v.x;
                        if(sz>=2) *ptr++ = v.y;
                        if(sz>=3) *ptr++ = v.z;
                        *ptr++ = v.x;
                        if(sz>=2) *ptr++ = v.y;
                        if(sz>=3) *ptr++ = v.z;