Skip to content
Permalink
Browse files

add LuaFonts:SetText{View,Proj}Matrix

  • Loading branch information...
rtri
rtri committed Oct 19, 2019
1 parent 5720d78 commit f0c6861b65c7f63242fd7ea28e7ce5d86430f341
@@ -135,7 +135,9 @@ Lua:
The first is mandatory for tesselation to work, the other two are optional and can be used on the OpenGL host side instead of
writing the tesselation control shader.
4) New vertex primitive type GL.PATCHES
! Renamed SetShaderParameter to SetGeometryShaderParameter to avoid confusion of what kind shader parameters belongs to.
! Renamed SetShaderParameter to SetGeometryShaderParameter to avoid confusion
- add font:World{Begin,End,Print} callouts
- add font:SetText{View,Proj}Matrix callouts
- Added VFS.GetLoadedArchives() -> { string archiveName1, string archiveName2 ... }
- Added VFS.GetArchivePath(string archiveName1) -> string archivePathOnDisk
- Added VFS.GetFileAbsolutePath(string vfsFilePath) -> string filePathOnDisk
@@ -50,6 +50,9 @@ bool LuaFonts::CreateMetatable(lua_State* L)
REGISTER_LUA_CFUNC(GetTextWidth);
REGISTER_LUA_CFUNC(GetTextHeight);

REGISTER_LUA_CFUNC(SetTextViewMatrix);
REGISTER_LUA_CFUNC(SetTextProjMatrix);

REGISTER_LUA_CFUNC(SetTextColor);
REGISTER_LUA_CFUNC(SetOutlineColor);

@@ -267,15 +270,15 @@ int LuaFonts::Begin(lua_State* L)
{
CheckDrawingEnabled(L, __func__);
CglFont* f = tofont(L, 1);
f->BeginGL4();
f->Begin();
return 0;
}

int LuaFonts::End(lua_State* L)
{
CheckDrawingEnabled(L, __func__);
CglFont* f = tofont(L, 1);
f->EndGL4();
f->End();
return 0;
}

@@ -302,7 +305,7 @@ int LuaFonts::DrawBuffered(lua_State* L)
CheckDrawingEnabled(L, __func__);
CglFont* f = tofont(L, 1);
// does Begin&End state changes internally
f->DrawBufferedGL4();
f->DrawBuffered();
return 0;
}

@@ -398,6 +401,34 @@ int LuaFonts::SetAutoOutlineColor(lua_State* L)
}


/******************************************************************************/
/******************************************************************************/

int LuaFonts::SetTextViewMatrix(lua_State* L)
{
CglFont* f = tofont(L, 1);
CMatrix44f mat;

if (LuaUtils::ParseFloatArray(L, 2, &mat.m[0], 16) == 16)
f->SetViewMatrix(mat);
else
f->SetViewMatrix(CglFont::DefViewMatrix());

return 0;
}
int LuaFonts::SetTextProjMatrix(lua_State* L)
{
CglFont* f = tofont(L, 1);
CMatrix44f mat;

if (LuaUtils::ParseFloatArray(L, 2, &mat.m[0], 16) == 16)
f->SetProjMatrix(mat);
else
f->SetProjMatrix(CglFont::DefProjMatrix());

return 0;
}

/******************************************************************************/
/******************************************************************************/

@@ -43,6 +43,9 @@ class LuaFonts {
static int SetOutlineColor(lua_State* L);
static int SetAutoOutlineColor(lua_State* L);

static int SetTextViewMatrix(lua_State* L);
static int SetTextProjMatrix(lua_State* L);

static int BindTexture(lua_State* L);
};

@@ -1038,21 +1038,21 @@ int LuaOpenGL::DrawMiniMap(lua_State* L)
int LuaOpenGL::BeginText(lua_State* L)
{
CheckDrawingEnabled(L, __func__);
font->BeginGL4();
font->Begin();
return 0;
}

int LuaOpenGL::EndText(lua_State* L)
{
CheckDrawingEnabled(L, __func__);
font->EndGL4();
font->End();
return 0;
}

int LuaOpenGL::DrawBufferedText(lua_State* L)
{
CheckDrawingEnabled(L, __func__);
font->DrawBufferedGL4();
font->DrawBuffered();
return 0;
}

0 comments on commit f0c6861

Please sign in to comment.
You can’t perform that action at this time.