Remove irrlicht.h in font code

This commit is contained in:
Benau 2022-11-16 09:26:30 +08:00
parent e6111a4084
commit 8fb52db8f2
5 changed files with 45 additions and 24 deletions

View File

@ -21,7 +21,7 @@
#include "utils/leak_check.hpp"
#include <irrlicht.h>
#include "SColor.h"
using namespace irr;

View File

@ -35,7 +35,10 @@
#include FT_OUTLINE_H
#endif
#include <irrlicht.h>
#include <GlyphLayout.h>
#include <dimension2d.h>
#include <irrString.h>
#include <rect.h>
using namespace irr;
@ -45,6 +48,19 @@ class FaceTTF;
class FontSettings;
struct FontArea;
namespace irr
{
namespace video
{
class ITexture;
class SColor;
}
namespace gui
{
class IGUISpriteBank;
}
}
/** An abstract class which contains functions which convert vector fonts into
* bitmap and render them in STK. To make STK draw characters with different
* render option (like scaling, shadow) using a same FontWithFace, you need

View File

@ -26,6 +26,8 @@
#include <ge_spm.hpp>
#include <ge_spm_buffer.hpp>
#include <sstream>
#include <IMeshBuffer.h>
#include <ITexture.h>
// ----------------------------------------------------------------------------
STKTextBillboard::STKTextBillboard(const video::SColor& color_top,
@ -531,5 +533,26 @@ void STKTextBillboard::removeGENode()
}
} // removeGENode
// ----------------------------------------------------------------------------
void STKTextBillboard::clearBuffer()
{
if (m_instanced_array != 0)
{
glDeleteBuffers(1, &m_instanced_array);
}
for (auto& p : m_vao_vbos)
{
glDeleteVertexArrays(1, &p.second.first);
glDeleteBuffers(1, &p.second.second);
}
m_vao_vbos.clear();
for (auto& p : m_gl_mb)
{
p.second->drop();
}
m_gl_mb.clear();
m_gl_tbs.clear();
} // clearBuffer
#endif // !SERVER_ONLY

View File

@ -36,6 +36,7 @@ namespace irr
namespace scene
{
class IMeshSceneNode;
class IMeshBuffer;
}
}
@ -87,7 +88,7 @@ private:
std::unordered_map<video::ITexture*, std::pair<GLuint, GLuint> >
m_vao_vbos;
std::unordered_map<video::ITexture*, IMeshBuffer*> m_gl_mb;
std::unordered_map<video::ITexture*, scene::IMeshBuffer*> m_gl_mb;
core::aabbox3df m_bbox;
@ -115,27 +116,7 @@ public:
clearBuffer();
}
// ------------------------------------------------------------------------
void clearBuffer()
{
#ifndef SERVER_ONLY
if (m_instanced_array != 0)
{
glDeleteBuffers(1, &m_instanced_array);
}
for (auto& p : m_vao_vbos)
{
glDeleteVertexArrays(1, &p.second.first);
glDeleteBuffers(1, &p.second.second);
}
m_vao_vbos.clear();
for (auto& p : m_gl_mb)
{
p.second->drop();
}
m_gl_mb.clear();
m_gl_tbs.clear();
#endif
}
void clearBuffer();
// ------------------------------------------------------------------------
void reload();
// ------------------------------------------------------------------------

View File

@ -21,6 +21,7 @@
#include "graphics/texture_shader.hpp"
#include <unordered_set>
#include <ITexture.h>
namespace TextBillboardDrawer
{