Reputation: 13
The server has more than 3000 models and each of them has several colors of material. I need to load separately models and textures and set textures depending on the user's choice. How to change baseColorMap, normalMap, metallicMap, roughnessMap in runtime?
after modelRenderable.getMaterial().setTexture("normalMap", normalMap.get()); nothing happens I'm doing something wrong. There is no information in documentation for that.
Upvotes: 1
Views: 2184
Reputation: 41
use this code`
CompletableFuture<Texture> futureTexture = Texture.builder()
.setSource(this, R.drawable.shoes)
.build();
and replace with
/*.thenAccept(renderable -> andyRenderable = renderable)*/
.thenAcceptBoth(futureTexture, (renderable, texture) -> {
andyRenderable = renderable;
andyRenderable.getMaterial().setTexture("baseColor", texture);
})
would work.
Upvotes: 1
Reputation: 36
thank you for posting this question.
setTexture()
appears to not work: Unfortunately this part of our API is still a little rough; it works but is very easy to get wrong. We're working on a sample to illustrate how to modify material parameters (including textures) at runtime and will improve our error reporting in the next release..sfb
. We'll be releasing a blog post soon on how to do this..sfa
will get the ability to contain loose textures and materials not explicitly associated with geometry, and .sfa
's will be able to declare data dependencies on other .sfa
's. This will mean that you can author (and deliver) .sfb
's that contain textures/materials (but no geometry) and .sfb
's that contain geometry (but no textures/materials), and if they're both available at instantiation time it will just work.Upvotes: 1