-
-
Notifications
You must be signed in to change notification settings - Fork 206
Open
Description
I recently started experimenting with this library. My use case is loading a simple model and then changing some material textures dynamically at runtime. This works with io.github.sceneview:arsceneview:2.2.1, today I tried out the new release io.github.sceneview:arsceneview:2.3.0 and the same code no longer does.
Relevant bits.
fun updateTexture(node: ModelNode, bitmap: Bitmap): Boolean {
val material = findMaterial(node) ?: return false
val texture = createTexture(node.engine, bitmap)
material.setBaseColorMap(texture)
return true
}
fun findMaterial(node: ModelNode): MaterialInstance? {
node.materialInstances.forEach {
it.forEach {
if (/* insert filter */) {
return it
}
}
}
return null
}
fun createTexture(engine: Engine, bitmap: Bitmap): Texture {
val texture = Texture.Builder()
.width(bitmap.width)
.height(bitmap.height)
.sampler(Texture.Sampler.SAMPLER_2D)
.build(engine)
texture.setBitmap(engine, bitmap)
return texture
}Metadata
Metadata
Assignees
Labels
No labels