From 9040a659bcf7d52fb11b0bbbb1db6c1651a80270 Mon Sep 17 00:00:00 2001 From: LHoG <1476261+lhog@users.noreply.github.com> Date: Sun, 19 Dec 2021 23:13:30 +0300 Subject: [PATCH] Implement https://github.com/beyond-all-reason/spring/issues/143 --- rts/Lua/LuaUnsyncedCtrl.cpp | 28 ++++++++++++++++++++++++++++ rts/Lua/LuaUnsyncedCtrl.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/rts/Lua/LuaUnsyncedCtrl.cpp b/rts/Lua/LuaUnsyncedCtrl.cpp index b288ec5080..8b15c2d9bb 100644 --- a/rts/Lua/LuaUnsyncedCtrl.cpp +++ b/rts/Lua/LuaUnsyncedCtrl.cpp @@ -40,6 +40,8 @@ #include "Map/ReadMap.h" #include "Map/BaseGroundDrawer.h" #include "Map/BaseGroundTextures.h" +#include "Map/SMF/SMFGroundDrawer.h" +#include "Map/SMF/ROAM/RoamMeshDrawer.h" #include "Net/Protocol/NetProtocol.h" #include "Net/GameServer.h" #include "Rendering/Env/ISky.h" @@ -259,6 +261,8 @@ bool LuaUnsyncedCtrl::PushEntries(lua_State* L) REGISTER_LUA_CFUNC(SetSunDirection); REGISTER_LUA_CFUNC(SetMapRenderingParams); + REGISTER_LUA_CFUNC(ForceTesselationUpdate); + REGISTER_LUA_CFUNC(SendSkirmishAIMessage); REGISTER_LUA_CFUNC(SetLogSectionFilterLevel); @@ -3042,6 +3046,30 @@ int LuaUnsyncedCtrl::SetMapRenderingParams(lua_State* L) return 0; } +int LuaUnsyncedCtrl::ForceTesselationUpdate(lua_State* L) +{ + CSMFGroundDrawer* smfDrawer = dynamic_cast(readMap->GetGroundDrawer()); + + if (smfDrawer == nullptr) { + lua_pushboolean(L, false); + return 1; + } + + CRoamMeshDrawer* roamMeshDrawer = dynamic_cast(smfDrawer->GetMeshDrawer()); + if (roamMeshDrawer == nullptr) { + lua_pushboolean(L, false); + return 1; + } + + CRoamMeshDrawer::ForceNextTesselation( + luaL_optboolean(L, 1, true ), + luaL_optboolean(L, 2, false) + ); + + lua_pushboolean(L, true); + return 1; +} + /******************************************************************************/ /******************************************************************************/ diff --git a/rts/Lua/LuaUnsyncedCtrl.h b/rts/Lua/LuaUnsyncedCtrl.h index cd26af7e5d..e3d66cf6db 100644 --- a/rts/Lua/LuaUnsyncedCtrl.h +++ b/rts/Lua/LuaUnsyncedCtrl.h @@ -164,6 +164,8 @@ class LuaUnsyncedCtrl { static int SetSunDirection(lua_State* L); static int SetMapRenderingParams(lua_State* L); + static int ForceTesselationUpdate(lua_State* L); + static int SendSkirmishAIMessage(lua_State* L); static int SetLogSectionFilterLevel(lua_State* L);