繁体   English   中英

在 ARcore 移动应用程序中显示 .png 或 .jpeg 图像?

[英]Displaying .png or .jpeg images in ARcore mobile application?

我必须显示 2d 图像并且不想使用带有 .obj 文件的 3d 对象。它甚至可能吗? 以及怎么做?

在您的情况下,您可以使用三种强大的方法来创建 Sceneform 的Renderable

  • 第一种方法是创建一个plane primitive ,并为其分配.jpg.png纹理。

     ModelRenderable plane = ShapeFactory.makeCube( new Vector3(5.0f, 5.0f, 0.0f), // size new Vector3(0.0f, 0.0f, 0.0f), // center material);
  • 第二种方法是从标准的Android Widgets创建一个ViewRenderable

     ViewRenderable.builder() .setView(this, R.layout.test_view) .build() .thenAccept(renderable -> testViewRenderable = renderable);
  • 第三种方法是导入在 3d 创作工具(Maya、3dsMax、Cinema4D 等)中制作的平面。

     ModelRenderable.builder() .setSource(this, RenderableSource.builder().setSource( this, Uri.parse(ASSET), RenderableSource.SourceType.OBJ) .setScale(2.0f) .setRecenterMode(RenderableSource.RecenterMode.ROOT) .build()) .setRegistryId(ASSET) .build()

暂无
暂无

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

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