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