58 this->win_half = {1.0f, 1.0f};
63 this->win_half = {region->
winx / 2.0f, region->
winy / 2.0f};
69 for (
int i = 0;
i < 4;
i++) {
70 this->proj_mat[
i][0] *= this->win_half[0];
71 this->proj_mat[
i][1] *= this->win_half[1];
77 this->proj_mat.
location()[0] -= this->win_half[0];
78 this->proj_mat.
location()[1] -= this->win_half[1];
96 if (
sv.co_link_orig_3d.size() <= 1) {
100 const float3 v_co_orig =
sv.co_orig_3d();
104 int co_link_curr_best = -1;
106 for (
int j :
sv.co_link_orig_3d.index_range()) {
107 const float3 &loc_dst =
sv.co_link_orig_3d[j];
112 if (dir_dot > dir_dot_best) {
113 dir_dot_best = dir_dot;
114 co_link_curr_best = j;
118 if (co_link_curr_best != -1) {
119 sv.co_link_curr = co_link_curr_best;
136 if (dist_sq < dist_min_sq) {
137 dist_min_sq = dist_sq;
138 this->curr_sv_index =
i;
161 int mval_ofs[2], mval_start[2], mval_end[2];
167 ARRAY_SET_ITEMS(mval_start, co_orig_2d[0] + mval_ofs[0], co_orig_2d[1] + mval_ofs[1]);
168 ARRAY_SET_ITEMS(mval_end, co_curr_2d[0] + mval_ofs[0], co_curr_2d[1] + mval_ofs[1]);
198 if (sld->
sv.is_empty()) {
219 custom_data->
data =
nullptr;
231 switch (event->
type) {
291 const int alpha_shade = -160;
308 immVertexFormat(),
"pos", blender::gpu::VertAttrType::SFLOAT_32_32_32);
360 float3 co_orig_3d_cpy = co_orig_3d_act;
362 co_orig_3d_cpy[0] /= t->
aspect[0];
363 co_orig_3d_cpy[1] /= t->
aspect[1];
376 float viewport_size[4];
378 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
407 if (use_even ==
false) {
414 if (edge_len > FLT_EPSILON) {
434 const bool use_even = slp->
use_even;
438 if (sld ==
nullptr) {
446 tperc *= edge_len_curr;
463 float snap_point[3], dvec[3];
493 const bool flipped = slp->
flipped;
494 const bool use_even = slp->
use_even;
496 const bool is_constrained = !(is_clamp ==
false ||
hasNumInput(&t->
num));
509 if (is_constrained) {
510 CLAMP(
final, 0.0f, 1.0f);
551 status.item_bool(
IFACE_(
"Clamp"), is_clamp, ICON_EVENT_C, ICON_EVENT_ALT);
552 status.item_bool(
IFACE_(
"Even"), use_even, ICON_EVENT_E);
554 status.item_bool(
IFACE_(
"Flipped"), flipped, ICON_EVENT_F);
571 const float edge_len_curr =
len_v3v3(orig_co, loc_dst_act);
572 tperc *= edge_len_curr;
615 tc->custom.mode.data = sld;
642 bool use_even =
false;
643 bool flipped =
false;
644 bool use_clamp =
true;
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[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 float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool compare_v2v2(const float v1[2], const float v2[2], float limit) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
char size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
size_t BLI_snprintf_utf8_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define ARRAY_SET_ITEMS(...)
void ED_area_status_text(ScrArea *area, const char *str)
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
void GPU_matrix_identity_set()
void GPU_matrix_scale_2f(float x, float y)
void GPU_matrix_push_projection()
#define GPU_matrix_mul(x)
void GPU_matrix_pop_projection()
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_SHADER_3D_POINT_UNIFORM_COLOR
void GPU_line_width(float width)
void GPU_blend(GPUBlend blend)
void GPU_depth_test(GPUDepthTest test)
void GPU_point_size(float size)
void GPU_viewport_size_get_f(float coords[4])
float UI_GetThemeValuef(int colorid)
void UI_view2d_view_to_region_m4(const View2D *v2d, float matrix[4][4]) ATTR_NONNULL()
IndexRange index_range() const
void * MEM_callocN(size_t len, const char *str)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
VectorT project_point(const MatT &mat, const VectorT &point)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
VecBase< float, 3 > float3
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
const c_style_mat & ptr() const
static MatBase identity()
VecBase< T, 2 > xy() const
struct wmOperatorType * type
void wmOrtho2_region_pixelspace(const ARegion *region)