Renderer/src/main/java/electrosphere/RendererObjects/Light/DirectionalLight.java
2021-03-17 00:39:34 -04:00

75 lines
1.9 KiB
Java

/*
* 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.RendererObjects.Light;
import org.joml.Vector3f;
/**
*
* @author amaterasu
*/
public class DirectionalLight {
Vector3f direction;
Vector3f ambient;
Vector3f diffuse;
Vector3f specular;
public void setDirection(Vector3f direction) {
this.direction = direction;
}
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 getDirection() {
return direction;
}
public Vector3f getAmbient() {
return ambient;
}
public Vector3f getDiffuse() {
return diffuse;
}
public Vector3f getSpecular() {
return specular;
}
public DirectionalLight(Vector3f direction){
this.direction = direction;
ambient = new Vector3f(0.05f, 0.05f, 0.05f);
diffuse = new Vector3f(0.4f, 0.4f, 0.4f);
specular = new Vector3f(0.5f, 0.5f, 0.5f);
this.direction.normalize();
ambient.normalize();
diffuse.normalize();
specular.normalize();
}
public DirectionalLight(Vector3f direction, Vector3f color){
this.direction = direction;
ambient = new Vector3f( color.x * 0.05f, color.y * 0.05f, color.z * 0.05f);
diffuse = new Vector3f( color.x * 0.4f, color.y * 0.4f, color.z * 0.4f);
specular = new Vector3f(color.x * 0.5f, color.y * 0.5f, color.z * 0.5f);
this.direction.normalize();
ambient.normalize();
diffuse.normalize();
specular.normalize();
}
}