RENAMED: Some Rectangle parameters with more descriptive names

This commit is contained in:
Ray
2026-06-03 20:16:12 +02:00
parent 895154bcb2
commit cef7718468
5 changed files with 74 additions and 74 deletions

View File

@@ -3983,22 +3983,22 @@ void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float
// Draw a billboard
void DrawBillboard(Camera camera, Texture2D texture, Vector3 position, float scale, Color tint)
{
Rectangle source = { 0.0f, 0.0f, (float)texture.width, (float)texture.height };
Rectangle rec = { 0.0f, 0.0f, (float)texture.width, (float)texture.height };
DrawBillboardRec(camera, texture, source, position, (Vector2){ scale*fabsf((float)source.width/source.height), scale }, tint);
DrawBillboardRec(camera, texture, rec, position, (Vector2){ scale*fabsf((float)rec.width/rec.height), scale }, tint);
}
// Draw a billboard (part of a texture defined by a rectangle)
void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint)
void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle rec, Vector3 position, Vector2 size, Color tint)
{
// NOTE: Billboard locked on axis-Y
Vector3 up = { 0.0f, 1.0f, 0.0f };
DrawBillboardPro(camera, texture, source, position, up, size, Vector2Scale(size, 0.5), 0.0f, tint);
DrawBillboardPro(camera, texture, rec, position, up, size, Vector2Scale(size, 0.5), 0.0f, tint);
}
// Draw a billboard with additional parameters
void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint)
// Draw a billboard texture defined by source rectangle with scaling and rotation
void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle rec, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint)
{
// Compute the up vector and the right vector
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
@@ -4009,20 +4009,20 @@ void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector
// Flip the content of the billboard while maintaining the counterclockwise edge rendering order
if (size.x < 0.0f)
{
source.x -= size.x;
source.width *= -1.0;
rec.x -= size.x;
rec.width *= -1.0;
right = Vector3Negate(right);
origin.x *= -1.0f;
}
if (size.y < 0.0f)
{
source.y -= size.y;
source.height *= -1.0;
rec.y -= size.y;
rec.height *= -1.0;
up = Vector3Negate(up);
origin.y *= -1.0f;
}
// Draw the texture region described by source on the following rectangle in 3D space:
// Draw the texture region described by rec on the following rectangle in 3D space:
//
// size.x <--.
// 3 ^---------------------------+ 2 \ rotation
@@ -4054,10 +4054,10 @@ void DrawBillboardPro(Camera camera, Texture2D texture, Rectangle source, Vector
}
Vector2 texcoords[4];
texcoords[0] = (Vector2){ (float)source.x/texture.width, (float)(source.y + source.height)/texture.height };
texcoords[1] = (Vector2){ (float)(source.x + source.width)/texture.width, (float)(source.y + source.height)/texture.height };
texcoords[2] = (Vector2){ (float)(source.x + source.width)/texture.width, (float)source.y/texture.height };
texcoords[3] = (Vector2){ (float)source.x/texture.width, (float)source.y/texture.height };
texcoords[0] = (Vector2){ (float)rec.x/texture.width, (float)(rec.y + rec.height)/texture.height };
texcoords[1] = (Vector2){ (float)(rec.x + rec.width)/texture.width, (float)(rec.y + rec.height)/texture.height };
texcoords[2] = (Vector2){ (float)(rec.x + rec.width)/texture.width, (float)rec.y/texture.height };
texcoords[3] = (Vector2){ (float)rec.x/texture.width, (float)rec.y/texture.height };
rlSetTexture(texture.id);
rlBegin(RL_QUADS);