From 655810d1c4e710e7c85772b8dde96772dbcf274b Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 01 Jul 2018 11:50:49 -0400
Subject: [PATCH] Major mocap changes.

---
 CameraPane.java |   79 ++++++++++++++++++++++++++++++++-------
 1 files changed, 64 insertions(+), 15 deletions(-)

diff --git a/CameraPane.java b/CameraPane.java
index dda961a..b6d1421 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -2000,10 +2000,12 @@
          */
     TextureData ReduceTexture(TextureData texturedata, int resolution) // String name)
     {
+        int pixelformat = texturedata.getPixelFormat();
+        
         int stride = 1;
-        if (texturedata.getPixelFormat() == GetGL().GL_RGB || texturedata.getPixelFormat() == GetGL().GL_BGR) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE)
+        if (pixelformat == GetGL().GL_RGB || pixelformat == GetGL().GL_BGR) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE)
             stride = 3;
-        if (texturedata.getPixelFormat() == GetGL().GL_RGBA || texturedata.getPixelFormat() == GetGL().GL_BGRA) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE_ALPHA)
+        if (pixelformat == GetGL().GL_RGBA || pixelformat == GetGL().GL_BGRA) // || texturedata.getPixelFormat() == GL.GL_LUMINANCE_ALPHA)
             stride = 4;
 
         int width = texturedata.getWidth();
@@ -7590,7 +7592,8 @@
     
     float[] options1 = new float[]{1000, 0.00001f, 20, 0, 0}; // focus, aperture, Shadow blur, aniso, anisoV
     float[] options2 = new float[]{0, 1, 0, 0}; // fog density, intensity, elevation
-    float[] options3 = new float[]{1, 1, 1, 1}; // fog color. image intensity
+    float[] options3 = new float[]{1, 1, 1, 0}; // fog color
+    float[] options4 = new float[]{1, 0, 1, 0}; // image intensity, subsurface, lightsheen
 
     static int imagecount = 0; // movie generation
     
@@ -7923,7 +7926,7 @@
             
             if (!BOXMODE)
             {
-                System.out.println("image: " + fullname + " (" + (GrafreeD.wav.cursor / 735 / 4) + ")");
+                System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
             }
     
             if (!BOXMODE)
@@ -8784,7 +8787,7 @@
             if (!IsFrozen())
             {
                 // dec 2012
-                if (!(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0))
+                if (!ambientOcclusion && !(!flash && !lightMode && drawMode == DEFAULT && ANTIALIAS > 0))
                 {
             framecount++;
                     shadowbuffer.display();
@@ -9379,6 +9382,7 @@
 
         gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 63, options2, 0);
         gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 62, options3, 0);
+        gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 61, options4, 0);
 
         options2[0] *= renderCamera.Distance();
 
@@ -9750,7 +9754,7 @@
                         selectedpoint.radius = radius;
                         selectedpoint.recalculate();
                         selectedpoint.material = new cMaterial();
-                        selectedpoint.material.color = 0.25f;
+                        selectedpoint.material.color = 0.15f;
                         selectedpoint.material.modulation = 0.75f;
                         
                         debugpoint.radius = radius;
@@ -10357,11 +10361,13 @@
                 "PARAM params6   = program.env[6];" + // bump, noise, borderfade, fog punchthrough
                 "PARAM params7   = program.env[7];" + // noise power, opacity power
                 "PARAM options0   = program.env[63];" + // fog density, intensity, elevation
-                "PARAM options1   = program.env[62];" + // fog rgb color, image intensity
+                "PARAM options1   = program.env[62];" + // fog rgb color
+                "PARAM options2   = program.env[61];" + // image intensity, subsurface, lightsheen
                 "PARAM pointlight   = program.env[127];" + // ...
                 "PARAM zero     = { 0.0, 0.0, 0.0, 0.0 };" +
                 "PARAM halfhalf = { 0.25, 0.25, 0.25, 1.0 };" +
                 "PARAM half     = { 0.5, 0.5, 0.5, 1.0 };" +
+                "PARAM threequarter = { 0.75, 0.75, 0.75, 1.0 };" +
                 "PARAM two      = { 2.0, 2.0, 2.0, 1.0 };" +
                 "PARAM ten      = { 10, 10, 10, 1.0 };" +
                 "PARAM one3rd  = { 0.5, 0.33333333333, 0.333333333, 1.0 };" +
@@ -10422,6 +10428,10 @@
                 "TEMP R1;" +
                 "TEMP R2;" +
                 "TEMP R3;" +
+                "TEMP min;" +
+                "TEMP max;" +
+                "TEMP average;" +
+                "TEMP saturation;" +
                 "TEMP keep1;" +
                 "TEMP keep2;" +
                 "TEMP keep3;" +
@@ -10952,10 +10962,40 @@
 
                 // skin?
                 // Saturation for skin
-                /**/ // c'est ici
-    (Skinshader?                "DP3 temp.x, final,one;" +
+                /**/
+   (Skinshader?
+                "DP3 average.x, final,one;" +
+                "MUL average, one3rd.xxxx,average.xxxx;" +
+
+                "MIN min.x, final.x,final.y;" +
+                "MIN min.x, min.x,final.z;" +
+
+                "MAX max.x, final.x,final.y;" +
+                "MAX max.x, max.x,final.z;" +
+                "MOV max, max.xxxx;" +
+                
+                "SUB saturation, max, final;" +
+                
+                "ADD temp.x, max.x, one10th.x;" +
+                "RCP temp.x, temp.x;" +
+                "MUL temp.x, temp.x, half.x;" +
+                "MUL saturation, saturation, temp.xxxx;" +
+                
+            "DP3 ndotl.x, normald, light;" +
+            "MAX ndotl.x, ndotl.x, -ndotl.x;" +
+                
+                "SUB temp.x, one.x, ndotl.x;" +
+                "ADD temp.x, temp.x, options2.z;" + // lightsheen
+                "ADD temp.y, one.y, options2.y;" + // sursurface
+                "MUL temp.x, temp.x, temp.y;" +
+                                
+                "MUL saturation, saturation, temp.xxxx;" +
+                "SUB_SAT temp, max, saturation;" +
+/**
+                "DP3 temp.x, final,one;" +
                 "MUL R2, one3rd.xxxx,temp.xxxx;" +
-                "SUB temp, final,R2;" +
+                "SUB temp, final, R2;" +
+                  
             // using light angle
             "DP3 ndotl.x, normald,light;" +
             //"SLT ndotl.y, ndotl.x, zero.x;" +
@@ -10968,7 +11008,6 @@
             // using light intensity
             "MOV ndotl.z, R2.x;" +
             "MUL ndotl.z, ndotl.z, ndotl.z;" + // tuning...
-                
 // june 2014
                 "MAD R1.x, ndotl.z,slope.y,one.x;" +
 //                "SUB ndotl.x, one.x, ndotl.x;" +
@@ -10980,6 +11019,7 @@
 //"MUL R2.y, shadow.x,R2.y;" + // avril 2014
                 
         "MAD temp.x, R2.y, ndotl.y, temp.x;" + // red shift (skin)
+/**/
                 
              //   "ADD final, R2,temp;" +
                 "MOV final, temp;"
@@ -11069,7 +11109,7 @@
                 /**/
                 // HDR
                 "MOV temp.z, final.a;" +
-                "MUL final, final,options1.w;" +
+                "MUL final, final,options2.x;" +
                 "MOV final.a, temp.z;" +
                 /**/
                 
@@ -12814,7 +12854,9 @@
         {
             mouseMode |= ZOOM;
         }
-        if ((modifiers & META) == META)
+        
+        boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
+        if (capsLocked || (modifiers & META) == META)
         {
             mouseMode |= VR; // BACKFORTH;
         }
@@ -12828,6 +12870,7 @@
         }
         if ((modifiers & SHIFT) == SHIFT || forcetranslate)
         {
+            mouseMode &= ~VR;
             mouseMode |= TRANSLATE;
         }
     //    if ((modifiers & SHIFT_META) == SHIFT_META)
@@ -13217,7 +13260,8 @@
                 FlipTransform();
                 break;
             case ENTER:
-                object.editWindow.ScreenFit(); // Edit();
+                // object.editWindow.ScreenFit(); // Edit();
+                ToggleLive();
                 break;
             case DELETE:
                 ClearSelection();
@@ -14678,6 +14722,11 @@
 //                System.err.println("view = " + view[8] + " " + view[9] + " " + view[10] + " " + view[11]);
 //                System.err.println("view = " + view[12] + " " + view[13] + " " + view[14] + " " + view[15]);
                 
+                // Will fit the mesh !!!
+                selectedpoint.toParent[0][0] = 0.0001;
+                selectedpoint.toParent[1][1] = 0.0001;
+                selectedpoint.toParent[2][2] = 0.0001;
+                
                 glu.gluUnProject(x,y,depth,view,0,tempmat2,0,viewport,0,selectedpoint.toParent[3],0);
                 
 //                if (object.selection != null && object.selection.Size() > 0)
@@ -15300,7 +15349,7 @@
     int AAbuffersize = 0;
     
     //double[] selectedpoint = new double[3];
-    static Sphere selectedpoint = new Sphere();
+    static Superellipsoid selectedpoint = new Superellipsoid();
     static Sphere previousselectedpoint = null;
     static Sphere debugpoint = new Sphere();
     static Sphere debugpoint2 = new Sphere();

--
Gitblit v1.6.2