From d5fac992bb6a91e52a90e8318060f5f26ddab982 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 15 Sep 2019 10:55:46 -0400
Subject: [PATCH] Fix navigation and hide cursor.

---
 ObjEditor.java             |   97 +++++++++++++++++++++++---------
 RandomEditor.java          |    4 +
 CameraPane.java            |   29 +++++++--
 Camera.java                |   28 ++++++---
 fullscenes/desertmotel.png |    0 
 fullscenes/tuscany.png     |    0 
 6 files changed, 115 insertions(+), 43 deletions(-)

diff --git a/Camera.java b/Camera.java
index e28a69d..e2f05a8 100644
--- a/Camera.java
+++ b/Camera.java
@@ -286,24 +286,34 @@
                 if (scale == 0)
                 {
                     // Zoom
-                    LA.vecSub(location, lookAt, location);
-
-                    cVector p = location;
-
                     double factor = Math.exp(-dy/300.0); // (1 + dy/100);
 
-                    p.x *= factor;
-                    p.y *= factor;
-                    p.z *= factor;
+                    if (viewCode != 0)
+                    {
+                        LA.vecSub(location, lookAt, location);
 
-                    LA.vecAdd(location, lookAt, location);
+                        cVector p = location;
+
+                        p.x *= factor;
+                        p.y *= factor;
+                        p.z *= factor;
+
+                        LA.vecAdd(location, lookAt, location);
+                    }
+                    else
+                    if (//shaper_fovy < 180 && factor > 1 ||
+                        shaper_fovy * factor < 180)
+                    {
+                        shaper_fovy *= factor;
+                        //System.out.println("fovy = " + shaper_fovy);
+                    }
                 }
                 else
                 {
                     LA.vecSub(location, lookAt, direction);
 
                     //scale /= Distance();
-                    scale /= shaper_fovy/20;
+           //         scale /= shaper_fovy/20;
 
                     location.x -= dy * direction.x / scale;
                     //location.y -= dy * direction.y / scale;
diff --git a/CameraPane.java b/CameraPane.java
index 232593d..90689ce 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -9854,7 +9854,7 @@
             
             boolean vr = capsLocked && !lightMode;
             
-            accPerspective(gl, renderCamera.shaper_fovy / ratio * (vr ? 2 : 1),
+            accPerspective(gl, renderCamera.shaper_fovy / ratio * (vr ? 1.2 : 1),
                     ratio,
                     //near_plane, far_plane,
                     renderCamera.shaper_zNear * renderCamera.Distance(), renderCamera.shaper_zFar * renderCamera.Distance(),
@@ -11513,7 +11513,8 @@
                 {
                     boolean vr = capsLocked && !lightMode;
                     
-                    glu.gluPerspective(cam.shaper_fovy / ratio * (vr ? 2 : 1), ratio, cam.shaper_zNear * cam.Distance(), cam.shaper_zFar * cam.Distance());
+                    glu.gluPerspective(cam.shaper_fovy / ratio * (vr ? 1.2 : 1),
+                            ratio, cam.shaper_zNear * cam.Distance(), cam.shaper_zFar * cam.Distance());
                 }
             }
 
@@ -14603,8 +14604,8 @@
         
         //if (drawing)
         //return;
-        if ((e.getModifiersEx() & CTRL) != 0
-            || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
+        if ((e.getModifiersEx() & CTRL) != 0 ||
+            (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
         {
             //System.out.println("mouseDragged: " + e);
             clickEnd(e.getX(), e.getY(), e.getModifiersEx());
@@ -14750,7 +14751,7 @@
             {
                 if (LOOKAT)
                     manipCamera.lookAt.add(tmp);
-                if (OEIL)
+                if (OEIL && !capsLocked)
                     manipCamera.location.add(tmp);
                 
                 {
@@ -14765,7 +14766,10 @@
                     lightCamera.computeTransform();
                     }
                 }
-                manipCamera.computeTransform();
+                if (tmp.x != 0 || tmp.y != 0 || tmp.z != 0)
+                {
+                    manipCamera.computeTransform();
+                }
             }
 // ??????            mouseDown = true;
             //System.out.println("----------------   ----------      Paint " + tmp.length2());
@@ -15195,6 +15199,9 @@
         
     public void mouseMoved(MouseEvent e)
     {
+//object.editWindow.frame.
+        setCursor(Cursor.getDefaultCursor());
+
         //System.out.println("mouseMoved: " + e);
         if (isRenderer)
             return;
@@ -15439,8 +15446,18 @@
     float SATPOW = 1; // 2; // 0.5f;
     float BRIPOW = 1; // 0.5f; // 0.5f;
     
+static BufferedImage cursorImg = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB);
+
+// Create a new blank cursor.
+static Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(
+    cursorImg, new Point(0, 0), "blank cursor");
+    
     public void keyPressed(int key)
     {
+// Set the blank cursor to the JFrame.
+//object.editWindow.frame.
+        setCursor(blankCursor);
+
         if (key >= '0' && key <= '5')
             clampbit = (key-'0');
         
diff --git a/ObjEditor.java b/ObjEditor.java
index d6747b4..00afea7 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -1875,6 +1875,30 @@
                 }
         });
 
+        fullscenePanel.add(fullsceneButton = GetButton("fullscenes/desertmotel.png", !Globals.NIMBUSLAF));
+        fullsceneButton.setToolTipText("Desert Motel!");
+        fullsceneButton.addActionListener(new ActionListener()
+        {
+                @Override
+                public void actionPerformed(ActionEvent e)
+                {
+                    ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/DesertMotel.gfd", new iCallBack()
+                    {
+
+                        public void Callback(Object obj)
+                        {
+                            LoadIt(obj);
+                        }
+
+                        public void DragGesture()
+                        {
+                        }
+                    });
+                }
+        });
+        
+        fullscenePanel.Return();
+        
         fullscenePanel.add(fullsceneButton = GetButton("fullscenes/london.png", !Globals.NIMBUSLAF));
         fullsceneButton.setToolTipText("Old London!");
         fullsceneButton.addActionListener(new ActionListener()
@@ -1897,8 +1921,52 @@
                 }
         });
         
+        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(fullsceneButton = GetButton("fullscenes/tuscany.png", !Globals.NIMBUSLAF));
+        fullsceneButton.setToolTipText("Tuscany!");
+        fullsceneButton.addActionListener(new ActionListener()
+        {
+                @Override
+                public void actionPerformed(ActionEvent e)
+                {
+                    ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/Tuscany.gfd", new iCallBack()
+                    {
+
+                        public void Callback(Object obj)
+                        {
+                            LoadIt(obj);
+                        }
+
+                        public void DragGesture()
+                        {
+                        }
+                    });
+                }
+        });
+                
         fullscenePanel.add(fullsceneButton = GetButton("fullscenes/venice.png", !Globals.NIMBUSLAF));
         fullsceneButton.setToolTipText("Venice!");
         fullsceneButton.addActionListener(new ActionListener()
@@ -1921,6 +1989,8 @@
                 }
         });
 
+        fullscenePanel.Return();
+        
         fullscenePanel.add(fullsceneButton = GetButton("fullscenes/viking.png", !Globals.NIMBUSLAF));
         fullsceneButton.setToolTipText("Viking Village!");
         fullsceneButton.addActionListener(new ActionListener()
@@ -1943,8 +2013,6 @@
                 }
         });
 
-        fullscenePanel.Return();
-        
         fullscenePanel.add(fullsceneButton = GetButton("fullscenes/yvoire.png", !Globals.NIMBUSLAF));
         fullsceneButton.setToolTipText("Yvoire!");
         fullsceneButton.addActionListener(new ActionListener()
@@ -1967,33 +2035,8 @@
                 }
         });
 
-        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();
diff --git a/RandomEditor.java b/RandomEditor.java
index cd30ede..a112b2a 100644
--- a/RandomEditor.java
+++ b/RandomEditor.java
@@ -98,7 +98,9 @@
 			//System.out.println(e);
 			applySelf();
 			//super.applySelf();
-			objEditor.refreshContents();
+
+            Globals.lighttouched = true;
+                        objEditor.refreshContents();
 			//Refresh();
 		}
 		else
diff --git a/fullscenes/desertmotel.png b/fullscenes/desertmotel.png
new file mode 100644
index 0000000..7e3d879
--- /dev/null
+++ b/fullscenes/desertmotel.png
Binary files differ
diff --git a/fullscenes/tuscany.png b/fullscenes/tuscany.png
new file mode 100644
index 0000000..d06dada
--- /dev/null
+++ b/fullscenes/tuscany.png
Binary files differ

--
Gitblit v1.6.2