generate_rectangle_gpu_sprite now accepts texture coordinates

This commit is contained in:
CobaltXII
2019-01-03 16:59:48 -05:00
parent d723bc8ad2
commit e3d8be2eb9

View File

@@ -179,7 +179,7 @@ gpu_sprite* generate_test_gpu_sprite()
// Generate a rectangle sprite.
gpu_sprite* generate_rectangle_gpu_sprite(int x_tl, int y_tl, int x_br, int y_br, int x_res, int y_res, GLuint texture)
gpu_sprite* generate_rectangle_gpu_sprite(int x_tl, int y_tl, int x_br, int y_br, float x_ttl, float y_ttl, float x_tbr, float y_tbr, int x_res, int y_res, GLuint texture)
{
cpu_sprite* my_cpu_sprite = allocate_sprite(6);
@@ -189,13 +189,13 @@ gpu_sprite* generate_rectangle_gpu_sprite(int x_tl, int y_tl, int x_br, int y_br
float x_brf = x_br / float(x_res) * 2.0f - 1.0f;
float y_brf = y_br / float(y_res) * 2.0f - 1.0f;
write_vertex(my_cpu_sprite, x_tlf, -y_tlf, 0.0f, 0.0f);
write_vertex(my_cpu_sprite, x_tlf, -y_brf, 0.0f, 1.0f);
write_vertex(my_cpu_sprite, x_brf, -y_brf, 1.0f, 1.0f);
write_vertex(my_cpu_sprite, x_tlf, -y_tlf, x_ttl, y_ttl);
write_vertex(my_cpu_sprite, x_tlf, -y_brf, x_ttl, y_tbr);
write_vertex(my_cpu_sprite, x_brf, -y_brf, x_tbr, y_tbr);
write_vertex(my_cpu_sprite, x_tlf, -y_tlf, 0.0f, 0.0f);
write_vertex(my_cpu_sprite, x_brf, -y_brf, 1.0f, 1.0f);
write_vertex(my_cpu_sprite, x_brf, -y_tlf, 1.0f, 0.0f);
write_vertex(my_cpu_sprite, x_tlf, -y_tlf, x_ttl, y_ttl);
write_vertex(my_cpu_sprite, x_brf, -y_brf, x_tbr, y_tbr);
write_vertex(my_cpu_sprite, x_brf, -y_tlf, x_tbr, y_ttl);
gpu_sprite* my_gpu_sprite = make_gpu_sprite(my_cpu_sprite, texture);