Replaced seperate getValue(Vec*) implementations with template based implementation

This commit is contained in:
Robert Osfield
2016-07-04 10:53:06 +01:00
parent 55e4d567c4
commit 6870c195d0
2 changed files with 38 additions and 76 deletions

View File

@@ -3672,32 +3672,6 @@ bool LuaScriptEngine::getboundingsphere(int pos) const
return false;
}
bool LuaScriptEngine::getValue(int pos, osg::Vec2f& value) const
{
if (!getvec2(pos)) return false;
value.set(lua_tonumber(_lua, -2), lua_tonumber(_lua, -1));
lua_pop(_lua, 2);
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Vec3f& value) const
{
if (!getvec3(pos)) return false;
value.set(lua_tonumber(_lua, -3), lua_tonumber(_lua, -2), lua_tonumber(_lua, -1));
lua_pop(_lua, 3);
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Vec4f& value) const
{
if (!getvec4(pos)) return false;
value.set(lua_tonumber(_lua, -4), lua_tonumber(_lua, -3), lua_tonumber(_lua, -2), lua_tonumber(_lua, -1));
lua_pop(_lua, 4);
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Matrixf& value) const
{
if (!getmatrix(pos)) return false;
@@ -3712,48 +3686,6 @@ bool LuaScriptEngine::getValue(int pos, osg::Matrixf& value) const
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Vec2d& value) const
{
if (!getvec2(pos)) return false;
value.set(lua_tonumber(_lua, -2), lua_tonumber(_lua, -1));
lua_pop(_lua, 2);
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Vec3d& value) const
{
if (!getvec3(pos)) return false;
value.set(lua_tonumber(_lua, -3), lua_tonumber(_lua, -2), lua_tonumber(_lua, -1));
lua_pop(_lua, 3);
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Vec4d& value) const
{
if (!getvec4(pos)) return false;
value.set(lua_tonumber(_lua, -4), lua_tonumber(_lua, -3), lua_tonumber(_lua, -2), lua_tonumber(_lua, -1));
lua_pop(_lua, 4);
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Quat& value) const
{
if (!getvec4(pos)) return false;
value.set(lua_tonumber(_lua, -4), lua_tonumber(_lua, -3), lua_tonumber(_lua, -2), lua_tonumber(_lua, -1));
lua_pop(_lua, 4);
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Plane& value) const
{
if (!getvec4(pos)) return false;
value.set(lua_tonumber(_lua, -4), lua_tonumber(_lua, -3), lua_tonumber(_lua, -2), lua_tonumber(_lua, -1));
lua_pop(_lua, 4);
return true;
}
bool LuaScriptEngine::getValue(int pos, osg::Matrixd& value) const
{
if (!getmatrix(pos)) return false;