Skip to content

Commit

Permalink
Implement #143
Browse files Browse the repository at this point in the history
  • Loading branch information
lhog committed Dec 19, 2021
1 parent 1b3258a commit 9040a65
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions rts/Lua/LuaUnsyncedCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -3042,6 +3046,30 @@ int LuaUnsyncedCtrl::SetMapRenderingParams(lua_State* L)
return 0;
}

int LuaUnsyncedCtrl::ForceTesselationUpdate(lua_State* L)
{
CSMFGroundDrawer* smfDrawer = dynamic_cast<CSMFGroundDrawer*>(readMap->GetGroundDrawer());

if (smfDrawer == nullptr) {
lua_pushboolean(L, false);
return 1;
}

CRoamMeshDrawer* roamMeshDrawer = dynamic_cast<CRoamMeshDrawer*>(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;
}


/******************************************************************************/
/******************************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions rts/Lua/LuaUnsyncedCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9040a65

Please sign in to comment.