diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-05-17 05:22:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-05-17 05:36:02 +0300 |
commit | 5bfeaf6cc183549e4051273841a3e98b7d85924f (patch) | |
tree | c9e7ea83a8050a4d7cf644ddc9e54c99476d830b /source/blender/draw/intern/draw_cache_impl_lattice.c | |
parent | 3d6361aa9c8d3d21dca91130a7249d3892b68bc0 (diff) |
Cleanup: group VBO attributes in a struct
Some names are a bit arbitrary,
this makes it clear which names are VBO attributes.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_lattice.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_lattice.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_lattice.c b/source/blender/draw/intern/draw_cache_impl_lattice.c index 444b4e641f6..e5d8a6c9301 100644 --- a/source/blender/draw/intern/draw_cache_impl_lattice.c +++ b/source/blender/draw/intern/draw_cache_impl_lattice.c @@ -347,10 +347,10 @@ static VertexBuffer *lattice_batch_cache_get_pos(LatticeRenderData *rdata, Latti if (cache->pos == NULL) { static VertexFormat format = { 0 }; - static unsigned pos_id; + static struct { uint pos; } attr_id; if (format.attrib_ct == 0) { /* initialize vertex format */ - pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); } const int vert_len = lattice_render_data_verts_len_get(rdata); @@ -359,7 +359,7 @@ static VertexBuffer *lattice_batch_cache_get_pos(LatticeRenderData *rdata, Latti VertexBuffer_allocate_data(cache->pos, vert_len); for (int i = 0; i < vert_len; ++i) { const BPoint *bp = lattice_render_data_vert_bpoint(rdata, i); - VertexBuffer_set_attrib(cache->pos, pos_id, i, bp->vec); + VertexBuffer_set_attrib(cache->pos, attr_id.pos, i, bp->vec); } } @@ -432,11 +432,11 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt) if (cache->overlay_verts == NULL) { static VertexFormat format = { 0 }; - static unsigned pos_id, data_id; + static struct { uint pos, data; } attr_id; if (format.attrib_ct == 0) { /* initialize vertex format */ - pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); - data_id = VertexFormat_add_attrib(&format, "data", COMP_U8, 1, KEEP_INT); + attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT); + attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_U8, 1, KEEP_INT); } const int vert_len = lattice_render_data_verts_len_get(rdata); @@ -456,8 +456,8 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt) } } - VertexBuffer_set_attrib(vbo, pos_id, i, bp->vec); - VertexBuffer_set_attrib(vbo, data_id, i, &vflag); + VertexBuffer_set_attrib(vbo, attr_id.pos, i, bp->vec); + VertexBuffer_set_attrib(vbo, attr_id.data, i, &vflag); } cache->overlay_verts = Batch_create(PRIM_POINTS, vbo, NULL); |