Created
April 3, 2020 01:08
-
-
Save prideout/00411c80f9b6dc3621afff62f3866049 to your computer and use it in GitHub Desktop.
getting-started-ibl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onCreate(savedInstanceState: Bundle?) { | |
| // ... | |
| loadGlb("DamagedHelmet") | |
| loadEnvironment("venetian_crossroads_2k") | |
| } | |
| private fun loadEnvironment(ibl: String) { | |
| // Create the indirect light source and add it to the scene. | |
| var buffer = readAsset("envs/$ibl/${ibl}_ibl.ktx") | |
| KtxLoader.createIndirectLight(modelViewer.engine, buffer).apply { | |
| intensity = 50_000f | |
| modelViewer.scene.indirectLight = this | |
| } | |
| // Create the sky box and add it to the scene. | |
| buffer = readAsset("envs/$ibl/${ibl}_skybox.ktx") | |
| KtxLoader.createSkybox(modelViewer.engine, buffer).apply { | |
| modelViewer.scene.skybox = this | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment