Revision 15466 import/ext3D/branches/ext3D_v1.1/extAnimation3D/src/com/iver/cit/gvsig/animation/Interpolator3DFlat.java
Interpolator3DFlat.java | ||
---|---|---|
4 | 4 |
|
5 | 5 |
import com.iver.ai2.gvsig3d.camera.ProjectCamera; |
6 | 6 |
import com.iver.ai2.gvsig3d.gui.View3D; |
7 |
import com.iver.cit.gvsig.animation.keyframe.IInterpolator; |
|
8 | 7 |
import com.iver.cit.gvsig.animation.keyframe.IKeyFrame; |
8 |
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolator; |
|
9 |
import com.iver.cit.gvsig.animation.keyframe.interpolator.IInterpolatorFuntion; |
|
9 | 10 |
|
10 | 11 |
import es.upv.ai2.libjosg.Vec3; |
11 | 12 |
import es.upv.ai2.libjosg.viewer.Camera; |
... | ... | |
13 | 14 |
public class Interpolator3DFlat implements IInterpolator { |
14 | 15 |
|
15 | 16 |
public View3D view; |
17 |
private IInterpolatorFuntion funtion; |
|
16 | 18 |
|
17 | 19 |
public IKeyFrame interpolate(List kfList, int index, double time) { |
18 | 20 |
KeyFrame3DFlat KF = new KeyFrame3DFlat(); |
... | ... | |
23 | 25 |
if (this.view == null) |
24 | 26 |
return null; |
25 | 27 |
|
28 |
|
|
29 |
// convert the time in the new time using funtion |
|
30 |
double newTime = this.getFuntion().interpolate(time); |
|
31 |
|
|
26 | 32 |
switch (kfList.size()) { |
27 | 33 |
// this case when there are only has 2 keyframes |
28 | 34 |
case 2: |
... | ... | |
48 | 54 |
double time1 = kf1.getTime(); |
49 | 55 |
double time2 = kf2.getTime(); |
50 | 56 |
|
51 |
Vec3 eye = linearInterpolate(cam1.getEye(), cam2.getEye(), time1, time2, time);
|
|
52 |
Vec3 center = linearInterpolate(cam1.getCenter(), cam2.getCenter(), time1, time2, time);
|
|
57 |
Vec3 eye = linearInterpolate(cam1.getEye(), cam2.getEye(), time1, time2, newTime);
|
|
58 |
Vec3 center = linearInterpolate(cam1.getCenter(), cam2.getCenter(), time1, time2, newTime);
|
|
53 | 59 |
// Vec3 center = new Vec3(eye.x(),eye.y(),0.0); |
54 |
Vec3 up = linearInterpolate(cam1.getUp(), cam2.getUp(), time1, time2, time);
|
|
60 |
Vec3 up = linearInterpolate(cam1.getUp(), cam2.getUp(), time1, time2, newTime);
|
|
55 | 61 |
|
56 | 62 |
Camera newCamera = new Camera(); |
57 | 63 |
// newCamera.setViewByLookAt(eye, center, cam1.getUp()); |
... | ... | |
103 | 109 |
this.view = (View3D) ani; |
104 | 110 |
|
105 | 111 |
} |
112 |
|
|
113 |
public IInterpolatorFuntion getFuntion() { |
|
114 |
return this.funtion; |
|
115 |
} |
|
116 |
|
|
117 |
public void setFuntion(IInterpolatorFuntion funtion) { |
|
118 |
this.funtion = funtion; |
|
119 |
|
|
120 |
} |
|
106 | 121 |
} |
Also available in: Unified diff