/** * 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)); } }
samplerId = GltfIds.generateId("sampler", gltf.getSamplers()); gltf.addSamplers(samplerId, sampler);
getGltf().getSamplers(), samplerId, context.with("sampler"))); if (validatorResult.hasErrors())
/** * Compute the {@link IndexMappingSet} for the given glTF instance. * The {@link IndexMappingSet} will contain index mappings for all * top-level dictionaries of the given glTF. * * @param gltf The glTF * @return The {@link IndexMappingSet} */ static IndexMappingSet create(GlTF gltf) { IndexMappingSet indexMappingSet = new IndexMappingSet(); indexMappingSet.generate("accessors", gltf.getAccessors()); indexMappingSet.generate("animations", gltf.getAnimations()); indexMappingSet.generate("buffers", gltf.getBuffers()); indexMappingSet.generate("bufferViews", gltf.getBufferViews()); indexMappingSet.generate("cameras", gltf.getCameras()); indexMappingSet.generate("images", gltf.getImages()); indexMappingSet.generate("materials", gltf.getMaterials()); indexMappingSet.generate("meshes", gltf.getMeshes()); indexMappingSet.generate("nodes", gltf.getNodes()); indexMappingSet.generate("programs", gltf.getPrograms()); indexMappingSet.generate("samplers", gltf.getSamplers()); indexMappingSet.generate("scenes", gltf.getScenes()); indexMappingSet.generate("shaders", gltf.getShaders()); indexMappingSet.generate("skins", gltf.getSkins()); indexMappingSet.generate("techniques", gltf.getTechniques()); indexMappingSet.generate("textures", gltf.getTextures()); return indexMappingSet; }