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

@@ -61,11 +61,7 @@ namespace OpenVulkano
m_nodesPool.resize(N);
m_drawablesPool.reserve(N);
static TextDrawable textDrawable(sdfMetadataInfo);
auto& sh = TextDrawable::GetSdfDefaultShader();
sh.depthWrite = false;
sh.depthCompareOp = CompareOp::LESS_OR_EQUAL;
textDrawable.SetShader(&sh);
TextDrawable textDrawable(sdfMetadataInfo);
const std::vector<std::string> texts = { "Hello", "1", "XYZ" };
BillboardControlBlock billboardSettings;
LabelDrawableSettings labelSettings;
@@ -75,14 +71,14 @@ namespace OpenVulkano
//labelSettings.hasRoundedCorners = (i % 2 == 0 ? 1 : 0);
labelSettings.hasArrow = (i % 2 == 0 ? 1 : 0);
bool isBillboard = (i % 2 == 0 ? 1 : 0);
LabelDrawable& label = m_drawablesPool.emplace_back(labelSettings, isBillboard);
LabelDrawable& label = m_drawablesPool.emplace_back(textDrawable.GetAtlasData(), labelSettings, isBillboard);
label.SetBillboardSettings(billboardSettings);
label.AddText(&textDrawable, texts[i]);
label.AddText(texts[i]);
if (i == 2)
{
for (int j = 0; j < 3; j++)
{
label.AddText(&textDrawable, "Additional text" + std::to_string(j));
label.AddText("Additional text" + std::to_string(j));
}
}
m_scene.GetRoot()->AddChild(&m_nodesPool[i]);