From 6bd63de8d052f99e08ec20c0e0f13b2b4b5eed2b Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 11 May 2021 01:02:53 +0200 Subject: [PATCH] Reviewed latest PR REMOVED: DrawBillboardEx() --- src/models.c | 19 ++++++------------- src/raylib.h | 5 ++--- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/models.c b/src/models.c index 7a0ce8ad..177a1123 100644 --- a/src/models.c +++ b/src/models.c @@ -2798,25 +2798,17 @@ void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float } // Draw a billboard -void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint) +void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint) { Rectangle source = { 0.0f, 0.0f, (float)texture.width, (float)texture.height }; - DrawBillboardRec(camera, texture, source, center, (Vector2){ size, size }, tint); + DrawBillboardRec(camera, texture, source, position, (Vector2){ size, size }, tint); } // Draw a billboard (part of a texture defined by a rectangle) -void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 center, Vector2 size, Color tint) +void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint) { - DrawBillboardPro(camera, texture, source, center, size, Vector2Zero(), 0.0f, tint); -} - -// Draw a billboard (part of a texture defined by a rectangle) -void DrawBillboardEx(Camera camera, Texture2D texture, Vector3 center, Vector2 origin, float rotation, Vector2 size, Color tint) -{ - Rectangle source = { 0.0f, 0.0f, (float)texture.width, (float)texture.height }; - - DrawBillboardPro(camera, texture, source, center, size, origin, rotation, tint); + DrawBillboardPro(camera, texture, source, position, size, Vector2Zero(), 0.0f, tint); } void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Vector2 origin, float rotation, Color tint) @@ -2880,7 +2872,8 @@ void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector bottomLeft = Vector3Add(Vector3Scale(up, rotatedY), Vector3Scale(right, rotatedX)); } - topLeft = Vector3Add(topLeft, position); // Translate points to the draw center (position) + // Translate points to the draw center (position) + topLeft = Vector3Add(topLeft, position); topRight = Vector3Add(topRight, position); bottomRight = Vector3Add(bottomRight, position); bottomLeft = Vector3Add(bottomLeft, position); diff --git a/src/raylib.h b/src/raylib.h index c525ad2f..d0548fab 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1443,9 +1443,8 @@ RLAPI void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, floa RLAPI void DrawModelWires(Model model, Vector3 position, float scale, Color tint); // Draw a model wires (with texture if set) RLAPI void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters RLAPI void DrawBoundingBox(BoundingBox box, Color color); // Draw bounding box (wires) -RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture -RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 center, Vector2 size, Color tint); // Draw a billboard texture defined by source -RLAPI void DrawBillboardEx(Camera camera, Texture2D texture, Vector3 center, Vector2 origin, float rotation, Vector2 size, Color tint); // Draw a billboard texture defined by rotation +RLAPI void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float size, Color tint); // Draw a billboard texture +RLAPI void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint); // Draw a billboard texture defined by source RLAPI void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Vector2 origin, float rotation, Color tint); // Draw a billboard texture defined by source and rotation // Collision detection functions