Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_cache_impl_displist.c
| Show First 20 Lines • Show All 526 Lines • ▼ Show 20 Lines | void DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv_and_tan(ListBase *lb, | ||||
| int vbo_len_capacity = curve_render_surface_tri_len_get(lb) * 3; | int vbo_len_capacity = curve_render_surface_tri_len_get(lb) * 3; | ||||
| GPUVertBufRaw pos_step = {0}; | GPUVertBufRaw pos_step = {0}; | ||||
| GPUVertBufRaw nor_step = {0}; | GPUVertBufRaw nor_step = {0}; | ||||
| GPUVertBufRaw uv_step = {0}; | GPUVertBufRaw uv_step = {0}; | ||||
| GPUVertBufRaw tan_step = {0}; | GPUVertBufRaw tan_step = {0}; | ||||
| #define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? (v) : NULL)) | |||||
| if (DRW_TEST_ASSIGN_VBO(vbo_pos_nor)) { | if (DRW_TEST_ASSIGN_VBO(vbo_pos_nor)) { | ||||
| GPU_vertbuf_init_with_format(vbo_pos_nor, | GPU_vertbuf_init_with_format(vbo_pos_nor, | ||||
| do_hq_normals ? &format_pos_nor_hq : &format_pos_nor); | do_hq_normals ? &format_pos_nor_hq : &format_pos_nor); | ||||
| GPU_vertbuf_data_alloc(vbo_pos_nor, vbo_len_capacity); | GPU_vertbuf_data_alloc(vbo_pos_nor, vbo_len_capacity); | ||||
| GPU_vertbuf_attr_get_raw_data(vbo_pos_nor, pos_id, &pos_step); | GPU_vertbuf_attr_get_raw_data(vbo_pos_nor, pos_id, &pos_step); | ||||
| GPU_vertbuf_attr_get_raw_data(vbo_pos_nor, nor_id, &nor_step); | GPU_vertbuf_attr_get_raw_data(vbo_pos_nor, nor_id, &nor_step); | ||||
| } | } | ||||
| if (DRW_TEST_ASSIGN_VBO(vbo_uv)) { | if (DRW_TEST_ASSIGN_VBO(vbo_uv)) { | ||||
| GPU_vertbuf_init_with_format(vbo_uv, &format_uv); | GPU_vertbuf_init_with_format(vbo_uv, &format_uv); | ||||
| GPU_vertbuf_data_alloc(vbo_uv, vbo_len_capacity); | GPU_vertbuf_data_alloc(vbo_uv, vbo_len_capacity); | ||||
| GPU_vertbuf_attr_get_raw_data(vbo_uv, attr_id.uv, &uv_step); | GPU_vertbuf_attr_get_raw_data(vbo_uv, attr_id.uv, &uv_step); | ||||
| } | } | ||||
| if (DRW_TEST_ASSIGN_VBO(vbo_tan)) { | if (DRW_TEST_ASSIGN_VBO(vbo_tan)) { | ||||
| GPU_vertbuf_init_with_format(vbo_tan, do_hq_normals ? &format_tan_hq : &format_tan); | GPU_vertbuf_init_with_format(vbo_tan, do_hq_normals ? &format_tan_hq : &format_tan); | ||||
| GPU_vertbuf_data_alloc(vbo_tan, vbo_len_capacity); | GPU_vertbuf_data_alloc(vbo_tan, vbo_len_capacity); | ||||
| GPU_vertbuf_attr_get_raw_data(vbo_tan, tan_id, &tan_step); | GPU_vertbuf_attr_get_raw_data(vbo_tan, tan_id, &tan_step); | ||||
| } | } | ||||
| #undef DRW_TEST_ASSIGN_VBO | |||||
| BKE_displist_normals_add(lb); | BKE_displist_normals_add(lb); | ||||
| LISTBASE_FOREACH (const DispList *, dl, lb) { | LISTBASE_FOREACH (const DispList *, dl, lb) { | ||||
| const bool is_smooth = (dl->rt & CU_SMOOTH) != 0; | const bool is_smooth = (dl->rt & CU_SMOOTH) != 0; | ||||
| if (ELEM(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) { | if (ELEM(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) { | ||||
| const float(*verts)[3] = (float(*)[3])dl->verts; | const float(*verts)[3] = (float(*)[3])dl->verts; | ||||
| const float(*nors)[3] = (float(*)[3])dl->nors; | const float(*nors)[3] = (float(*)[3])dl->nors; | ||||
| const int *idx = dl->index; | const int *idx = dl->index; | ||||
| ▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines | |||||