rework label drawable and text drawable's API

This commit is contained in:
ohyzha
2024-08-26 17:42:43 +03:00
parent a2923966fa
commit e2ae1687ac
13 changed files with 160 additions and 217 deletions

View File

@@ -46,8 +46,9 @@ namespace OpenVulkano::Scene
class LabelDrawable final : public Drawable
{
public:
LabelDrawable(const LabelDrawableSettings& settings = LabelDrawableSettings(), bool isBillboard = false);
void AddText(TextDrawable* td, const std::string& text);
LabelDrawable(const std::shared_ptr<AtlasData>& atlasData,
const LabelDrawableSettings& settings = LabelDrawableSettings(), bool isBillboard = false);
void AddText(const std::string& text, const TextConfig& config = TextConfig());
void SetLabelSettings(const LabelDrawableSettings& settings);
void SetBillboardSettings(const BillboardControlBlock& settings);
void SetPosition(const Math::Vector3f& pos) { m_position = pos; }
@@ -62,7 +63,6 @@ namespace OpenVulkano::Scene
const Math::AABB& GetBoundingBox() const { return m_bbox; }
private:
void RecalculateBbox(const Math::AABB& other);
Shader* GetBillboardTextShader(Shader* src);
void SetupShaders();
void SetupBuffers();
private:
@@ -73,8 +73,10 @@ namespace OpenVulkano::Scene
std::vector<Shader> m_billboardTextShaders;
// list over vector to prevent memory reallocation and crash
std::list<TextDrawable> m_texts;
Shader m_textShader;
LabelDrawableSettings m_settings;
LabelUniformData m_labelData;
std::shared_ptr<AtlasData> m_atlasData;
BillboardControlBlock m_billboardSettings;
Math::Vector3f m_position = { 0, 0, 0 };
Math::AABB m_bbox;