Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1954 - in trunk: Interface UserInterface


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1954 - in trunk: Interface UserInterface
  • Date: Sun, 30 Dec 2007 23:52:28 -0700 (MST)

Author: sparker
Date: Sun Dec 30 23:52:23 2007
New Revision: 1954

Modified:
   trunk/Interface/FrameState.h
   trunk/Interface/MantaInterface.h
   trunk/Interface/Scene.h
   trunk/UserInterface/CameraPathAutomator.cc
   trunk/UserInterface/XWindowUI.cc
   trunk/UserInterface/XWindowUI.h
Log:
M    Interface/FrameState.h
M    Interface/Scene.h
- Added more control over animation state

M    Interface/MantaInterface.h
M    UserInterface/XWindowUI.h
M    UserInterface/XWindowUI.cc
- Overloaded space bar to start/stop animation when a camera path automator 
is not present

M    UserInterface/CameraPathAutomator.cc
- Use new frame interface



Modified: trunk/Interface/FrameState.h
==============================================================================
--- trunk/Interface/FrameState.h        (original)
+++ trunk/Interface/FrameState.h        Sun Dec 30 23:52:23 2007
@@ -4,7 +4,8 @@
 
 namespace Manta {
   struct FrameState {
-    long frameNumber;
+    long frameSerialNumber; // Incremented every single frame
+    long animationFrameNumber; // Only incremented when animation is running
     double frameTime;
     Real shutter_open;
     Real shutter_close;

Modified: trunk/Interface/MantaInterface.h
==============================================================================
--- trunk/Interface/MantaInterface.h    (original)
+++ trunk/Interface/MantaInterface.h    Sun Dec 30 23:52:23 2007
@@ -44,6 +44,7 @@
   class Barrier;
   class Camera;
   class CameraPath;
+  class FrameState;
   class Group;
   class IdleMode;
   class Image;
@@ -150,9 +151,12 @@
       Static
     };
     virtual void setTimeMode(TimeMode tm, double rate) = 0;
+    virtual void startTime() = 0;
+    virtual void stopTime() = 0;
+    virtual bool timeIsStopped() = 0;
 
     // Query functions
-    virtual int getCurrentFrame() const = 0;
+    virtual const FrameState& getFrameState() const = 0;
 
     
///////////////////////////////////////////////////////////////////////////
     
///////////////////////////////////////////////////////////////////////////

Modified: trunk/Interface/Scene.h
==============================================================================
--- trunk/Interface/Scene.h     (original)
+++ trunk/Interface/Scene.h     Sun Dec 30 23:52:23 2007
@@ -20,6 +20,8 @@
       object = 0;
       bg = 0;
       currentBookmark_id = 0;
+      animationStartTime = 0;
+      animationEndTime = 100;
     }
 
     const Object* getObject() const
@@ -74,6 +76,9 @@
     void selectBookmark(unsigned int bookmark);
     const BasicCameraData* nextBookmark();
     const BasicCameraData* currentBookmark();
+    BasicCameraData* getBookmark(int i) {
+       return &bookmarks[i]->cameradata;
+    }
 
     void readwrite(ArchiveElement*);
     struct Bookmark {
@@ -83,6 +88,13 @@
       std::string name;
       BasicCameraData cameradata;
     };
+
+    void setAnimationStartTime(double start) {
+      animationStartTime = start;
+    }
+    void setAnimationEndTime(double end) {
+      animationEndTime = end;
+    }
   private:
     Object* object;
     Background* bg;
@@ -90,6 +102,8 @@
     RenderParameters renderParameters;
     std::vector<Bookmark*> bookmarks;
     unsigned int currentBookmark_id;
+    double animationStartTime;
+    double animationEndTime;
   };
 }
 

Modified: trunk/UserInterface/CameraPathAutomator.cc
==============================================================================
--- trunk/UserInterface/CameraPathAutomator.cc  (original)
+++ trunk/UserInterface/CameraPathAutomator.cc  Sun Dec 30 23:52:23 2007
@@ -35,6 +35,7 @@
 #include <Core/Math/MinMax.h>
 
 #include <Interface/Camera.h>
+#include <Interface/FrameState.h>
 #include <Core/Util/Callback.h>
 
 #include <Core/Math/CatmullRomInterpolator.h>
@@ -375,7 +376,7 @@
   int last_point  = Min(total_points-2,interval_last);
   int first_point = Max(1,Min(interval_start,last_point));
   
-  int start_frame = getMantaInterface()->getCurrentFrame();
+  int start_frame = getMantaInterface()->getFrameState().frameSerialNumber;
   start_seconds = Time::currentSeconds();
   
   std::cerr << "Beginning camera path " << total_points 
@@ -439,7 +440,7 @@
     }
 
     // Compute the average fps for this run.
-    int total_frames = getMantaInterface()->getCurrentFrame() - start_frame;
+    int total_frames = 
getMantaInterface()->getFrameState().frameSerialNumber - start_frame;
     average_fps = (Real)total_frames/(Time::currentSeconds()-start_seconds);
 
     std::cerr << "Path complete. "    << total_frames
@@ -477,7 +478,7 @@
   synchronize_barrier.wait( 2 );
 
   double current_sync_seconds = Time::currentSeconds();
-  int  current_sync_frame   = getMantaInterface()->getCurrentFrame();
+  int  current_sync_frame   = 
getMantaInterface()->getFrameState().frameSerialNumber;
 
   double total_elapse_seconds = current_sync_seconds - start_seconds;
   

Modified: trunk/UserInterface/XWindowUI.cc
==============================================================================
--- trunk/UserInterface/XWindowUI.cc    (original)
+++ trunk/UserInterface/XWindowUI.cc    Sun Dec 30 23:52:23 2007
@@ -4,6 +4,7 @@
 #include <Interface/Camera.h>
 #include <Interface/CameraPath.h>
 #include <Interface/Context.h>
+#include <Interface/FrameState.h>
 #include <Interface/MantaInterface.h>
 #include <Interface/Transaction.h>
 #include <Interface/XWindow.h>
@@ -520,8 +521,8 @@
                "output window",
                Callback::create(this, &XWindowUI::output_window));
   register_key(0, XK_space,
-               "animate path",
-               Callback::create(this, &XWindowUI::animate_path));
+               "animate path or start/stop animation",
+               Callback::create(this, &XWindowUI::animate));
   register_key(0, XStringToKeysym("Escape"),
                "quit after this frame, press again to immediately quit",
                Callback::create(this, &XWindowUI::quitkey));
@@ -639,7 +640,7 @@
 
   BasicCameraData data;
   rtrt_interface->getCamera(channel)->getBasicCameraData(data);
-  path->addKnot(rtrt_interface->getCurrentFrame(), data);
+  path->addKnot(rtrt_interface->getFrameState().frameSerialNumber, data);
 }
 
 void XWindowUI::write_knots(unsigned int, unsigned long, int)
@@ -650,13 +651,19 @@
   path->writeKnots();
 }
 
-void XWindowUI::animate_path(unsigned int, unsigned long, int channel)
+void XWindowUI::animate(unsigned int, unsigned long, int channel)
 {
-  if (!path)
-    return;
-
-  rtrt_interface->addTransaction("animate path",
-                                 Callback::create(path, 
&CameraPath::animate));
+  if (!path){
+    // Start/stop time
+    if(rtrt_interface->timeIsStopped()){
+      rtrt_interface->startTime();
+    } else {
+      rtrt_interface->stopTime();
+    }
+  } else {
+    rtrt_interface->addTransaction("animate path",
+                                   Callback::create(path, 
&CameraPath::animate));
+  }
 }
 
 void XWindowUI::reset_path(unsigned int, unsigned long, int channel)

Modified: trunk/UserInterface/XWindowUI.h
==============================================================================
--- trunk/UserInterface/XWindowUI.h     (original)
+++ trunk/UserInterface/XWindowUI.h     Sun Dec 30 23:52:23 2007
@@ -85,7 +85,7 @@
     void add_bookmark(unsigned int, unsigned long, int);               
     void add_knot(unsigned int, unsigned long, int);
     void write_knots(unsigned int, unsigned long, int);
-    void animate_path(unsigned int, unsigned long, int);
+    void animate(unsigned int, unsigned long, int);
     void reset_path(unsigned int, unsigned long, int);
     void output_camera(unsigned int, unsigned long, int);
     void output_window(unsigned int, unsigned long, int);




  • [Manta] r1954 - in trunk: Interface UserInterface, sparker, 12/31/2007

Archive powered by MHonArc 2.6.16.

Top of page