1 /*******************************************************************************
\r
2 * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
\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
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.proconf.g3d.animation;
\r
13 import com.jme.renderer.ColorRGBA;
\r
14 import com.jme.scene.state.MaterialState;
\r
16 public class ChanneledColorInterpolator implements Interpolator {
\r
17 private ScalarInterpolator rInterpolator;
\r
18 private ScalarInterpolator gInterpolator;
\r
19 private ScalarInterpolator bInterpolator;
\r
21 //Material m = null;
\r
22 MaterialState m = null;
\r
25 public static final int AMBIENT = 0;
\r
26 public static final int DIFFUSE = 1;
\r
27 public static final int SPECULAR = 2;
\r
28 public static final int EMISSIVE = 3;
\r
31 public ChanneledColorInterpolator(ScalarInterpolator rInterpolator, ScalarInterpolator gInterpolator, ScalarInterpolator bInterpolator) {
\r
32 this.rInterpolator = rInterpolator;
\r
33 this.gInterpolator = gInterpolator;
\r
34 this.bInterpolator = bInterpolator;
\r
37 public void interpolate(double delta) {
\r
38 double r = rInterpolator.evaluate(delta);
\r
39 double g = gInterpolator.evaluate(delta);
\r
40 double b = bInterpolator.evaluate(delta);
\r
42 ColorRGBA c = new ColorRGBA((float)r, (float)g, (float)b,0.f);
\r
59 public void setTarget(Object target) {
\r
60 // m = (Material)target;
\r
61 m = (MaterialState)target;
\r
64 public void setType(int type) {
\r