/** * Create the {@link TextureModel} instances */ private void createTextureModels() { Map<String, Texture> textures = Optionals.of(gltf.getTextures()); Map<String, Sampler> samplers = Optionals.of(gltf.getSamplers()); for (Entry<String, Texture> entry : textures.entrySet()) { Texture texture = entry.getValue(); String samplerId = texture.getSampler(); Sampler sampler = samplers.get(samplerId); int magFilter = Optionals.of( sampler.getMagFilter(), sampler.defaultMagFilter()); int minFilter = Optionals.of( sampler.getMinFilter(), sampler.defaultMinFilter()); int wrapS = Optionals.of( sampler.getWrapS(), sampler.defaultWrapS()); int wrapT = Optionals.of( sampler.getWrapT(), sampler.defaultWrapT()); textureModels.add(new DefaultTextureModel( magFilter, minFilter, wrapS, wrapT)); } }
Sampler sampler = new Sampler(); samplerId = GltfIds.generateId("sampler", gltf.getSamplers()); gltf.addSamplers(samplerId, sampler);