mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Moved most love.math functions out of the Math class, since they're pure functions.
--HG-- branch : minor
This commit is contained in:
@@ -42,9 +42,9 @@ void gammaCorrectColor(Colorf &c)
|
||||
{
|
||||
if (isGammaCorrect())
|
||||
{
|
||||
c.r = math::Math::instance.gammaToLinear(c.r);
|
||||
c.g = math::Math::instance.gammaToLinear(c.g);
|
||||
c.b = math::Math::instance.gammaToLinear(c.b);
|
||||
c.r = math::gammaToLinear(c.r);
|
||||
c.g = math::gammaToLinear(c.g);
|
||||
c.b = math::gammaToLinear(c.b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ void unGammaCorrectColor(Colorf &c)
|
||||
{
|
||||
if (isGammaCorrect())
|
||||
{
|
||||
c.r = math::Math::instance.linearToGamma(c.r);
|
||||
c.g = math::Math::instance.linearToGamma(c.g);
|
||||
c.b = math::Math::instance.linearToGamma(c.b);
|
||||
c.r = math::linearToGamma(c.r);
|
||||
c.g = math::linearToGamma(c.g);
|
||||
c.b = math::linearToGamma(c.b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ void Graphics::clear(const std::vector<OptionalColorf> &colors)
|
||||
if (isGammaCorrect())
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
c[i] = math::Math::instance.gammaToLinear(c[i]);
|
||||
c[i] = math::gammaToLinear(c[i]);
|
||||
}
|
||||
|
||||
if (GLAD_ES_VERSION_3_0 || GLAD_VERSION_3_0)
|
||||
|
||||
@@ -159,12 +159,11 @@ static int w__Shader_sendFloat(lua_State *L, bool colors)
|
||||
{
|
||||
// the fourth component (alpha) is always already linear, if it exists.
|
||||
int ncomponents = std::min((int) dimension, 3);
|
||||
const auto &m = love::math::Math::instance;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
for (int j = 0; j < ncomponents; j++)
|
||||
values[i * dimension + j] = m.gammaToLinear(values[i * dimension + j]);
|
||||
values[i * dimension + j] = math::gammaToLinear(values[i * dimension + j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user