mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 06:53:46 +02:00
fix keyboard textures and text display
This commit is contained in:
parent
c6080d0795
commit
391cca787f
2 changed files with 5 additions and 1 deletions
|
@ -325,6 +325,7 @@ void Keyboard::updateTextDisplay() {
|
|||
scaledDimensions *= sensorToWorldScale;
|
||||
float leftMargin = (scaledDimensions.x / 2);
|
||||
scaledDimensions.x += textWidth;
|
||||
scaledDimensions.y *= 1.25f;
|
||||
|
||||
EntityItemProperties properties;
|
||||
properties.setDimensions(scaledDimensions);
|
||||
|
@ -817,7 +818,7 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) {
|
|||
properties.setEmissive(true);
|
||||
properties.setParentID(_anchor.entityID);
|
||||
properties.setModelURL(url);
|
||||
properties.setTextures(QVariant(textureMap).toString());
|
||||
properties.setTextures(QString(QJsonDocument::fromVariant(textureMap).toJson()));
|
||||
properties.getGrab().setGrabbable(false);
|
||||
properties.setLocalRotation(quatFromVariant(keyboardKeyValue["localOrientation"].toVariant()));
|
||||
QUuid id = entityScriptingInterface->addEntityInternal(properties, entity::HostType::LOCAL);
|
||||
|
@ -868,6 +869,8 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) {
|
|||
properties.setEmissive(true);
|
||||
properties.getGrab().setGrabbable(false);
|
||||
properties.setText("");
|
||||
properties.setTextAlpha(1.0f);
|
||||
properties.setBackgroundAlpha(0.7f);
|
||||
properties.setParentID(_anchor.entityID);
|
||||
|
||||
TextDisplay textDisplay;
|
||||
|
|
|
@ -214,6 +214,7 @@ void TextEntityRenderer::doRender(RenderArgs* args) {
|
|||
|
||||
QSizeF TextEntityRenderer::textSize(const QString& text) const {
|
||||
auto extents = _textRenderer->computeExtent(text);
|
||||
extents.y *= 2.0f;
|
||||
|
||||
float maxHeight = (float)_textRenderer->computeExtent("Xy").y * LINE_SCALE_RATIO;
|
||||
float pointToWorldScale = (maxHeight / FIXED_FONT_SCALING_RATIO) * _lineHeight;
|
||||
|
|
Loading…
Reference in a new issue