ref: 07f70200d06d1cfa2e0d2841d8f91e21228bd05f
parent: a0378dc30cff6eb367c4c0ad1e7b488fe880cda8
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Sep 8 08:48:25 EDT 2020
Renderer cleanup
--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -591,6 +591,20 @@
if (vertex_buffer_slot != NULL)
{
+ vertex_buffer_slot->vertices[0][0].position.x = -1.0f;
+ vertex_buffer_slot->vertices[0][0].position.y = -1.0f;
+ vertex_buffer_slot->vertices[0][1].position.x = 1.0f;
+ vertex_buffer_slot->vertices[0][1].position.y = -1.0f;
+ vertex_buffer_slot->vertices[0][2].position.x = 1.0f;
+ vertex_buffer_slot->vertices[0][2].position.y = 1.0f;
+
+ vertex_buffer_slot->vertices[1][0].position.x = -1.0f;
+ vertex_buffer_slot->vertices[1][0].position.y = -1.0f;
+ vertex_buffer_slot->vertices[1][1].position.x = 1.0f;
+ vertex_buffer_slot->vertices[1][1].position.y = 1.0f;
+ vertex_buffer_slot->vertices[1][2].position.x = -1.0f;
+ vertex_buffer_slot->vertices[1][2].position.y = 1.0f;
+
vertex_buffer_slot->vertices[0][0].texture.x = 0.0f;
vertex_buffer_slot->vertices[0][0].texture.y = 1.0f;
vertex_buffer_slot->vertices[0][1].texture.x = 1.0f;
@@ -605,19 +619,6 @@
vertex_buffer_slot->vertices[1][2].texture.x = 0.0f;
vertex_buffer_slot->vertices[1][2].texture.y = 0.0f;
- vertex_buffer_slot->vertices[0][0].position.x = -1.0f;
- vertex_buffer_slot->vertices[0][0].position.y = -1.0f;
- vertex_buffer_slot->vertices[0][1].position.x = 1.0f;
- vertex_buffer_slot->vertices[0][1].position.y = -1.0f;
- vertex_buffer_slot->vertices[0][2].position.x = 1.0f;
- vertex_buffer_slot->vertices[0][2].position.y = 1.0f;
-
- vertex_buffer_slot->vertices[1][0].position.x = -1.0f;
- vertex_buffer_slot->vertices[1][0].position.y = -1.0f;
- vertex_buffer_slot->vertices[1][1].position.x = 1.0f;
- vertex_buffer_slot->vertices[1][1].position.y = 1.0f;
- vertex_buffer_slot->vertices[1][2].position.x = -1.0f;
- vertex_buffer_slot->vertices[1][2].position.y = 1.0f;
}
FlushVertexBuffer();
@@ -760,16 +761,30 @@
if (vertex_buffer_slot != NULL)
{
- const GLfloat texture_left = (GLfloat)rect->left / (GLfloat)source_surface->width;
- const GLfloat texture_right = (GLfloat)rect->right / (GLfloat)source_surface->width;
- const GLfloat texture_top = (GLfloat)rect->top / (GLfloat)source_surface->height;
- const GLfloat texture_bottom = (GLfloat)rect->bottom / (GLfloat)source_surface->height;
+ const GLfloat vertex_left = x * 2.0f / destination_surface->width - 1.0f;
+ const GLfloat vertex_top = y * 2.0f / destination_surface->height - 1.0f;
+ const GLfloat vertex_right = (x + (rect->right - rect->left)) * 2.0f / destination_surface->width - 1.0f;
+ const GLfloat vertex_bottom = (y + (rect->bottom - rect->top)) * 2.0f / destination_surface->height - 1.0f;
- const GLfloat vertex_left = (x * (2.0f / destination_surface->width)) - 1.0f;
- const GLfloat vertex_right = ((x + (rect->right - rect->left)) * (2.0f / destination_surface->width)) - 1.0f;
- const GLfloat vertex_top = (y * (2.0f / destination_surface->height)) - 1.0f;
- const GLfloat vertex_bottom = ((y + (rect->bottom - rect->top)) * (2.0f / destination_surface->height)) - 1.0f;
+ vertex_buffer_slot->vertices[0][0].position.x = vertex_left;
+ vertex_buffer_slot->vertices[0][0].position.y = vertex_top;
+ vertex_buffer_slot->vertices[0][1].position.x = vertex_right;
+ vertex_buffer_slot->vertices[0][1].position.y = vertex_top;
+ vertex_buffer_slot->vertices[0][2].position.x = vertex_right;
+ vertex_buffer_slot->vertices[0][2].position.y = vertex_bottom;
+ vertex_buffer_slot->vertices[1][0].position.x = vertex_left;
+ vertex_buffer_slot->vertices[1][0].position.y = vertex_top;
+ vertex_buffer_slot->vertices[1][1].position.x = vertex_right;
+ vertex_buffer_slot->vertices[1][1].position.y = vertex_bottom;
+ vertex_buffer_slot->vertices[1][2].position.x = vertex_left;
+ vertex_buffer_slot->vertices[1][2].position.y = vertex_bottom;
+
+ const GLfloat texture_left = rect->left / (GLfloat)source_surface->width;
+ const GLfloat texture_top = rect->top / (GLfloat)source_surface->height;
+ const GLfloat texture_right = rect->right / (GLfloat)source_surface->width;
+ const GLfloat texture_bottom = rect->bottom / (GLfloat)source_surface->height;
+
vertex_buffer_slot->vertices[0][0].texture.x = texture_left;
vertex_buffer_slot->vertices[0][0].texture.y = texture_top;
vertex_buffer_slot->vertices[0][1].texture.x = texture_right;
@@ -783,20 +798,6 @@
vertex_buffer_slot->vertices[1][1].texture.y = texture_bottom;
vertex_buffer_slot->vertices[1][2].texture.x = texture_left;
vertex_buffer_slot->vertices[1][2].texture.y = texture_bottom;
-
- vertex_buffer_slot->vertices[0][0].position.x = vertex_left;
- vertex_buffer_slot->vertices[0][0].position.y = vertex_top;
- vertex_buffer_slot->vertices[0][1].position.x = vertex_right;
- vertex_buffer_slot->vertices[0][1].position.y = vertex_top;
- vertex_buffer_slot->vertices[0][2].position.x = vertex_right;
- vertex_buffer_slot->vertices[0][2].position.y = vertex_bottom;
-
- vertex_buffer_slot->vertices[1][0].position.x = vertex_left;
- vertex_buffer_slot->vertices[1][0].position.y = vertex_top;
- vertex_buffer_slot->vertices[1][1].position.x = vertex_right;
- vertex_buffer_slot->vertices[1][1].position.y = vertex_bottom;
- vertex_buffer_slot->vertices[1][2].position.x = vertex_left;
- vertex_buffer_slot->vertices[1][2].position.y = vertex_bottom;
}
}
@@ -840,10 +841,10 @@
if (vertex_buffer_slot != NULL)
{
- const GLfloat vertex_left = (rect->left * (2.0f / surface->width)) - 1.0f;
- const GLfloat vertex_right = (rect->right * (2.0f / surface->width)) - 1.0f;
- const GLfloat vertex_top = (rect->top * (2.0f / surface->height)) - 1.0f;
- const GLfloat vertex_bottom = (rect->bottom * (2.0f / surface->height)) - 1.0f;
+ const GLfloat vertex_left = rect->left * 2.0f / surface->width - 1.0f;
+ const GLfloat vertex_top = rect->top * 2.0f / surface->height - 1.0f;
+ const GLfloat vertex_right = rect->right * 2.0f / surface->width - 1.0f;
+ const GLfloat vertex_bottom = rect->bottom * 2.0f / surface->height - 1.0f;
vertex_buffer_slot->vertices[0][0].position.x = vertex_left;
vertex_buffer_slot->vertices[0][0].position.y = vertex_top;
@@ -966,16 +967,30 @@
if (vertex_buffer_slot != NULL)
{
+ const GLfloat vertex_left = x * 2.0f / glyph_destination_surface->width - 1.0f;
+ const GLfloat vertex_top = y * 2.0f / glyph_destination_surface->height - 1.0f;
+ const GLfloat vertex_right = (x + glyph_width) * 2.0f / glyph_destination_surface->width - 1.0f;
+ const GLfloat vertex_bottom = (y + glyph_height) * 2.0f / glyph_destination_surface->height - 1.0f;
+
+ vertex_buffer_slot->vertices[0][0].position.x = vertex_left;
+ vertex_buffer_slot->vertices[0][0].position.y = vertex_top;
+ vertex_buffer_slot->vertices[0][1].position.x = vertex_right;
+ vertex_buffer_slot->vertices[0][1].position.y = vertex_top;
+ vertex_buffer_slot->vertices[0][2].position.x = vertex_right;
+ vertex_buffer_slot->vertices[0][2].position.y = vertex_bottom;
+
+ vertex_buffer_slot->vertices[1][0].position.x = vertex_left;
+ vertex_buffer_slot->vertices[1][0].position.y = vertex_top;
+ vertex_buffer_slot->vertices[1][1].position.x = vertex_right;
+ vertex_buffer_slot->vertices[1][1].position.y = vertex_bottom;
+ vertex_buffer_slot->vertices[1][2].position.x = vertex_left;
+ vertex_buffer_slot->vertices[1][2].position.y = vertex_bottom;
+
const GLfloat texture_left = glyph_x / (GLfloat)atlas->size;
- const GLfloat texture_right = (glyph_x + glyph_width) / (GLfloat)atlas->size;
const GLfloat texture_top = glyph_y / (GLfloat)atlas->size;
+ const GLfloat texture_right = (glyph_x + glyph_width) / (GLfloat)atlas->size;
const GLfloat texture_bottom = (glyph_y + glyph_height) / (GLfloat)atlas->size;
- const GLfloat vertex_left = (x * (2.0f / glyph_destination_surface->width)) - 1.0f;
- const GLfloat vertex_right = ((x + glyph_width) * (2.0f / glyph_destination_surface->width)) - 1.0f;
- const GLfloat vertex_top = (y * (2.0f / glyph_destination_surface->height)) - 1.0f;
- const GLfloat vertex_bottom = ((y + glyph_height) * (2.0f / glyph_destination_surface->height)) - 1.0f;
-
vertex_buffer_slot->vertices[0][0].texture.x = texture_left;
vertex_buffer_slot->vertices[0][0].texture.y = texture_top;
vertex_buffer_slot->vertices[0][1].texture.x = texture_right;
@@ -989,20 +1004,6 @@
vertex_buffer_slot->vertices[1][1].texture.y = texture_bottom;
vertex_buffer_slot->vertices[1][2].texture.x = texture_left;
vertex_buffer_slot->vertices[1][2].texture.y = texture_bottom;
-
- vertex_buffer_slot->vertices[0][0].position.x = vertex_left;
- vertex_buffer_slot->vertices[0][0].position.y = vertex_top;
- vertex_buffer_slot->vertices[0][1].position.x = vertex_right;
- vertex_buffer_slot->vertices[0][1].position.y = vertex_top;
- vertex_buffer_slot->vertices[0][2].position.x = vertex_right;
- vertex_buffer_slot->vertices[0][2].position.y = vertex_bottom;
-
- vertex_buffer_slot->vertices[1][0].position.x = vertex_left;
- vertex_buffer_slot->vertices[1][0].position.y = vertex_top;
- vertex_buffer_slot->vertices[1][1].position.x = vertex_right;
- vertex_buffer_slot->vertices[1][1].position.y = vertex_bottom;
- vertex_buffer_slot->vertices[1][2].position.x = vertex_left;
- vertex_buffer_slot->vertices[1][2].position.y = vertex_bottom;
}
}
--- a/src/Backends/Rendering/WiiU.cpp
+++ b/src/Backends/Rendering/WiiU.cpp
@@ -631,8 +631,8 @@
// Set vertex position buffer
const float vertex_left = x * 2.0f / destination_surface->width - 1.0f;
const float vertex_top = y * -2.0f / destination_surface->height + 1.0f;
- const float vertex_right = (x + rect->right - rect->left) * 2.0f / destination_surface->width - 1.0f;
- const float vertex_bottom = (y + rect->bottom - rect->top) * -2.0f / destination_surface->height + 1.0f;
+ const float vertex_right = (x + (rect->right - rect->left)) * 2.0f / destination_surface->width - 1.0f;
+ const float vertex_bottom = (y + (rect->bottom - rect->top)) * -2.0f / destination_surface->height + 1.0f;
vertex_buffer_slot->vertices[0].position.x = vertex_left;
vertex_buffer_slot->vertices[0].position.y = vertex_top;