From 6ed65dcb597fb2153cef75bf1845978f1115658c Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Fri, 14 Dec 2018 22:53:55 -0500
Subject: [PATCH] Repair shadow, normal push + attractor mesh.

---
 CameraPane.java |   92 ++++++++++++++++++++++++++++-----------------
 1 files changed, 57 insertions(+), 35 deletions(-)

diff --git a/CameraPane.java b/CameraPane.java
index f2d438e..a5a5ed5 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -7444,6 +7444,8 @@
             //gl.glFrustum(-0.5*scale, 0.5*scale, -0.5*scale, 0.5*scale, 1, 100);
             //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar);
             double scale = lightCamera.SCALE / lightCamera.Distance();
+// PATCH FILLE AUX JEANS           
+            //scale *= lightCamera.shaper_fovy / 25;
             gl.glScaled(2 * scale, 2 * scale, -scale);
             gl.glTranslated(0, 0, lightCamera.DECAL);
 
@@ -9092,6 +9094,8 @@
             //gl.glFrustum(-0.5*scale, 0.5*scale, -0.5*scale, 0.5*scale, 1, 100);
             //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar);
             double scale = lightCamera.SCALE / lightCamera.Distance();
+// PATCH FILLE AUX JEANS           
+            //scale *= lightCamera.shaper_fovy / 25;
             gl.glScaled(2 * scale, 2 * scale, -scale);
             gl.glTranslated(0, 0, lightCamera.DECAL);
 
@@ -9231,6 +9235,8 @@
         {
             //glu.gluPerspective(lightshaper_fovy, 1, lightshaper_zNear, lightshaper_zFar);
             double scale = lightCamera.SCALE / lightCamera.Distance();
+// PATCH FILLE AUX JEANS            
+            //scale *= lightCamera.shaper_fovy / 25;
             gl.glScaled(2 * scale, 2 * scale, -scale);
             gl.glTranslated(0, 0, lightCamera.DECAL);
         //System.out.println("DECAL = " + LIGHTDECAL + "; SCALE = " + LIGHTSCALE);
@@ -9754,40 +9760,40 @@
                         selectedpoint.radius = radius;
                         selectedpoint.recalculate();
                         selectedpoint.material = new cMaterial();
-                        selectedpoint.material.color = 0.15f;
+                        selectedpoint.material.color = 0.15f; // Yellow
                         selectedpoint.material.modulation = 0.75f;
                         
-                        debugpoint.radius = radius;
-                        debugpoint.recalculate();
-                        debugpoint.material = new cMaterial();
-                        debugpoint.material.color = 0.25f;
-                        debugpoint.material.modulation = 0.75f;
+                        debugpointG.radius = radius;
+                        debugpointG.recalculate();
+                        debugpointG.material = new cMaterial();
+                        debugpointG.material.color = 0.25f; // Green
+                        debugpointG.material.modulation = 0.75f;
                         
-                        debugpoint2.radius = radius;
-                        debugpoint2.recalculate();
-                        debugpoint2.material = new cMaterial();
-                        debugpoint2.material.color = 0.75f;
-                        debugpoint2.material.modulation = 0.75f;
+                        debugpointP.radius = radius;
+                        debugpointP.recalculate();
+                        debugpointP.material = new cMaterial();
+                        debugpointP.material.color = 0.75f; // Purple
+                        debugpointP.material.modulation = 0.75f;
                         
-                        debugpoint3.radius = radius;
-                        debugpoint3.recalculate();
-                        debugpoint3.material = new cMaterial();
-                        debugpoint3.material.color = 0.5f;
-                        debugpoint3.material.modulation = 0.75f;
+                        debugpointC.radius = radius;
+                        debugpointC.recalculate();
+                        debugpointC.material = new cMaterial();
+                        debugpointC.material.color = 0.5f; // Cyan
+                        debugpointC.material.modulation = 0.75f;
                         
-                        debugpoint4.radius = radius;
-                        debugpoint4.recalculate();
-                        debugpoint4.material = new cMaterial();
-                        debugpoint4.material.color = 0f;
-                        debugpoint4.material.modulation = 0.75f;
+                        debugpointR.radius = radius;
+                        debugpointR.recalculate();
+                        debugpointR.material = new cMaterial();
+                        debugpointR.material.color = 0f; // Red
+                        debugpointR.material.modulation = 0.75f;
                         
                         InitPoints(radius);
                     }
                     selectedpoint.draw(this, /*(Composite)*/ null, false, false);
-                    debugpoint.draw(this, /*(Composite)*/ null, false,false);
-                    debugpoint2.draw(this, /*(Composite)*/ null, false,false);
-                    debugpoint3.draw(this, /*(Composite)*/ null, false,false);
-                    debugpoint4.draw(this, /*(Composite)*/ null, false,false);
+                    debugpointG.draw(this, /*(Composite)*/ null, false,false);
+                    debugpointP.draw(this, /*(Composite)*/ null, false,false);
+                    debugpointC.draw(this, /*(Composite)*/ null, false,false);
+                    debugpointR.draw(this, /*(Composite)*/ null, false,false);
                     // DrawPoints(this);
                 }
                 
@@ -9825,12 +9831,14 @@
 
             if (checker != null && drawMode == DEFAULT)
             {
-               // BindTexture(IMMORTAL_TEXTURE);
+                //BindTexture(IMMORTAL_TEXTURE);
+                BindTextures(checker.GetTextures(), checker.texres);
                 // NEAREST
                 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
                 DrawChecker(gl);
                 //checker.Draw(this, null, false);
               //  ReleaseTexture(IMMORTAL_TEXTURE);
+                ReleaseTextures(checker.GetTextures());
             }
 
             if (object.parent != null)
@@ -10388,6 +10396,7 @@
                 "PARAM lodbias = { 10,10,10,10 };" + // 20, -2, -20, 1.0 };" +
                 "PARAM infinity  = { 100000000, 100000000, 100000000, 1.0 };" +
                 "PARAM one2048th = { 0.00048828125, 0.00048828125, 0.00048828125, 1.0 };" +
+                "PARAM ninetenth = { 0.9, 0.9, 0.9, 1.0 };" +
                 "PARAM almostone = { 0.999, 0.999, 0.999, 1.0 };" +
                 "PARAM c256 = { 256, 256, 256, 1.0 };" +
                 "PARAM c256i = { 0.00390625, 0.00390625, 0.00390625, 1.0 };" +
@@ -11302,6 +11311,7 @@
     String Shadow(String depth, String shadow)
     {
         return "MAX temp.x, ndotl.x, one64th.x;" +
+               "MIN temp.x, temp.x, ninetenth.x;" +
                 /**/
                 // Sine
                 "MUL temp.y, temp.x, temp.x;" +
@@ -14438,7 +14448,7 @@
         gl.glPushAttrib(GL.GL_ALL_ATTRIB_BITS);
         gl.glPushMatrix();
         gl.glLoadIdentity();
-        PushMatrix(checker.toParent);
+        //PushMatrix(checker.toParent);
 
         gl.glMatrixMode(GL.GL_TEXTURE);
         gl.glPushMatrix();
@@ -14461,8 +14471,8 @@
 
         gl.glNormal3f(0.0f, 0.0f, 1.0f);
             
-        float step = 0.1666f; //0.25f;
-        float stepv = step * 1652 / 998;
+        float step = 2; // 0.1666f; //0.25f;
+        float stepv = 2; // step * 1652 / 998;
 
         int i0 = 0;
         /*
@@ -14532,15 +14542,27 @@
 
                 //float u = (i+1)/2;
                 //float v = (j+1)/2;
-                gl.glTexCoord2f((i + 1) / 2, (j + 1) / 2); // (1,0) // (i+1+step)/2,(j+1)/2);
+                if (checker.flipV)
+                        gl.glTexCoord2f((i + 1) / 2, 1 - (j + 1) / 2);
+                else
+                        gl.glTexCoord2f((i + 1) / 2, (j + 1) / 2); // (1,0) // (i+1+step)/2,(j+1)/2);
                 gl.glVertex3f(i, j, -0.5f);
 
+                if (checker.flipV)
+                gl.glTexCoord2f((i + 1 + step) / 2, 1 - (j + 1) / 2); // (1,1) // (i+1+step)/2,(j+1+step)/2);
+                else
                 gl.glTexCoord2f((i + 1 + step) / 2, (j + 1) / 2); // (1,1) // (i+1+step)/2,(j+1+step)/2);
                 gl.glVertex3f(i + step, j, -0.5f);
 
+                if (checker.flipV)
+                gl.glTexCoord2f((i + 1 + step) / 2, 1 - (j + 1 + stepv) / 2); // (0,1) //(i+1)/2,(j+1+step)/2);
+                else
                 gl.glTexCoord2f((i + 1 + step) / 2, (j + 1 + stepv) / 2); // (0,1) //(i+1)/2,(j+1+step)/2);
                 gl.glVertex3f(i + step, j + stepv, -0.5f);
 
+                if (checker.flipV)
+                gl.glTexCoord2f((i + 1) / 2, 1 - (j + 1 + stepv) / 2); // (0,0) //(i+1)/2,(j+1)/2);
+                else
                 gl.glTexCoord2f((i + 1) / 2, (j + 1 + stepv) / 2); // (0,0) //(i+1)/2,(j+1)/2);
                 gl.glVertex3f(i, j + stepv, -0.5f);
             }
@@ -14552,7 +14574,7 @@
         gl.glMatrixMode(GL.GL_PROJECTION);
         gl.glPopMatrix();
         gl.glMatrixMode(GL.GL_MODELVIEW);
-        PopMatrix(null); // checker.toParent); // null);
+        //PopMatrix(null); // checker.toParent); // null);
         gl.glPopMatrix();
         PopTextureMatrix(checker.toParent);
         gl.glMatrixMode(GL.GL_TEXTURE);
@@ -15370,10 +15392,10 @@
     //double[] selectedpoint = new double[3];
     static Superellipsoid selectedpoint = new Superellipsoid();
     static Sphere previousselectedpoint = null;
-    static Sphere debugpoint = new Sphere();
-    static Sphere debugpoint2 = new Sphere();
-    static Sphere debugpoint3 = new Sphere();
-    static Sphere debugpoint4 = new Sphere();
+    static Sphere debugpointG = new Sphere();
+    static Sphere debugpointP = new Sphere();
+    static Sphere debugpointC = new Sphere();
+    static Sphere debugpointR = new Sphere();
     
     static Sphere debugpoints[] = new Sphere[8];
  

--
Gitblit v1.6.2