Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1408 - in trunk: Model/Cameras SwigInterface UserInterface


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1408 - in trunk: Model/Cameras SwigInterface UserInterface
  • Date: Mon, 4 Jun 2007 15:56:43 -0600 (MDT)

Author: bigler
Date: Mon Jun  4 15:56:42 2007
New Revision: 1408

Modified:
   trunk/Model/Cameras/PinholeCamera.cc
   trunk/SwigInterface/wxManta.py
   trunk/UserInterface/XWindowUI.cc
   trunk/UserInterface/XWindowUI.h
Log:

Model/Cameras/PinholeCamera.cc

  Added check for scale == 1 in dolly.

  Added comments on what expression to use when trying to "undo" a
  scale.

SwigInterface/wxManta.py

  Mouse wheel goes the direction I think it should.

  Use the "undo" scale dolly expression.

UserInterface/XWindowUI.cc
UserInterface/XWindowUI.h

  Fix warnings.

  Zoom (dolly) now goes the same way as in maya.

  Added mouse wheel dolly.


Modified: trunk/Model/Cameras/PinholeCamera.cc
==============================================================================
--- trunk/Model/Cameras/PinholeCamera.cc        (original)
+++ trunk/Model/Cameras/PinholeCamera.cc        Mon Jun  4 15:56:42 2007
@@ -360,9 +360,13 @@
   setup();
 }
 
+// Here scale will move the eye point closer or farther away from the
+// lookat point.  If you want an invertable value feed it
+// (previous_scale/(previous_scale-1)
 void PinholeCamera::dolly(Real scale)
 {
   // Better make sure the scale isn't exactly one.
+  if (scale == 1) return;
   Vector d = (lookat - eye) * scale;
   eye    += d;
 

Modified: trunk/SwigInterface/wxManta.py
==============================================================================
--- trunk/SwigInterface/wxManta.py      (original)
+++ trunk/SwigInterface/wxManta.py      Mon Jun  4 15:56:42 2007
@@ -812,6 +812,13 @@
         # Get wheel input.
         delta = event.GetWheelDelta()
         rotation = event.GetWheelRotation()/delta
+        rotation = rotation * 0.1
+
+        # Invert the scale if going the other way
+        if (rotation > 0):
+            rotation = rotation/(rotation-1)
+        else:
+            rotation = -rotation
 
         # Obtain the camera.
         channel = 0
@@ -819,7 +826,7 @@
 
         # Add transaction.
         self.engine.addTransaction("dolly",
-                                   
manta_new(createMantaTransaction(camera.dolly, (0.25*rotation,))))
+                                   
manta_new(createMantaTransaction(camera.dolly, (rotation,))))
 
     
###########################################################################
     ## projectToSphere

Modified: trunk/UserInterface/XWindowUI.cc
==============================================================================
--- trunk/UserInterface/XWindowUI.cc    (original)
+++ trunk/UserInterface/XWindowUI.cc    Mon Jun  4 15:56:42 2007
@@ -68,18 +68,21 @@
 }
 
 XWindowUI::XWindowUI(const vector<string>& args, MantaInterface 
*rtrt_interface)
-  : rtrt_interface(rtrt_interface), xlock("XWindowUI display lock"),
-    xsema("XWindowUI semaphore", 0), path( 0 ), timeView(0),
+  : rtrt_interface(rtrt_interface),
+    path( 0 ),
+    timeView(0),
+    xlock("XWindowUI display lock"),
+    xsema("XWindowUI semaphore", 0), 
     quitting(false)
 {
   bool quit=false;
   int max_count=0;
   int offset=0;
-  CameraPath::IOMode mode;
+  CameraPath::IOMode mode = CameraPath::WriteKnots;
   string fname="";
 
   // Parse command line args.
-  for (int i=0;i<args.size();++i) {
+  for (int i=0;i<static_cast<int>(args.size());++i) {
     const string &arg = args[i];
     if (arg=="-loop") {
       if (!getIntArg(i, args, max_count))
@@ -531,6 +534,12 @@
   register_mouse(0, Button3,
                  "dolly to/from lookat",
                  Callback::create(this, &XWindowUI::mouse_dolly));
+  register_mouse(0, Button4,
+                 "dolly to/from lookat",
+                 Callback::create(this, &XWindowUI::mouse_wheel_dolly));
+  register_mouse(0, Button5,
+                 "dolly to/from lookat",
+                 Callback::create(this, &XWindowUI::mouse_wheel_dolly));
   register_mouse(0, Button1,
                  "rotate",
                  Callback::create(this, &XWindowUI::mouse_rotate));
@@ -789,7 +798,7 @@
   } else {
     XWindow* window = windows[channel];
     Real xmotion = -Real(ias.last_x-mouse_x)/window->xres;
-    Real ymotion =  Real(ias.last_y-mouse_y)/window->yres;
+    Real ymotion = -Real(ias.last_y-mouse_y)/window->yres;
 
     Real scale;
     if (Abs(xmotion)>Abs(ymotion))
@@ -807,6 +816,28 @@
   }
 }
 
+void XWindowUI::mouse_wheel_dolly(unsigned int /*button_state*/,
+                                  unsigned int current_button,
+                                  int /*event*/, int channel,
+                                  int /*mouse_x*/, int /*mouse_y*/)
+{
+  Real scale = 0.01 * dolly_speed;
+  if (current_button == Button4) {
+    // This will undo our actions
+    scale = scale/(scale-1);
+  } else if (current_button == Button5) {
+    // Keep as is
+  } else {
+    // Don't recongnize this event
+    return;
+  }
+
+  Camera* camera = rtrt_interface->getCamera(channel);
+  rtrt_interface->addTransaction("dolly",
+                                 Callback::create(camera, &Camera::dolly,
+                                                  scale));
+}
+
 void XWindowUI::shootDebugRays(int channel,
                                int mouse_x, int mouse_y,
                                int numPixels)
@@ -1015,7 +1046,9 @@
     break;
   case ClientMessage:
     {
-      if (e.xclient.data.l[0] == deleteWindow) {
+      // The case was being done implicitly.  Now making it explicit.
+      // This is how wxWidgets does it, at least.
+      if (static_cast<Atom>(e.xclient.data.l[0]) == deleteWindow) {
         //        cerr << "Delete window event caught\n";
         // Takes three arguments that are simply ignored
         quitkey(0,0,0);
@@ -1046,7 +1079,7 @@
 
 void XWindowUI::animation_callback(int, int, bool& changed)
 {
-  for(int i=0;i<interactions.size();i++)
+  for(size_t i=0;i<interactions.size();i++)
     if(interactions[i].current_mouse_handler){
       changed=true;
       break;

Modified: trunk/UserInterface/XWindowUI.h
==============================================================================
--- trunk/UserInterface/XWindowUI.h     (original)
+++ trunk/UserInterface/XWindowUI.h     Mon Jun  4 15:56:42 2007
@@ -88,9 +88,14 @@
     void reset_path(unsigned int, unsigned long, int);
     void output_camera(unsigned int, unsigned long, int);
 
+    // button_state (ShiftMask, ControlMask, Mod1Mask),
+    // current_button (Button1,2,3,4,5),
+    // event (ButtonPress, ButtonRelease, MotionNotify),
+    // channel, mouse_x, mouse_y
     void mouse_fov(unsigned int, unsigned int, int, int, int, int);
     void mouse_translate(unsigned int, unsigned int, int, int, int, int);
     void mouse_dolly(unsigned int, unsigned int, int, int, int, int);
+    void mouse_wheel_dolly(unsigned int, unsigned int, int, int, int, int);
     void mouse_rotate(unsigned int, unsigned int, int, int, int, int);
     void mouse_debug_ray(unsigned int, unsigned int, int, int, int, int);
     // Transaction function




  • [MANTA] r1408 - in trunk: Model/Cameras SwigInterface UserInterface, bigler, 06/04/2007

Archive powered by MHonArc 2.6.16.

Top of page