From ab9e1281ca1ccb3e5d01eb24934f81c1072114f2 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Thu, 12 Sep 2019 21:14:10 -0400
Subject: [PATCH] Four new presets + sort option.

---
 ObjEditor.java           |  118 ++++++++++++++++++++++++++++++++++++---
 fullscenes/skullcove.png |    0 
 BoundaryRep.java         |    3 
 CameraPane.java          |   18 +++++
 cMaterial.java           |    2 
 fullscenes/yvoire.png    |    0 
 fullscenes/viking.png    |    0 
 Object3D.java            |   34 +++++++----
 fullscenes/alsace.png    |    0 
 9 files changed, 149 insertions(+), 26 deletions(-)

diff --git a/BoundaryRep.java b/BoundaryRep.java
index 8891b1a..6fecd44 100644
--- a/BoundaryRep.java
+++ b/BoundaryRep.java
@@ -7,7 +7,8 @@
 
 class BoundaryRep implements java.io.Serializable
 {
-    static final long serialVersionUID = -4852664309425035321L;
+    static final long serialVersionUID = // VERY old 2008 -5762968998168738314L;
+                                        -4852664309425035321L;
 
     transient int displaylist = 0;
     
diff --git a/CameraPane.java b/CameraPane.java
index f05e777..232593d 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -3601,6 +3601,8 @@
            };
      /**/
         
+        static Object3D lastObject;
+        
         //com.sun.opengl.util.texture.Texture
         TextureData
                 GetFileTexture(String name, boolean bump, int resolution)
@@ -3637,6 +3639,8 @@
                 //    return null;
                     //if (i == 2)
                     //    return null;
+                    // TIFF issue sept 2019
+                    System.err.println("lastObject = " + lastObject);
                     e.printStackTrace();
                     name = name.split("\\.tif")[0] + ".jpg";
                 }
@@ -15753,6 +15757,16 @@
                 break;
             case 'l':
                 lightMode ^= true;
+                if (lightMode)
+                {
+                    keepshadow = Globals.RENDERSHADOW;
+                    Globals.RENDERSHADOW = false;
+                }
+                else
+                {
+                    Globals.RENDERSHADOW = keepshadow;
+                }
+        
                 Globals.lighttouched = true;
                 manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
                 targetLookAt.set(manipCamera.lookAt);
@@ -17410,7 +17424,7 @@
 
             float depth = depths[y * TEX_SIZE + x];
 
-            if (pointselection && mouseMode == SELECT && depth != 0 && depth != 1)
+            if (pointselection && (mouseMode & SELECT) == SELECT && depth != 0 && depth != 1)
             {
                 pointselection = false;
                 
@@ -18075,6 +18089,8 @@
     boolean OCCLUSION_CULLING = false; //true;
     public boolean lightMode = false;
     
+    private boolean keepshadow;
+    
     public boolean capsLocked = false; // VR
     
     static public int indexcount = 0;
diff --git a/ObjEditor.java b/ObjEditor.java
index 4f82f20..d6747b4 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -799,6 +799,8 @@
 //            SendInfo("    delay: " + sel.delay + newline, "regular");
             // live, hide, ...
             //??       SendInfo("    Orig: " + maxima + newline, "regular");
+            if (sel.GetTextures().pigmentdata != null)
+                si.SendInfo(" EMBEDDED ", "regular");
             si.SendInfo((debug ? "    Texture: " : "    ") + sel.GetTextures(), "bold");
     //        SendInfo((debug ? "    Material: " : "    ") + sel.material + newline, "regular");
             if (sel instanceof cMesh)
@@ -1169,6 +1171,7 @@
     JCheckBox selectableCB;
     JCheckBox hideCB;
     JCheckBox link2masterCB;
+    JCheckBox sortCB;
     JCheckBox markCB;
     JCheckBox randomCB;
     JCheckBox speedupCB;
@@ -1412,11 +1415,14 @@
         rewindCB = AddCheckBox(setupPanel2, "Rewind", copy.rewind);
         rewindCB.setToolTipText("Rewind animation");
         
+        sortCB = AddCheckBox(setupPanel2, "Sort", copy.sort);
+        sortCB.setToolTipText("Display from back to front");
+        
         randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
         randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
 
         link2masterCB = AddCheckBox(setupPanel2, GetSupportText(), copy.link2master);
-        link2masterCB.setToolTipText("Attach to support");
+        link2masterCB.setToolTipText("Link to support");
         
         if (Globals.ADVANCED)
         {
@@ -1847,6 +1853,28 @@
         
         cButton fullsceneButton;
         
+        fullscenePanel.add(fullsceneButton = GetButton("fullscenes/alsace.png", !Globals.NIMBUSLAF));
+        fullsceneButton.setToolTipText("Alsace!");
+        fullsceneButton.addActionListener(new ActionListener()
+        {
+                @Override
+                public void actionPerformed(ActionEvent e)
+                {
+                    ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Alsace.gfd", new iCallBack()
+                    {
+
+                        public void Callback(Object obj)
+                        {
+                            LoadIt(obj);
+                        }
+
+                        public void DragGesture()
+                        {
+                        }
+                    });
+                }
+        });
+
         fullscenePanel.add(fullsceneButton = GetButton("fullscenes/london.png", !Globals.NIMBUSLAF));
         fullsceneButton.setToolTipText("Old London!");
         fullsceneButton.addActionListener(new ActionListener()
@@ -1854,7 +1882,7 @@
                 @Override
                 public void actionPerformed(ActionEvent e)
                 {
-                    /*Object3D readobj =*/ ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/oldlondon.gfd", new iCallBack()
+                    ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/oldlondon.gfd", new iCallBack()
                     {
 
                         public void Callback(Object obj)
@@ -1869,6 +1897,8 @@
                 }
         });
         
+        fullscenePanel.Return();
+        
         fullscenePanel.add(fullsceneButton = GetButton("fullscenes/venice.png", !Globals.NIMBUSLAF));
         fullsceneButton.setToolTipText("Venice!");
         fullsceneButton.addActionListener(new ActionListener()
@@ -1876,7 +1906,29 @@
                 @Override
                 public void actionPerformed(ActionEvent e)
                 {
-                    /*Object3D readobj =*/ ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Venice.gfd", new iCallBack()
+                    ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Venice.gfd", new iCallBack()
+                    {
+
+                        public void Callback(Object obj)
+                        {
+                            LoadIt(obj);
+                        }
+
+                        public void DragGesture()
+                        {
+                        }
+                    });
+                }
+        });
+
+        fullscenePanel.add(fullsceneButton = GetButton("fullscenes/viking.png", !Globals.NIMBUSLAF));
+        fullsceneButton.setToolTipText("Viking Village!");
+        fullsceneButton.addActionListener(new ActionListener()
+        {
+                @Override
+                public void actionPerformed(ActionEvent e)
+                {
+                    ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/VikingVillage.gfd", new iCallBack()
                     {
 
                         public void Callback(Object obj)
@@ -1892,12 +1944,53 @@
         });
 
         fullscenePanel.Return();
-        fullscenePanel.add(new cGridBag());
-        fullscenePanel.add(new cGridBag());
+        
+        fullscenePanel.add(fullsceneButton = GetButton("fullscenes/yvoire.png", !Globals.NIMBUSLAF));
+        fullsceneButton.setToolTipText("Yvoire!");
+        fullsceneButton.addActionListener(new ActionListener()
+        {
+                @Override
+                public void actionPerformed(ActionEvent e)
+                {
+                    ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Yvoire.gfd", new iCallBack()
+                    {
+
+                        public void Callback(Object obj)
+                        {
+                            LoadIt(obj);
+                        }
+
+                        public void DragGesture()
+                        {
+                        }
+                    });
+                }
+        });
+
+        fullscenePanel.add(fullsceneButton = GetButton("fullscenes/skullcove.png", !Globals.NIMBUSLAF));
+        fullsceneButton.setToolTipText("Skull Cove Island!");
+        fullsceneButton.addActionListener(new ActionListener()
+        {
+                @Override
+                public void actionPerformed(ActionEvent e)
+                {
+                    ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/SkullCoveIsland.gfd", new iCallBack()
+                    {
+
+                        public void Callback(Object obj)
+                        {
+                            LoadIt(obj);
+                        }
+
+                        public void DragGesture()
+                        {
+                        }
+                    });
+                }
+        });
+
         fullscenePanel.Return();
-        fullscenePanel.add(new cGridBag());
-        fullscenePanel.add(new cGridBag());
-        fullscenePanel.Return();
+        
         fullscenePanel.add(new cGridBag());
         fullscenePanel.add(new cGridBag());
         fullscenePanel.Return();
@@ -4196,6 +4289,11 @@
             copy.Touch(); // display list issue
             objEditor.refreshContents(true); // To show item colors
             return;
+        } else if (event.getSource() == sortCB)
+        {
+            copy.sort ^= true;
+            objEditor.refreshContents();
+            return;
         } else if (event.getSource() == link2masterCB)
         {
             copy.link2master ^= true;
@@ -4959,7 +5057,7 @@
         void ImportGFD()
         {
             FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
-            browser.show();
+            browser.setVisible(true);
             String filename = browser.getFile();
             if (filename != null && filename.length() > 0)
             {
@@ -5934,7 +6032,7 @@
         {
             try
             {
-                url = new java.net.URL("file://" + fullname);
+                url = new java.net.URL("file:///" + fullname);
             } catch (Exception e2)
             {
                 e2.printStackTrace();
diff --git a/Object3D.java b/Object3D.java
index 3a1cb6e..f36024d 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -140,7 +140,7 @@
                     projectedVertices[i] = new cVector2(); // Others
                 }
                 projectedVertices[0].x = 100; // bump
-                projectedVertices[1].y = 5000; // punchthrough. only for png
+                projectedVertices[1].y = 1000; // punchthrough. only for png
         }
 
     void MinMax(cVector minima, cVector maxima)
@@ -641,6 +641,9 @@
     boolean random = false;
     boolean speedup = false;
     boolean rewind = false;
+    
+    // Option to sort triangles, e.g. for transparency.
+    boolean sort = false;
     
     float NORMALPUSH = 0;
     
@@ -1213,24 +1216,28 @@
     {
 //        return true;
         
-        if (material == null || material.multiply)
-            return true;
+//        if (material == null || material.multiply)
+//            return true;
+//        
+//        if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
+//            return false;
+//        
+//        // Transparent objects are dynamic because we have to sort the triangles.
+//        return material.opacity > 0.99;
         
-        if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
-            return false;
-        
-        // Transparent objects are dynamic because we have to sort the triangles.
-        return material.opacity > 0.99;
+        return !sort;
     }
     
     boolean IsOpaque()
     {
 //        return true;
         
-        if (material == null || material.multiply)
-            return true;
+//        if (material == null || material.multiply)
+//            return true;
+//        
+//        return material.opacity > 0.99;
         
-        return material.opacity > 0.99;
+        return !sort;
     }
     
     Object3D()
@@ -6307,8 +6314,8 @@
             Globals.lighttouched = true; // all panes...
         }
 
-        touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
-        //touched = false;
+        //touched = GetBRep() == null; // this instanceof Composite || this instanceof FileObject; // false;
+        touched = false;
 
         if (this instanceof Texture || this instanceof TextureNode)
         {
@@ -6455,6 +6462,7 @@
     boolean failedPigment = false;
     boolean failedBump = false;
     
+    CameraPane.lastObject = this;
     try
     {
         display.BindPigmentTexture(tex, texres);
diff --git a/cMaterial.java b/cMaterial.java
index 0d302bd..73ae2fb 100644
--- a/cMaterial.java
+++ b/cMaterial.java
@@ -362,7 +362,7 @@
     
     float color = 0.5f, modulation /*SATURATION*/ = 0.001f, metalness = 0.001f;
     float diffuse = 1f, specular = 0.25f, shininess = 0.75f, shift = 1;
-    float ambient = 0.001f, lightarea = 0.025f, factor = 0.001f, velvet = 0.001f;
+    float ambient = 0.001f, lightarea = 0.005f, factor = 0.001f, velvet = 0.001f;
     float sheen = 1f, subsurface = 0.001f, bump = 0.75f, aniso = 0.001f, anisoV = 0.001f;
     float cameralight = 0.5f, diffuseness = 0.001f, shadow = 5f, texture = 1f, opacity = 1;
     float fakedepth = 0.5f, shadowbias = 0.01f; // 0.001f;
diff --git a/fullscenes/alsace.png b/fullscenes/alsace.png
new file mode 100644
index 0000000..8b77987
--- /dev/null
+++ b/fullscenes/alsace.png
Binary files differ
diff --git a/fullscenes/skullcove.png b/fullscenes/skullcove.png
new file mode 100644
index 0000000..8bd10af
--- /dev/null
+++ b/fullscenes/skullcove.png
Binary files differ
diff --git a/fullscenes/viking.png b/fullscenes/viking.png
new file mode 100644
index 0000000..d69a031
--- /dev/null
+++ b/fullscenes/viking.png
Binary files differ
diff --git a/fullscenes/yvoire.png b/fullscenes/yvoire.png
new file mode 100644
index 0000000..f1ff83c
--- /dev/null
+++ b/fullscenes/yvoire.png
Binary files differ

--
Gitblit v1.6.2