98 #define CONSTRAIN_EPSILON 0.0001f
102 const float *constraint_vector[2];
104 for (
int i = 0; i < 3; i++) {
106 constraint_vector[n++] =
t->spacemtx[i];
114 cross_v3_v3v3(r_plane, constraint_vector[0], constraint_vector[1]);
116 r_plane[3] = -
dot_v3v3(r_plane,
t->center_global);
121 int mode =
t->con.mode;
144 else if (dims == 1) {
168 const float min_dist = 1.0f;
173 if (
dot_v3v3(dir,
t->viewinv[2]) < 0.0f) {
197 float t_con_center[3];
218 factor =
dot_v3v3(
t->viewinv[1], vec) * 2.0f;
233 float norm_center[3];
247 if (1.0f -
fabsf(factor) < 0.0002f) {
289 const float *edge_snap_point =
t->tsnap.snapPoint;
290 const float *edge_dir =
t->tsnap.snapNormal;
303 const float plane[4],
306 float face_plane[4], isect_orig[3], isect_dir[3];
307 const float *face_snap_point =
t->tsnap.snapPoint;
308 const float *face_normal =
t->tsnap.snapNormal;
325 const float *edge_snap_point =
t->tsnap.snapPoint;
326 const float *edge_dir =
t->tsnap.snapNormal;
343 const float *face_snap_point =
t->tsnap.snapPoint;
344 const float *face_normal =
t->tsnap.snapNormal;
358 const float eps = 0.001f;
359 float view_to_plane[3];
362 float factor =
dot_v3v3(plane, view_to_plane);
368 float vec[3], factor,
norm[3];
376 if (factor == 0.0f) {
379 factor =
dot_v3v3(vec, vec) / factor;
399 bool is_snap_to_point =
false, is_snap_to_edge =
false, is_snap_to_face =
false;
406 is_snap_to_point = !is_snap_to_edge && !is_snap_to_face;
409 is_snap_to_point =
true;
414 if (!is_snap_to_point || is_snap_to_edge || is_snap_to_face) {
421 if (is_snap_to_edge) {
424 else if (is_snap_to_face) {
436 else if (dims == 1) {
450 if (is_snap_to_edge) {
453 else if (is_snap_to_face) {
553 const float axismtx[3][3],
577 float view_vector[3];
579 if (
dot_v3v3(r_vec, view_vector) > 0.0f) {
580 *r_angle = -(*r_angle);
623 float tmp_axismtx[3][3];
624 const float(*axismtx)[3];
635 axismtx = tmp_axismtx;
659 t->con.drawExtra =
NULL;
684 if ((
t->flag &
T_EDIT) ||
t->data_len_all == 1) {
703 short orientation =
t->orient[
t->orient_curr].type;
706 orientation =
t->orient[0].type;
712 switch (orientation) {
766 drawLine(
t,
t->center_global,
t->spacemtx[0],
'X', 0);
767 drawLine(
t,
t->center_global,
t->spacemtx[1],
'Y', 0);
768 drawLine(
t,
t->center_global,
t->spacemtx[2],
'Z', 0);
771 if (depth_test_enabled) {
780 float viewport_size[4];
782 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
796 if (depth_test_enabled) {
818 float tmat[4][4], imat[4][4];
840 rctf *datamask = &
t->region->v2d.cur;
849 if (depth_test_enabled) {
873 if (depth_test_enabled) {
890 float tmp_axismtx[3][3];
894 for (
int i = 0; i < tc->data_len; i++, td++) {
916 axismtx = tmp_axismtx;
956 if (
t->orient_curr != O_DEFAULT) {
962 t->num.idx_max =
t->idx_max;
973 if (
t->orient_curr == O_DEFAULT) {
1008 if (
abs(
t->mval[0] -
t->con.imval[0]) <
abs(
t->mval[1] -
t->con.imval[1])) {
1021 float mvec[3], proj[3];
1026 mvec[0] = (
float)(
t->mval[0] -
t->con.imval[0]);
1027 mvec[1] = (
float)(
t->mval[1] -
t->con.imval[1]);
1038 zfac =
len_v3(
t->persinv[0]) * 2.0f /
t->region->winx * zfac * 30.0f;
1040 for (i = 0; i < 3; i++) {
1041 float axis[3], axis_2d[2];
1143 int mode =
t->con.mode;
typedef float(TangentPoint)[2]
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
MINLINE int min_ii(int a, int b)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
bool isect_ray_ray_v3(const float ray_origin_a[3], const float ray_direction_a[3], const float ray_origin_b[3], const float ray_direction_b[3], float *r_lambda_a, float *r_lambda_b)
float closest_to_ray_v3(float r_close[3], const float p[3], const float ray_orig[3], const float ray_dir[3])
bool isect_plane_plane_v3(const float plane_a[4], const float plane_b[4], float r_isect_co[3], float r_isect_no[3]) ATTR_WARN_UNUSED_RESULT
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_m3_v3(const float M[3][3], float r[3])
void unit_m3(float m[3][3])
void unit_m4(float m[4][4])
bool invert_m4_m4(float R[4][4], const float A[4][4])
bool invert_m3_m3(float R[3][3], const float A[3][3])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
float angle_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
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 bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float mul_project_m4_v3_zfac(const float mat[4][4], const float co[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE float normalize_v3_v3_length(float r[3], const float a[3], const float unit_scale)
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Object is a sort of wrapper for general info.
#define SCE_SNAP_MODE_FACE
#define SCE_SNAP_MODE_GRID
#define SCE_SNAP_MODE_EDGE
@ V3D_ORIENT_CUSTOM_MATRIX
void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned int pos)
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
void GPU_matrix_pop(void)
void GPU_matrix_scale_2f(float x, float y)
void GPU_matrix_push(void)
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
eGPUDepthTest GPU_depth_test_get(void)
void GPU_depth_test(eGPUDepthTest test)
void GPU_viewport_size_get_f(float coords[4])
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
static void mul(btAlignedObjectArray< T > &items, const Q &value)
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
CCL_NAMESPACE_BEGIN struct Options options
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
static bool is_aligned(void *ptr, uint alignment)
void(* drawExtra)(struct TransInfo *t)
__forceinline const avxi abs(const avxi &a)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)