63 #include "../gizmo_geometry.h"
64 #include "../gizmo_library_intern.h"
87 bool unbind_shader =
true;
112 const float unitx = aspect[0];
113 const float unity = aspect[1];
114 const float vec[4][3] = {
125 #ifdef USE_GIZMO_CUSTOM_ARROWS
130 const float vec[2][3] = {
132 {0.0f, 0.0f, arrow_length},
148 const float size = 0.05f;
157 unbind_shader =
false;
163 const float len = 0.25f;
164 const float width = 0.06f;
190 float matrix_final[4][4];
238 float matrix_final[4][4];
242 const float arrow_start[2] = {matrix_final[3][0], matrix_final[3][1]};
245 float co[3] = {0, 0, arrow_length};
250 const float mval_fl[2] = {
UNPACK2(mval)};
251 const float arrow_stem_threshold_px = 5 *
UI_DPI_FAC;
252 const float arrow_head_threshold_px = 12 *
UI_DPI_FAC;
264 if (lambda >= 0.0 && lambda <= 1.0) {
296 float ray_origin[3], ray_direction[3];
310 for (
int j = 0; j < 2; j++) {
319 float arrow_no_proj[3];
338 sub_v3_v3v3(offset, proj[1].location, proj[0].location);
339 facdir =
dot_v3v3(arrow_no, offset) < 0.0f ? -1 : 1;
342 const float ofs_new = facdir *
len_v3(offset);
353 data, inter, ofs_new, constrained, inverted, use_precision);
362 data->offset = ofs_new;
462 "Make sure this function is called before WM_gizmo_target_property_def_rna"));
479 "Make sure this function is called before WM_gizmo_target_property_def_rna"));
487 gzt->
idname =
"GIZMO_GT_arrow_3d";
522 rna_enum_draw_style_items,
528 rna_enum_draw_options_items,
534 RNA_def_float(gzt->
srna,
"length", 1.0f, 0.0f, FLT_MAX,
"Arrow Line Length",
"", 0.0f, FLT_MAX);
536 gzt->
srna,
"aspect", 2,
NULL, 0, FLT_MAX,
"Aspect",
"Cone/box style only", 0.0f, FLT_MAX);
struct ARegion * CTX_wm_region(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
MINLINE float square_f(float a)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
float closest_to_line_v2(float r_close[2], const float p[2], const float l1[2], const float l2[2])
bool isect_ray_plane_v3(const float ray_origin[3], const float ray_direction[3], const float plane[4], float *r_lambda, const bool clip)
void mul_m4_v3(const float M[4][4], float r[3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
@ ED_GIZMO_ARROW_XFORM_FLAG_CONSTRAINED
@ ED_GIZMO_ARROW_XFORM_FLAG_INVERTED
@ ED_GIZMO_ARROW_DRAW_FLAG_STEM
@ ED_GIZMO_ARROW_STYLE_CROSS
@ ED_GIZMO_ARROW_STYLE_BOX
@ ED_GIZMO_ARROW_STYLE_NORMAL
@ ED_GIZMO_ARROW_STYLE_CONE
void ED_region_tag_redraw_editor_overlays(struct ARegion *region)
void ED_view3d_win_to_ray(const struct ARegion *region, const float mval[2], float r_ray_start[3], float r_ray_normal[3])
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
void GPU_matrix_pop(void)
#define GPU_matrix_mul(x)
void GPU_matrix_scale_3f(float x, float y, float z)
void GPU_matrix_push(void)
void GPU_matrix_translate_3f(float x, float y, float z)
bool GPU_select_load_id(unsigned int id)
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
void GPU_viewport_size_get_f(float coords[4])
Read Guarded memory(de)allocation.
eWM_GizmoFlagTweak
Gizmo tweak flag. Bitflag passed to gizmo while tweaking.
@ WM_GIZMO_STATE_HIGHLIGHT
static void gizmo_arrow_matrix_basis_get(const wmGizmo *gz, float r_matrix[4][4])
static void gizmo_arrow_setup(wmGizmo *gz)
static void arrow_draw_geom(const ArrowGizmo3D *arrow, const bool select, const float color[4])
static int gizmo_arrow_test_select(bContext *UNUSED(C), wmGizmo *gz, const int mval[2])
static int gizmo_arrow_invoke(bContext *UNUSED(C), wmGizmo *gz, const wmEvent *event)
void ED_gizmotypes_arrow_3d(void)
void ED_gizmo_arrow3d_set_range_fac(wmGizmo *gz, const float range_fac)
struct ArrowGizmo3D ArrowGizmo3D
static int gizmo_arrow_modal(bContext *C, wmGizmo *gz, const wmEvent *event, eWM_GizmoFlagTweak tweak_flag)
static void GIZMO_GT_arrow_3d(wmGizmoType *gzt)
static void arrow_draw_intern(ArrowGizmo3D *arrow, const bool select, const bool highlight)
static void gizmo_arrow_exit(bContext *C, wmGizmo *gz, const bool cancel)
void ED_gizmo_arrow3d_set_ui_range(wmGizmo *gz, const float min, const float max)
static void gizmo_arrow_property_update(wmGizmo *gz, wmGizmoProperty *gz_prop)
static void gizmo_arrow_draw_select(const bContext *UNUSED(C), wmGizmo *gz, int select_id)
static void gizmo_arrow_draw(const bContext *UNUSED(C), wmGizmo *gz)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
GizmoGeomInfo wm_gizmo_geom_data_arrow
GizmoGeomInfo wm_gizmo_geom_data_cube
void wm_gizmo_vec_draw(const float color[4], const float(*verts)[3], uint vert_count, uint pos, uint primitive_type)
void wm_gizmo_geometryinfo_draw(const GizmoGeomInfo *info, const bool UNUSED(select), const float color[4])
float gizmo_value_from_offset(GizmoCommonData *data, GizmoInteraction *inter, const float offset, const bool constrained, const bool inverted, const bool use_precision)
void gizmo_color_get(const struct wmGizmo *gz, const bool highlight, float r_color[4])
void gizmo_property_value_reset(bContext *C, const struct wmGizmo *gz, GizmoInteraction *inter, wmGizmoProperty *gz_prop)
void gizmo_property_data_update(struct wmGizmo *gz, GizmoCommonData *data, wmGizmoProperty *gz_prop, const bool constrained, const bool inverted)
float gizmo_offset_from_value(GizmoCommonData *data, const float value, const bool constrained, const bool inverted)
void *(* MEM_callocN)(size_t len, const char *str)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
float RNA_float_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
float init_matrix_basis[4][4]
float init_matrix_final[4][4]
wmGizmoFnMatrixBasisGet matrix_basis_get
wmGizmoFnTestSelect test_select
wmGizmoFnDrawSelect draw_select
wmGizmoFnPropertyUpdate property_update
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
void WM_event_add_mousemove(wmWindow *win)
void WM_gizmo_calc_matrix_final(const wmGizmo *gz, float r_mat[4][4])
void WM_gizmo_target_property_float_set(bContext *C, const wmGizmo *gz, wmGizmoProperty *gz_prop, const float value)
wmGizmoProperty * WM_gizmo_target_property_find(wmGizmo *gz, const char *idname)
bool WM_gizmo_target_property_is_valid(const wmGizmoProperty *gz_prop)
void WM_gizmotype_target_property_def(wmGizmoType *gzt, const char *idname, int data_type, int array_length)
float WM_gizmo_target_property_float_get(const wmGizmo *gz, wmGizmoProperty *gz_prop)
void WM_gizmo_target_property_anim_autokey(bContext *C, const wmGizmo *UNUSED(gz), wmGizmoProperty *gz_prop)
void WM_gizmotype_append(void(*gtfunc)(struct wmGizmoType *))