mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Switch quads over to floats instead of ints (issue #285)
This commit is contained in:
@@ -33,7 +33,7 @@ namespace graphics
|
||||
{
|
||||
namespace opengl
|
||||
{
|
||||
Quad::Quad(const Viewport & v, int sw, int sh)
|
||||
Quad::Quad(const Viewport & v, float sw, float sh)
|
||||
: sw(sw), sh(sh)
|
||||
{
|
||||
memset(vertices, 255, sizeof(vertex)*4);
|
||||
@@ -44,7 +44,7 @@ namespace opengl
|
||||
{
|
||||
}
|
||||
|
||||
void Quad::refresh(const Viewport & v, int sw, int sh)
|
||||
void Quad::refresh(const Viewport & v, float sw, float sh)
|
||||
{
|
||||
if (!GLEE_ARB_texture_non_power_of_two)
|
||||
{
|
||||
@@ -56,20 +56,20 @@ namespace opengl
|
||||
vertices[0].x = 0;
|
||||
vertices[0].y = 0;
|
||||
vertices[1].x = 0;
|
||||
vertices[1].y = (float)v.h;
|
||||
vertices[2].x = (float)v.w;
|
||||
vertices[2].y = (float)v.h;
|
||||
vertices[3].x = (float)v.w;
|
||||
vertices[1].y = v.h;
|
||||
vertices[2].x = v.w;
|
||||
vertices[2].y = v.h;
|
||||
vertices[3].x = v.w;
|
||||
vertices[3].y = 0;
|
||||
|
||||
vertices[0].s = (float)v.x/(float)sw;
|
||||
vertices[0].t = (float)v.y/(float)sh;
|
||||
vertices[1].s = (float)v.x/(float)sw;
|
||||
vertices[1].t = (float)(v.y+v.h)/(float)sh;
|
||||
vertices[2].s = (float)(v.x+v.w)/(float)sw;
|
||||
vertices[2].t = (float)(v.y+v.h)/(float)sh;
|
||||
vertices[3].s = (float)(v.x+v.w)/(float)sw;
|
||||
vertices[3].t = (float)v.y/(float)sh;
|
||||
vertices[0].s = v.x/sw;
|
||||
vertices[0].t = v.y/sh;
|
||||
vertices[1].s = v.x/sw;
|
||||
vertices[1].t = (v.y+v.h)/sh;
|
||||
vertices[2].s = (v.x+v.w)/sw;
|
||||
vertices[2].t = (v.y+v.h)/sh;
|
||||
vertices[3].s = (v.x+v.w)/sw;
|
||||
vertices[3].t = v.y/sh;
|
||||
}
|
||||
|
||||
void Quad::setViewport(const Quad::Viewport & v)
|
||||
|
||||
Reference in New Issue
Block a user