From: Mikko Rasa Date: Mon, 13 Sep 2021 17:03:12 +0000 (+0300) Subject: Tweak the comma operator between VertexAttribute and unsigned X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=a04e4054b3001d24a540a0e7b088d270f3e07c07 Tweak the comma operator between VertexAttribute and unsigned It now returns VertexAttribute instead of VertexFormat, avoiding the need to call make_indexed_attribute in some cases. --- diff --git a/source/core/vertexformat.h b/source/core/vertexformat.h index c7a2fcf1..e3c12050 100644 --- a/source/core/vertexformat.h +++ b/source/core/vertexformat.h @@ -77,11 +77,11 @@ public: inline VertexFormat operator,(VertexAttribute a1, VertexAttribute a2) { return (VertexFormat(a1), a2); } -inline VertexFormat operator,(VertexAttribute a, unsigned i) -{ return (VertexFormat(a), i); } - VertexAttribute make_indexed_attribute(VertexAttribute, unsigned); +inline VertexAttribute operator,(VertexAttribute a, unsigned i) +{ return make_indexed_attribute(a, i); } + DEPRECATED inline VertexAttribute make_indexed_component(VertexAttribute a, unsigned i) { return make_indexed_attribute(a, i); } diff --git a/source/render/instancearray.cpp b/source/render/instancearray.cpp index 039a50ec..42797612 100644 --- a/source/render/instancearray.cpp +++ b/source/render/instancearray.cpp @@ -46,7 +46,7 @@ InstanceArray::InstanceArray(const Object &o): { instance_data = new VertexArray((RAW_ATTRIB4,matrix_location, RAW_ATTRIB4,matrix_location+1, RAW_ATTRIB4,matrix_location+2)); const VertexFormat &fmt = instance_data->get_format(); - matrix_offset = fmt.offset(make_indexed_attribute(RAW_ATTRIB4, matrix_location)); + matrix_offset = fmt.offset((RAW_ATTRIB4,matrix_location)); instance_buffer = new Buffer; instance_data->use_buffer(instance_buffer);