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-05-01 17:32:09 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-05-01 17:32:55 +0300
commitbb5f4a1f67c82794ba478bedb08b1851e9aeb274 (patch)
tree815e40afde954c1e3e4c3165d018802273ef521d
parentd7d4bca23be91ec5b0ce562d47a34ee49dd337b8 (diff)
Cleanup/followup to previous commit: get rid of dashed-specific helpers.
Those are no more needed.
-rw-r--r--source/blender/gpu/GPU_immediate_util.h3
-rw-r--r--source/blender/gpu/intern/gpu_immediate_util.c71
2 files changed, 5 insertions, 69 deletions
diff --git a/source/blender/gpu/GPU_immediate_util.h b/source/blender/gpu/GPU_immediate_util.h
index eb35e640b13..b68b353e717 100644
--- a/source/blender/gpu/GPU_immediate_util.h
+++ b/source/blender/gpu/GPU_immediate_util.h
@@ -30,7 +30,6 @@
void imm_cpack(unsigned int x);
void imm_draw_circle_wire(uint shdr_pos, float x, float y, float radius, int nsegments);
-void imm_draw_circle_wire_dashed(uint shdr_pos, uint shdr_dashed_origin, float x, float y, float rad, int nsegments);
void imm_draw_circle_fill(uint shdr_pos, float x, float y, float radius, int nsegments);
/* use this version when VertexFormat has a vec3 position */
@@ -45,8 +44,6 @@ void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2);
void imm_draw_line_box_3d(unsigned pos, float x1, float y1, float x2, float y2);
-void imm_draw_line_box_dashed(uint pos, uint line_origin, float x1, float y1, float x2, float y2);
-
void imm_draw_checker_box(float x1, float y1, float x2, float y2);
void imm_draw_cylinder_fill_normal_3d(
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index 1cf7d641d7f..152f1f3dd98 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -47,31 +47,12 @@ void imm_cpack(unsigned int x)
(((x) >> 16) & 0xFF));
}
-static void imm_draw_circle(
- PrimitiveType prim_type, const uint shdr_pos, const bool use_dashed, const uint shdr_dashed_origin,
- float x, float y, float rad, int nsegments)
+static void imm_draw_circle(PrimitiveType prim_type, const uint shdr_pos, float x, float y, float rad, int nsegments)
{
- const bool use_prim_lines = (prim_type == PRIM_LINES);
- float prev_x, prev_y;
-
- if (use_prim_lines || use_dashed) {
- const float angle = 2.0f * M_PI * ((float)(nsegments - 1) / (float)nsegments);
- prev_x = x + rad * cosf(angle);
- prev_y = y + rad * sinf(angle);
- }
-
- immBegin(prim_type, use_prim_lines ? nsegments * 2 : nsegments);
+ immBegin(prim_type, nsegments);
for (int i = 0; i < nsegments; ++i) {
const float angle = 2 * M_PI * ((float)i / (float)nsegments);
- if (use_dashed) {
- immAttrib2f(shdr_dashed_origin, prev_x, prev_y);
- }
- if (use_prim_lines) {
- immVertex2f(shdr_pos, prev_x, prev_y);
- }
- prev_x = x + rad * cosf(angle);
- prev_y = y + rad * sinf(angle);
- immVertex2f(shdr_pos, prev_x, prev_y);
+ immVertex2f(shdr_pos, x + rad * cosf(angle), y + rad * sinf(angle));
}
immEnd();
}
@@ -88,23 +69,7 @@ static void imm_draw_circle(
*/
void imm_draw_circle_wire(uint shdr_pos, float x, float y, float rad, int nsegments)
{
- imm_draw_circle(PRIM_LINE_LOOP, shdr_pos, false, 0, x, y, rad, nsegments);
-}
-
-/**
- * Draw a circle dashed outline with the given \a radius.
- * The circle is centered at \a x, \a y and drawn in the XY plane.
- *
- * \param shdr_pos The vertex attribute number for position.
- * \param pos The vertex attribute number for position.
- * \param x Horizontal center.
- * \param y Vertical center.
- * \param radius The circle's radius.
- * \param nsegments The number of segments to use in drawing (more = smoother).
- */
-void imm_draw_circle_wire_dashed(uint shdr_pos, uint shdr_dashed_origin, float x, float y, float rad, int nsegments)
-{
- imm_draw_circle(PRIM_LINES, shdr_pos, true, shdr_dashed_origin, x, y, rad, nsegments);
+ imm_draw_circle(PRIM_LINE_LOOP, shdr_pos, x, y, rad, nsegments);
}
/**
@@ -119,7 +84,7 @@ void imm_draw_circle_wire_dashed(uint shdr_pos, uint shdr_dashed_origin, float x
*/
void imm_draw_circle_fill(uint shdr_pos, float x, float y, float rad, int nsegments)
{
- imm_draw_circle(PRIM_TRIANGLE_FAN, shdr_pos, false, 0, x, y, rad, nsegments);
+ imm_draw_circle(PRIM_TRIANGLE_FAN, shdr_pos, x, y, rad, nsegments);
}
/**
@@ -218,32 +183,6 @@ 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.
*/