package de.frajul.endlessroll.data;

/**
 * Created by Julian on 02.08.2016.
 */
public class Color3f {

    private float r, g, b;

    public Color3f() {
    }

    public Color3f(float r, float g, float b) {
        this.r = r;
        this.g = g;
        this.b = b;
    }

    public Color3f(Color3f other) {
        this.r = other.getR();
        this.g = other.getG();
        this.b = other.getB();
    }

    public Color3f interpolate(float leftValue, float rightValue, Color3f color2) {
        float r = this.r + (color2.r - this.r) * leftValue;
        float g = this.g + (color2.g - this.g) * leftValue;
        float b = this.b + (color2.b - this.b) * leftValue;
        return new Color3f(r, g, b);
    }

    private void mul(float a) {
        r *= a;
        g *= a;
        b *= a;
    }

    private void add(Color3f other) {
        r += other.getR();
        g += other.getG();
        b += other.getB();
    }

    public float getR() {
        return r;
    }

    public void setR(float r) {
        this.r = r;
    }

    public float getG() {
        return g;
    }

    public void setG(float g) {
        this.g = g;
    }

    public float getB() {
        return b;
    }

    public void setB(float b) {
        this.b = b;
    }
}
