Deduplicate shader creation function for text drawable

This commit is contained in:
Georg Hagen
2025-01-04 01:15:25 +01:00
parent c288f3ccba
commit d96ced96c0
2 changed files with 19 additions and 57 deletions

View File

@@ -13,8 +13,6 @@
#include "UniformBuffer.hpp"
#include "AtlasData.hpp"
#include "Image/Image.hpp"
#include <map>
#include <optional>
namespace OpenVulkano::Scene
{
@@ -35,10 +33,12 @@ namespace OpenVulkano::Scene
class TextDrawable : public SimpleDrawable
{
static Shader DEFAULT_SHADER_BITMAP, DEFAULT_SHADER_SDF, DEFAULT_SHADER_MSDF;
public:
static Shader& GetSdfDefaultShader();
static Shader& GetMsdfDefaultShader();
static Shader& GetBitmapDefaultShader();
[[nodiscard]] static Shader& GetSdfDefaultShader() { return DEFAULT_SHADER_SDF; }
[[nodiscard]] static Shader& GetMsdfDefaultShader() { return DEFAULT_SHADER_MSDF; }
[[nodiscard]] static Shader& GetBitmapDefaultShader() { return DEFAULT_SHADER_BITMAP; }
TextDrawable(const TextConfig& config = TextConfig());
TextDrawable(const Array<char>& atlasMetadata, const TextConfig& config = TextConfig());
TextDrawable(const std::string& atlasMetadataFile, const TextConfig& config = TextConfig());