|
|
@@ -31,7 +31,20 @@ void luaRegister_MaterialParameter()
|
|
|
{"getSampler", lua_MaterialParameter_getSampler},
|
|
|
{"release", lua_MaterialParameter_release},
|
|
|
{"setAnimationPropertyValue", lua_MaterialParameter_setAnimationPropertyValue},
|
|
|
+ {"setFloat", lua_MaterialParameter_setFloat},
|
|
|
+ {"setFloatArray", lua_MaterialParameter_setFloatArray},
|
|
|
+ {"setInt", lua_MaterialParameter_setInt},
|
|
|
+ {"setIntArray", lua_MaterialParameter_setIntArray},
|
|
|
+ {"setMatrix", lua_MaterialParameter_setMatrix},
|
|
|
+ {"setMatrixArray", lua_MaterialParameter_setMatrixArray},
|
|
|
+ {"setSampler", lua_MaterialParameter_setSampler},
|
|
|
{"setValue", lua_MaterialParameter_setValue},
|
|
|
+ {"setVector2", lua_MaterialParameter_setVector2},
|
|
|
+ {"setVector2Array", lua_MaterialParameter_setVector2Array},
|
|
|
+ {"setVector3", lua_MaterialParameter_setVector3},
|
|
|
+ {"setVector3Array", lua_MaterialParameter_setVector3Array},
|
|
|
+ {"setVector4", lua_MaterialParameter_setVector4},
|
|
|
+ {"setVector4Array", lua_MaterialParameter_setVector4Array},
|
|
|
{NULL, NULL}
|
|
|
};
|
|
|
const luaL_Reg lua_statics[] =
|
|
|
@@ -969,6 +982,409 @@ int lua_MaterialParameter_setAnimationPropertyValue(lua_State* state)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+int lua_MaterialParameter_setFloat(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ lua_type(state, 2) == LUA_TNUMBER)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ float param1 = (float)luaL_checknumber(state, 2);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setFloat(param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setFloat - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setFloatArray(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ gameplay::ScriptUtil::LuaArray<float> param1 = gameplay::ScriptUtil::getFloatPointer(2);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setFloatArray(param1, param2);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setFloatArray - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 4:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 4) == LUA_TBOOLEAN)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ gameplay::ScriptUtil::LuaArray<float> param1 = gameplay::ScriptUtil::getFloatPointer(2);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
+ bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setFloatArray(param1, param2, param3);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setFloatArray - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setInt(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ lua_type(state, 2) == LUA_TNUMBER)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ int param1 = (int)luaL_checkint(state, 2);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setInt(param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setInt - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setIntArray(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ gameplay::ScriptUtil::LuaArray<int> param1 = gameplay::ScriptUtil::getIntPointer(2);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setIntArray(param1, param2);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setIntArray - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 4:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 4) == LUA_TBOOLEAN)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ gameplay::ScriptUtil::LuaArray<int> param1 = gameplay::ScriptUtil::getIntPointer(2);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
+ bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setIntArray(param1, param2, param3);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setIntArray - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setMatrix(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Matrix'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setMatrix(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setMatrix - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setMatrixArray(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Matrix'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setMatrixArray(param1, param2);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setMatrixArray - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 4:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 4) == LUA_TBOOLEAN)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Matrix'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
+ bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setMatrixArray(param1, param2, param3);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setMatrixArray - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setSampler(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Texture::Sampler> param1 = gameplay::ScriptUtil::getObjectPointer<Texture::Sampler>(2, "TextureSampler", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setSampler(param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setSampler - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TBOOLEAN)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(2, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ bool param2 = gameplay::ScriptUtil::luaCheckBool(state, 3);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ void* returnPtr = (void*)instance->setSampler(param1, param2);
|
|
|
+ if (returnPtr)
|
|
|
+ {
|
|
|
+ gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
|
|
|
+ object->instance = returnPtr;
|
|
|
+ object->owns = false;
|
|
|
+ luaL_getmetatable(state, "TextureSampler");
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushnil(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setSampler - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
{
|
|
|
// Get the number of parameters.
|
|
|
@@ -1027,13 +1443,139 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
|
|
|
+ (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ gameplay::ScriptUtil::LuaArray<int> param1 = gameplay::ScriptUtil::getIntPointer(2);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setValue(param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", true, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setValue(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setValue(param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setValue(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setValue(param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", true, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setValue(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ break;
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setValue(param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ } while (0);
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
- gameplay::ScriptUtil::LuaArray<int> param1 = gameplay::ScriptUtil::getIntPointer(2);
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ break;
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1);
|
|
|
+ instance->setValue(*param1);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1042,16 +1584,16 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", true, ¶m1Valid);
|
|
|
+ gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false, ¶m1Valid);
|
|
|
if (!param1Valid)
|
|
|
break;
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(*param1);
|
|
|
+ instance->setValue(param1);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1064,7 +1606,7 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", false, ¶m1Valid);
|
|
|
+ gameplay::ScriptUtil::LuaArray<Texture::Sampler> param1 = gameplay::ScriptUtil::getObjectPointer<Texture::Sampler>(2, "TextureSampler", false, ¶m1Valid);
|
|
|
if (!param1Valid)
|
|
|
break;
|
|
|
|
|
|
@@ -1075,19 +1617,26 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
}
|
|
|
} while (0);
|
|
|
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setValue - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
- bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, ¶m1Valid);
|
|
|
- if (!param1Valid)
|
|
|
- break;
|
|
|
+ gameplay::ScriptUtil::LuaArray<float> param1 = gameplay::ScriptUtil::getFloatPointer(2);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(*param1);
|
|
|
+ instance->setValue(param1, param2);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1096,16 +1645,17 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
- bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, ¶m1Valid);
|
|
|
- if (!param1Valid)
|
|
|
- break;
|
|
|
+ gameplay::ScriptUtil::LuaArray<int> param1 = gameplay::ScriptUtil::getIntPointer(2);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1);
|
|
|
+ instance->setValue(param1, param2);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1114,16 +1664,20 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", true, ¶m1Valid);
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", false, ¶m1Valid);
|
|
|
if (!param1Valid)
|
|
|
break;
|
|
|
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(*param1);
|
|
|
+ instance->setValue(param1, param2);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1132,16 +1686,20 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, ¶m1Valid);
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, ¶m1Valid);
|
|
|
if (!param1Valid)
|
|
|
break;
|
|
|
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1);
|
|
|
+ instance->setValue(param1, param2);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1150,16 +1708,20 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true, ¶m1Valid);
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, ¶m1Valid);
|
|
|
if (!param1Valid)
|
|
|
break;
|
|
|
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(*param1);
|
|
|
+ instance->setValue(param1, param2);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1168,7 +1730,8 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
bool param1Valid;
|
|
|
@@ -1176,8 +1739,11 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
if (!param1Valid)
|
|
|
break;
|
|
|
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1);
|
|
|
+ instance->setValue(param1, param2);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1186,18 +1752,31 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
do
|
|
|
{
|
|
|
if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TBOOLEAN)
|
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
|
- bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Texture::Sampler> param1 = gameplay::ScriptUtil::getObjectPointer<Texture::Sampler>(2, "TextureSampler", false, ¶m1Valid);
|
|
|
- if (!param1Valid)
|
|
|
- break;
|
|
|
+ const char* param1 = gameplay::ScriptUtil::getString(2, false);
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ bool param2 = gameplay::ScriptUtil::luaCheckBool(state, 3);
|
|
|
|
|
|
MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1);
|
|
|
-
|
|
|
- return 0;
|
|
|
+ void* returnPtr = (void*)instance->setValue(param1, param2);
|
|
|
+ if (returnPtr)
|
|
|
+ {
|
|
|
+ gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
|
|
|
+ object->instance = returnPtr;
|
|
|
+ object->owns = false;
|
|
|
+ luaL_getmetatable(state, "TextureSampler");
|
|
|
+ lua_setmetatable(state, -2);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lua_pushnil(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ return 1;
|
|
|
}
|
|
|
} while (0);
|
|
|
|
|
|
@@ -1205,172 +1784,369 @@ int lua_MaterialParameter_setValue(lua_State* state)
|
|
|
lua_error(state);
|
|
|
break;
|
|
|
}
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setVector2(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", true, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector2'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector2(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector2 - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setVector2Array(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector2'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector2Array(param1, param2);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector2Array - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 4:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 4) == LUA_TBOOLEAN)
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector2'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
+ bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector2Array(param1, param2, param3);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector2Array - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setVector3(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
+ {
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
+
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector3(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector3 - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int lua_MaterialParameter_setVector3Array(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
case 3:
|
|
|
{
|
|
|
- do
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
|
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
- lua_type(state, 3) == LUA_TNUMBER)
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
{
|
|
|
- // Get parameter 1 off the stack.
|
|
|
- gameplay::ScriptUtil::LuaArray<float> param1 = gameplay::ScriptUtil::getFloatPointer(2);
|
|
|
-
|
|
|
- // Get parameter 2 off the stack.
|
|
|
- unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
-
|
|
|
- MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1, param2);
|
|
|
-
|
|
|
- return 0;
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
|
|
|
+ lua_error(state);
|
|
|
}
|
|
|
- } while (0);
|
|
|
|
|
|
- do
|
|
|
- {
|
|
|
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
|
|
|
- lua_type(state, 3) == LUA_TNUMBER)
|
|
|
- {
|
|
|
- // Get parameter 1 off the stack.
|
|
|
- gameplay::ScriptUtil::LuaArray<int> param1 = gameplay::ScriptUtil::getIntPointer(2);
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
|
|
|
- // Get parameter 2 off the stack.
|
|
|
- unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector3Array(param1, param2);
|
|
|
|
|
|
- MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1, param2);
|
|
|
-
|
|
|
- return 0;
|
|
|
- }
|
|
|
- } while (0);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- do
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector3Array - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 4:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 4) == LUA_TBOOLEAN)
|
|
|
{
|
|
|
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
- lua_type(state, 3) == LUA_TNUMBER)
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
{
|
|
|
- // Get parameter 1 off the stack.
|
|
|
- bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector2> param1 = gameplay::ScriptUtil::getObjectPointer<Vector2>(2, "Vector2", false, ¶m1Valid);
|
|
|
- if (!param1Valid)
|
|
|
- break;
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
|
|
|
- // Get parameter 2 off the stack.
|
|
|
- unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
|
|
|
- MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1, param2);
|
|
|
-
|
|
|
- return 0;
|
|
|
- }
|
|
|
- } while (0);
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
+ bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
|
|
|
|
|
|
- do
|
|
|
- {
|
|
|
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
- lua_type(state, 3) == LUA_TNUMBER)
|
|
|
- {
|
|
|
- // Get parameter 1 off the stack.
|
|
|
- bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector3> param1 = gameplay::ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, ¶m1Valid);
|
|
|
- if (!param1Valid)
|
|
|
- break;
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector3Array(param1, param2, param3);
|
|
|
|
|
|
- // Get parameter 2 off the stack.
|
|
|
- unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1, param2);
|
|
|
-
|
|
|
- return 0;
|
|
|
- }
|
|
|
- } while (0);
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector3Array - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
|
|
|
- do
|
|
|
+int lua_MaterialParameter_setVector4(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 2:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
|
|
|
{
|
|
|
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
- lua_type(state, 3) == LUA_TNUMBER)
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", true, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
{
|
|
|
- // Get parameter 1 off the stack.
|
|
|
- bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, ¶m1Valid);
|
|
|
- if (!param1Valid)
|
|
|
- break;
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector4'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
|
|
|
- // Get parameter 2 off the stack.
|
|
|
- unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector4(*param1);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1, param2);
|
|
|
-
|
|
|
- return 0;
|
|
|
- }
|
|
|
- } while (0);
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector4 - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
|
|
|
- do
|
|
|
+int lua_MaterialParameter_setVector4Array(lua_State* state)
|
|
|
+{
|
|
|
+ // Get the number of parameters.
|
|
|
+ int paramCount = lua_gettop(state);
|
|
|
+
|
|
|
+ // Attempt to match the parameters to a valid binding.
|
|
|
+ switch (paramCount)
|
|
|
+ {
|
|
|
+ case 3:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER)
|
|
|
{
|
|
|
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
- lua_type(state, 3) == LUA_TNUMBER)
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
{
|
|
|
- // Get parameter 1 off the stack.
|
|
|
- bool param1Valid;
|
|
|
- gameplay::ScriptUtil::LuaArray<Matrix> param1 = gameplay::ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false, ¶m1Valid);
|
|
|
- if (!param1Valid)
|
|
|
- break;
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector4'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
|
|
|
- // Get parameter 2 off the stack.
|
|
|
- unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
|
|
|
- MaterialParameter* instance = getInstance(state);
|
|
|
- instance->setValue(param1, param2);
|
|
|
-
|
|
|
- return 0;
|
|
|
- }
|
|
|
- } while (0);
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector4Array(param1, param2);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- do
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector4Array - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_error(state);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 4:
|
|
|
+ {
|
|
|
+ if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
+ (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
+ lua_type(state, 3) == LUA_TNUMBER &&
|
|
|
+ lua_type(state, 4) == LUA_TBOOLEAN)
|
|
|
{
|
|
|
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
|
|
|
- (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
|
|
|
- lua_type(state, 3) == LUA_TBOOLEAN)
|
|
|
+ // Get parameter 1 off the stack.
|
|
|
+ bool param1Valid;
|
|
|
+ gameplay::ScriptUtil::LuaArray<Vector4> param1 = gameplay::ScriptUtil::getObjectPointer<Vector4>(2, "Vector4", false, ¶m1Valid);
|
|
|
+ if (!param1Valid)
|
|
|
{
|
|
|
- // Get parameter 1 off the stack.
|
|
|
- const char* param1 = gameplay::ScriptUtil::getString(2, false);
|
|
|
+ lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector4'.");
|
|
|
+ lua_error(state);
|
|
|
+ }
|
|
|
|
|
|
- // Get parameter 2 off the stack.
|
|
|
- bool param2 = gameplay::ScriptUtil::luaCheckBool(state, 3);
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
|
|
|
|
|
|
- MaterialParameter* instance = getInstance(state);
|
|
|
- void* returnPtr = (void*)instance->setValue(param1, param2);
|
|
|
- if (returnPtr)
|
|
|
- {
|
|
|
- gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
|
|
|
- object->instance = returnPtr;
|
|
|
- object->owns = false;
|
|
|
- luaL_getmetatable(state, "TextureSampler");
|
|
|
- lua_setmetatable(state, -2);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lua_pushnil(state);
|
|
|
- }
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
+ bool param3 = gameplay::ScriptUtil::luaCheckBool(state, 4);
|
|
|
|
|
|
- return 1;
|
|
|
- }
|
|
|
- } while (0);
|
|
|
+ MaterialParameter* instance = getInstance(state);
|
|
|
+ instance->setVector4Array(param1, param2, param3);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- lua_pushstring(state, "lua_MaterialParameter_setValue - Failed to match the given parameters to a valid function signature.");
|
|
|
+ lua_pushstring(state, "lua_MaterialParameter_setVector4Array - Failed to match the given parameters to a valid function signature.");
|
|
|
lua_error(state);
|
|
|
break;
|
|
|
}
|
|
|
default:
|
|
|
{
|
|
|
- lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
|
|
|
lua_error(state);
|
|
|
break;
|
|
|
}
|