From 733d632a8ed4f4054048dd6cb4dbc0c1b4440427 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Tschumperl=C3=A9?= <David.Tschumperle@gmail.com>
Date: Fri, 15 Jun 2018 08:49:18 +0200
Subject: [PATCH] .

---
 CImg.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/CImg.h b/CImg.h
index baca22d..a0b12af 100644
--- a/CImg.h
+++ b/CImg.h
@@ -47030,15 +47030,18 @@ namespace cimg_library_suffixed {
             tx1 = (int)primitive[6], ty1 = (int)primitive[7],
             tx2 = (int)primitive[8], ty2 = (int)primitive[9],
             tx3 = (int)primitive[10], ty3 = (int)primitive[11],
+            txc = (tx0 + tx1 + tx2 + tx3)/4, tyc = (ty0 + ty1 + ty2 + ty3)/4,
             x0 = (int)projections(n0,0), y0 = (int)projections(n0,1),
             x1 = (int)projections(n1,0), y1 = (int)projections(n1,1),
             x2 = (int)projections(n2,0), y2 = (int)projections(n2,1),
-            x3 = (int)projections(n3,0), y3 = (int)projections(n3,1);
+            x3 = (int)projections(n3,0), y3 = (int)projections(n3,1),
+            xc = (x0 + x1 + x2 + x3)/4, yc = (y0 + y1 + y2 + y3)/4;
           const float
             z0 = vertices(n0,2) + Z + _focale,
             z1 = vertices(n1,2) + Z + _focale,
             z2 = vertices(n2,2) + Z + _focale,
-            z3 = vertices(n3,2) + Z + _focale;
+            z3 = vertices(n3,2) + Z + _focale,
+            zc = (z0 + z1 + z2 + z3)/4;
 
           switch (render_type) {
           case 0 :
@@ -47126,7 +47129,8 @@ namespace cimg_library_suffixed {
           case 4 : {
             const float
               lightprop0 = lightprops(n0), lightprop1 = lightprops(n1),
-              lightprop2 = lightprops(n2), lightprop3 = lightprops(n3);
+              lightprop2 = lightprops(n2), lightprop3 = lightprops(n3),
+              lightpropc = (lightprop0 + lightprop1 + lightprop2 + lightprop3)/4;
             if (zbuffer)
               draw_triangle(zbuffer,x0,y0,z0,x1,y1,z1,x2,y2,z2,color,tx0,ty0,tx1,ty1,tx2,ty2,
                             lightprop0,lightprop1,lightprop2,opacity).
-- 
GitLab