Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_cache_impl_curve.cc
| Show First 20 Lines • Show All 837 Lines • ▼ Show 20 Lines | if (format_pos.attr_len == 0) { | ||||
| attr_id.pos = GPU_vertformat_attr_add(&format_pos, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | attr_id.pos = GPU_vertformat_attr_add(&format_pos, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | ||||
| attr_id.data = GPU_vertformat_attr_add(&format_data, "data", GPU_COMP_U8, 1, GPU_FETCH_INT); | attr_id.data = GPU_vertformat_attr_add(&format_data, "data", GPU_COMP_U8, 1, GPU_FETCH_INT); | ||||
| } | } | ||||
| int verts_len_capacity = curve_render_data_overlay_verts_len_get(rdata); | int verts_len_capacity = curve_render_data_overlay_verts_len_get(rdata); | ||||
| int edges_len_capacity = curve_render_data_overlay_edges_len_get(rdata) * 2; | int edges_len_capacity = curve_render_data_overlay_edges_len_get(rdata) * 2; | ||||
| int vbo_len_used = 0; | int vbo_len_used = 0; | ||||
| #define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? (v) : NULL)) | |||||
| #define DRW_TEST_ASSIGN_IBO(v) (v = (DRW_ibo_requested(v) ? (v) : NULL)) | |||||
| if (DRW_TEST_ASSIGN_VBO(vbo_pos)) { | if (DRW_TEST_ASSIGN_VBO(vbo_pos)) { | ||||
| GPU_vertbuf_init_with_format(vbo_pos, &format_pos); | GPU_vertbuf_init_with_format(vbo_pos, &format_pos); | ||||
| GPU_vertbuf_data_alloc(vbo_pos, verts_len_capacity); | GPU_vertbuf_data_alloc(vbo_pos, verts_len_capacity); | ||||
| } | } | ||||
| if (DRW_TEST_ASSIGN_VBO(vbo_data)) { | if (DRW_TEST_ASSIGN_VBO(vbo_data)) { | ||||
| GPU_vertbuf_init_with_format(vbo_data, &format_data); | GPU_vertbuf_init_with_format(vbo_data, &format_data); | ||||
| GPU_vertbuf_data_alloc(vbo_data, verts_len_capacity); | GPU_vertbuf_data_alloc(vbo_data, verts_len_capacity); | ||||
| } | } | ||||
| GPUIndexBufBuilder elb_verts, *elbp_verts = nullptr; | GPUIndexBufBuilder elb_verts, *elbp_verts = nullptr; | ||||
| GPUIndexBufBuilder elb_lines, *elbp_lines = nullptr; | GPUIndexBufBuilder elb_lines, *elbp_lines = nullptr; | ||||
| if (DRW_TEST_ASSIGN_IBO(ibo_edit_verts_points)) { | if (DRW_TEST_ASSIGN_IBO(ibo_edit_verts_points)) { | ||||
| elbp_verts = &elb_verts; | elbp_verts = &elb_verts; | ||||
| GPU_indexbuf_init(elbp_verts, GPU_PRIM_POINTS, verts_len_capacity, verts_len_capacity); | GPU_indexbuf_init(elbp_verts, GPU_PRIM_POINTS, verts_len_capacity, verts_len_capacity); | ||||
| } | } | ||||
| if (DRW_TEST_ASSIGN_IBO(ibo_edit_lines)) { | if (DRW_TEST_ASSIGN_IBO(ibo_edit_lines)) { | ||||
| elbp_lines = &elb_lines; | elbp_lines = &elb_lines; | ||||
| GPU_indexbuf_init(elbp_lines, GPU_PRIM_LINES, edges_len_capacity, verts_len_capacity); | GPU_indexbuf_init(elbp_lines, GPU_PRIM_LINES, edges_len_capacity, verts_len_capacity); | ||||
| } | } | ||||
| #undef DRW_TEST_ASSIGN_VBO | |||||
| #undef DRW_TEST_ASSIGN_IBO | |||||
| int nu_id = 0; | int nu_id = 0; | ||||
| for (Nurb *nu = (Nurb *)rdata->nurbs->first; nu; nu = nu->next, nu_id++) { | for (Nurb *nu = (Nurb *)rdata->nurbs->first; nu; nu = nu->next, nu_id++) { | ||||
| const BezTriple *bezt = nu->bezt; | const BezTriple *bezt = nu->bezt; | ||||
| const BPoint *bp = nu->bp; | const BPoint *bp = nu->bp; | ||||
| if (bezt) { | if (bezt) { | ||||
| for (int a = 0; a < nu->pntsu; a++, bezt++) { | for (int a = 0; a < nu->pntsu; a++, bezt++) { | ||||
| if (bezt->hide != 0) { | if (bezt->hide != 0) { | ||||
| ▲ Show 20 Lines • Show All 335 Lines • Show Last 20 Lines | |||||