如何解决在场景中动态改变 3D 模型的纹理
如何在 Android Studio 中使用 Sceneform 动态更改 3D(.fbx) 模型的颜色(纹理)?
{
materials: [
{
name: 'diffuse_0',parameters: [
{
baseColorFactor: [
0.14999999999999999,0.14999999999999999,1,],},{
baseColor: null,{
diffuseColorFactor: null,{
diffuseColor: null,{
normal: null,{
metallicFactor: 1,
以上代码片段是 .sfa 文件的一部分。我想改变我的 3d 模型的颜色。 我正在使用下面的代码,但它不起作用。
val futureTexture: CompletableFuture<Texture> = Texture.builder()
.setSource(this,R.raw.a)
.build()
ModelRenderable.builder()
.setSource(this,R.raw.anim)
.build()
.thenAcceptBoth(futureTexture) { renderable,texture ->
modelRenderable = renderable
modelRenderable?.material?.setTexture("baseColor",texture)
}
.exceptionally {
Toast.makeText(this,"Model 1 didn't load. Msg: ${it.message}",Toast.LENGTH_SHORT).show()
return@exceptionally null
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。