Manta Interactive Ray Tracer Development Mailing List

Text archives Help


Re: [MANTA] r1185 - in trunk: Interface UserInterface


Chronological Thread 
  • From: Christiaan Paul Gribble <cgribble@sci.utah.edu>
  • To: manta@sci.utah.edu
  • Subject: Re: [MANTA] r1185 - in trunk: Interface UserInterface
  • Date: Fri, 18 Aug 2006 16:54:07 -0600

You can also just loop once and quit.  Use as follows

-ui X(args)

where args =
"-loop X" to run the path X times
"-loop X -quit" to run the path X times and quit
"-quit" to run the path once and quit
<no args> to run the path forever...

C

On Aug 18, 2006, at 4:50 PM, cgribble@sci.utah.edu wrote:

Author: cgribble
Date: Fri Aug 18 16:50:40 2006
New Revision: 1185

Modified:
   trunk/Interface/CameraPath.cc
   trunk/Interface/CameraPath.h
   trunk/UserInterface/XWindowUI.cc
Log:
UserInterface/XWindowUI.cc
Interface/CameraPath.h
Interface/CameraPath.cc
Fixed bug in camera path control: can now loop X times, loop X times and quit,
    or loop infinitely


Modified: trunk/Interface/CameraPath.cc
====================================================================== ========
--- trunk/Interface/CameraPath.cc       (original)
+++ trunk/Interface/CameraPath.cc       Fri Aug 18 16:50:40 2006
@@ -33,10 +33,29 @@

 void CameraPath::interpolate(int, int, bool&)
 {
-  if (loop==Loop && count < max_count - 1 && frame >= max_frame) {
-    ++count;
-    frame=0;
-  }
+  // Loop control
+  switch (loop) {
+  case Count:
+    if (count < max_count - 1 && frame >= max_frame) {
+      frame = 0;
+      ++count;
+    }
+
+    break;
+  case CountAndQuit:
+    if (count < max_count - 1 && frame >= max_frame) {
+      frame = 0;
+      ++count;
+    }
+
+    break;
+  case Infinite:
+  default:
+    if (frame >= max_frame)
+      frame = 0;
+
+    break;
+  };

   if (frame < max_frame) {
     Camera* camera=interface->getCamera(0);
@@ -47,7 +66,7 @@
     anim=false;
     interface->unregisterCallback(handle);
     cerr<<"Reached end of camera path";
-    if (loop==Quit) {
+    if (loop==CountAndQuit) {
       cerr<<"... quitting\n";
       interface->finish();
     } else

Modified: trunk/Interface/CameraPath.h
====================================================================== ========
--- trunk/Interface/CameraPath.h        (original)
+++ trunk/Interface/CameraPath.h        Fri Aug 18 16:50:40 2006
@@ -18,11 +18,11 @@
   {
   public:
     typedef enum { ReadKnots, WriteKnots } IOMode;
-    typedef enum { NoLoop, Loop, Quit } LoopMode;
+    typedef enum { Count, CountAndQuit, Infinite } LoopMode;

     CameraPath(MantaInterface* interface, string const& fname,
-               IOMode mode=WriteKnots, LoopMode loop=NoLoop,
-               int max_count=INT_MAX, int offset=0);
+               IOMode mode=WriteKnots, LoopMode loop=Infinite,
+               int max_count=0, int offset=0);
     ~CameraPath(void);

     void interpolate(int, int, bool&);

Modified: trunk/UserInterface/XWindowUI.cc
====================================================================== ========
--- trunk/UserInterface/XWindowUI.cc    (original)
+++ trunk/UserInterface/XWindowUI.cc    Fri Aug 18 16:50:40 2006
@@ -68,8 +68,8 @@
   : rtrt_interface(rtrt_interface), xlock("XWindowUI display lock"),
     xsema("XWindowUI semaphore", 0), path( 0 )
 {
-  CameraPath::LoopMode loop=CameraPath::NoLoop;
-  int max_count=INT_MAX;
+  bool quit=false;
+  int max_count=0;
   int offset=0;
   CameraPath::IOMode mode;
   string fname="";
@@ -78,9 +78,8 @@
   for (int i=0;i<args.size();++i) {
     const string &arg = args[i];
     if (arg=="-loop") {
-      // Grab optional loop count
-      getIntArg(i, args, max_count);
-      loop=CameraPath::Loop;
+      if (!getIntArg(i, args, max_count))
+        throw IllegalArgument("XWindowUI -loop", i, args);
     } else if (arg=="-offset") {
       if (!getIntArg(i, args, offset))
         throw IllegalArgument("XWindowUI -offset", i, args);
@@ -93,13 +92,24 @@
         throw IllegalArgument("XWindowUI -path", i, args);
       mode=CameraPath::ReadKnots;
     } else if (arg=="-quit") {
-      loop=CameraPath::Quit;
+      quit=true;
     }
   }

   // Create a CameraPath (if necessary)
-  if (fname != "")
- path = new CameraPath(rtrt_interface, fname, mode, loop, max_count, offset);
+  if (fname != "") {
+    CameraPath::LoopMode loopMode=CameraPath::Infinite;
+    if (quit) {
+      loopMode=CameraPath::CountAndQuit;
+      if (max_count == 0)
+        max_count = 1;
+    } else if (max_count > 0) {
+      loopMode=CameraPath::Count;
+    }
+
+ path = new CameraPath(rtrt_interface, fname, mode, loopMode, max_count,
+                          offset);
+  }

   fov_speed = 10;
   translate_speed = 1;






Archive powered by MHonArc 2.6.16.

Top of page