Replaced pushVec(Vec2f etc.) implementations with template implementations.
This commit is contained in:
parent
50f6cf6a69
commit
bc7bd7da9d
@ -3773,33 +3773,6 @@ bool LuaScriptEngine::getValue(int pos, osg::BoundingSphered& value) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Vec2f& value) const
|
|
||||||
{
|
|
||||||
lua_newtable(_lua);
|
|
||||||
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
|
||||||
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Vec3f& value) const
|
|
||||||
{
|
|
||||||
lua_newtable(_lua);
|
|
||||||
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
|
||||||
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "z"); lua_pushnumber(_lua, value.z()); lua_settable(_lua, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Vec4f& value) const
|
|
||||||
{
|
|
||||||
lua_newtable(_lua);
|
|
||||||
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
|
||||||
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "z"); lua_pushnumber(_lua, value.z()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "w"); lua_pushnumber(_lua, value.w()); lua_settable(_lua, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Matrixf& value) const
|
void LuaScriptEngine::pushValue(const osg::Matrixf& value) const
|
||||||
{
|
{
|
||||||
lua_newtable(_lua);
|
lua_newtable(_lua);
|
||||||
@ -3814,53 +3787,6 @@ void LuaScriptEngine::pushValue(const osg::Matrixf& value) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Vec2d& value) const
|
|
||||||
{
|
|
||||||
lua_newtable(_lua);
|
|
||||||
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
|
||||||
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Vec3d& value) const
|
|
||||||
{
|
|
||||||
lua_newtable(_lua);
|
|
||||||
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
|
||||||
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "z"); lua_pushnumber(_lua, value.z()); lua_settable(_lua, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Vec4d& value) const
|
|
||||||
{
|
|
||||||
lua_newtable(_lua);
|
|
||||||
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
|
||||||
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "z"); lua_pushnumber(_lua, value.z()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "w"); lua_pushnumber(_lua, value.w()); lua_settable(_lua, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Quat& value) const
|
|
||||||
{
|
|
||||||
lua_newtable(_lua);
|
|
||||||
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
|
||||||
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "z"); lua_pushnumber(_lua, value.z()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "w"); lua_pushnumber(_lua, value.w()); lua_settable(_lua, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Plane& value) const
|
|
||||||
{
|
|
||||||
lua_newtable(_lua);
|
|
||||||
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
|
||||||
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.asVec4().x()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.asVec4().y()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "z"); lua_pushnumber(_lua, value.asVec4().z()); lua_settable(_lua, -3);
|
|
||||||
lua_pushstring(_lua, "w"); lua_pushnumber(_lua, value.asVec4().w()); lua_settable(_lua, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaScriptEngine::pushValue(const osg::Matrixd& value) const
|
void LuaScriptEngine::pushValue(const osg::Matrixd& value) const
|
||||||
{
|
{
|
||||||
lua_newtable(_lua);
|
lua_newtable(_lua);
|
||||||
|
@ -147,15 +147,46 @@ class LuaScriptEngine : public osg::ScriptEngine
|
|||||||
|
|
||||||
void pushValue(osgDB::BaseSerializer::Type type, const void* ptr) const;
|
void pushValue(osgDB::BaseSerializer::Type type, const void* ptr) const;
|
||||||
|
|
||||||
void pushValue(const osg::Vec2f& value) const;
|
template<typename T>
|
||||||
void pushValue(const osg::Vec3f& value) const;
|
void pushVec2(const T& value) const
|
||||||
void pushValue(const osg::Vec4f& value) const;
|
{
|
||||||
|
lua_newtable(_lua);
|
||||||
|
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
||||||
|
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
||||||
|
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
||||||
|
}
|
||||||
|
|
||||||
void pushValue(const osg::Vec2d& value) const;
|
template<typename T>
|
||||||
void pushValue(const osg::Vec3d& value) const;
|
void pushVec3(const T& value) const
|
||||||
void pushValue(const osg::Vec4d& value) const;
|
{
|
||||||
void pushValue(const osg::Quat& value) const;
|
lua_newtable(_lua);
|
||||||
void pushValue(const osg::Plane& value) const;
|
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
||||||
|
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
||||||
|
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
||||||
|
lua_pushstring(_lua, "z"); lua_pushnumber(_lua, value.z()); lua_settable(_lua, -3);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void pushVec4(const T& value) const
|
||||||
|
{
|
||||||
|
lua_newtable(_lua);
|
||||||
|
lua_newtable(_lua); luaL_getmetatable(_lua, "LuaScriptEngine.Table"); lua_setmetatable(_lua, -2);
|
||||||
|
lua_pushstring(_lua, "x"); lua_pushnumber(_lua, value.x()); lua_settable(_lua, -3);
|
||||||
|
lua_pushstring(_lua, "y"); lua_pushnumber(_lua, value.y()); lua_settable(_lua, -3);
|
||||||
|
lua_pushstring(_lua, "z"); lua_pushnumber(_lua, value.z()); lua_settable(_lua, -3);
|
||||||
|
lua_pushstring(_lua, "w"); lua_pushnumber(_lua, value.w()); lua_settable(_lua, -3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pushValue(const osg::Vec2f& value) const { pushVec2(value); }
|
||||||
|
void pushValue(const osg::Vec3f& value) const { pushVec3(value); }
|
||||||
|
void pushValue(const osg::Vec4f& value) const { pushVec4(value); }
|
||||||
|
|
||||||
|
void pushValue(const osg::Vec2d& value) const { pushVec2(value); }
|
||||||
|
void pushValue(const osg::Vec3d& value) const { pushVec3(value); }
|
||||||
|
void pushValue(const osg::Vec4d& value) const { pushVec4(value); }
|
||||||
|
|
||||||
|
void pushValue(const osg::Quat& value) const { pushVec4(value); }
|
||||||
|
void pushValue(const osg::Plane& value) const { pushVec4(value.asVec4()); }
|
||||||
|
|
||||||
void pushValue(const osg::Matrixf& value) const;
|
void pushValue(const osg::Matrixf& value) const;
|
||||||
void pushValue(const osg::Matrixd& value) const;
|
void pushValue(const osg::Matrixd& value) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user