/******************************************************************************* * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.proconf.g3d.animation; import com.jme.math.Vector3f; import com.jme.scene.Node; public class ChanneledPositionInterpolator implements Interpolator { private ScalarInterpolator xInterpolator; private ScalarInterpolator yInterpolator; private ScalarInterpolator zInterpolator; Node node; public ChanneledPositionInterpolator(ScalarInterpolator xInterpolator, ScalarInterpolator yInterpolator, ScalarInterpolator zInterpolator) { this.xInterpolator = xInterpolator; this.yInterpolator = yInterpolator; this.zInterpolator = zInterpolator; } public void interpolate(double delta) { double x = xInterpolator.evaluate(delta); double y = yInterpolator.evaluate(delta); double z = zInterpolator.evaluate(delta); node.setLocalTranslation(new Vector3f((float)x,(float)y,(float)z)); } public void setTarget(Object target) { node = (Node)target; } }