X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fvertexsetup.cpp;h=0971aed1c62f08c8c2823e873bcf86ce5ba15ba4;hb=a4d83d3748cdde8cf30683d36a040d3dfacfd693;hp=75d3ad8bc11017966d249adbe4762e2b235cab0f;hpb=3a1b9cbe2441ae670a97541dc8ccb0a2860c8302;p=libs%2Fgl.git diff --git a/source/core/vertexsetup.cpp b/source/core/vertexsetup.cpp index 75d3ad8b..0971aed1 100644 --- a/source/core/vertexsetup.cpp +++ b/source/core/vertexsetup.cpp @@ -107,8 +107,8 @@ bool VertexSetup::verify_format(const VertexFormat &fmt) unsigned max_attribs = Limits::get_global().max_vertex_attributes; - for(const uint16_t *a=fmt.begin(); a!=fmt.end(); ++a) - if(get_attribute_semantic(*a)>=max_attribs) + for(VertexAttribute a: fmt) + if(get_attribute_semantic(a)>=max_attribs) return false; return true; @@ -117,8 +117,8 @@ bool VertexSetup::verify_format(const VertexFormat &fmt) void VertexSetup::require_format(const VertexFormat &fmt) { bool has_int = false; - for(const uint16_t *a=fmt.begin(); a!=fmt.end(); ++a) - has_int = has_int | is_integer_attribute(*a); + for(VertexAttribute a: fmt) + has_int = has_int | is_integer_attribute(a); if(has_int) static Require _req(EXT_gpu_shader4); @@ -162,12 +162,12 @@ void VertexSetup::update_vertex_array(const VertexArray &array, unsigned binding } unsigned offset = 0; - for(const uint16_t *a=fmt.begin(); a!=fmt.end(); ++a) + for(VertexAttribute a: fmt) { - unsigned sem = get_attribute_semantic(*a); - bool integer = is_integer_attribute(*a); - GLenum type = get_gl_type(get_attribute_source_type(*a)); - unsigned cc = get_attribute_component_count(*a); + unsigned sem = get_attribute_semantic(a); + bool integer = is_integer_attribute(a); + GLenum type = get_gl_type(get_attribute_source_type(a)); + unsigned cc = get_attribute_component_count(a); if(direct) { if(integer) @@ -187,7 +187,7 @@ void VertexSetup::update_vertex_array(const VertexArray &array, unsigned binding glVertexAttribDivisor(sem, divisor); glEnableVertexAttribArray(sem); } - offset += get_attribute_size(*a); + offset += get_attribute_size(a); } if(!direct) @@ -207,15 +207,15 @@ void VertexSetup::unload() glBindVertexArray(id); glBindBuffer(GL_ARRAY_BUFFER, 0); - for(const uint16_t *a=vertex_format.begin(); a!=vertex_format.end(); ++a) + for(VertexAttribute a: vertex_format) { - unsigned sem = get_attribute_semantic(*a); + unsigned sem = get_attribute_semantic(a); glDisableVertexAttribArray(sem); glVertexAttribPointer(sem, 1, GL_FLOAT, false, 0, 0); } - for(const uint16_t *a=inst_format.begin(); a!=inst_format.end(); ++a) + for(VertexAttribute a: inst_format) { - unsigned sem = get_attribute_semantic(*a); + unsigned sem = get_attribute_semantic(a); glDisableVertexAttribArray(sem); glVertexAttribPointer(sem, 1, GL_FLOAT, false, 0, 0); }