mirror of
https://github.com/raysan5/raylib.git
synced 2026-08-25 13:48:27 -04:00
Compare commits
2 Commits
4640c84920
...
d224912bd5
| Author | SHA1 | Date | |
|---|---|---|---|
| d224912bd5 | |||
| 39706cccbe |
4
src/external/rlsw.h
vendored
4
src/external/rlsw.h
vendored
@ -3909,7 +3909,6 @@ static void sw_immediate_set_color(const float color[4])
|
||||
RLSW.primitive.color[2] = color[2];
|
||||
RLSW.primitive.color[3] = color[3];
|
||||
|
||||
RLSW.primitive.hasColorAlpha |= (color[3] < 1.0f);
|
||||
}
|
||||
|
||||
static void sw_immediate_set_texcoord(const float texcoord[2])
|
||||
@ -3948,6 +3947,9 @@ static void sw_immediate_push_vertex(const float position[4])
|
||||
for (int i = 0; i < 4; i++) vertex->color[i] = RLSW.primitive.color[i];
|
||||
for (int i = 0; i < 2; i++) vertex->texcoord[i] = RLSW.primitive.texcoord[i];
|
||||
|
||||
// Track whether any vertex in this primitive has alpha < 1.0
|
||||
RLSW.primitive.hasColorAlpha |= (vertex->color[3] < 1.0f);
|
||||
|
||||
// Immediate rendering of the primitive if the required number is reached
|
||||
if (RLSW.primitive.vertexCount == SW_PRIMITIVE_VERTEX_COUNT[RLSW.drawMode])
|
||||
{
|
||||
|
||||
@ -888,14 +888,13 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co
|
||||
// Draw rectangle with rounded edges
|
||||
void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, Color color)
|
||||
{
|
||||
// NOTE: For line thicknes <=1.0f using RL_LINES, otherwise using RL_QUADS/RL_TRIANGLES
|
||||
DrawRectangleRoundedLinesEx(rec, roundness, segments, 1.0f, color);
|
||||
}
|
||||
|
||||
// Draw rectangle with rounded edges outline with line thickness
|
||||
void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, float thick, Color color)
|
||||
{
|
||||
if (thick < 0) thick = 0;
|
||||
if (thick <= 0) return;
|
||||
|
||||
// Not a rounded rectangle
|
||||
if (roundness <= 0.0f)
|
||||
@ -966,8 +965,6 @@ void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, f
|
||||
|
||||
const float angles[4] = { 180.0f, 270.0f, 0.0f, 90.0f };
|
||||
|
||||
if (thick > 1)
|
||||
{
|
||||
#if SUPPORT_QUADS_DRAW_MODE
|
||||
rlSetTexture(GetShapesTexture().id);
|
||||
Rectangle shapeRect = GetShapesTextureRectangle();
|
||||
@ -1107,35 +1104,6 @@ void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, f
|
||||
rlVertex2f(point[14].x, point[14].y);
|
||||
rlEnd();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use LINES to draw the outline
|
||||
rlBegin(RL_LINES);
|
||||
// Draw all the 4 corners first: Upper Left Corner, Upper Right Corner, Lower Right Corner, Lower Left Corner
|
||||
for (int k = 0; k < 4; ++k) // Hope the compiler is smart enough to unroll this loop
|
||||
{
|
||||
float angle = angles[k];
|
||||
const Vector2 center = centers[k];
|
||||
|
||||
for (int i = 0; i < segments; i++)
|
||||
{
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlVertex2f(center.x + cosf(DEG2RAD*angle)*outerRadius, center.y + sinf(DEG2RAD*angle)*outerRadius);
|
||||
rlVertex2f(center.x + cosf(DEG2RAD*(angle + stepLength))*outerRadius, center.y + sinf(DEG2RAD*(angle + stepLength))*outerRadius);
|
||||
angle += stepLength;
|
||||
}
|
||||
}
|
||||
|
||||
// And now the remaining 4 lines
|
||||
for (int i = 0; i < 8; i += 2)
|
||||
{
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlVertex2f(point[i].x, point[i].y);
|
||||
rlVertex2f(point[i + 1].x, point[i + 1].y);
|
||||
}
|
||||
rlEnd();
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a polygon of n sides
|
||||
|
||||
Reference in New Issue
Block a user