feat: surcharge applyLights

This commit is contained in:
Laureηt 2022-04-19 21:59:52 +02:00
parent ac2837a7af
commit 22d1218690
No known key found for this signature in database
GPG key ID: D88C6B294FD40994

View file

@ -1,5 +1,8 @@
import java.util.*;
import java.util.List;
import algebra.*;
import java.awt.Color;
/* * The Lighting class describes a scene lighting environment
* @author: gmorin, smondet */
@ -43,13 +46,13 @@ public class Lighting {
/*
* Computes the illuminated color of a 3D points of given position, normal and
* color,
* and given the camera position and material parameters.
* color, and given the camera position and material parameters.
* Returns an array of size 3.
*/
public double[] applyLights(Vector3 position, Vector3 normal, double[] color,
Vector3 cameraPosition,
double ka, double kd, double ks, double s) {
double[] litColor = new double[3];
/* total light intensity */
double I = 0.0;
@ -102,4 +105,20 @@ public class Lighting {
litColor[2] = I * color[2];
return litColor;
}
/*
* Computes the illuminated color of a 3D points of given position, normal and
* color, and given the camera position and material parameters.
* Returns an array of size 3.
*/
public double[] applyLights(Vector3 position, Vector3 normal, Color color,
Vector3 cameraPosition, double ka, double kd, double ks, double s) {
double[] couleur = new double[3];
couleur[0] = color.getRed();
couleur[1] = color.getGreen();
couleur[2] = color.getBlue();
return applyLights(position, normal, couleur, cameraPosition, ka, kd, ks, s);
}
}