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:
authorCampbell Barton <ideasman42@gmail.com>2017-09-13 18:36:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-09-13 20:54:32 +0300
commit55fb6e7096536a59ec306eb67889f8cf2f4e94bc (patch)
tree67018a6e61e421832737a128753bafeb066d3236 /source/blender/gpu/intern/gpu_immediate_util.c
parentd5478e20cc52641ea44fb3acfd6a58fc021978df (diff)
GPU_immediate_util: Add x,y radius to circle draw
A version of circle drawing for non 1:1 aspects
Diffstat (limited to 'source/blender/gpu/intern/gpu_immediate_util.c')
-rw-r--r--source/blender/gpu/intern/gpu_immediate_util.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c
index 4f68bbef4d7..5feb1c58cea 100644
--- a/source/blender/gpu/intern/gpu_immediate_util.c
+++ b/source/blender/gpu/intern/gpu_immediate_util.c
@@ -51,12 +51,13 @@ void imm_cpack(unsigned int x)
(((x) >> 16) & 0xFF));
}
-static void imm_draw_circle(Gwn_PrimType prim_type, const uint shdr_pos, float x, float y, float rad, int nsegments)
+static void imm_draw_circle(
+ Gwn_PrimType prim_type, const uint shdr_pos, float x, float y, float rad_x, float rad_y, int nsegments)
{
immBegin(prim_type, nsegments);
for (int i = 0; i < nsegments; ++i) {
const float angle = (float)(2 * M_PI) * ((float)i / (float)nsegments);
- immVertex2f(shdr_pos, x + rad * cosf(angle), y + rad * sinf(angle));
+ immVertex2f(shdr_pos, x + (rad_x * cosf(angle)), y + (rad_y * sinf(angle)));
}
immEnd();
}
@@ -73,7 +74,7 @@ static void imm_draw_circle(Gwn_PrimType prim_type, const uint shdr_pos, float x
*/
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float rad, int nsegments)
{
- imm_draw_circle(GWN_PRIM_LINE_LOOP, shdr_pos, x, y, rad, nsegments);
+ imm_draw_circle(GWN_PRIM_LINE_LOOP, shdr_pos, x, y, rad, rad, nsegments);
}
/**
@@ -88,7 +89,16 @@ void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float rad, int nse
*/
void imm_draw_circle_fill_2d(uint shdr_pos, float x, float y, float rad, int nsegments)
{
- imm_draw_circle(GWN_PRIM_TRI_FAN, shdr_pos, x, y, rad, nsegments);
+ imm_draw_circle(GWN_PRIM_TRI_FAN, shdr_pos, x, y, rad, rad, nsegments);
+}
+
+void imm_draw_circle_wire_aspect_2d(uint shdr_pos, float x, float y, float rad_x, float rad_y, int nsegments)
+{
+ imm_draw_circle(GWN_PRIM_LINE_LOOP, shdr_pos, x, y, rad_x, rad_y, nsegments);
+}
+void imm_draw_circle_fill_aspect_2d(uint shdr_pos, float x, float y, float rad_x, float rad_y, int nsegments)
+{
+ imm_draw_circle(GWN_PRIM_TRI_FAN, shdr_pos, x, y, rad_x, rad_y, nsegments);
}
/**