/** * Create one {@link Animation} for each {@link AnimationModel.Channel}. * If there is any error or inconsistency in the given data, then a * warning will be printed and the respective animation will be * skipped. * * @param channels The {@link AnimationModel.Channel} list * @return The list of model animations */ private static List<Animation> createModelAnimationsForChannels( Iterable<? extends Channel> channels) { List<Animation> modelAnimations = new ArrayList<Animation>(); for (Channel channel : channels) { Animation modelAnimation = createModelAnimation(channel); if (modelAnimation != null) { modelAnimations.add(modelAnimation); } } return modelAnimations; }
/** * Create all model {@link Animation} instances from the given * {@link AnimationModel} instances * * @param animationModels The {@link AnimationModel} instances * @return The model animations */ public static List<Animation> createModelAnimations( Iterable<? extends AnimationModel> animationModels) { Objects.requireNonNull(animationModels, "The animationModels may not be null"); List<Animation> allModelAnimations = new ArrayList<Animation>(); for (AnimationModel animationModel : animationModels) { List<Channel> channels = animationModel.getChannels(); List<Animation> modelAnimations = createModelAnimationsForChannels(channels); allModelAnimations.addAll(modelAnimations); } return allModelAnimations; }
return createTranslationAnimationListener(nodeModel); return createRotationAnimationListener(nodeModel); return createScaleAnimationListener(nodeModel); return createWeightsAnimationListener(nodeModel);
createAnimationListener(nodeModel, path); if (animationListener == null) typeForInterpolation(interpolation, path); createAnimation(inputFloatData, outputFloatData, interpolatorType); modelAnimation.addAnimationListener(animationListener); return modelAnimation;
/** * Default constructor */ protected AbstractGltfViewer() { this.beforeRenderTasks = Collections.synchronizedList( new ArrayList<Runnable>()); this.renderedGltfModels = new LinkedHashMap<GltfModel, RenderedGltfModel>(); this.gltfModels = new ArrayList<GltfModel>(); this.animationManager = GltfAnimations.createAnimationManager(AnimationPolicy.LOOP); this.animationManager.addAnimationManagerListener(a -> { triggerRendering(); }); this.animationRunner = new AnimationRunner(animationManager); this.modelAnimations = new LinkedHashMap<GltfModel, List<Animation>>(); setAnimationsRunning(true); }
GltfAnimations.createModelAnimations(gltfModel.getAnimationModels()); modelAnimations.put(gltfModel, currentModelAnimations); animationManager.addAnimations(currentModelAnimations);