fix text debug assert on invalid or unloaded font

This commit is contained in:
HifiExperiments 2024-09-09 13:38:55 -07:00
parent 729b85062d
commit 0dd0d07466

View file

@ -367,7 +367,11 @@ void entities::TextPayload::render(RenderArgs* args) {
transform.setRotation(BillboardModeHelpers::getBillboardRotation(transform.getTranslation(), transform.getRotation(), textRenderable->_billboardMode,
usePrimaryFrustum ? BillboardModeHelpers::getPrimaryViewFrustumPosition() : args->getViewFrustum().getPosition()));
float scale = textRenderable->_lineHeight / textRenderer->getFontHeight();
float scale = 1.0f;
float fontHeight = textRenderer->getFontHeight();
if (fontHeight > 0.0f) {
scale = textRenderable->_lineHeight / fontHeight;
}
transform.postTranslate(glm::vec3(-0.5, 0.5, 1.0f + EPSILON / dimensions.z));
transform.setScale(scale);
batch.setModelTransform(transform);