diff options
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index eafcfb007e7..7a72622cb9e 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -116,10 +116,10 @@ typedef struct EdgeAdjacentVerts { } EdgeAdjacentVerts; typedef struct EdgeDrawAttr { - unsigned char v_flag; - unsigned char e_flag; - unsigned char crease; - unsigned char bweight; + uchar v_flag; + uchar e_flag; + uchar crease; + uchar bweight; } EdgeDrawAttr; typedef struct MeshRenderData { @@ -1349,9 +1349,9 @@ enum { * (see gpu_shader_edit_mesh_overlay_geom.glsl) */ }; -static unsigned char mesh_render_data_looptri_flag(MeshRenderData *rdata, const BMFace *efa) +static uchar mesh_render_data_looptri_flag(MeshRenderData *rdata, const BMFace *efa) { - unsigned char fflag = 0; + uchar fflag = 0; if (efa == rdata->efa_act) fflag |= VFLAG_FACE_ACTIVE; @@ -1397,10 +1397,10 @@ static void mesh_render_data_edge_flag( } } -static unsigned char mesh_render_data_vertex_flag(MeshRenderData *rdata, const BMVert *eve) +static uchar mesh_render_data_vertex_flag(MeshRenderData *rdata, const BMVert *eve) { - unsigned char vflag = 0; + uchar vflag = 0; /* Current vertex */ if (eve == rdata->eve_act) @@ -1417,8 +1417,8 @@ static void add_overlay_tri( const uint pos_id, const uint vnor_id, const uint lnor_id, const uint data_id, const BMLoop **bm_looptri, const int base_vert_idx) { - unsigned char fflag; - unsigned char vflag; + uchar fflag; + uchar vflag; if (vbo_pos) { /* TODO(sybren): deduplicate this and all the other places it's pasted to in this file. */ @@ -1528,7 +1528,7 @@ static void add_overlay_loose_vert( } if (vbo_data) { - unsigned char vflag[4] = {0, 0, 0, 0}; + uchar vflag[4] = {0, 0, 0, 0}; vflag[0] = mesh_render_data_vertex_flag(rdata, eve); GWN_vertbuf_attr_set(vbo_data, data_id, base_vert_idx, vflag); } @@ -1634,7 +1634,7 @@ typedef struct MeshBatchCache { * set srgb conversion for auto attribs.*/ char *auto_layer_names; int *auto_layer_is_srgb; - int auto_layer_ct; + int auto_layer_len; /* settings to determine if cache is invalid */ bool is_maybe_dirty; @@ -1947,22 +1947,22 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata, uint auto_names_len = 0; uint auto_ofs = 0; uint auto_id = 0; - cache->auto_layer_ct = 0; + cache->auto_layer_len = 0; for (uint i = 0; i < uv_len; i++) { const char *attrib_name = mesh_render_data_uv_auto_layer_uuid_get(rdata, i); auto_names_len += strlen(attrib_name) + 2; /* include null terminator and b prefix. */ - cache->auto_layer_ct++; + cache->auto_layer_len++; } for (uint i = 0; i < vcol_len; i++) { if (rdata->cd.layers.auto_vcol[i]) { const char *attrib_name = mesh_render_data_vcol_auto_layer_uuid_get(rdata, i); auto_names_len += strlen(attrib_name) + 2; /* include null terminator and b prefix. */ - cache->auto_layer_ct++; + cache->auto_layer_len++; } } auto_names_len += 1; /* add an ultimate '\0' terminator */ cache->auto_layer_names = MEM_callocN(auto_names_len * sizeof(char), "Auto layer name buf"); - cache->auto_layer_is_srgb = MEM_mallocN(cache->auto_layer_ct * sizeof(int), "Auto layer value buf"); + cache->auto_layer_is_srgb = MEM_mallocN(cache->auto_layer_len * sizeof(int), "Auto layer value buf"); for (uint i = 0; i < uv_len; i++) { /* UV */ @@ -2159,7 +2159,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_uv_active( static Gwn_VertFormat format = { 0 }; static struct { uint uv; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.uv = GWN_vertformat_attr_add(&format, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -2222,7 +2222,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_pos_and_normals_ex( if (*r_vbo == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); } @@ -2374,7 +2374,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_facedot_pos_with_normals_and_flag( if (cache->ed_fcenter_pos_with_nor_and_sel == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.data = GWN_vertformat_attr_add(&format, "norAndFlag", GWN_COMP_I10, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); } @@ -2418,7 +2418,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_edges_visible( if (cache->ed_edge_pos == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -2463,7 +2463,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_verts_visible( if (cache->ed_vert_pos == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -2513,7 +2513,7 @@ static Gwn_VertBuf *mesh_create_facedot_select_id( { static Gwn_VertFormat format = { 0 }; static struct { uint pos, col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -2561,7 +2561,7 @@ static Gwn_VertBuf *mesh_create_edges_select_id( { static Gwn_VertFormat format = { 0 }; static struct { uint pos, col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -2611,7 +2611,7 @@ static Gwn_VertBuf *mesh_create_verts_select_id( { static Gwn_VertFormat format = { 0 }; static struct { uint pos, col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -2671,7 +2671,7 @@ static Gwn_VertBuf *mesh_create_tri_weights( static Gwn_VertFormat format = { 0 }; static struct { uint col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } @@ -2731,7 +2731,7 @@ static Gwn_VertBuf *mesh_create_tri_vert_colors( static Gwn_VertFormat format = { 0 }; static struct { uint col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); } @@ -2791,7 +2791,7 @@ static Gwn_VertBuf *mesh_create_tri_select_id( static Gwn_VertFormat format = { 0 }; static struct { uint col; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT); } @@ -2847,7 +2847,7 @@ static Gwn_VertBuf *mesh_batch_cache_get_vert_pos_and_nor_in_order( if (cache->pos_in_order == NULL) { static Gwn_VertFormat format = { 0 }; static struct { uint pos, nor; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { /* Normal is padded so that the vbo can be used as a buffer texture */ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT); @@ -2886,8 +2886,8 @@ static Gwn_VertBuf *mesh_batch_cache_get_vert_pos_and_nor_in_order( static Gwn_VertFormat *edit_mesh_overlay_pos_format(uint *r_pos_id) { static Gwn_VertFormat format_pos = { 0 }; - static unsigned pos_id; - if (format_pos.attrib_ct == 0) { + static uint pos_id; + if (format_pos.attr_len == 0) { pos_id = GWN_vertformat_attr_add(&format_pos, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); } *r_pos_id = pos_id; @@ -2898,8 +2898,8 @@ static Gwn_VertFormat *edit_mesh_overlay_nor_format(uint *r_vnor_id, uint *r_lno { static Gwn_VertFormat format_nor = { 0 }; static Gwn_VertFormat format_nor_loop = { 0 }; - static unsigned vnor_id, vnor_loop_id, lnor_id; - if (format_nor.attrib_ct == 0) { + static uint vnor_id, vnor_loop_id, lnor_id; + if (format_nor.attr_len == 0) { vnor_id = GWN_vertformat_attr_add(&format_nor, "vnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); vnor_loop_id = GWN_vertformat_attr_add(&format_nor_loop, "vnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); lnor_id = GWN_vertformat_attr_add(&format_nor_loop, "lnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); @@ -2918,8 +2918,8 @@ static Gwn_VertFormat *edit_mesh_overlay_nor_format(uint *r_vnor_id, uint *r_lno static Gwn_VertFormat *edit_mesh_overlay_data_format(uint *r_data_id) { static Gwn_VertFormat format_flag = { 0 }; - static unsigned data_id; - if (format_flag.attrib_ct == 0) { + static uint data_id; + if (format_flag.attr_len == 0) { data_id = GWN_vertformat_attr_add(&format_flag, "data", GWN_COMP_U8, 4, GWN_FETCH_INT); } *r_data_id = data_id; @@ -3420,7 +3420,7 @@ static Gwn_VertBuf *mesh_batch_cache_create_edges_overlay_texture_buf(MeshRender int j, j_next; for (j = 2, j_next = 0; j_next < 3; j = j_next++) { MEdge *ed = &medge[mloop[mlt->tri[j]].e]; - unsigned int tri_edge[2] = {mloop[mlt->tri[j]].v, mloop[mlt->tri[j_next]].v}; + uint tri_edge[2] = {mloop[mlt->tri[j]].v, mloop[mlt->tri[j_next]].v}; if (((ed->v1 == tri_edge[0]) && (ed->v2 == tri_edge[1])) || ((ed->v1 == tri_edge[1]) && (ed->v2 == tri_edge[0]))) @@ -3657,7 +3657,7 @@ static Gwn_VertBuf *mesh_create_edge_pos_with_sel( static Gwn_VertFormat format = { 0 }; static struct { uint pos, sel; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.sel = GWN_vertformat_attr_add(&format, "select", GWN_COMP_U8, 1, GWN_FETCH_INT); } @@ -3744,7 +3744,7 @@ static Gwn_VertBuf *mesh_create_vert_pos_with_overlay_data( static Gwn_VertFormat format = { 0 }; static struct { uint data; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_I8, 1, GWN_FETCH_INT); } @@ -3997,7 +3997,7 @@ Gwn_Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me) /* create batch from DM */ static Gwn_VertFormat format = { 0 }; static struct { uint pos, n1, n2; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); @@ -4330,7 +4330,7 @@ Gwn_Batch **DRW_mesh_batch_cache_get_surface_shaded( if (auto_layer_names) { *auto_layer_names = cache->auto_layer_names; *auto_layer_is_srgb = cache->auto_layer_is_srgb; - *auto_layer_count = cache->auto_layer_ct; + *auto_layer_count = cache->auto_layer_len; } return cache->shaded_triangles; |