(D3D) Simplify struct overlay_vertex

This commit is contained in:
twinaphex 2015-11-11 04:07:48 +01:00
parent fd12b4b957
commit a61c529d20

View File

@ -1290,9 +1290,7 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay)
unsigned i;
struct overlay_vertex
{
float x, y, z;
float u, v;
float r, g, b, a;
float v[9];
} vert[4];
float overlay_width, overlay_height;
#ifndef _XBOX1
@ -1325,9 +1323,11 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay)
for (i = 0; i < 4; i++)
{
vert[i].z = 0.5f;
vert[i].r = vert[i].g = vert[i].b = 1.0f;
vert[i].a = overlay->alpha_mod;
vert[i].v[2] = 0.5f;
vert[i].v[5] = 1.0f;
vert[i].v[6] = 1.0f;
vert[i].v[7] = 1.0f;
vert[i].v[8] = overlay->alpha_mod;
}
d3d_viewport_info(d3d, &vp);
@ -1335,33 +1335,33 @@ static void d3d_overlay_render(d3d_video_t *d3d, overlay_t *overlay)
overlay_width = vp.width;
overlay_height = vp.height;
vert[0].x = overlay->vert_coords[0] * overlay_width;
vert[1].x = (overlay->vert_coords[0] + overlay->vert_coords[2])
vert[0].v[0] = overlay->vert_coords[0] * overlay_width;
vert[1].v[0] = (overlay->vert_coords[0] + overlay->vert_coords[2])
* overlay_width;
vert[2].x = overlay->vert_coords[0] * overlay_width;
vert[3].x = (overlay->vert_coords[0] + overlay->vert_coords[2])
vert[2].v[0] = overlay->vert_coords[0] * overlay_width;
vert[3].v[0] = (overlay->vert_coords[0] + overlay->vert_coords[2])
* overlay_width;
vert[0].y = overlay->vert_coords[1] * overlay_height;
vert[1].y = overlay->vert_coords[1] * overlay_height;
vert[2].y = (overlay->vert_coords[1] + overlay->vert_coords[3])
vert[0].v[1] = overlay->vert_coords[1] * overlay_height;
vert[1].v[1] = overlay->vert_coords[1] * overlay_height;
vert[2].v[1] = (overlay->vert_coords[1] + overlay->vert_coords[3])
* overlay_height;
vert[3].y = (overlay->vert_coords[1] + overlay->vert_coords[3])
vert[3].v[1] = (overlay->vert_coords[1] + overlay->vert_coords[3])
* overlay_height;
vert[0].u = overlay->tex_coords[0];
vert[1].u = overlay->tex_coords[0] + overlay->tex_coords[2];
vert[2].u = overlay->tex_coords[0];
vert[3].u = overlay->tex_coords[0] + overlay->tex_coords[2];
vert[0].v = overlay->tex_coords[1];
vert[1].v = overlay->tex_coords[1];
vert[2].v = overlay->tex_coords[1] + overlay->tex_coords[3];
vert[3].v = overlay->tex_coords[1] + overlay->tex_coords[3];
vert[0].v[3] = overlay->tex_coords[0];
vert[1].v[3] = overlay->tex_coords[0] + overlay->tex_coords[2];
vert[2].v[3] = overlay->tex_coords[0];
vert[3].v[3] = overlay->tex_coords[0] + overlay->tex_coords[2];
vert[0].v[4] = overlay->tex_coords[1];
vert[1].v[4] = overlay->tex_coords[1];
vert[2].v[4] = overlay->tex_coords[1] + overlay->tex_coords[3];
vert[3].v[4] = overlay->tex_coords[1] + overlay->tex_coords[3];
/* Align texels and vertices. */
for (i = 0; i < 4; i++)
{
vert[i].x -= 0.5f;
vert[i].y += 0.5f;
vert[i].v[0] -= 0.5f;
vert[i].v[1] += 0.5f;
}
overlay->vert_buf->Lock(0, sizeof(vert), &verts, 0);