]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d/src/org/simantics/proconf/g3d/animation/SlerpInterpolator.java
f6c1913f6ca54903d654edc46bf75a7fae90b477
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / proconf / g3d / animation / SlerpInterpolator.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.proconf.g3d.animation;\r
12 \r
13 import javax.vecmath.Quat4d;\r
14 \r
15 import org.simantics.proconf.g3d.base.VecmathJmeTools;\r
16 \r
17 \r
18 import com.jme.scene.Node;\r
19 \r
20 import org.simantics.animation.curve.SlerpCurve;\r
21 \r
22 \r
23 public class SlerpInterpolator implements Interpolator{\r
24     private SlerpCurve curve;\r
25     \r
26     //private TransformGroup group;\r
27     //private Transform3D transform;\r
28     private Node node = null;\r
29     \r
30     public SlerpInterpolator(SlerpCurve curve) {\r
31         this.curve = curve;\r
32         //transform = new Transform3D();\r
33     }\r
34     \r
35     public void interpolate(double delta) {\r
36        Quat4d q = curve.evaluate(delta);\r
37        //transform.set(new Quat4f(q));\r
38        //group.setTransform(transform);\r
39        node.setLocalRotation(VecmathJmeTools.get(q));\r
40     }\r
41     \r
42     public void setTarget(Object target) {\r
43         //group = (TransformGroup)target;\r
44         node = (Node)target;\r
45     }\r
46     \r
47 }\r