From 294eab460cb3292d17576d3be2e07f1e369a2bc3 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Wed, 25 Dec 2019 16:56:25 -0500
Subject: [PATCH] Camera improvements + new scenes.

---
 CameraPane.java |   95 +++++++++++++++++++++++++----------------------
 1 files changed, 51 insertions(+), 44 deletions(-)

diff --git a/CameraPane.java b/CameraPane.java
index 376dc7c..05b2c8f 100644
--- a/CameraPane.java
+++ b/CameraPane.java
@@ -10895,7 +10895,7 @@
             {
                 //pingthread.mute = true;
         
-                if (capsLocked)
+                if (true) // capsLocked)
                 {
                     boolean keyon = false;
 
@@ -14658,7 +14658,7 @@
             (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
         {
             //System.out.println("mouseDragged: " + e);
-            clickEnd(e.getX(), e.getY(), e.getModifiersEx());
+            clickEnd(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
         }
         else
             drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
@@ -15034,14 +15034,16 @@
         }
     }
     
+    float SCALE = 1;
+    
     void GoDown(int mod)
     {
         LA.vecSub(manipCamera.location, manipCamera.lookAt, manipCamera.direction);
         float scale = (float)manipCamera.direction.length() / 10;
         
-        if (!capsLocked)
+        //if (!capsLocked)
         {
-            scale = 50;
+            scale = SCALE;
         }
 
         MODIFIERS |= COMMAND;
@@ -15062,7 +15064,7 @@
             if (isVR)
                 manipCamera.BackForth(0, -speed*delta*scale, isVR?1000:0); // getWidth());
             else
-                manipCamera.RotatePosition(0, -speed*scale);
+                manipCamera.RotatePosition(0, speed*scale*8/manipCamera.shaper_fovy);
         }
         
         /**/
@@ -15085,9 +15087,9 @@
         LA.vecSub(manipCamera.location, manipCamera.lookAt, manipCamera.direction);
         float scale = (float)manipCamera.direction.length() / 10;
         
-        if (!capsLocked)
+        //if (!capsLocked)
         {
-            scale = 50;
+            scale = SCALE;
         }
 
                 RigidBody.justclicked = true;
@@ -15111,7 +15113,7 @@
             if (isVR)
                 manipCamera.BackForth(0, speed*delta*scale, isVR?1000:0); // getWidth());
             else
-                manipCamera.RotatePosition(0, speed*scale);
+                manipCamera.RotatePosition(0, -speed*scale*(capsLocked?manipCamera.shaper_fovy/90:8/manipCamera.shaper_fovy));
         }
         
         /**/
@@ -15134,9 +15136,9 @@
         LA.vecSub(manipCamera.location, manipCamera.lookAt, manipCamera.direction);
         float scale = (float)manipCamera.direction.length() / 10;
         
-        if (!capsLocked)
+        //if (!capsLocked)
         {
-            scale = 50;
+            scale = SCALE;
         }
 
         MODIFIERS |= COMMAND;
@@ -15146,9 +15148,9 @@
         else
         {
             if ((mouseMode&VR)!=0)
-                manipCamera.RotateInterest(-speed*scale*manipCamera.shaper_fovy/90, 0);
+                manipCamera.RotateInterest(-speed*scale*(capsLocked?manipCamera.shaper_fovy/90:8/manipCamera.shaper_fovy), 0);
             else
-                manipCamera.RotatePosition(speed*scale*manipCamera.shaper_fovy/90, 0);
+                manipCamera.RotatePosition(-speed*scale*(capsLocked?manipCamera.shaper_fovy/90:8/manipCamera.shaper_fovy), 0);
         }
         
         /**/
@@ -15174,9 +15176,9 @@
         LA.vecSub(manipCamera.location, manipCamera.lookAt, manipCamera.direction);
         float scale = (float)manipCamera.direction.length() / 10;
         
-        if (!capsLocked)
+        //if (!capsLocked)
         {
-            scale = 50;
+            scale = SCALE;
         }
 
         MODIFIERS |= COMMAND;
@@ -15186,9 +15188,9 @@
         else
         {
             if ((mouseMode&VR)!=0)
-                manipCamera.RotateInterest(speed*scale*manipCamera.shaper_fovy/90, 0);
+                manipCamera.RotateInterest(speed*scale*(capsLocked?manipCamera.shaper_fovy/90:8/manipCamera.shaper_fovy), 0);
             else
-                manipCamera.RotatePosition(-speed*scale*manipCamera.shaper_fovy/90, 0);
+                manipCamera.RotatePosition(speed*scale*(capsLocked?manipCamera.shaper_fovy/90:8/manipCamera.shaper_fovy), 0);
         }
         
         /**/
@@ -15341,12 +15343,13 @@
                     }
                     else
                     if ((mouseMode & VR) != 0)
-                        manipCamera.BackForth(dx, dy, getWidth());
+                        manipCamera.BackForth(dx, dy, -getWidth());
                     else
                         manipCamera.BackForth(dx, dy, 0);
                 }
                 if ((mouseMode & BACKFORTH) != 0)
                 {
+                    Grafreed.SystemExit("mouseMode & BACKFORTH");
                     if (manipCamera != lightCamera)
                     {
                         manipCamera.BackForth(dx, dy, getWidth());
@@ -15357,7 +15360,7 @@
                 }
                 if ((mouseMode & TRANSLATE) != 0)
                 {
-                    manipCamera.Translate(dx, dy, getWidth());
+                    manipCamera.Translate(dx, dy, getWidth()*(capsLocked?-1:1));
                 }
                 else
                 if ((mouseMode & ZOOM) == 0 && (mouseMode & VR) != 0)
@@ -15453,15 +15456,15 @@
         X = 0; // getBounds().width/2;
         Y = 0; // getBounds().height/2;
         //System.out.println("mouseReleased: " + e);
-        clickEnd(e.getX(), e.getY(), e.getModifiersEx());
+        clickEnd(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
     }
 
-    void clickEnd(int x, int y, int modifiers)
+    void clickEnd(int x, int y, int modifiers, int modifiersex)
     {
-        clickEnd(x, y, modifiers, false);
+        clickEnd(x, y, modifiers, modifiersex, false);
     }
 
-    void clickEnd(int x, int y, int modifiers, boolean timeout)
+    void clickEnd(int x, int y, int modifiers, int modifiersex, boolean timeout)
     {
    //     System.out.println("clickEnd: " + modifiers);
 
@@ -15471,8 +15474,8 @@
         
         timeout |= hold || forcetranslate;
 
-        boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
-        boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
+        boolean control = ((modifiersex & CTRL) != 0); // june 2013: for point selection
+        boolean command = ((modifiersex & COMMAND) != 0); // june 2013: for multiple selection
         
 // No delay        if (control || command || IsFrozen())
             timeout = true;
@@ -15496,14 +15499,18 @@
 
             selection = true;
             
-            if (control)
+            if (control || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
+            {
                 pointselection = true;
+
+                //mouseMode &= ~TRANSLATE;
+            }
             
-            if (modifiers != 0)
+            if (modifiersex != 0)
             {
                // System.out.println("modifiers = " + modifiers);
             }
-            deselect = (modifiers == 0); // || control;
+            deselect = (modifiersex == 0); // || control;
             //if (control)
             //{
             //    selectX = x;
@@ -15610,7 +15617,7 @@
         {
             mouseMode |= VR; // BACKFORTH;
         }
-        if ((modifiersex & CTRLCLICK) == CTRLCLICK)
+        if ((modifiersex & CTRLCLICK) == CTRLCLICK) // || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
         {
             mouseMode |= SELECT;
         }
@@ -16146,13 +16153,13 @@
                 Globals.ONESTEP = true;
                 repaint();
                 break;
-//            case BACKSPACE:
-//                // almost working enablebackspace = true;
-//                Globals.WALK ^= true;
-//                
-//   //             SwitchCameras(false);
-//                repaint();
-//                break;
+            case BACKSPACE:
+                // almost working enablebackspace = true;
+                Globals.WALK ^= true;
+                
+   //             SwitchCameras(false);
+                repaint();
+                break;
 
             default:
                 return (false);
@@ -16184,7 +16191,7 @@
             case KeyEvent.KEY_PRESSED:
                 boolean repaintit = false;
                 
-                if (capsLocked)
+                if (true) // capsLocked)
                 {
                     keys[e.getKeyCode()] = true;
                     modifiers = e.getModifiersEx();
@@ -16199,24 +16206,24 @@
                         switch (e.getKeyCode())
                         {
                             case DOWN_ARROW:
-                                lightCamera.DECAL /= 2;
+                                lightCamera.DECAL /= 1.1;
                                 repaintit = true;
                                 break;
                             case UP_ARROW:
-                                lightCamera.DECAL *= 2;
+                                lightCamera.DECAL *= 1.1;
                                 repaintit = true;
                                 break;
                             case LEFT_ARROW:
-                                lightCamera.SCALE /= 2;
+                                lightCamera.SCALE /= 1.1;
                                 repaintit = true;
                                 break;
                             case RIGHT_ARROW:
-                                lightCamera.SCALE *= 2;
+                                lightCamera.SCALE *= 1.1;
                                 repaintit = true;
                                 break;
                             default:
-                                modifiers = e.getModifiersEx();
-                                repaintit = keyPressed(e.getKeyChar(), modifiers);
+                            //    modifiers = e.getModifiersEx();
+                            //    repaintit = keyPressed(e.getKeyChar(), modifiers);
                                 break;
                         }
 
@@ -17095,7 +17102,7 @@
         {
             modifiers |= SHIFT;
         }
-        clickEnd(x, y, modifiers);
+        clickEnd(x, y, modifiers, 0); // modifiersex? 
         if (modifiers != 0)
         {
             keyReleased(0, modifiers);
@@ -17750,7 +17757,7 @@
 
             float depth = depths[y * TEX_SIZE + x];
 
-            if (pointselection && (mouseMode & SELECT) == SELECT && depth != 0 && depth != 1)
+            if (pointselection && ((mouseMode & SELECT) == SELECT || (mouseMode & TRANSLATE) == TRANSLATE) && depth != 0 && depth != 1)
             {
                 pointselection = false;
                 

--
Gitblit v1.6.2