diff --git a/Lighting.java b/Lighting.java index 5c3c644..fd4efb2 100644 --- a/Lighting.java +++ b/Lighting.java @@ -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); + } }