style: calcul de pondere plus joli

This commit is contained in:
Laureηt 2022-04-14 16:49:46 +02:00
parent aa3c813795
commit e56ba8d1c7
No known key found for this signature in database
GPG key ID: D88C6B294FD40994

View file

@ -241,8 +241,10 @@ public class Rasterizer {
// on interpole la couleur // on interpole la couleur
for (int i = 0; i < couleur.getNumAttributes(); i++) { for (int i = 0; i < couleur.getNumAttributes(); i++) {
double pondere = v1.getAttribute(i) * barycentre.get(0) + v2.getAttribute(i) * barycentre.get(1) double pondere = 0;
+ v3.getAttribute(i) * barycentre.get(2); pondere += v1.getAttribute(i) * barycentre.get(0);
pondere += v2.getAttribute(i) * barycentre.get(1);
pondere += v3.getAttribute(i) * barycentre.get(2);
couleur.setAttribute(i, pondere); couleur.setAttribute(i, pondere);
} }