/** * Create the {@link AnimationModel} instances */ private void createAnimationModels() { Map<String, Animation> animations = Optionals.of(gltf.getAnimations()); for (int i = 0; i < animations.size(); i++) { animationModels.add(new DefaultAnimationModel()); } }
/** * Initialize the {@link AnimationModel} instances */ private void initAnimationModels() { Map<String, Animation> animations = Optionals.of(gltf.getAnimations()); for (Entry<String, Animation> entry : animations.entrySet()) { String animationId = entry.getKey(); Animation animation = entry.getValue(); DefaultAnimationModel animationModel = get("animations", animationId, animationModels); animationModel.setName(animation.getName()); List<AnimationChannel> channels = Optionals.of(animation.getChannels()); for (AnimationChannel animationChannel : channels) { Channel channel = createChannel(animation, animationChannel); animationModel.addChannel(channel); } } }
/** * 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; }