package electrosphere.renderer.light;

import org.joml.Vector3f;

import electrosphere.game.data.common.light.PointLightDescription;

/**
 * Data about a point light
 */
public class PointLight {
    Vector3f position;
    float constant;
    float linear;
    float quadratic;
    float radius;
    Vector3f color;

    public void setPosition(Vector3f position) {
        this.position = position;
    }

    public void setConstant(float constant) {
        this.constant = constant;
    }

    public void setLinear(float linear) {
        this.linear = linear;
    }

    public void setQuadratic(float quadratic) {
        this.quadratic = quadratic;
    }

    public void setRadius(float radius){
        this.radius = radius;
    }

    public void setColor(Vector3f color){
        this.color = color;
    }

    public Vector3f getPosition() {
        return position;
    }

    public float getConstant() {
        return constant;
    }

    public float getLinear() {
        return linear;
    }

    public float getQuadratic() {
        return quadratic;
    }

    public Vector3f getColor(){
        return color;
    }

    public float getRadius(){
        return radius;
    }

    protected PointLight(Vector3f position){
        this.position = position;
        radius = 1;
        constant = 1.0f;
        linear = 0.7f;
        quadratic = 1.8f;
        color = new Vector3f(1.0f);
    }

    protected PointLight(Vector3f position, Vector3f color){
        this.position = position;
        radius = 1;
        constant = 1.0f;
        linear = 0.7f;
        quadratic = 1.8f;
        this.color = color;
    }

    /**
     * Creates a point light from a light description
     * @param description The description
     */
    protected PointLight(PointLightDescription description){
        this.position = new Vector3f();
        this.radius = description.getRadius();
        this.constant = description.getConstant();
        this.linear = description.getLinear();
        this.quadratic = description.getQuadratic();
        this.color = description.getColor();
    }
}