96 const bool align_center)
103 alloc_len =
sizeof(
void *);
106 alloc_len = str_len + 1;
123 memcpy(vos->
str, &
str, alloc_len);
126 memcpy(vos->
str,
str, alloc_len);
134 int col_pack_prev = 0;
136 float original_proj[4][4];
146 float outline_dark_color[4] = {0, 0, 0, 0.8f};
147 float outline_light_color[4] = {1, 1, 1, 0.8f};
148 bool outline_is_dark =
true;
153 if (col_pack_prev != vos->
col.
pack) {
156 outline_is_dark = lightness > 96;
169 vos->
xoffs -= short(width / 2.0f);
170 vos->
yoffs -= short(height / 2.0f);
178 outline_is_dark ? outline_dark_color : outline_light_color);
226 if (rv3d_clipping_enabled) {
232 if (rv3d_clipping_enabled) {
241 View2D *v2d = ®ion->v2d;
243 rctf region_space = {0.0f,
float(region->winx), 0.0f,
float(region->winy)};
270 const BMEditMesh *em = mesh->runtime->edit_mesh.get();
272 const char *conv_float;
274 const float grid = unit->system ? unit->scale_length : v3d->
grid;
281 const bool use_coords = !vert_positions.
is_empty();
284 short edge_tex_count = 0;
294 const short edge_tex_sep = short((edge_tex_count - 1) * 5.0f *
UI_SCALE_FAC);
301 else if (grid <= 0.1f) {
304 else if (grid <= 1.0f) {
307 else if (grid <= 10.0f) {
318 const rcti rect = {0, region->winx, 0, region->winy};
352 0.5 * (v1_clip + v2_clip));
355 v1 = ob->object_to_world().view<3, 3>() * v1;
356 v2 = ob->object_to_world().view<3, 3>() *
v2;
359 const size_t numstr_len = unit->system ?
420 0.5 * (v1_clip + v2_clip));
462 const int f_corner_tris_len = f->
len - 2;
467 const std::array<BMLoop *, 3> *ltri_array = &em->
looptris[tri_index];
468 for (
int j = 0; j < f_corner_tris_len; j++) {
477 v1 = ltri_array[j][0]->v->co;
478 v2 = ltri_array[j][1]->v->
co;
479 v3 = ltri_array[j][2]->v->co;
488 v1 = ob->object_to_world().view<3, 3>() * v1;
489 v2 = ob->object_to_world().view<3, 3>() *
v2;
490 v3 = ob->object_to_world().view<3, 3>() * v3;
496 vmid *= 1.0f /
float(n);
499 const size_t numstr_len = unit->system ?
503 double(area * unit->scale_length * unit->scale_length),
512 tri_index += f_corner_tris_len;
529 if (is_face_sel || do_moving) {
532 bool is_first =
true;
566 v1 = ob->object_to_world().view<3, 3>() * v1;
567 v2 = ob->object_to_world().view<3, 3>() *
v2;
568 v3 = ob->object_to_world().view<3, 3>() * v3;
615 const bool use_edge_tex_sep = (edge_tex_count == 2);
634 0.5 * (v1_clip + v2_clip));
643 (use_edge_tex_sep) ? (use_edge_tex_len) ? -edge_tex_sep : edge_tex_sep : 0,
blender::Span< blender::float3 > BKE_mesh_wrapper_face_normals(Mesh *mesh)
blender::Span< blender::float3 > BKE_mesh_wrapper_vert_coords(const Mesh *mesh)
General operations, lookup, etc. for blender objects.
const Mesh * BKE_object_get_editmesh_eval_cage(const Object *object)
size_t BKE_unit_value_as_string(char *str, int str_maxncpy, double value, int prec, int type, const UnitSettings *settings, bool pad)
void BLF_shadow(int fontid, FontShadowType type, const float rgba[4]=nullptr)
void BLF_width_and_height(int fontid, const char *str, size_t str_len, float *r_width, float *r_height) ATTR_NONNULL()
void BLF_shadow_offset(int fontid, int x, int y)
void BLF_disable(int fontid, int option)
void BLF_default_size(float size)
void BLF_enable(int fontid, int option)
void BLF_color4ubv(int fontid, const unsigned char rgba[4])
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3])
bool clip_segment_v3_plane_n(const float p1[3], const float p2[3], const float plane_array[][4], int plane_num, float r_p1[3], float r_p2[3])
float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
MINLINE void copy_v3_v3(float r[3], const float a[3])
float angle_v3v3v3(const float a[3], const float b[3], const float c[3]) ATTR_WARN_UNUSED_RESULT
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
void BLI_memiter_destroy(BLI_memiter *mi) ATTR_NONNULL(1)
void * BLI_memiter_iter_step(BLI_memiter_handle *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_memiter * BLI_memiter_create(unsigned int chunk_size_min) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
void * BLI_memiter_alloc(BLI_memiter *mi, unsigned int elem_size) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
void BLI_memiter_iter_init(BLI_memiter *mi, BLI_memiter_handle *iter) ATTR_NONNULL(1
void BLI_rctf_transform_calc_m4_pivot_min(const rctf *dst, const rctf *src, float matrix[4][4])
#define SNPRINTF_RLEN(dst, format,...)
#define BLI_STR_UTF8_DEGREE_SIGN
Object is a sort of wrapper for general info.
@ V3D_OVERLAY_EDIT_INDICES
@ V3D_OVERLAY_EDIT_FACE_AREA
@ V3D_OVERLAY_EDIT_EDGE_ANG
@ V3D_OVERLAY_EDIT_FACE_ANG
@ V3D_OVERLAY_EDIT_EDGE_LEN
#define RV3D_CLIPPING_ENABLED(v3d, rv3d)
void ED_view3d_clipping_calc(BoundBox *bb, float planes[4][4], const ARegion *region, const Object *ob, const rcti *rect)
@ V3D_PROJ_TEST_CLIP_NEAR
eV3DProjStatus ED_view3d_project_short_ex(const ARegion *region, float perspmat[4][4], bool is_local, const float co[3], short r_co[2], eV3DProjTest flag)
void GPU_matrix_identity_set()
#define GPU_matrix_projection_get(x)
#define GPU_matrix_projection_set(x)
void GPU_clip_distances(int distances_enabled)
Read Guarded memory(de)allocation.
const uiStyle * UI_style_get()
void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
#define BM_elem_index_get(ele)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_test_bool(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3])
void BM_face_calc_center_bounds_vcos(const BMesh *bm, const BMFace *f, float r_cent[3], const blender::Span< blender::float3 > vert_positions)
void BM_face_calc_center_median_vcos(const BMesh *bm, const BMFace *f, float r_cent[3], const blender::Span< blender::float3 > vert_positions)
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
ATTR_WARN_UNUSED_RESULT const BMVert * v
constexpr bool is_empty() const
void DRW_text_cache_add(DRWTextStore *dt, const float co[3], const char *str, const int str_len, short xoffs, short yoffs, short flag, const uchar col[4], const bool shadow, const bool align_center)
DRWTextStore * DRW_text_cache_create()
void DRW_text_cache_draw(DRWTextStore *dt, ARegion *region, View3D *v3d)
static void drw_text_cache_draw_ex(DRWTextStore *dt, ARegion *region)
void DRW_text_cache_destroy(DRWTextStore *dt)
void DRW_text_edit_mesh_measure_stats(const ARegion *region, const View3D *v3d, const Object *ob, const UnitSettings *unit, DRWTextStore *dt)
@ DRW_TEXT_CACHE_LOCALCLIP
@ DRW_TEXT_CACHE_GLOBALSPACE
@ DRW_TEXT_CACHE_STRING_PTR
draw_view in_light_buf[] float
void MEM_freeN(void *vmemh)
T interpolate(const T &a, const T &b, const FactorT &t)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
blender::Array< std::array< BMLoop *, 3 > > looptris
BLI_memiter * cache_strings
union ViewCachedString::@296 col
const c_style_mat & ptr() const
void wmOrtho2_region_pixelspace(const ARegion *region)