diff options
author | Mike Erwin <significant.bit@gmail.com> | 2017-04-05 03:45:23 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2017-04-06 08:18:12 +0300 |
commit | c2f5cd8f6454bf8256a39a5fc9cb075311e25c58 (patch) | |
tree | c0c9f803f810c2be81c9b302d814ac4989a559ed | |
parent | 957b408458140d1cfc72395d62189918bac5b5c7 (diff) |
Gawain: add VertexBuffer prefix to functions
See intern/gawain for the API change. Other files are updated to use the new names.
-rw-r--r-- | intern/gawain/gawain/vertex_buffer.h | 6 | ||||
-rw-r--r-- | intern/gawain/src/vertex_buffer.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_render.c | 64 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 242 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 28 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 32 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 30 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_compositing.c | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 6 |
12 files changed, 216 insertions, 214 deletions
diff --git a/intern/gawain/gawain/vertex_buffer.h b/intern/gawain/gawain/vertex_buffer.h index 6a72cfe6ff3..687f15e9e98 100644 --- a/intern/gawain/gawain/vertex_buffer.h +++ b/intern/gawain/gawain/vertex_buffer.h @@ -46,9 +46,9 @@ void VertexBuffer_resize_data(VertexBuffer*, unsigned v_ct); // to the vertex attribute's type and component count. They're in control of both, so this // should not be a problem. -void setAttrib(VertexBuffer*, unsigned a_idx, unsigned v_idx, const void* data); -void fillAttrib(VertexBuffer*, unsigned a_idx, const void* data); // tightly packed, non interleaved input data -void fillAttribStride(VertexBuffer*, unsigned a_idx, unsigned stride, const void* data); +void VertexBuffer_set_attrib(VertexBuffer*, unsigned a_idx, unsigned v_idx, const void* data); +void VertexBuffer_fill_attrib(VertexBuffer*, unsigned a_idx, const void* data); // tightly packed, non interleaved input data +void VertexBuffer_fill_attrib_stride(VertexBuffer*, unsigned a_idx, unsigned stride, const void* data); // TODO: decide whether to keep the functions below // doesn't immediate mode satisfy these needs? diff --git a/intern/gawain/src/vertex_buffer.c b/intern/gawain/src/vertex_buffer.c index 827703403e3..ab488a07bed 100644 --- a/intern/gawain/src/vertex_buffer.c +++ b/intern/gawain/src/vertex_buffer.c @@ -92,7 +92,7 @@ void VertexBuffer_resize_data(VertexBuffer* verts, unsigned v_ct) // extra space will be reclaimed, and never sent to VRAM (see VertexBuffer_prime) } -void setAttrib(VertexBuffer* verts, unsigned a_idx, unsigned v_idx, const void* data) +void VertexBuffer_set_attrib(VertexBuffer* verts, unsigned a_idx, unsigned v_idx, const void* data) { const VertexFormat* format = &verts->format; const Attrib* a = format->attribs + a_idx; @@ -106,7 +106,7 @@ void setAttrib(VertexBuffer* verts, unsigned a_idx, unsigned v_idx, const void* memcpy((GLubyte*)verts->data + a->offset + v_idx * format->stride, data, a->sz); } -void fillAttrib(VertexBuffer* verts, unsigned a_idx, const void* data) +void VertexBuffer_fill_attrib(VertexBuffer* verts, unsigned a_idx, const void* data) { const VertexFormat* format = &verts->format; const Attrib* a = format->attribs + a_idx; @@ -117,10 +117,10 @@ void fillAttrib(VertexBuffer* verts, unsigned a_idx, const void* data) const unsigned stride = a->sz; // tightly packed input data - fillAttribStride(verts, a_idx, stride, data); + VertexBuffer_fill_attrib_stride(verts, a_idx, stride, data); } -void fillAttribStride(VertexBuffer* verts, unsigned a_idx, unsigned stride, const void* data) +void VertexBuffer_fill_attrib_stride(VertexBuffer* verts, unsigned a_idx, unsigned stride, const void* data) { const VertexFormat* format = &verts->format; const Attrib* a = format->attribs + a_idx; diff --git a/source/blender/blenkernel/intern/mesh_render.c b/source/blender/blenkernel/intern/mesh_render.c index dbe99acc10b..ecd2c6ea28e 100644 --- a/source/blender/blenkernel/intern/mesh_render.c +++ b/source/blender/blenkernel/intern/mesh_render.c @@ -676,22 +676,22 @@ static void add_overlay_tri( unsigned char fflag = mesh_render_data_looptri_flag(mrdata, f); unsigned char vflag = mesh_render_data_vertex_flag(mrdata, v1); eflag[0] = fflag | vflag; - setAttrib(vbo, pos_id, base_vert_idx + 0, pos); - setAttrib(vbo, edgeMod_id, base_vert_idx + 0, eflag); + VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 0, pos); + VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 0, eflag); pos = mesh_render_data_vert_co(mrdata, v2); eflag = mesh_render_data_edge_flag(mrdata, v1, v3, -1); vflag = mesh_render_data_vertex_flag(mrdata, v2); eflag[0] = fflag | vflag; - setAttrib(vbo, pos_id, base_vert_idx + 1, pos); - setAttrib(vbo, edgeMod_id, base_vert_idx + 1, eflag); + VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 1, pos); + VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 1, eflag); pos = mesh_render_data_vert_co(mrdata, v3); eflag = mesh_render_data_edge_flag(mrdata, v1, v2, -1); vflag = mesh_render_data_vertex_flag(mrdata, v3); eflag[0] = fflag | vflag; - setAttrib(vbo, pos_id, base_vert_idx + 2, pos); - setAttrib(vbo, edgeMod_id, base_vert_idx + 2, eflag); + VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 2, pos); + VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 2, eflag); } static void add_overlay_loose_edge( @@ -701,13 +701,13 @@ static void add_overlay_loose_edge( unsigned char *eflag = mesh_render_data_edge_flag(mrdata, 0, 0, e); const float *pos = mesh_render_data_vert_co(mrdata, v1); eflag[0] = mesh_render_data_vertex_flag(mrdata, v1); - setAttrib(vbo, pos_id, base_vert_idx + 0, pos); - setAttrib(vbo, edgeMod_id, base_vert_idx + 0, eflag); + VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 0, pos); + VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 0, eflag); pos = mesh_render_data_vert_co(mrdata, v2); eflag[0] = mesh_render_data_vertex_flag(mrdata, v2); - setAttrib(vbo, pos_id, base_vert_idx + 1, pos); - setAttrib(vbo, edgeMod_id, base_vert_idx + 1, eflag); + VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 1, pos); + VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 1, eflag); } static void add_overlay_loose_vert( @@ -717,8 +717,8 @@ static void add_overlay_loose_vert( unsigned char vflag[4] = {0, 0, 0, 0}; const float *pos = mesh_render_data_vert_co(mrdata, v); vflag[0] = mesh_render_data_vertex_flag(mrdata, v); - setAttrib(vbo, pos_id, base_vert_idx + 0, pos); - setAttrib(vbo, edgeMod_id, base_vert_idx + 0, vflag); + VertexBuffer_set_attrib(vbo, pos_id, base_vert_idx + 0, pos); + VertexBuffer_set_attrib(vbo, edgeMod_id, base_vert_idx + 0, vflag); } /* ---------------------------------------------------------------------- */ @@ -919,19 +919,19 @@ static VertexBuffer *mesh_batch_cache_get_pos_and_normals(MeshRenderData *mrdata const bool is_smooth = mesh_render_data_looptri_cos_nors_smooth_get(mrdata, i, &tri_vert_cos, &tri_nor, &tri_vert_nors); if (is_smooth) { - setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[0]); - setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[1]); - setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[2]); + VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[0]); + VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[1]); + VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_vert_nors[2]); } else { - setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_nor); - setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_nor); - setAttrib(cache->pos_with_normals, nor_id, nidx++, tri_nor); + VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_nor); + VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_nor); + VertexBuffer_set_attrib(cache->pos_with_normals, nor_id, nidx++, tri_nor); } - setAttrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[0]); - setAttrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[1]); - setAttrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[2]); + VertexBuffer_set_attrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[0]); + VertexBuffer_set_attrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[1]); + VertexBuffer_set_attrib(cache->pos_with_normals, pos_id, vidx++, tri_vert_cos[2]); } } return cache->pos_with_normals; @@ -954,8 +954,8 @@ static VertexBuffer *mesh_batch_cache_get_pos_and_nor_in_order(MeshRenderData *m cache->pos_in_order = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(cache->pos_in_order, vertex_ct); for (int i = 0; i < vertex_ct; ++i) { - setAttrib(cache->pos_in_order, pos_id, i, mesh_render_data_vert_co(mrdata, i)); - setAttrib(cache->pos_in_order, nor_id, i, mesh_render_data_vert_nor(mrdata, i)); + VertexBuffer_set_attrib(cache->pos_in_order, pos_id, i, mesh_render_data_vert_co(mrdata, i)); + VertexBuffer_set_attrib(cache->pos_in_order, nor_id, i, mesh_render_data_vert_nor(mrdata, i)); } } @@ -1138,13 +1138,13 @@ Batch *BKE_mesh_batch_cache_get_fancy_edges(Mesh *me) const float *n2 = (is_manifold) ? pnor2 : dummy2; #endif - setAttrib(vbo, pos_id, 2 * i, vcos1); - setAttrib(vbo, n1_id, 2 * i, n1); - setAttrib(vbo, n2_id, 2 * i, n2); + VertexBuffer_set_attrib(vbo, pos_id, 2 * i, vcos1); + VertexBuffer_set_attrib(vbo, n1_id, 2 * i, n1); + VertexBuffer_set_attrib(vbo, n2_id, 2 * i, n2); - setAttrib(vbo, pos_id, 2 * i + 1, vcos2); - setAttrib(vbo, n1_id, 2 * i + 1, n1); - setAttrib(vbo, n2_id, 2 * i + 1, n2); + VertexBuffer_set_attrib(vbo, pos_id, 2 * i + 1, vcos2); + VertexBuffer_set_attrib(vbo, n1_id, 2 * i + 1, n1); + VertexBuffer_set_attrib(vbo, n2_id, 2 * i + 1, n2); } cache->fancy_edges = Batch_create(GL_LINES, vbo, NULL); @@ -1289,13 +1289,13 @@ Batch *BKE_mesh_batch_cache_get_overlay_facedots(Mesh *me) PackedNormal nor = { .x = 0, .y = 0, .z = -511 }; nor = convert_i10_v3(pnor); nor.w = selected; - setAttrib(vbo, data_id, i, &nor); + VertexBuffer_set_attrib(vbo, data_id, i, &nor); #else float nor[4] = {pnor[0], pnor[1], pnor[2], (float)selected}; - setAttrib(vbo, data_id, i, nor); + VertexBuffer_set_attrib(vbo, data_id, i, nor); #endif - setAttrib(vbo, pos_id, i, pcenter); + VertexBuffer_set_attrib(vbo, pos_id, i, pcenter); } cache->overlay_facedots = Batch_create(GL_POINTS, vbo, NULL); diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 0d79011d267..fe09c6d8f06 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -134,13 +134,13 @@ static void add_fancy_edge(VertexBuffer *vbo, unsigned int pos_id, unsigned int unsigned int *v_idx, const float co1[3], const float co2[3], const float n1[3], const float n2[3]) { - setAttrib(vbo, n1_id, *v_idx, n1); - setAttrib(vbo, n2_id, *v_idx, n2); - setAttrib(vbo, pos_id, (*v_idx)++, co1); + VertexBuffer_set_attrib(vbo, n1_id, *v_idx, n1); + VertexBuffer_set_attrib(vbo, n2_id, *v_idx, n2); + VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, co1); - setAttrib(vbo, n1_id, *v_idx, n1); - setAttrib(vbo, n2_id, *v_idx, n2); - setAttrib(vbo, pos_id, (*v_idx)++, co2); + VertexBuffer_set_attrib(vbo, n1_id, *v_idx, n1); + VertexBuffer_set_attrib(vbo, n2_id, *v_idx, n2); + VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, co2); } static void add_lat_lon_vert(VertexBuffer *vbo, unsigned int pos_id, unsigned int nor_id, @@ -152,8 +152,8 @@ static void add_lat_lon_vert(VertexBuffer *vbo, unsigned int pos_id, unsigned in nor[2] = sinf(lat) * sinf(lon); mul_v3_v3fl(pos, nor, rad); - setAttrib(vbo, nor_id, *v_idx, nor); - setAttrib(vbo, pos_id, (*v_idx)++, pos); + VertexBuffer_set_attrib(vbo, nor_id, *v_idx, nor); + VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, pos); } static VertexBuffer *fill_arrows_vbo(const float scale) @@ -179,21 +179,21 @@ static VertexBuffer *fill_arrows_vbo(const float scale) v2[axis] = 1.0f; mul_v3_v3fl(vtmp1, v1, scale); mul_v3_v3fl(vtmp2, v2, scale); - setAttrib(vbo, pos_id, axis * 6 + 0, vtmp1); - setAttrib(vbo, pos_id, axis * 6 + 1, vtmp2); + VertexBuffer_set_attrib(vbo, pos_id, axis * 6 + 0, vtmp1); + VertexBuffer_set_attrib(vbo, pos_id, axis * 6 + 1, vtmp2); v1[axis] = 0.85f; v1[arrow_axis] = -0.08f; mul_v3_v3fl(vtmp1, v1, scale); mul_v3_v3fl(vtmp2, v2, scale); - setAttrib(vbo, pos_id, axis * 6 + 2, vtmp1); - setAttrib(vbo, pos_id, axis * 6 + 3, vtmp2); + VertexBuffer_set_attrib(vbo, pos_id, axis * 6 + 2, vtmp1); + VertexBuffer_set_attrib(vbo, pos_id, axis * 6 + 3, vtmp2); v1[arrow_axis] = 0.08f; mul_v3_v3fl(vtmp1, v1, scale); mul_v3_v3fl(vtmp2, v2, scale); - setAttrib(vbo, pos_id, axis * 6 + 4, vtmp1); - setAttrib(vbo, pos_id, axis * 6 + 5, vtmp2); + VertexBuffer_set_attrib(vbo, pos_id, axis * 6 + 4, vtmp1); + VertexBuffer_set_attrib(vbo, pos_id, axis * 6 + 5, vtmp2); /* reset v1 & v2 to zero */ v1[arrow_axis] = v1[axis] = v2[axis] = 0.0f; @@ -238,7 +238,7 @@ static VertexBuffer *sphere_wire_vbo(const float rad) else v[0] = 0.0f, v[1] = cv[0], v[2] = cv[1]; - setAttrib(vbo, pos_id, i * 2 + j + (NSEGMENTS * 2 * axis), v); + VertexBuffer_set_attrib(vbo, pos_id, i * 2 + j + (NSEGMENTS * 2 * axis), v); } } } @@ -266,8 +266,8 @@ Batch *DRW_cache_fullscreen_quad_get(void) VertexBuffer_allocate_data(vbo, 4); for (int i = 0; i < 4; ++i) { - setAttrib(vbo, pos_id, i, pos[i]); - setAttrib(vbo, uvs_id, i, uvs[i]); + VertexBuffer_set_attrib(vbo, pos_id, i, pos[i]); + VertexBuffer_set_attrib(vbo, uvs_id, i, uvs[i]); } SHC.drw_fullscreen_quad = Batch_create(GL_TRIANGLE_STRIP, vbo, NULL); @@ -304,7 +304,7 @@ Batch *DRW_cache_cube_get(void) VertexBuffer_allocate_data(vbo, 24); for (int i = 0; i < 24; ++i) { - setAttrib(vbo, pos_id, i, verts[indices[i]]); + VertexBuffer_set_attrib(vbo, pos_id, i, verts[indices[i]]); } SHC.drw_cube = Batch_create(GL_LINES, vbo, NULL); @@ -332,12 +332,12 @@ Batch *DRW_cache_circle_get(void) v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL)); v[2] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL)); v[1] = 0.0f; - setAttrib(vbo, pos_id, a * 2, v); + VertexBuffer_set_attrib(vbo, pos_id, a * 2, v); v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL)); v[2] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL)); v[1] = 0.0f; - setAttrib(vbo, pos_id, a * 2 + 1, v); + VertexBuffer_set_attrib(vbo, pos_id, a * 2 + 1, v); } SHC.drw_circle = Batch_create(GL_LINES, vbo, NULL); @@ -365,8 +365,8 @@ Batch *DRW_cache_square_get(void) VertexBuffer_allocate_data(vbo, 8); for (int i = 0; i < 4; i++) { - setAttrib(vbo, pos_id, i * 2, p[i % 4]); - setAttrib(vbo, pos_id, i * 2 + 1, p[(i+1) % 4]); + VertexBuffer_set_attrib(vbo, pos_id, i * 2, p[i % 4]); + VertexBuffer_set_attrib(vbo, pos_id, i * 2 + 1, p[(i+1) % 4]); } SHC.drw_square = Batch_create(GL_LINES, vbo, NULL); @@ -391,8 +391,8 @@ Batch *DRW_cache_single_line_get(void) VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, 2); - setAttrib(vbo, pos_id, 0, v1); - setAttrib(vbo, pos_id, 1, v2); + VertexBuffer_set_attrib(vbo, pos_id, 0, v1); + VertexBuffer_set_attrib(vbo, pos_id, 1, v2); SHC.drw_line = Batch_create(GL_LINES, vbo, NULL); } @@ -417,8 +417,8 @@ Batch *DRW_cache_single_line_endpoints_get(void) VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, 2); - setAttrib(vbo, pos_id, 0, v1); - setAttrib(vbo, pos_id, 1, v2); + VertexBuffer_set_attrib(vbo, pos_id, 0, v1); + VertexBuffer_set_attrib(vbo, pos_id, 1, v2); SHC.drw_line_endpoints = Batch_create(GL_POINTS, vbo, NULL); } @@ -447,8 +447,8 @@ Batch *DRW_cache_plain_axes_get(void) v1[axis] = 1.0f; v2[axis] = -1.0f; - setAttrib(vbo, pos_id, axis * 2, v1); - setAttrib(vbo, pos_id, axis * 2 + 1, v2); + VertexBuffer_set_attrib(vbo, pos_id, axis * 2, v1); + VertexBuffer_set_attrib(vbo, pos_id, axis * 2 + 1, v2); /* reset v1 & v2 to zero for next axis */ v1[axis] = v2[axis] = 0.0f; @@ -489,9 +489,9 @@ Batch *DRW_cache_single_arrow_get(void) v3[0] = -v3[0]; } - setAttrib(vbo, pos_id, sides * 3 + 0, v1); - setAttrib(vbo, pos_id, sides * 3 + 1, v2); - setAttrib(vbo, pos_id, sides * 3 + 2, v3); + VertexBuffer_set_attrib(vbo, pos_id, sides * 3 + 0, v1); + VertexBuffer_set_attrib(vbo, pos_id, sides * 3 + 1, v2); + VertexBuffer_set_attrib(vbo, pos_id, sides * 3 + 2, v3); } SHC.drw_single_arrow = Batch_create(GL_TRIANGLES, vbo, NULL); @@ -537,17 +537,17 @@ Batch *DRW_cache_empty_cone_get(void) /* cone sides */ v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1]; - setAttrib(vbo, pos_id, i * 4, v); + VertexBuffer_set_attrib(vbo, pos_id, i * 4, v); v[0] = 0.0f, v[1] = 2.0f, v[2] = 0.0f; - setAttrib(vbo, pos_id, i * 4 + 1, v); + VertexBuffer_set_attrib(vbo, pos_id, i * 4 + 1, v); /* end ring */ v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1]; - setAttrib(vbo, pos_id, i * 4 + 2, v); + VertexBuffer_set_attrib(vbo, pos_id, i * 4 + 2, v); cv[0] = p[(i + 1) % NSEGMENTS][0]; cv[1] = p[(i + 1) % NSEGMENTS][1]; v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1]; - setAttrib(vbo, pos_id, i * 4 + 3, v); + VertexBuffer_set_attrib(vbo, pos_id, i * 4 + 3, v); } SHC.drw_empty_cone = Batch_create(GL_LINES, vbo, NULL); @@ -587,40 +587,40 @@ Batch *DRW_cache_axis_names_get(void) /* X */ copy_v3_fl3(v1, -size, size, 0.0f); copy_v3_fl3(v2, size, -size, 0.0f); - setAttrib(vbo, pos_id, 0, v1); - setAttrib(vbo, pos_id, 1, v2); + VertexBuffer_set_attrib(vbo, pos_id, 0, v1); + VertexBuffer_set_attrib(vbo, pos_id, 1, v2); copy_v3_fl3(v1, size, size, 0.0f); copy_v3_fl3(v2, -size, -size, 0.0f); - setAttrib(vbo, pos_id, 2, v1); - setAttrib(vbo, pos_id, 3, v2); + VertexBuffer_set_attrib(vbo, pos_id, 2, v1); + VertexBuffer_set_attrib(vbo, pos_id, 3, v2); /* Y */ copy_v3_fl3(v1, -size + 0.25f * size, size, 1.0f); copy_v3_fl3(v2, 0.0f, 0.0f, 1.0f); - setAttrib(vbo, pos_id, 4, v1); - setAttrib(vbo, pos_id, 5, v2); + VertexBuffer_set_attrib(vbo, pos_id, 4, v1); + VertexBuffer_set_attrib(vbo, pos_id, 5, v2); copy_v3_fl3(v1, size - 0.25f * size, size, 1.0f); copy_v3_fl3(v2, -size + 0.25f * size, -size, 1.0f); - setAttrib(vbo, pos_id, 6, v1); - setAttrib(vbo, pos_id, 7, v2); + VertexBuffer_set_attrib(vbo, pos_id, 6, v1); + VertexBuffer_set_attrib(vbo, pos_id, 7, v2); /* Z */ copy_v3_fl3(v1, -size, size, 2.0f); copy_v3_fl3(v2, size, size, 2.0f); - setAttrib(vbo, pos_id, 8, v1); - setAttrib(vbo, pos_id, 9, v2); + VertexBuffer_set_attrib(vbo, pos_id, 8, v1); + VertexBuffer_set_attrib(vbo, pos_id, 9, v2); copy_v3_fl3(v1, size, size, 2.0f); copy_v3_fl3(v2, -size, -size, 2.0f); - setAttrib(vbo, pos_id, 10, v1); - setAttrib(vbo, pos_id, 11, v2); + VertexBuffer_set_attrib(vbo, pos_id, 10, v1); + VertexBuffer_set_attrib(vbo, pos_id, 11, v2); copy_v3_fl3(v1, -size, -size, 2.0f); copy_v3_fl3(v2, size, -size, 2.0f); - setAttrib(vbo, pos_id, 12, v1); - setAttrib(vbo, pos_id, 13, v2); + VertexBuffer_set_attrib(vbo, pos_id, 12, v1); + VertexBuffer_set_attrib(vbo, pos_id, 13, v2); SHC.drw_axis_names = Batch_create(GL_LINES, vbo, NULL); } @@ -647,11 +647,11 @@ Batch *DRW_cache_lamp_get(void) for (int a = 0; a < NSEGMENTS; a++) { v[0] = sinf((2.0f * M_PI * a) / ((float)NSEGMENTS)); v[1] = cosf((2.0f * M_PI * a) / ((float)NSEGMENTS)); - setAttrib(vbo, pos_id, a * 2, v); + VertexBuffer_set_attrib(vbo, pos_id, a * 2, v); v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)NSEGMENTS)); v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)NSEGMENTS)); - setAttrib(vbo, pos_id, a * 2 + 1, v); + VertexBuffer_set_attrib(vbo, pos_id, a * 2 + 1, v); } SHC.drw_lamp = Batch_create(GL_LINES, vbo, NULL); @@ -682,8 +682,8 @@ Batch *DRW_cache_lamp_sunrays_get(void) mul_v2_v2fl(v1, v, 1.2f); mul_v2_v2fl(v2, v, 2.5f); - setAttrib(vbo, pos_id, a * 2, v1); - setAttrib(vbo, pos_id, a * 2 + 1, v2); + VertexBuffer_set_attrib(vbo, pos_id, a * 2, v1); + VertexBuffer_set_attrib(vbo, pos_id, a * 2 + 1, v2); } SHC.drw_lamp_sunrays = Batch_create(GL_LINES, vbo, NULL); @@ -707,18 +707,18 @@ Batch *DRW_cache_lamp_area_get(void) VertexBuffer_allocate_data(vbo, 8); v1[0] = v1[1] = 0.5f; - setAttrib(vbo, pos_id, 0, v1); + VertexBuffer_set_attrib(vbo, pos_id, 0, v1); v1[0] = -0.5f; - setAttrib(vbo, pos_id, 1, v1); - setAttrib(vbo, pos_id, 2, v1); + VertexBuffer_set_attrib(vbo, pos_id, 1, v1); + VertexBuffer_set_attrib(vbo, pos_id, 2, v1); v1[1] = -0.5f; - setAttrib(vbo, pos_id, 3, v1); - setAttrib(vbo, pos_id, 4, v1); + VertexBuffer_set_attrib(vbo, pos_id, 3, v1); + VertexBuffer_set_attrib(vbo, pos_id, 4, v1); v1[0] = 0.5f; - setAttrib(vbo, pos_id, 5, v1); - setAttrib(vbo, pos_id, 6, v1); + VertexBuffer_set_attrib(vbo, pos_id, 5, v1); + VertexBuffer_set_attrib(vbo, pos_id, 6, v1); v1[1] = 0.5f; - setAttrib(vbo, pos_id, 7, v1); + VertexBuffer_set_attrib(vbo, pos_id, 7, v1); SHC.drw_lamp_area = Batch_create(GL_LINES, vbo, NULL); } @@ -747,12 +747,12 @@ Batch *DRW_cache_lamp_hemi_get(void) v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL) - M_PI / 2); v[2] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL) - M_PI / 2) - 1.0f; v[1] = 0.0f; - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL) - M_PI / 2); v[2] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL) - M_PI / 2) - 1.0f; v[1] = 0.0f; - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); } /* XY plane */ @@ -760,12 +760,12 @@ Batch *DRW_cache_lamp_hemi_get(void) v[2] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL)) - 1.0f; v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL)); v[0] = 0.0f; - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); v[2] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL)) - 1.0f; v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL)); v[0] = 0.0f; - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); } /* YZ plane full circle */ @@ -774,11 +774,11 @@ Batch *DRW_cache_lamp_hemi_get(void) for (int a = 0; a < CIRCLE_RESOL; a++) { v[1] = rad * sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL)); v[0] = rad * cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL)); - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); v[1] = rad * sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL)); v[0] = rad * cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL)); - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); } @@ -829,27 +829,27 @@ Batch *DRW_cache_lamp_spot_get(void) /* cone sides */ v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f; - setAttrib(vbo, pos_id, i * 4, v); + VertexBuffer_set_attrib(vbo, pos_id, i * 4, v); v[0] = 0.0f, v[1] = 0.0f, v[2] = 0.0f; - setAttrib(vbo, pos_id, i * 4 + 1, v); + VertexBuffer_set_attrib(vbo, pos_id, i * 4 + 1, v); - setAttrib(vbo, n1_id, i * 4, n[(i) % NSEGMENTS]); - setAttrib(vbo, n1_id, i * 4 + 1, n[(i) % NSEGMENTS]); - setAttrib(vbo, n2_id, i * 4, n[(i+1) % NSEGMENTS]); - setAttrib(vbo, n2_id, i * 4 + 1, n[(i+1) % NSEGMENTS]); + VertexBuffer_set_attrib(vbo, n1_id, i * 4, n[(i) % NSEGMENTS]); + VertexBuffer_set_attrib(vbo, n1_id, i * 4 + 1, n[(i) % NSEGMENTS]); + VertexBuffer_set_attrib(vbo, n2_id, i * 4, n[(i+1) % NSEGMENTS]); + VertexBuffer_set_attrib(vbo, n2_id, i * 4 + 1, n[(i+1) % NSEGMENTS]); /* end ring */ v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f; - setAttrib(vbo, pos_id, i * 4 + 2, v); + VertexBuffer_set_attrib(vbo, pos_id, i * 4 + 2, v); cv[0] = p[(i + 1) % NSEGMENTS][0]; cv[1] = p[(i + 1) % NSEGMENTS][1]; v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f; - setAttrib(vbo, pos_id, i * 4 + 3, v); + VertexBuffer_set_attrib(vbo, pos_id, i * 4 + 3, v); - setAttrib(vbo, n1_id, i * 4 + 2, n[(i) % NSEGMENTS]); - setAttrib(vbo, n1_id, i * 4 + 3, n[(i) % NSEGMENTS]); - setAttrib(vbo, n2_id, i * 4 + 2, neg[(i) % NSEGMENTS]); - setAttrib(vbo, n2_id, i * 4 + 3, neg[(i) % NSEGMENTS]); + VertexBuffer_set_attrib(vbo, n1_id, i * 4 + 2, n[(i) % NSEGMENTS]); + VertexBuffer_set_attrib(vbo, n1_id, i * 4 + 3, n[(i) % NSEGMENTS]); + VertexBuffer_set_attrib(vbo, n2_id, i * 4 + 2, neg[(i) % NSEGMENTS]); + VertexBuffer_set_attrib(vbo, n2_id, i * 4 + 3, neg[(i) % NSEGMENTS]); } SHC.drw_lamp_spot = Batch_create(GL_LINES, vbo, NULL); @@ -881,11 +881,11 @@ Batch *DRW_cache_lamp_spot_square_get(void) /* piramid sides */ for (int i = 1; i <= 4; ++i) { - setAttrib(vbo, pos_id, v_idx++, p[0]); - setAttrib(vbo, pos_id, v_idx++, p[i]); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, p[0]); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, p[i]); - setAttrib(vbo, pos_id, v_idx++, p[(i % 4)+1]); - setAttrib(vbo, pos_id, v_idx++, p[((i+1) % 4)+1]); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, p[(i % 4)+1]); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, p[((i+1) % 4)+1]); } SHC.drw_lamp_spot_square = Batch_create(GL_LINES, vbo, NULL); @@ -916,16 +916,16 @@ Batch *DRW_cache_speaker_get(void) float r = (j == 0 ? 0.5f : 0.25f); copy_v3_fl3(v, r, 0.0f, z); - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); for (int i = 1; i < segments; i++) { float x = cosf(2.f * (float)M_PI * i / segments) * r; float y = sinf(2.f * (float)M_PI * i / segments) * r; copy_v3_fl3(v, x, y, z); - setAttrib(vbo, pos_id, vidx++, v); - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); } copy_v3_fl3(v, r, 0.0f, z); - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); } for (int j = 0; j < 4; j++) { @@ -939,9 +939,9 @@ Batch *DRW_cache_speaker_get(void) float z = 0.25f * i - 0.125f; copy_v3_fl3(v, x, y, z); - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); if (i == 1) { - setAttrib(vbo, pos_id, vidx++, v); + VertexBuffer_set_attrib(vbo, pos_id, vidx++, v); } } } @@ -1016,12 +1016,12 @@ Batch *DRW_cache_bone_octahedral_get(void) VertexBuffer_allocate_data(vbo, 24); for (int i = 0; i < 8; i++) { - setAttrib(vbo, nor_id, v_idx, bone_octahedral_solid_normals[i]); - setAttrib(vbo, pos_id, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]); - setAttrib(vbo, nor_id, v_idx, bone_octahedral_solid_normals[i]); - setAttrib(vbo, pos_id, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]); - setAttrib(vbo, nor_id, v_idx, bone_octahedral_solid_normals[i]); - setAttrib(vbo, pos_id, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][2]]); + VertexBuffer_set_attrib(vbo, nor_id, v_idx, bone_octahedral_solid_normals[i]); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]); + VertexBuffer_set_attrib(vbo, nor_id, v_idx, bone_octahedral_solid_normals[i]); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]); + VertexBuffer_set_attrib(vbo, nor_id, v_idx, bone_octahedral_solid_normals[i]); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][2]]); } SHC.drw_bone_octahedral = Batch_create(GL_TRIANGLES, vbo, NULL); @@ -1148,40 +1148,40 @@ Batch *DRW_cache_camera_get(void) VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, 22); - setAttrib(vbo, pos_id, v_idx++, &v0); - setAttrib(vbo, pos_id, v_idx++, &v1); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v0); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v1); - setAttrib(vbo, pos_id, v_idx++, &v0); - setAttrib(vbo, pos_id, v_idx++, &v2); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v0); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v2); - setAttrib(vbo, pos_id, v_idx++, &v0); - setAttrib(vbo, pos_id, v_idx++, &v3); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v0); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v3); - setAttrib(vbo, pos_id, v_idx++, &v0); - setAttrib(vbo, pos_id, v_idx++, &v4); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v0); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v4); /* camera frame */ - setAttrib(vbo, pos_id, v_idx++, &v1); - setAttrib(vbo, pos_id, v_idx++, &v2); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v1); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v2); - setAttrib(vbo, pos_id, v_idx++, &v2); - setAttrib(vbo, pos_id, v_idx++, &v3); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v2); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v3); - setAttrib(vbo, pos_id, v_idx++, &v3); - setAttrib(vbo, pos_id, v_idx++, &v4); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v3); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v4); - setAttrib(vbo, pos_id, v_idx++, &v4); - setAttrib(vbo, pos_id, v_idx++, &v1); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v4); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v1); /* tria */ - setAttrib(vbo, pos_id, v_idx++, &v5); - setAttrib(vbo, pos_id, v_idx++, &v6); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v5); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v6); - setAttrib(vbo, pos_id, v_idx++, &v6); - setAttrib(vbo, pos_id, v_idx++, &v7); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v6); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v7); - setAttrib(vbo, pos_id, v_idx++, &v7); - setAttrib(vbo, pos_id, v_idx++, &v5); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v7); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v5); SHC.drw_camera = Batch_create(GL_LINES, vbo, NULL); } @@ -1210,9 +1210,9 @@ Batch *DRW_cache_camera_tria_get(void) VertexBuffer_allocate_data(vbo, 6); /* tria */ - setAttrib(vbo, pos_id, v_idx++, &v5); - setAttrib(vbo, pos_id, v_idx++, &v6); - setAttrib(vbo, pos_id, v_idx++, &v7); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v5); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v6); + VertexBuffer_set_attrib(vbo, pos_id, v_idx++, &v7); SHC.drw_camera_tria = Batch_create(GL_TRIANGLES, vbo, NULL); } @@ -1235,7 +1235,7 @@ Batch *DRW_cache_single_vert_get(void) VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, 1); - setAttrib(vbo, pos_id, 0, v1); + VertexBuffer_set_attrib(vbo, pos_id, 0, v1); SHC.drw_single_vertice = Batch_create(GL_POINTS, vbo, NULL); } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 276ccd980a0..44fc2f96b8b 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -689,7 +689,7 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup) for (DRWDynamicCall *call = shgroup->calls.first; call; call = call->next, j++) { int i = 0; for (DRWAttrib *attrib = interface->attribs.first; attrib; attrib = attrib->next, i++) { - setAttrib(vbo, attrib->format_id, j, call->data[i]); + VertexBuffer_set_attrib(vbo, attrib->format_id, j, call->data[i]); } } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 643470dd3cf..5f5598f79d8 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -793,7 +793,7 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3]) VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, nbr); - fillAttrib(vbo, pos_id, waveform); + VertexBuffer_fill_attrib(vbo, pos_id, waveform); /* TODO store the Batch inside the scope */ Batch *batch = Batch_create(GL_POINTS, vbo, NULL); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 3b2791b7a62..f0c47ee2639 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -334,12 +334,12 @@ static void set_ebone_color(const unsigned int boneflag) static void add_solid_flat_triangle(VertexBuffer *vbo, unsigned int *vertex, unsigned int pos, unsigned int nor, const float p1[3], const float p2[3], const float p3[3], const float n[3]) { - setAttrib(vbo, nor, *vertex, n); - setAttrib(vbo, pos, (*vertex)++, p1); - setAttrib(vbo, nor, *vertex, n); - setAttrib(vbo, pos, (*vertex)++, p2); - setAttrib(vbo, nor, *vertex, n); - setAttrib(vbo, pos, (*vertex)++, p3); + VertexBuffer_set_attrib(vbo, nor, *vertex, n); + VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p1); + VertexBuffer_set_attrib(vbo, nor, *vertex, n); + VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p2); + VertexBuffer_set_attrib(vbo, nor, *vertex, n); + VertexBuffer_set_attrib(vbo, pos, (*vertex)++, p3); } /* half the cube, in Y */ @@ -444,7 +444,7 @@ static void drawcube_size(float xsize, float ysize, float zsize) VertexBuffer_init_with_format(&vbo, &format); VertexBuffer_allocate_data(&vbo, 8); for (int i = 0; i < 8; ++i) { - setAttrib(&vbo, pos, i, cube_vert[i]); + VertexBuffer_set_attrib(&vbo, pos, i, cube_vert[i]); } Batch_init(&batch, GL_LINES, &vbo, &el); @@ -481,26 +481,26 @@ static void draw_bonevert(void) vert[0] = r * cosf(2 * M_PI * i / 16.f); vert[1] = r * sinf(2 * M_PI * i / 16.f); - setAttrib(&vbo, pos, i * 6 + 0, vert); + VertexBuffer_set_attrib(&vbo, pos, i * 6 + 0, vert); vert[0] = r * cosf(2 * M_PI * (i + 1) / 16.f); vert[1] = r * sinf(2 * M_PI * (i + 1) / 16.f); - setAttrib(&vbo, pos, i * 6 + 1, vert); + VertexBuffer_set_attrib(&vbo, pos, i * 6 + 1, vert); vert[0] = 0.f; vert[1] = r * cosf(2 * M_PI * i / 16.f); vert[2] = r * sinf(2 * M_PI * i / 16.f); - setAttrib(&vbo, pos, i * 6 + 2, vert); + VertexBuffer_set_attrib(&vbo, pos, i * 6 + 2, vert); vert[1] = r * cosf(2 * M_PI * (i + 1) / 16.f); vert[2] = r * sinf(2 * M_PI * (i + 1) / 16.f); - setAttrib(&vbo, pos, i * 6 + 3, vert); + VertexBuffer_set_attrib(&vbo, pos, i * 6 + 3, vert); vert[1] = 0.f; vert[0] = r * cosf(2 * M_PI * i / 16.f); vert[2] = r * sinf(2 * M_PI * i / 16.f); - setAttrib(&vbo, pos, i * 6 + 4, vert); + VertexBuffer_set_attrib(&vbo, pos, i * 6 + 4, vert); vert[0] = r * cosf(2 * M_PI * (i + 1) / 16.f); vert[2] = r * sinf(2 * M_PI * (i + 1) / 16.f); - setAttrib(&vbo, pos, i * 6 + 5, vert); + VertexBuffer_set_attrib(&vbo, pos, i * 6 + 5, vert); } Batch_init(&batch, GL_LINES, &vbo, NULL); @@ -596,7 +596,7 @@ static void draw_bone_octahedral(void) VertexBuffer_init_with_format(&vbo, &format); VertexBuffer_allocate_data(&vbo, 6); for (int i = 0; i < 6; ++i) { - setAttrib(&vbo, pos, i, bone_octahedral_verts[i]); + VertexBuffer_set_attrib(&vbo, pos, i, bone_octahedral_verts[i]); } Batch_init(&batch, GL_LINES, &vbo, &el); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index eaa5ee3b9eb..19f8f6eae6f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5119,7 +5119,7 @@ static void drawDispListVerts(int dt, const void *data, unsigned int vert_ct, co VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, vert_ct); - fillAttrib(vbo, pos_id, data); + VertexBuffer_fill_attrib(vbo, pos_id, data); Batch *batch = Batch_create(dt, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_3D_UNIFORM_COLOR); @@ -5165,10 +5165,10 @@ static void drawDispListElem(bool quads, bool UNUSED(smooth), const float *data, VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, vert_ct); - fillAttrib(vbo, pos_id, data); + VertexBuffer_fill_attrib(vbo, pos_id, data); if (ndata) { - fillAttrib(vbo, nor_id, ndata); + VertexBuffer_fill_attrib(vbo, nor_id, ndata); } Batch *batch = Batch_create(GL_TRIANGLES, vbo, ElementList_build(&elb)); @@ -5594,14 +5594,14 @@ static void draw_vertex_array(int dt, const float *vert, const float *nor, const VertexBuffer_allocate_data(vbo, vert_ct); if (stride == 0) { - fillAttrib(vbo, pos_id, vert); - if (nor) fillAttrib(vbo, nor_id, nor); - if (color) fillAttrib(vbo, col_id, color); + VertexBuffer_fill_attrib(vbo, pos_id, vert); + if (nor) VertexBuffer_fill_attrib(vbo, nor_id, nor); + if (color) VertexBuffer_fill_attrib(vbo, col_id, color); } else { - fillAttribStride(vbo, pos_id, stride, vert); - if (nor) fillAttribStride(vbo, nor_id, stride, nor); - if (color) fillAttribStride(vbo, col_id, stride, color); + VertexBuffer_fill_attrib_stride(vbo, pos_id, stride, vert); + if (nor) VertexBuffer_fill_attrib_stride(vbo, nor_id, stride, nor); + if (color) VertexBuffer_fill_attrib_stride(vbo, col_id, stride, color); } Batch *batch = Batch_create(dt, vbo, NULL); @@ -6590,7 +6590,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, path->segments + 1); - fillAttribStride(vbo, pos_id, sizeof(ParticleCacheKey), path->co); + VertexBuffer_fill_attrib_stride(vbo, pos_id, sizeof(ParticleCacheKey), path->co); float *pcol = pathcol; @@ -6600,7 +6600,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) pcol[3] = 0.25f; } - fillAttrib(vbo, col_id, pathcol); + VertexBuffer_fill_attrib(vbo, col_id, pathcol); } else if (timed) { ParticleCacheKey *pkey = path; @@ -6609,12 +6609,12 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) pcol[3] = 1.0f - fabsf((float)(CFRA) -pkey->time) / (float)pset->fade_frames; } - fillAttrib(vbo, col_id, pathcol); + VertexBuffer_fill_attrib(vbo, col_id, pathcol); } else { /* FIXME: shader wants 4 color components but the cache only contains ParticleCacheKey * So alpha is random */ - fillAttribStride(vbo, col_id, sizeof(ParticleCacheKey), path->col); + VertexBuffer_fill_attrib_stride(vbo, col_id, sizeof(ParticleCacheKey), path->col); } Batch *batch = Batch_create(GL_LINE_STRIP, vbo, NULL); @@ -6683,11 +6683,11 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit) VertexBuffer_allocate_data(vbo, point->totkey); if (point->keys->flag & PEK_USE_WCO) - fillAttribStride(vbo, pos_id, sizeof(PTCacheEditKey), point->keys->world_co); + VertexBuffer_fill_attrib_stride(vbo, pos_id, sizeof(PTCacheEditKey), point->keys->world_co); else - fillAttrib(vbo, pos_id, pd); + VertexBuffer_fill_attrib(vbo, pos_id, pd); - fillAttrib(vbo, col_id, cd); + VertexBuffer_fill_attrib(vbo, col_id, cd); Batch *batch = Batch_create(GL_POINTS, vbo, NULL); Batch_set_builtin_program(batch, GPU_SHADER_3D_SMOOTH_COLOR); diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 014aa65efb5..b940de4a727 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1560,7 +1560,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar float col[4]; static VertexFormat format = { 0 }; - static unsigned pos_id; + static unsigned int pos_id; if (format.attrib_ct == 0) { pos_id = add_attrib(&format, "pos", GL_FLOAT, 2, KEEP_FLOAT); } @@ -1572,7 +1572,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, stitch_preview->num_static_tris * 3); for (int i = 0; i < stitch_preview->num_static_tris * 3; i++) - setAttrib(vbo, pos_id, i, &stitch_preview->static_tris[i*2]); + VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->static_tris[i*2]); stitch_draw_vbo(vbo, GL_TRIANGLES, col); @@ -1593,21 +1593,21 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar BLI_assert(stitch_preview->uvs_per_polygon[i] >= 3); /* Start line */ - setAttrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); - setAttrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + 2]); + VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); + VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + 2]); for (j = 1; j < stitch_preview->uvs_per_polygon[i] - 1; ++j) { - setAttrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]); - setAttrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); - setAttrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); + VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]); + VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); + VertexBuffer_set_attrib(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); - setAttrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); - setAttrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); + VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); + VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); } /* Closing line */ - setAttrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); - setAttrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j*2]); /* j = uvs_per_polygon[i] - 1*/ + VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); + VertexBuffer_set_attrib(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j*2]); /* j = uvs_per_polygon[i] - 1*/ index += stitch_preview->uvs_per_polygon[i] * 2; } @@ -1627,14 +1627,14 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, stitch_preview->num_stitchable); for (int i = 0; i < stitch_preview->num_stitchable; i++) - setAttrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); + VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); stitch_draw_vbo(vbo, GL_POINTS, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, stitch_preview->num_unstitchable); for (int i = 0; i < stitch_preview->num_unstitchable; i++) - setAttrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); + VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); stitch_draw_vbo(vbo, GL_POINTS, col); } else { @@ -1642,14 +1642,14 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, stitch_preview->num_stitchable * 2); for (int i = 0; i < stitch_preview->num_stitchable * 2; i++) - setAttrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); + VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); stitch_draw_vbo(vbo, GL_LINES, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, stitch_preview->num_unstitchable * 2); for (int i = 0; i < stitch_preview->num_unstitchable * 2; i++) - setAttrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); + VertexBuffer_set_attrib(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); stitch_draw_vbo(vbo, GL_LINES, col); } } diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index 65a827febde..0e4b71ab9b8 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -55,8 +55,8 @@ static void batch_sphere_lat_lon_vert(float lat, float lon) pos[1] = cosf(lat); pos[2] = sinf(lat) * sinf(lon); - setAttrib(vbo, nor_id, vert, pos); - setAttrib(vbo, pos_id, vert++, pos); + VertexBuffer_set_attrib(vbo, nor_id, vert, pos); + VertexBuffer_set_attrib(vbo, pos_id, vert++, pos); } /* Replacement for gluSphere */ diff --git a/source/blender/gpu/intern/gpu_compositing.c b/source/blender/gpu/intern/gpu_compositing.c index 8ae100a7d95..e4647c33621 100644 --- a/source/blender/gpu/intern/gpu_compositing.c +++ b/source/blender/gpu/intern/gpu_compositing.c @@ -284,8 +284,8 @@ GPUFX *GPU_fx_compositor_create(void) VertexBuffer *vbo = VertexBuffer_create_with_format(&format); VertexBuffer_allocate_data(vbo, 4); for (int i = 0; i < 4; ++i) { - setAttrib(vbo, pos, i, fullscreencos[i]); - setAttrib(vbo, uvs, i, fullscreenuvs[i]); + VertexBuffer_set_attrib(vbo, pos, i, fullscreencos[i]); + VertexBuffer_set_attrib(vbo, uvs, i, fullscreenuvs[i]); } fx->quad_batch = Batch_create(GL_TRIANGLE_STRIP, vbo, NULL); @@ -298,7 +298,7 @@ GPUFX *GPU_fx_compositor_create(void) float dummy[2] = {0.0f, 0.0f}; VertexBuffer *vbo_point = VertexBuffer_create_with_format(&format_point); VertexBuffer_allocate_data(vbo_point, 1); - setAttrib(vbo_point, dummy_attrib, 0, &dummy); + VertexBuffer_set_attrib(vbo_point, dummy_attrib, 0, &dummy); fx->point_batch = Batch_create(GL_POINTS, vbo_point, NULL); return fx; diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index c6a98d01c02..afc04ac8626 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -398,10 +398,12 @@ void GPU_framebuffer_blur( VertexBuffer_allocate_data(&vbo, 36); for (int j = 0; j < 3; ++j) { - setAttrib(&vbo, uvs, i, fullscreenuvs[j]); setAttrib(&vbo, pos, i++, fullscreencos[j]); + VertexBuffer_set_attrib(&vbo, uvs, i, fullscreenuvs[j]); + VertexBuffer_set_attrib(&vbo, pos, i++, fullscreencos[j]); } for (int j = 1; j < 4; ++j) { - setAttrib(&vbo, uvs, i, fullscreenuvs[j]); setAttrib(&vbo, pos, i++, fullscreencos[j]); + VertexBuffer_set_attrib(&vbo, uvs, i, fullscreenuvs[j]); + VertexBuffer_set_attrib(&vbo, pos, i++, fullscreencos[j]); } Batch_init(&batch, GL_TRIANGLES, &vbo, NULL); |