Renamed Shader:getExternVariable to Shader:getUniformVariable. The "extern" alias for shader uniforms is considered deprecated, although it still exists.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-09-01 18:15:25 -03:00
parent 0ca5e57c3f
commit ee79038572
3 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -621,7 +621,7 @@ int Shader::getTextureUnit(const std::string &name)
return texunit;
}
Shader::UniformType Shader::getExternVariable(const std::string &name, int &components, int &count)
Shader::UniformType Shader::getUniformVariable(const std::string &name, int &components, int &count)
{
auto it = uniforms.find(name);
+7 -7
View File
@@ -55,7 +55,7 @@ public:
STAGE_MAX_ENUM
};
// Built-in uniform (extern) variables.
// Built-in uniform variables.
enum BuiltinUniform
{
BUILTIN_TRANSFORM_MATRIX = 0,
@@ -70,7 +70,7 @@ public:
BUILTIN_MAX_ENUM
};
// Types of potential uniform (extern) variables used in love's shaders.
// Types of potential uniform variables used in love's shaders.
enum UniformType
{
UNIFORM_FLOAT,
@@ -169,16 +169,16 @@ public:
/**
* Gets the type, number of components, and number of array elements of
* an active 'extern' (uniform) variable in the shader. If a uniform
* variable with the specified name doesn't exist, returns UNIFORM_UNKNOWN
* and sets the 'components' and 'count' values to 0.
* an active uniform variable in the shader. If a uniform variable with the
* specified name doesn't exist, returns UNIFORM_UNKNOWN and sets the
* 'components' and 'count' values to 0.
*
* @param name The name of the uniform variable in the source code.
* @param[out] components Number of components of the variable (2 for vec2.)
* @param[out] count Number of array elements, if the variable is an array.
* @return The base type of the uniform variable.
**/
UniformType getExternVariable(const std::string &name, int &components, int &count);
UniformType getUniformVariable(const std::string &name, int &components, int &count);
GLint getAttribLocation(const std::string &name);
@@ -221,7 +221,7 @@ public:
private:
// Represents a single uniform/extern shader variable.
// Represents a single uniform shader variable.
struct Uniform
{
GLint location;
+4 -4
View File
@@ -324,7 +324,7 @@ int w_Shader_send(lua_State *L)
return luaL_argerror(L, 3, "number, boolean, table, image, or canvas expected");
}
int w_Shader_getExternVariable(lua_State *L)
int w_Shader_getUniformVariable(lua_State *L)
{
Shader *shader = luax_checkshader(L, 1);
const char *name = luaL_checkstring(L, 2);
@@ -333,14 +333,14 @@ int w_Shader_getExternVariable(lua_State *L)
int arrayelements = 0;
Shader::UniformType type = Shader::UNIFORM_UNKNOWN;
type = shader->getExternVariable(name, components, arrayelements);
type = shader->getUniformVariable(name, components, arrayelements);
// Check if the variable exists (function will set components to 0 if not.)
if (components > 0)
{
const char *tname = nullptr;
if (!Shader::getConstant(type, tname))
return luaL_error(L, "Unknown extern variable type name.");
return luaL_error(L, "Unknown uniform variable type name.");
lua_pushstring(L, tname);
lua_pushinteger(L, components);
@@ -366,7 +366,7 @@ static const luaL_Reg w_Shader_functions[] =
{ "sendMatrix", w_Shader_sendMatrix },
{ "sendTexture", w_Shader_sendTexture },
{ "send", w_Shader_send },
{ "getExternVariable", w_Shader_getExternVariable },
{ "getUniformVariable", w_Shader_getUniformVariable },
{ 0, 0 }
};