some more refactoring and improvements
This commit is contained in:
@@ -6,11 +6,13 @@
|
||||
|
||||
#include "FontAtlasGeneratorBase.hpp"
|
||||
#include "Base/Logger.hpp"
|
||||
#define STBI_MSC_SECURE_CRT
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include <stb_image_write.h>
|
||||
#include <zlib.h>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#define STBI_MSC_SECURE_CRT
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#define STBIW_ZLIB_COMPRESS OpenVulkano::Utils::STBZlibCompressor
|
||||
#include <stb_image_write.h>
|
||||
|
||||
namespace OpenVulkano::Scene
|
||||
{
|
||||
@@ -86,6 +88,7 @@ namespace OpenVulkano::Scene
|
||||
}
|
||||
fs.write(reinterpret_cast<const char*>(&metadataBytes), sizeof(uint64_t));
|
||||
fs.write(reinterpret_cast<const char*>(&packedFlag), sizeof(uint32_t));
|
||||
fs.close();
|
||||
}
|
||||
|
||||
void FontAtlasGeneratorBase::SavePng(std::string output) const
|
||||
@@ -105,17 +108,8 @@ namespace OpenVulkano::Scene
|
||||
// generate texture
|
||||
m_atlasData->img = std::make_unique<Image::Image>();
|
||||
m_atlasData->img->resolution = Math::Vector3ui(textureResolution, 1);
|
||||
if (m_channelsCount == 1)
|
||||
{
|
||||
m_atlasData->img->data = Array<uint8_t>(textureResolution.x * textureResolution.y);
|
||||
m_atlasData->img->dataFormat = OpenVulkano::DataFormat::R8_UNORM;
|
||||
}
|
||||
else
|
||||
{
|
||||
// RGBA
|
||||
m_atlasData->img->data = Array<uint8_t>(textureResolution.x * textureResolution.y * 4);
|
||||
m_atlasData->img->dataFormat = OpenVulkano::DataFormat::R8G8B8A8_UNORM;
|
||||
}
|
||||
m_atlasData->img->dataFormat = m_channelsCount == 1 ? DataFormat::R8_UNORM : DataFormat::R8G8B8A8_UNORM;
|
||||
m_atlasData->img->data = Array<uint8_t>(m_atlasData->img->dataFormat.CalculatedSize(textureResolution.x, textureResolution.y));
|
||||
m_atlasData->texture.resolution = m_atlasData->img->resolution;
|
||||
m_atlasData->texture.textureBuffer = m_atlasData->img->data.Data();
|
||||
m_atlasData->texture.format = m_atlasData->img->dataFormat;
|
||||
|
||||
Reference in New Issue
Block a user