Subpixel rendering (#186)
Reviewed-on: https://git.madvoxel.net/OpenVulkano/OpenVulkano/pulls/186 Reviewed-by: Georg Hagen <georg.hagen@madvoxel.com> Co-authored-by: ohyzha <oleksii.hyzha.ext@madvoxel.com> Co-committed-by: ohyzha <oleksii.hyzha.ext@madvoxel.com>
This commit is contained in:
@@ -120,7 +120,10 @@ namespace OpenVulkano::Scene
|
||||
const std::span metadataSpan(metadata, eofHeader.metadataSize);
|
||||
if (eofHeader.flags.version == 0) LoadLegacy(metadataSpan);
|
||||
else LoadNew(metadataSpan);
|
||||
if (GetAtlasType() >= FontAtlasType::BITMAP) m_texture.m_samplerConfig = &SamplerConfig::NEAREST;
|
||||
if (GetAtlasType() >= FontAtlasType::BITMAP && GetAtlasType() != FontAtlasType::UNKNOWN)
|
||||
{
|
||||
m_texture.m_samplerConfig = &SamplerConfig::NEAREST;
|
||||
}
|
||||
}
|
||||
|
||||
void FontAtlas::LoadLegacy(const std::span<char> data)
|
||||
@@ -171,14 +174,18 @@ namespace OpenVulkano::Scene
|
||||
m_texture.textureBuffer = m_imgData.Data();
|
||||
}
|
||||
|
||||
void FontAtlas::Init(const Math::Vector2ui textureResolution, const double lineHeight, const FontAtlasType atlasType)
|
||||
void FontAtlas::Init(const Math::Vector2ui textureResolution, const double lineHeight,
|
||||
const FontAtlasType atlasType, DataFormat dataFormat)
|
||||
{
|
||||
m_metadata = { lineHeight, atlasType };
|
||||
m_texture.format = atlasType.GetChannelCount() == 1 ? DataFormat::R8_UNORM : DataFormat::R8G8B8A8_UNORM;
|
||||
m_texture.format = dataFormat;
|
||||
m_texture.resolution = { textureResolution, 1 };
|
||||
m_imgData = Array<uint8_t>(m_texture.format.CalculatedSize(m_texture.resolution.x, m_texture.resolution.y));
|
||||
m_texture.textureBuffer = m_imgData.Data();
|
||||
m_texture.size = m_imgData.Size();
|
||||
if (atlasType >= FontAtlasType::BITMAP) m_texture.m_samplerConfig = &SamplerConfig::NEAREST;
|
||||
if (atlasType >= FontAtlasType::BITMAP && atlasType != FontAtlasType::UNKNOWN)
|
||||
{
|
||||
m_texture.m_samplerConfig = &SamplerConfig::NEAREST;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user