mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Color values in love's APIs are now in the range of [0, 1] rather than [0, 255].
--HG-- branch : minor
This commit is contained in:
@@ -440,11 +440,9 @@ void Graphics::reset()
|
||||
|
||||
void Graphics::clear(Colorf c)
|
||||
{
|
||||
Colorf nc = Colorf(c.r/255.0f, c.g/255.0f, c.b/255.0f, c.a/255.0f);
|
||||
gammaCorrectColor(c);
|
||||
|
||||
gammaCorrectColor(nc);
|
||||
|
||||
glClearColor(nc.r, nc.g, nc.b, nc.a);
|
||||
glClearColor(c.r, c.g, c.b, c.a);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
if (gl.bugs.clearRequiresDriverTextureStateUpdate && Shader::current)
|
||||
@@ -479,7 +477,7 @@ void Graphics::clear(const std::vector<OptionalColorf> &colors)
|
||||
if (!colors[i].enabled)
|
||||
continue;
|
||||
|
||||
GLfloat c[] = {colors[i].r/255.f, colors[i].g/255.f, colors[i].b/255.f, colors[i].a/255.f};
|
||||
GLfloat c[] = {colors[i].r, colors[i].g, colors[i].b, colors[i].a};
|
||||
|
||||
// TODO: Investigate a potential bug on AMD drivers in Windows/Linux
|
||||
// which apparently causes the clear color to be incorrect when mixed
|
||||
@@ -943,11 +941,10 @@ bool Graphics::isGammaCorrect() const
|
||||
|
||||
void Graphics::setColor(Colorf c)
|
||||
{
|
||||
Colorf nc = Colorf(c.r/255.0f, c.g/255.0f, c.b/255.0f, c.a/255.0f);
|
||||
|
||||
Colorf nc = c;
|
||||
gammaCorrectColor(nc);
|
||||
|
||||
glVertexAttrib4f(ATTRIB_CONSTANTCOLOR, nc.r, nc.g, nc.b, nc.a);
|
||||
|
||||
states.back().color = c;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user