mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +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:
@@ -234,7 +234,7 @@ static int getGammaArgs(lua_State *L, float color[4])
|
||||
for (int i = 1; i <= n && i <= 4; i++)
|
||||
{
|
||||
lua_rawgeti(L, 1, i);
|
||||
color[i - 1] = (float) luaL_checknumber(L, -1) / 255.0f;
|
||||
color[i - 1] = (float) luaL_checknumber(L, -1);
|
||||
numcomponents++;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ static int getGammaArgs(lua_State *L, float color[4])
|
||||
int n = lua_gettop(L);
|
||||
for (int i = 1; i <= n && i <= 4; i++)
|
||||
{
|
||||
color[i - 1] = (float) luaL_checknumber(L, i) / 255.0f;
|
||||
color[i - 1] = (float) luaL_checknumber(L, i);
|
||||
numcomponents++;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ int w_gammaToLinear(lua_State *L)
|
||||
// Alpha should always be linear.
|
||||
if (i < 3)
|
||||
color[i] = Math::instance.gammaToLinear(color[i]);
|
||||
lua_pushnumber(L, color[i] * 255);
|
||||
lua_pushnumber(L, color[i]);
|
||||
}
|
||||
|
||||
return numcomponents;
|
||||
@@ -282,7 +282,7 @@ int w_linearToGamma(lua_State *L)
|
||||
// Alpha should always be linear.
|
||||
if (i < 3)
|
||||
color[i] = Math::instance.linearToGamma(color[i]);
|
||||
lua_pushnumber(L, color[i] * 255);
|
||||
lua_pushnumber(L, color[i]);
|
||||
}
|
||||
|
||||
return numcomponents;
|
||||
|
||||
Reference in New Issue
Block a user