remove optional by pointer texture_region parameters

This commit is contained in:
veclavtalica
2025-02-20 16:19:03 +03:00
parent 991196f7c8
commit b67bc92857
5 changed files with 23 additions and 15 deletions

View File

@@ -12,7 +12,7 @@
void draw_billboard(char const *texture,
Vec3 position,
Vec2 size,
Rect const *texture_region,
Rect texture_region,
Color color,
bool cylindrical)
{
@@ -26,16 +26,19 @@ void draw_billboard(char const *texture,
batch_p = &ctx.billboard_batches[hmlenu(ctx.billboard_batches) - 1]; /* TODO: can last index be used? */
}
bool const texture_region_valid = fabsf(texture_region.w - texture_region.h) > 0.00001f
&& fabsf(0.0f - texture_region.w) > 0.00001f;
struct SpaceBillboard billboard = {
.color = color,
.cylindrical = cylindrical,
.position = position,
.size = size,
.texture_region_opt_set = texture_region != NULL,
.texture_region_opt_set = texture_region_valid,
};
if (texture_region)
billboard.texture_region_opt = *texture_region;
if (texture_region_valid)
billboard.texture_region_opt = texture_region;
struct SpaceBillboard *billboards = (struct SpaceBillboard *)(void *)batch_p->value.primitives;