apply formatting to file
This commit is contained in:
@@ -122,8 +122,10 @@ namespace OpenVulkano::Scene
|
|||||||
{
|
{
|
||||||
const double maxCornerAngle = 3.0;
|
const double maxCornerAngle = 3.0;
|
||||||
for (msdf_atlas::GlyphGeometry& glyph : glyphsGeometry)
|
for (msdf_atlas::GlyphGeometry& glyph : glyphsGeometry)
|
||||||
|
{
|
||||||
glyph.edgeColoring(&msdfgen::edgeColoringByDistance, maxCornerAngle, 0);
|
glyph.edgeColoring(&msdfgen::edgeColoringByDistance, maxCornerAngle, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
msdf_atlas::TightAtlasPacker packer;
|
msdf_atlas::TightAtlasPacker packer;
|
||||||
packer.setDimensionsConstraint(msdf_atlas::DimensionsConstraint::SQUARE);
|
packer.setDimensionsConstraint(msdf_atlas::DimensionsConstraint::SQUARE);
|
||||||
@@ -147,8 +149,10 @@ namespace OpenVulkano::Scene
|
|||||||
generator.generate(glyphsGeometry.data(), glyphsGeometry.size());
|
generator.generate(glyphsGeometry.data(), glyphsGeometry.size());
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
m_atlasData = std::make_shared<FontAtlas>(Math::Vector2ui{ width, height }, fontGeometry.getMetrics().lineHeight,
|
m_atlasData =
|
||||||
channelsCount == 1 ? FontAtlasType::SDF : FontAtlasType::MSDF, m_channelsCount == 1 ? DataFormat::R8_UNORM : DataFormat::R8G8B8A8_UNORM);
|
std::make_shared<FontAtlas>(Math::Vector2ui { width, height }, fontGeometry.getMetrics().lineHeight,
|
||||||
|
channelsCount == 1 ? FontAtlasType::SDF : FontAtlasType::MSDF,
|
||||||
|
m_channelsCount == 1 ? DataFormat::R8_UNORM : DataFormat::R8G8B8A8_UNORM);
|
||||||
|
|
||||||
if constexpr (Channels == 3)
|
if constexpr (Channels == 3)
|
||||||
{
|
{
|
||||||
@@ -174,7 +178,7 @@ namespace OpenVulkano::Scene
|
|||||||
double l = 0, r = 0, t = 0, b = 0;
|
double l = 0, r = 0, t = 0, b = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const auto& glyph: glyphsGeometry)
|
for (const auto& glyph : glyphsGeometry)
|
||||||
{
|
{
|
||||||
GlyphInfo& info = m_atlasData->GetGlyphs()[glyph.getCodepoint()];
|
GlyphInfo& info = m_atlasData->GetGlyphs()[glyph.getCodepoint()];
|
||||||
const msdf_atlas::GlyphBox& glyphBox = generator.getLayout()[idx++];
|
const msdf_atlas::GlyphBox& glyphBox = generator.getLayout()[idx++];
|
||||||
@@ -187,6 +191,8 @@ namespace OpenVulkano::Scene
|
|||||||
double bearingY = glyphBox.bounds.t;
|
double bearingY = glyphBox.bounds.t;
|
||||||
double w = glyphBaselineBbox.r - glyphBaselineBbox.l;
|
double w = glyphBaselineBbox.r - glyphBaselineBbox.l;
|
||||||
double h = glyphBaselineBbox.t - glyphBaselineBbox.b;
|
double h = glyphBaselineBbox.t - glyphBaselineBbox.b;
|
||||||
|
|
||||||
|
// UV mapping
|
||||||
double l = glyphAtlasBbox.l;
|
double l = glyphAtlasBbox.l;
|
||||||
double r = glyphAtlasBbox.r;
|
double r = glyphAtlasBbox.r;
|
||||||
double t = glyphAtlasBbox.t;
|
double t = glyphAtlasBbox.t;
|
||||||
@@ -200,7 +206,10 @@ namespace OpenVulkano::Scene
|
|||||||
SetGlyphData(info, { bearingX, bearingY }, { w, h }, glyphAtlasAABB, glyphBox.advance);
|
SetGlyphData(info, { bearingX, bearingY }, { w, h }, glyphAtlasAABB, glyphBox.advance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pngOutput && !pngOutput->empty()) { m_atlasData->Save(*pngOutput); }
|
if (pngOutput && !pngOutput->empty())
|
||||||
|
{
|
||||||
|
m_atlasData->Save(*pngOutput);
|
||||||
|
}
|
||||||
destroyFont(font);
|
destroyFont(font);
|
||||||
deinitializeFreetype(ft);
|
deinitializeFreetype(ft);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user