【发布时间】:2021-02-19 07:19:56
【问题描述】:
在生成 .glb 文件的 ModelRenderable 实例后,我曾尝试为材质赋予颜色,但它抛出错误 "java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: submeshIndex ( 0) 超出范围。它必须小于 submeshCount (0)" 但同样适用于 .sfb 的 ModleRenderable 实例,请参阅下面的代码,我不知道如何处理这种情况。
ModelRenderable.builder()
.setSource(context, Uri.parse("redMarker.glb"))
.setIsFilamentGltf(true)
.build()
.thenAccept { renderable ->
pointy4Cursor = renderable
}
.exceptionally {
Log.e(TAG, "unable to load renderable pointy4Cursor - " + it.toString())
val toast = Toast.makeText(context, "Unable to load renderable new model 6", Toast.LENGTH_LONG)
toast.setGravity(Gravity.CENTER, 0, 0)
toast.show()
null
},
MaterialFactory.makeOpaqueWithColor(context, Color(context.getColor(R.color.colorSecondary)))
.thenAccept {
navaPink = it
}
.exceptionally {
Log.e(TAG, "unable to load material navaPink")
val toast = Toast.makeText(context, "Unable to load material", Toast.LENGTH_LONG)
toast.setGravity(Gravity.CENTER, 0, 0)
toast.show()
null
},
pointy4Cursor.material = navaPink // It's throwing exception as define above.
请帮忙
【问题讨论】: