rework label shader

This commit is contained in:
ohyzha
2024-08-28 11:12:59 +03:00
parent e2ae1687ac
commit 6305cbfe1e
7 changed files with 231 additions and 129 deletions

View File

@@ -57,19 +57,26 @@ namespace OpenVulkano
auto& resourceLoader = ResourceLoader::GetInstance();
auto sdfMetadataInfo = resourceLoader.GetResource("sdf_atlas_packed.png");
const int N = 3;
TextDrawable textDrawable(sdfMetadataInfo);
const std::vector<std::string> texts = { "_!?{}.#@", "1", "XYZ", "12345" };
const int N = texts.size();
m_nodesPool.resize(N);
m_drawablesPool.reserve(N);
TextDrawable textDrawable(sdfMetadataInfo);
const std::vector<std::string> texts = { "Hello", "1", "XYZ" };
BillboardControlBlock billboardSettings;
LabelDrawableSettings labelSettings;
for (int i = 0; i < N; i++)
{
//labelSettings.hasRoundedCorners = (i % 2 == 0 ? 1 : 0);
labelSettings.hasArrow = (i % 2 == 0 ? 1 : 0);
if (i == 3)
{
labelSettings.hasRoundedCorners = labelSettings.hasArrow = true;
}
else
{
labelSettings.hasRoundedCorners = (i % 2 == 0 ? 0 : 1);
labelSettings.hasArrow = (i % 2 == 0 ? 1 : 0);
}
bool isBillboard = (i % 2 == 0 ? 1 : 0);
LabelDrawable& label = m_drawablesPool.emplace_back(textDrawable.GetAtlasData(), labelSettings, isBillboard);
label.SetBillboardSettings(billboardSettings);