summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/models/models_billboard.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/models/models_billboard.c b/examples/models/models_billboard.c
index 237e1b69..7ad28513 100644
--- a/examples/models/models_billboard.c
+++ b/examples/models/models_billboard.c
@@ -44,10 +44,12 @@ int main(void)
// NOTE: Billboard locked on axis-Y
Vector3 billUp = { 0.0f, 1.0f, 0.0f };
+ // Set the height of the rotating billboard to 1.0 with the aspect ratio fixed
+ Vector2 size = { source.width / source.height, 1.0f };
+
// Rotate around origin
// Here we choose to rotate around the image center
- // NOTE: (-1, 1) is the range where origin.x, origin.y is inside the texture
- Vector2 rotateOrigin = { 0.0f };
+ Vector2 origin = Vector2Scale(size, 0.5f);
// Distance is needed for the correct billboard draw order
// Larger distance (further away from the camera) should be drawn prior to smaller distance.
@@ -84,11 +86,11 @@ int main(void)
if (distanceStatic > distanceRotating)
{
DrawBillboard(camera, bill, billPositionStatic, 2.0f, WHITE);
- DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, (Vector2) {1.0f, 1.0f}, rotateOrigin, rotation, WHITE);
+ DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, size, origin, rotation, WHITE);
}
else
{
- DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, (Vector2) {1.0f, 1.0f}, rotateOrigin, rotation, WHITE);
+ DrawBillboardPro(camera, bill, source, billPositionRotating, billUp, size, origin, rotation, WHITE);
DrawBillboard(camera, bill, billPositionStatic, 2.0f, WHITE);
}
@@ -108,4 +110,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
-} \ No newline at end of file
+}