/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package electrosphere.renderer.light;

import org.joml.Vector3f;

/**
 *
 * @author amaterasu
 */
public class SpotLight {
    Vector3f position;
    Vector3f direction;
    float cutOff;
    float outerCutOff;

    float constant;
    float linear;
    float quadratic;

    Vector3f ambient;
    Vector3f diffuse;
    Vector3f specular;

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

    public void setDirection(Vector3f direction) {
        this.direction = direction;
    }

    public void setCutOff(float cutOff) {
        this.cutOff = cutOff;
    }

    public void setOuterCutOff(float outerCutOff) {
        this.outerCutOff = outerCutOff;
    }

    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 setAmbient(Vector3f ambient) {
        this.ambient = ambient;
    }

    public void setDiffuse(Vector3f diffuse) {
        this.diffuse = diffuse;
    }

    public void setSpecular(Vector3f specular) {
        this.specular = specular;
    }

    public Vector3f getPosition() {
        return position;
    }

    public Vector3f getDirection() {
        return direction;
    }

    public float getCutOff() {
        return cutOff;
    }

    public float getOuterCutOff() {
        return outerCutOff;
    }

    public float getConstant() {
        return constant;
    }

    public float getLinear() {
        return linear;
    }

    public float getQuadratic() {
        return quadratic;
    }

    public Vector3f getAmbient() {
        return ambient;
    }

    public Vector3f getDiffuse() {
        return diffuse;
    }

    public Vector3f getSpecular() {
        return specular;
    }



    public SpotLight(Vector3f position, Vector3f direction){
        this.position = position;
        this.direction = direction;
        cutOff = (float)Math.toRadians(12.5f);
        outerCutOff = (float)Math.toRadians(15.0f);
        constant = 1.0f;
        linear = 0.01f;
        quadratic = 0.01f;
        ambient = new Vector3f(0.05f, 0.05f, 0.05f);
        diffuse = new Vector3f(0.8f, 0.8f, 0.8f);
        specular = new Vector3f(1.0f, 1.0f, 1.0f);
        this.position.normalize();
        this.direction.normalize();
        ambient.normalize();
        diffuse.normalize();
        specular.normalize();
    }

    public SpotLight(Vector3f position, Vector3f direction, Vector3f color){
        this.position = position;
        this.direction = direction;
        constant = 1.0f;
        linear = 0.01f;
        quadratic = 0.01f;
        ambient = new Vector3f(color.x * 0.05f, color.y * 0.05f, color.z * 0.05f);
        diffuse = new Vector3f(color.x * 0.8f,  color.y * 0.8f,  color.z * 0.8f);
        specular = new Vector3f(color.x,        color.y,         color.z);
        this.position.normalize();
        this.direction.normalize();
        ambient.normalize();
        diffuse.normalize();
        specular.normalize();
    }
}