package electrosphere.renderer.anim;

import org.joml.Quaternionf;
import org.joml.Vector3f;

/**
 *
 * @author amaterasu
 */
public class Keyframe implements Comparable{
    double time;
    Vector3f position;
    Quaternionf rotation;
    Vector3f scale;
    
    public Keyframe(double time){
        this.time = time;
    }
    
    @Override
    public int compareTo(Object t) {
        if(time > ((Keyframe)t).getTime()){
            return 1;
        } else if(time < ((Keyframe)t).getTime()){
            return -1;
        } else {
            return 0;
        }
    }
    
    public double getTime(){
        return time;
    }
    
    @Override
    public String toString(){
        String rVal = "";
        rVal = rVal + "[" + time + "]";
        if(position != null){
            rVal = rVal + " position:" + position.toString();
        }
        if(rotation != null){
            rVal = rVal + " rotation:" + rotation.toString();
        }
        if(scale != null){
            rVal = rVal + " scale:" + scale.toString();
        }
        return rVal;
    }
}
