简体   繁体   English

使用sceneform arcore android将文本添加到3d模型

[英]Adding text to a 3d model using sceneform arcore android

I am trying to build a app using arcore and sceneform.我正在尝试使用 arcore 和 sceneform 构建一个应用程序。 For that I want to add text to a 3d model.为此,我想向 3d 模型添加文本。 The text should appear in a particular position in the model.Is that possible using sceneform?文本应该出现在模型中的特定位置。使用场景形式可以吗?

Can anyone give suggestion as to how to proceed?任何人都可以就如何进行提出建议吗?

Text can be added using ViewRenderable , worked with filament version 1.7.0, crashes in some lower versions可以使用ViewRenderable添加文本,使用 filament 版本 1.7.0,在一些较低版本中崩溃

Reference 参考

Node tigerTitleNode = new Node();
      tigerTitleNode.setParent(model);
      tigerTitleNode.setEnabled(false);
      tigerTitleNode.setLocalPosition(new Vector3(0.0f, 1.0f, 0.0f));
      ViewRenderable.builder()
              .setView(this, R.layout.tiger_card_view)
              .build()
              .thenAccept(
                      (renderable) -> {
                          tigerTitleNode.setRenderable(renderable);
                          tigerTitleNode.setEnabled(true);
                      })
              .exceptionally(
                      (throwable) -> {
                          throw new AssertionError("Could not load card view.", throwable);
                      }
              );
    });

tiger_card_view.xml Tiger_card_view.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/rounded_bg"
    android:gravity="center"
    android:orientation="vertical"
    android:padding="6dp"
    android:text="Tiger"
    android:textAlignment="center" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM