Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-11-18 19:55:21 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-11-18 19:55:21 +0300
commitb8bf40ed4bf618a6bc908e39278cfbfd385e0d4b (patch)
tree15c3b0f937436348bd82752d43abd7440ed68b23 /source/blender/gpu
parent717a971035071d36af03d65713408f4da1f69cb3 (diff)
Revert "Revert "Revert "Adjust snap source drawing when adding multiple snap points"""
This reverts commit c7f9a782aafcdd08868504584b2621afcf1356c2.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_immediate_util.h2
-rw-r--r--source/blender/gpu/intern/gpu_immediate_util.c29
2 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_immediate_util.h b/source/blender/gpu/GPU_immediate_util.h
index 047c3d3da00..5b14b139662 100644
--- a/source/blender/gpu/GPU_immediate_util.h
+++ b/source/blender/gpu/GPU_immediate_util.h
@@ -93,6 +93,8 @@ void imm_draw_cylinder_fill_3d(
uint pos, float base, float top, float height, int slices, int stacks);
void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], uint pos);
+void imm_drawX(const float cent[3], float size, const float tmat[4][4], uint pos);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index df18b89bd67..2dd23fa46ae 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -654,3 +654,32 @@ void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], ui
}
immEnd();
}
+
+void imm_drawX(const float cent[3], float size, const float tmat[4][4], uint pos)
+{
+ /* Draw an "X" indicating where the previous snap point is.
+ * This is useful for indicating perpendicular snap. */
+
+ /* v1, v2, v3 and v4 indicate the coordinates of the ends of the "X". */
+ float vx[3], vy[3], v1[3], v2[3], v3[3], v4[4];
+
+ mul_v3_v3fl(vx, tmat[0], size);
+ mul_v3_v3fl(vy, tmat[1], size);
+
+ add_v3_v3v3(v1, vx, vy);
+ sub_v3_v3v3(v2, vx, vy);
+ negate_v3_v3(v3, v1);
+ negate_v3_v3(v4, v2);
+
+ add_v3_v3(v1, cent);
+ add_v3_v3(v2, cent);
+ add_v3_v3(v3, cent);
+ add_v3_v3(v4, cent);
+
+ immBegin(GPU_PRIM_LINES, 4);
+ immVertex3fv(pos, v3);
+ immVertex3fv(pos, v1);
+ immVertex3fv(pos, v4);
+ immVertex3fv(pos, v2);
+ immEnd();
+}