Cleanup/followup to previous commit: get rid of dashed-specific helpers.
Those are no more needed.
This commit is contained in:
parent
d7d4bca23b
commit
bb5f4a1f67
|
@ -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(
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue