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 /source/blender/editors | |
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.
Diffstat (limited to 'source/blender/editors')
-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 |
4 files changed, 46 insertions, 46 deletions
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); } } |