简体   繁体   English

使用Android SceneForm以编程方式将2D图像转换为可渲染的3D

[英]Programmatically convert 2D image to 3D renderable using android sceneform

All the tutorials and blogs out there show how to build Renderable: 所有的教程和博客都展示了如何构建Renderable:

ModelRenderable.builder()
               .setSource(this, <Path of 3D model>)
               .build()
               .thenAccept(renderable -> myRedenderable = renderable)

using the sceneform plugin in android studio. 在android studio中使用sceneform插件。 But I would like to build a 3D Renderable on the fly from a 2D .png image or something uploaded by the user. 但是我想从2D .png图像或用户上传的内容中即时构建3D Renderable。 How can I achieve that? 我该如何实现?

Use ViewRendarable to place a 2d View 使用ViewRendarable放置2d视图

// Build a renderable from a 2D View.
    CompletableFuture<ViewRenderable> solarControlsStage =
        ViewRenderable.builder().setView(this, R.layout.file_name).build();

To find more detail about placing 2D View Look at google Ar solar system sample 要查找有关放置2D视图的更多详细信息,请查看google Ar太阳系样本

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

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