本文整理匯總了C++中Technique::getParameterByIndex方法的典型用法代碼示例。如果您正苦於以下問題:C++ Technique::getParameterByIndex方法的具體用法?C++ Technique::getParameterByIndex怎麽用?C++ Technique::getParameterByIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Technique
的用法示例。
在下文中一共展示了Technique::getParameterByIndex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: lua_Technique_getParameterByIndex
static int lua_Technique_getParameterByIndex(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.
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
Technique* instance = getInstance(state);
void* returnPtr = ((void*)instance->getParameterByIndex(param1));
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, "MaterialParameter");
lua_setmetatable(state, -2);
}
else
{
lua_pushnil(state);
}
return 1;
}
lua_pushstring(state, "lua_Technique_getParameterByIndex - 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;
}