(Font) Added default atlas
Former-commit-id: 876f42110d4053b09abf86c6158b3ba79fdea201
This commit is contained in:
@@ -74,11 +74,13 @@ class NAZARA_API NzFont : public NzResource, NzAbstractAtlas::Listener, NzNonCop
|
|||||||
void SetGlyphBorder(unsigned int borderSize);
|
void SetGlyphBorder(unsigned int borderSize);
|
||||||
void SetMinimumStepSize(unsigned int minimumSizeStep);
|
void SetMinimumStepSize(unsigned int minimumSizeStep);
|
||||||
|
|
||||||
|
static std::shared_ptr<NzAbstractAtlas> GetDefaultAtlas();
|
||||||
static unsigned int GetDefaultGlyphBorder();
|
static unsigned int GetDefaultGlyphBorder();
|
||||||
static unsigned int GetDefaultMinimumStepSize();
|
static unsigned int GetDefaultMinimumStepSize();
|
||||||
|
|
||||||
static bool Initialize();
|
static bool Initialize();
|
||||||
|
|
||||||
|
static void SetDefaultAtlas(const std::shared_ptr<NzAbstractAtlas>& atlas);
|
||||||
static void SetDefaultGlyphBorder(unsigned int borderSize);
|
static void SetDefaultGlyphBorder(unsigned int borderSize);
|
||||||
static void SetDefaultMinimumStepSize(unsigned int minimumSizeStep);
|
static void SetDefaultMinimumStepSize(unsigned int minimumSizeStep);
|
||||||
|
|
||||||
@@ -130,6 +132,7 @@ class NAZARA_API NzFont : public NzResource, NzAbstractAtlas::Listener, NzNonCop
|
|||||||
unsigned int m_glyphBorder;
|
unsigned int m_glyphBorder;
|
||||||
unsigned int m_minimumSizeStep;
|
unsigned int m_minimumSizeStep;
|
||||||
|
|
||||||
|
static std::shared_ptr<NzAbstractAtlas> s_defaultAtlas;
|
||||||
static NzFontLoader::LoaderList s_loaders;
|
static NzFontLoader::LoaderList s_loaders;
|
||||||
static unsigned int s_defaultGlyphBorder;
|
static unsigned int s_defaultGlyphBorder;
|
||||||
static unsigned int s_defaultMinimumSizeStep;
|
static unsigned int s_defaultMinimumSizeStep;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <Nazara/Graphics/Config.hpp>
|
#include <Nazara/Graphics/Config.hpp>
|
||||||
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
||||||
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
|
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
|
||||||
|
#include <Nazara/Graphics/GuillotineTextureAtlas.hpp>
|
||||||
#include <Nazara/Graphics/Material.hpp>
|
#include <Nazara/Graphics/Material.hpp>
|
||||||
#include <Nazara/Graphics/RenderTechniques.hpp>
|
#include <Nazara/Graphics/RenderTechniques.hpp>
|
||||||
#include <Nazara/Graphics/SkinningManager.hpp>
|
#include <Nazara/Graphics/SkinningManager.hpp>
|
||||||
@@ -66,6 +67,8 @@ bool NzGraphics::Initialize()
|
|||||||
NzRenderTechniques::Register(NzRenderTechniques::ToString(nzRenderTechniqueType_DeferredShading), 20, []() -> NzAbstractRenderTechnique* { return new NzDeferredRenderTechnique; });
|
NzRenderTechniques::Register(NzRenderTechniques::ToString(nzRenderTechniqueType_DeferredShading), 20, []() -> NzAbstractRenderTechnique* { return new NzDeferredRenderTechnique; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NzFont::SetDefaultAtlas(new NzGuillotineTextureAtlas);
|
||||||
|
|
||||||
onExit.Reset();
|
onExit.Reset();
|
||||||
|
|
||||||
NazaraNotice("Initialized: Graphics module");
|
NazaraNotice("Initialized: Graphics module");
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <Nazara/Utility/Config.hpp>
|
#include <Nazara/Utility/Config.hpp>
|
||||||
#include <Nazara/Utility/FontData.hpp>
|
#include <Nazara/Utility/FontData.hpp>
|
||||||
#include <Nazara/Utility/FontGlyph.hpp>
|
#include <Nazara/Utility/FontGlyph.hpp>
|
||||||
|
#include <Nazara/Utility/GuillotineImageAtlas.hpp>
|
||||||
#include <Nazara/Utility/Debug.hpp>
|
#include <Nazara/Utility/Debug.hpp>
|
||||||
|
|
||||||
bool NzFontParams::IsValid() const
|
bool NzFontParams::IsValid() const
|
||||||
@@ -14,6 +15,7 @@ bool NzFontParams::IsValid() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
NzFont::NzFont() :
|
NzFont::NzFont() :
|
||||||
|
m_atlas(s_defaultAtlas),
|
||||||
m_glyphBorder(s_defaultGlyphBorder),
|
m_glyphBorder(s_defaultGlyphBorder),
|
||||||
m_minimumSizeStep(s_defaultMinimumSizeStep)
|
m_minimumSizeStep(s_defaultMinimumSizeStep)
|
||||||
{
|
{
|
||||||
@@ -318,6 +320,11 @@ void NzFont::SetMinimumStepSize(unsigned int minimumStepSize)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<NzAbstractAtlas> NzFont::GetDefaultAtlas()
|
||||||
|
{
|
||||||
|
return s_defaultAtlas;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int NzFont::GetDefaultGlyphBorder()
|
unsigned int NzFont::GetDefaultGlyphBorder()
|
||||||
{
|
{
|
||||||
return s_defaultGlyphBorder;
|
return s_defaultGlyphBorder;
|
||||||
@@ -330,12 +337,18 @@ unsigned int NzFont::GetDefaultMinimumStepSize()
|
|||||||
|
|
||||||
bool NzFont::Initialize()
|
bool NzFont::Initialize()
|
||||||
{
|
{
|
||||||
|
s_defaultAtlas.reset(new NzGuillotineImageAtlas);
|
||||||
s_defaultGlyphBorder = 1;
|
s_defaultGlyphBorder = 1;
|
||||||
s_defaultMinimumSizeStep = 1;
|
s_defaultMinimumSizeStep = 1;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NzFont::SetDefaultAtlas(const std::shared_ptr<NzAbstractAtlas>& atlas)
|
||||||
|
{
|
||||||
|
s_defaultAtlas = atlas;
|
||||||
|
}
|
||||||
|
|
||||||
void NzFont::SetDefaultGlyphBorder(unsigned int borderSize)
|
void NzFont::SetDefaultGlyphBorder(unsigned int borderSize)
|
||||||
{
|
{
|
||||||
s_defaultGlyphBorder = borderSize;
|
s_defaultGlyphBorder = borderSize;
|
||||||
@@ -356,7 +369,7 @@ void NzFont::SetDefaultMinimumStepSize(unsigned int minimumSizeStep)
|
|||||||
|
|
||||||
void NzFont::Uninitialize()
|
void NzFont::Uninitialize()
|
||||||
{
|
{
|
||||||
|
s_defaultAtlas.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
nzUInt64 NzFont::ComputeKey(unsigned int characterSize, nzUInt32 style) const
|
nzUInt64 NzFont::ComputeKey(unsigned int characterSize, nzUInt32 style) const
|
||||||
@@ -531,6 +544,7 @@ const NzFont::Glyph& NzFont::PrecacheGlyph(GlyphMap& glyphMap, unsigned int char
|
|||||||
return glyph;
|
return glyph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<NzAbstractAtlas> NzFont::s_defaultAtlas;
|
||||||
NzFontLoader::LoaderList NzFont::s_loaders;
|
NzFontLoader::LoaderList NzFont::s_loaders;
|
||||||
unsigned int NzFont::s_defaultGlyphBorder;
|
unsigned int NzFont::s_defaultGlyphBorder;
|
||||||
unsigned int NzFont::s_defaultMinimumSizeStep;
|
unsigned int NzFont::s_defaultMinimumSizeStep;
|
||||||
|
|||||||
Reference in New Issue
Block a user