From cef1e6e2e2a015d56b3018465f9094887ff94bdd Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 11 Aug 2019 21:26:12 +0200 Subject: [PATCH] Added notes about vertex order --- src/raylib.h | 6 +++--- src/shapes.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index 3cb8d327b..37557c613 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1054,9 +1054,9 @@ RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color c RLAPI void DrawRectangleLinesEx(Rectangle rec, int lineThick, Color color); // Draw rectangle outline with extended parameters RLAPI void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color color); // Draw rectangle with rounded edges RLAPI void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color); // Draw rectangle with rounded edges outline -RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle -RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline -RLAPI void DrawTriangleFan(Vector2 *points, int numPoints, Color color); // Draw a triangle fan defined by points +RLAPI void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw a color-filled triangle (vertex in counter-clockwise order!) +RLAPI void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color); // Draw triangle outline (vertex in counter-clockwise order!) +RLAPI void DrawTriangleFan(Vector2 *points, int numPoints, Color color); // Draw a triangle fan defined by points (first vertex is the center) RLAPI void DrawTriangleStrip(Vector2 *points, int pointsCount, Color color); // Draw a triangle strip defined by points RLAPI void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a regular polygon (Vector version) diff --git a/src/shapes.c b/src/shapes.c index d1956b26a..6217d2ada 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -1179,6 +1179,7 @@ void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int } // Draw a triangle +// NOTE: Vertex must be provided in counter-clockwise order void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color) { if (rlCheckBufferLimit(4)) rlglDraw(); @@ -1214,6 +1215,7 @@ void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color) } // Draw a triangle using lines +// NOTE: Vertex must be provided in counter-clockwise order void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color) { if (rlCheckBufferLimit(6)) rlglDraw(); @@ -1232,7 +1234,7 @@ void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color) } // Draw a triangle fan defined by points -// NOTE: First point provided is shared by all triangles +// NOTE: First vertex provided is the center, shared by all triangles void DrawTriangleFan(Vector2 *points, int pointsCount, Color color) { if (pointsCount >= 3) @@ -1263,7 +1265,7 @@ void DrawTriangleFan(Vector2 *points, int pointsCount, Color color) } // Draw a triangle strip defined by points -// NOTE: Every new point connects with previous two +// NOTE: Every new vertex connects with previous two void DrawTriangleStrip(Vector2 *points, int pointsCount, Color color) { if (pointsCount >= 3)