double elev = sg_random() * SGD_PI;
x = width * cos(theta) * 0.5f * sin(elev);
y = width * sin(theta) * 0.5f * sin(elev);
- z = height * cos(elev) * 0.5f;
+ z = height * cos(elev) * 0.5f;
}
- // Determine the height and width as scaling factors on the minimum size (used to create the quad)
+ // Determine the height and width as scaling factors on the minimum size (used to create the quad).
float sprite_width = 1.0f + sg_random() * (max_sprite_width - min_sprite_width) / min_sprite_width;
float sprite_height = 1.0f + sg_random() * (max_sprite_height - min_sprite_height) / min_sprite_height;
-
- if (i == 2) {
+
+ // Sprites are never taller than square.
+ if (sprite_height * min_sprite_height > sprite_width * min_sprite_width)
+ {
+ sprite_height = sprite_width * min_sprite_width / min_sprite_height;
+ }
+
+ if (i == 0) {
// The center sprite is always maximum size to fill up any holes.
sprite_width = 1.0f + (max_sprite_width - min_sprite_width) / min_sprite_width;
sprite_height = 1.0f + (max_sprite_height - min_sprite_height) / min_sprite_height;