@@ -1658,184 +1658,14 @@ void CLuaMain::AddBrowserClass ( lua_State* luaVM )
16581658}
16591659
16601660
1661- void CLuaMain::AddVector4DClass ( lua_State* luaVM )
1662- {
1663- lua_newclass ( luaVM );
1664-
1665- lua_classmetamethod ( luaVM, " __tostring" , CLuaVector4Defs::ToString );
1666- lua_classmetamethod ( luaVM, " __gc" , CLuaVector4Defs::Destroy );
1667-
1668- lua_classmetamethod ( luaVM, " __add" , CLuaVector4Defs::Add );
1669- lua_classmetamethod ( luaVM, " __sub" , CLuaVector4Defs::Sub );
1670- lua_classmetamethod ( luaVM, " __mul" , CLuaVector4Defs::Mul );
1671- lua_classmetamethod ( luaVM, " __div" , CLuaVector4Defs::Div );
1672- lua_classmetamethod ( luaVM, " __pow" , CLuaVector4Defs::Pow );
1673- lua_classmetamethod ( luaVM, " __unm" , CLuaVector4Defs::Unm );
1674- lua_classmetamethod ( luaVM, " __eq" , CLuaVector4Defs::Eq );
1675- lua_classmetamethod ( luaVM, " __len" , CLuaVector4Defs::GetLength );
1676-
1677- lua_classfunction ( luaVM, " create" , CLuaVector4Defs::Create );
1678- lua_classfunction ( luaVM, " normalize" , CLuaVector4Defs::Normalize );
1679- lua_classfunction ( luaVM, " dot" , CLuaVector4Defs::Dot );
1680-
1681- lua_classfunction ( luaVM, " getLength" , CLuaVector4Defs::GetLength );
1682- lua_classfunction ( luaVM, " getSquaredLength" , CLuaVector4Defs::GetLengthSquared );
1683- lua_classfunction ( luaVM, " getNormalized" , CLuaVector4Defs::GetNormalized );
1684- lua_classfunction ( luaVM, " getX" , CLuaVector4Defs::GetX );
1685- lua_classfunction ( luaVM, " getY" , CLuaVector4Defs::GetY );
1686- lua_classfunction ( luaVM, " getZ" , CLuaVector4Defs::GetZ );
1687- lua_classfunction ( luaVM, " getW" , CLuaVector4Defs::GetW );
1688-
1689- lua_classfunction ( luaVM, " setX" , CLuaVector4Defs::SetX );
1690- lua_classfunction ( luaVM, " setY" , CLuaVector4Defs::SetY );
1691- lua_classfunction ( luaVM, " setZ" , CLuaVector4Defs::SetZ );
1692- lua_classfunction ( luaVM, " setW" , CLuaVector4Defs::SetW );
1693-
1694- lua_classvariable ( luaVM, " x" , CLuaVector4Defs::SetX, CLuaVector4Defs::GetX );
1695- lua_classvariable ( luaVM, " y" , CLuaVector4Defs::SetY, CLuaVector4Defs::GetY );
1696- lua_classvariable ( luaVM, " z" , CLuaVector4Defs::SetZ, CLuaVector4Defs::GetZ );
1697- lua_classvariable ( luaVM, " w" , CLuaVector4Defs::SetW, CLuaVector4Defs::GetW );
1698-
1699- lua_classvariable ( luaVM, " length" , NULL , CLuaVector4Defs::GetLength );
1700- lua_classvariable ( luaVM, " squaredLength" , NULL , CLuaVector4Defs::GetLengthSquared );
1701- lua_classvariable ( luaVM, " normalized" , NULL , CLuaVector4Defs::GetNormalized );
1702-
1703- lua_registerclass ( luaVM, " Vector4" );
1704- }
1705-
1706-
1707- void CLuaMain::AddVector3DClass ( lua_State* luaVM )
1708- {
1709- lua_newclass ( luaVM );
1710-
1711- lua_classmetamethod ( luaVM, " __tostring" , CLuaVector3Defs::ToString );
1712- lua_classmetamethod ( luaVM, " __gc" , CLuaVector3Defs::Destroy );
1713-
1714- lua_classmetamethod ( luaVM, " __add" , CLuaVector3Defs::Add );
1715- lua_classmetamethod ( luaVM, " __sub" , CLuaVector3Defs::Sub );
1716- lua_classmetamethod ( luaVM, " __mul" , CLuaVector3Defs::Mul );
1717- lua_classmetamethod ( luaVM, " __div" , CLuaVector3Defs::Div );
1718- lua_classmetamethod ( luaVM, " __pow" , CLuaVector3Defs::Pow );
1719- lua_classmetamethod ( luaVM, " __unm" , CLuaVector3Defs::Unm );
1720- lua_classmetamethod ( luaVM, " __eq" , CLuaVector3Defs::Eq );
1721- lua_classmetamethod ( luaVM, " __len" , CLuaVector3Defs::GetLength );
1722-
1723- lua_classfunction ( luaVM, " create" , CLuaVector3Defs::Create );
1724- lua_classfunction ( luaVM, " normalize" , CLuaVector3Defs::Normalize );
1725- lua_classfunction ( luaVM, " cross" , CLuaVector3Defs::Cross );
1726- lua_classfunction ( luaVM, " dot" , CLuaVector3Defs::Dot );
1727-
1728- lua_classfunction ( luaVM, " getLength" , CLuaVector3Defs::GetLength );
1729- lua_classfunction ( luaVM, " getSquaredLength" , CLuaVector3Defs::GetLengthSquared );
1730- lua_classfunction ( luaVM, " getNormalized" , CLuaVector3Defs::GetNormalized );
1731- lua_classfunction ( luaVM, " getX" , CLuaVector3Defs::GetX );
1732- lua_classfunction ( luaVM, " getY" , CLuaVector3Defs::GetY );
1733- lua_classfunction ( luaVM, " getZ" , CLuaVector3Defs::GetZ );
1734-
1735- lua_classfunction ( luaVM, " setX" , CLuaVector3Defs::SetX );
1736- lua_classfunction ( luaVM, " setY" , CLuaVector3Defs::SetY );
1737- lua_classfunction ( luaVM, " setZ" , CLuaVector3Defs::SetZ );
1738-
1739- lua_classvariable ( luaVM, " x" , CLuaVector3Defs::SetX, CLuaVector3Defs::GetX );
1740- lua_classvariable ( luaVM, " y" , CLuaVector3Defs::SetY, CLuaVector3Defs::GetY );
1741- lua_classvariable ( luaVM, " z" , CLuaVector3Defs::SetZ, CLuaVector3Defs::GetZ );
1742- lua_classvariable ( luaVM, " length" , NULL , CLuaVector3Defs::GetLength );
1743- lua_classvariable ( luaVM, " squaredLength" , NULL , CLuaVector3Defs::GetLengthSquared );
1744- lua_classvariable ( luaVM, " normalized" , NULL , CLuaVector3Defs::GetNormalized );
1745-
1746- lua_registerclass ( luaVM, " Vector3" );
1747- }
1748-
1749-
1750- void CLuaMain::AddVector2DClass ( lua_State* luaVM )
1751- {
1752- lua_newclass ( luaVM );
1753-
1754-
1755- lua_classmetamethod ( luaVM, " __tostring" , CLuaVector2Defs::ToString );
1756- lua_classmetamethod ( luaVM, " __gc" , CLuaVector2Defs::Destroy );
1757-
1758- lua_classmetamethod ( luaVM, " __add" , CLuaVector2Defs::Add );
1759- lua_classmetamethod ( luaVM, " __sub" , CLuaVector2Defs::Sub );
1760- lua_classmetamethod ( luaVM, " __mul" , CLuaVector2Defs::Mul );
1761- lua_classmetamethod ( luaVM, " __div" , CLuaVector2Defs::Div );
1762- lua_classmetamethod ( luaVM, " __pow" , CLuaVector2Defs::Pow );
1763- lua_classmetamethod ( luaVM, " __unm" , CLuaVector2Defs::Unm );
1764- lua_classmetamethod ( luaVM, " __eq" , CLuaVector2Defs::Eq );
1765- lua_classmetamethod ( luaVM, " __len" , CLuaVector2Defs::GetLength );
1766-
1767- lua_classfunction ( luaVM, " create" , CLuaVector2Defs::Create );
1768- lua_classfunction ( luaVM, " normalize" , CLuaVector2Defs::Normalize );
1769- lua_classfunction ( luaVM, " dot" , CLuaVector2Defs::Dot );
1770-
1771- lua_classfunction ( luaVM, " getLength" , CLuaVector2Defs::GetLength );
1772- lua_classfunction ( luaVM, " getSquaredLength" , CLuaVector2Defs::GetLengthSquared );
1773- lua_classfunction ( luaVM, " getNormalized" , CLuaVector2Defs::GetNormalized );
1774- lua_classfunction ( luaVM, " getX" , CLuaVector2Defs::GetX );
1775- lua_classfunction ( luaVM, " getY" , CLuaVector2Defs::GetY );
1776-
1777- lua_classfunction ( luaVM, " setX" , CLuaVector2Defs::SetX );
1778- lua_classfunction ( luaVM, " setY" , CLuaVector2Defs::SetY );
1779-
1780- lua_classvariable ( luaVM, " x" , CLuaVector2Defs::SetX, CLuaVector2Defs::GetX );
1781- lua_classvariable ( luaVM, " y" , CLuaVector2Defs::SetY, CLuaVector2Defs::GetY );
1782-
1783- lua_classvariable ( luaVM, " length" , NULL , CLuaVector2Defs::GetLength );
1784- lua_classvariable ( luaVM, " squaredLength" , NULL , CLuaVector2Defs::GetLengthSquared );
1785- lua_classvariable ( luaVM, " normalized" , NULL , CLuaVector2Defs::GetNormalized );
1786-
1787- lua_registerclass ( luaVM, " Vector2" );
1788- }
1789-
1790-
1791- void CLuaMain::AddMatrixClass ( lua_State* luaVM )
1792- {
1793- lua_newclass ( luaVM );
1794-
1795- lua_classmetamethod ( luaVM, " __tostring" , CLuaMatrixDefs::ToString );
1796- lua_classmetamethod ( luaVM, " __gc" , CLuaMatrixDefs::Destroy );
1797-
1798- lua_classmetamethod ( luaVM, " __add" , CLuaMatrixDefs::Add );
1799- lua_classmetamethod ( luaVM, " __sub" , CLuaMatrixDefs::Sub );
1800- lua_classmetamethod ( luaVM, " __mul" , CLuaMatrixDefs::Mul );
1801- lua_classmetamethod ( luaVM, " __div" , CLuaMatrixDefs::Div );
1802-
1803- lua_classfunction ( luaVM, " create" , CLuaMatrixDefs::Create );
1804-
1805- lua_classfunction ( luaVM, " transformPosition" , CLuaMatrixDefs::TransformPosition );
1806- lua_classfunction ( luaVM, " transformDirection" , CLuaMatrixDefs::TransformDirection );
1807- lua_classfunction ( luaVM, " inverse" , CLuaMatrixDefs::Inverse );
1808-
1809- lua_classfunction ( luaVM, " getPosition" , CLuaMatrixDefs::GetPosition );
1810- lua_classfunction ( luaVM, " getRotation" , CLuaMatrixDefs::GetRotation );
1811- lua_classfunction ( luaVM, " getForward" , CLuaMatrixDefs::GetForward );
1812- lua_classfunction ( luaVM, " getRight" , CLuaMatrixDefs::GetRight );
1813- lua_classfunction ( luaVM, " getUp" , CLuaMatrixDefs::GetUp );
1814-
1815- lua_classfunction ( luaVM, " setPosition" , CLuaMatrixDefs::SetPosition );
1816- lua_classfunction ( luaVM, " setRotation" , CLuaMatrixDefs::SetRotation );
1817- lua_classfunction ( luaVM, " setForward" , CLuaMatrixDefs::SetForward );
1818- lua_classfunction ( luaVM, " setRight" , CLuaMatrixDefs::SetRight );
1819- lua_classfunction ( luaVM, " setUp" , CLuaMatrixDefs::SetUp );
1820-
1821- lua_classvariable ( luaVM, " position" , CLuaMatrixDefs::SetPosition, CLuaMatrixDefs::GetPosition );
1822- lua_classvariable ( luaVM, " rotation" , CLuaMatrixDefs::SetRotation, CLuaMatrixDefs::GetRotation );
1823- lua_classvariable ( luaVM, " forward" , CLuaMatrixDefs::SetForward, CLuaMatrixDefs::GetForward );
1824- lua_classvariable ( luaVM, " right" , CLuaMatrixDefs::SetRight, CLuaMatrixDefs::GetRight );
1825- lua_classvariable ( luaVM, " up" , CLuaMatrixDefs::SetUp, CLuaMatrixDefs::GetUp );
1826-
1827- lua_registerclass ( luaVM, " Matrix" );
1828- }
1829-
1830-
18311661void CLuaMain::InitClasses ( lua_State* luaVM )
18321662{
18331663 lua_initclasses ( luaVM );
18341664
1835- AddVector4DClass ( luaVM );
1836- AddVector3DClass ( luaVM );
1837- AddVector2DClass ( luaVM );
1838- AddMatrixClass ( luaVM );
1665+ CLuaVector4Defs::AddClass ( luaVM );
1666+ CLuaVector3Defs::AddClass ( luaVM );
1667+ CLuaVector2Defs::AddClass ( luaVM );
1668+ CLuaMatrixDefs::AddClass ( luaVM );
18391669
18401670 if ( !m_bEnableOOP )
18411671 return ;
0 commit comments