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:
authorBastien Montagne <montagne29@wanadoo.fr>2017-04-26 13:11:40 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-04-26 13:11:40 +0300
commit88a7d3438dc61674e4fd95698a7feffd3c9c05bb (patch)
treee7dabe78feed128b7b91b90a48a69f841a1e78be /source/blender/gpu/intern/gpu_immediate_util.c
parent621b8bdf86412786e561a5e25fb7583ed61e2b0d (diff)
Move imm_draw_line_box_dashed to GPU_immediate_util.
Diffstat (limited to 'source/blender/gpu/intern/gpu_immediate_util.c')
-rw-r--r--source/blender/gpu/intern/gpu_immediate_util.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index 52829c6956b..49ced32cd51 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -181,6 +181,32 @@ void imm_draw_line_box_3d(unsigned pos, float x1, float y1, float x2, float y2)
immEnd();
}
+/** Same as \a imm_draw_line_box, but for dashed shader. */
+/* TODO find a way to generate screen-space dashed lines without that line_origin ugly hack
+ * (would not bet it's possible with current GLSL though :( ). */
+void imm_draw_line_box_dashed(uint pos, uint line_origin, float x1, float y1, float x2, float y2)
+{
+ immBegin(PRIM_LINES, 8);
+
+ immAttrib2f(line_origin, x1, y1);
+ immVertex2f(pos, x1, y1);
+ immVertex2f(pos, x1, y2);
+
+ immAttrib2f(line_origin, x1, y2);
+ immVertex2f(pos, x1, y2);
+ immVertex2f(pos, x2, y2);
+
+ immAttrib2f(line_origin, x2, y1);
+ immVertex2f(pos, x2, y2);
+ immVertex2f(pos, x2, y1);
+
+ immAttrib2f(line_origin, x1, y1);
+ immVertex2f(pos, x2, y1);
+ immVertex2f(pos, x1, y1);
+
+ immEnd();
+}
+
/**
* Draw a standard checkerboard to indicate transparent backgrounds.
*/