如何在 Google 灯丝中为 Android 设置背景颜色?
How to set background color in Google Filament for Android?
我正在学习灯丝教程:https://medium.com/@philiprideout/getting-started-with-filament-on-android-d10b16f0ec67
如何将背景颜色设置为白色?
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
surfaceView = SurfaceView(this).apply {
setContentView(this)
}
choreographer = Choreographer.getInstance()
modelViewer = ModelViewer(surfaceView)
surfaceView.setOnTouchListener(modelViewer)
loadGlb("DamagedHelmet")
modelViewer.scene.skybox = Skybox.Builder().build(modelViewer.engine)
loadEnvironment("venetian_crossroads_2k")
}
我试过在 SurfaceView
上设置背景颜色,但没用。
目前看起来是这样的(好像默认是黑色的):
我明白了。我需要设置天空盒颜色。
例如,这会将颜色设置为红色。
modelViewer.view.blendMode = com.google.android.filament.View.BlendMode.OPAQUE
modelViewer.scene.skybox = Skybox.Builder().color(0.81f, 0f, 0f, 0f).build(modelViewer.engine)
我正在学习灯丝教程:https://medium.com/@philiprideout/getting-started-with-filament-on-android-d10b16f0ec67
如何将背景颜色设置为白色?
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
surfaceView = SurfaceView(this).apply {
setContentView(this)
}
choreographer = Choreographer.getInstance()
modelViewer = ModelViewer(surfaceView)
surfaceView.setOnTouchListener(modelViewer)
loadGlb("DamagedHelmet")
modelViewer.scene.skybox = Skybox.Builder().build(modelViewer.engine)
loadEnvironment("venetian_crossroads_2k")
}
我试过在 SurfaceView
上设置背景颜色,但没用。
目前看起来是这样的(好像默认是黑色的):
我明白了。我需要设置天空盒颜色。
例如,这会将颜色设置为红色。
modelViewer.view.blendMode = com.google.android.filament.View.BlendMode.OPAQUE
modelViewer.scene.skybox = Skybox.Builder().color(0.81f, 0f, 0f, 0f).build(modelViewer.engine)