Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1140 - in branches/Manta-knolla-isohack: Engine/Control Interface Model/Primitives UserInterface scenes


Chronological Thread 
  • From: knolla@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1140 - in branches/Manta-knolla-isohack: Engine/Control Interface Model/Primitives UserInterface scenes
  • Date: Wed, 5 Jul 2006 14:58:08 -0600 (MDT)

Author: knolla
Date: Wed Jul  5 14:58:07 2006
New Revision: 1140

Modified:
   branches/Manta-knolla-isohack/Engine/Control/RTRT.cc
   branches/Manta-knolla-isohack/Engine/Control/RTRT.h
   branches/Manta-knolla-isohack/Interface/MantaInterface.h
   branches/Manta-knolla-isohack/Interface/Scene.h
   branches/Manta-knolla-isohack/Model/Primitives/OctreeVolume.h
   branches/Manta-knolla-isohack/UserInterface/XWindowUI.cc
   branches/Manta-knolla-isohack/UserInterface/XWindowUI.h
   branches/Manta-knolla-isohack/scenes/octisovol.cc
Log:
isovalue key hack working

Modified: branches/Manta-knolla-isohack/Engine/Control/RTRT.cc
==============================================================================
--- branches/Manta-knolla-isohack/Engine/Control/RTRT.cc        (original)
+++ branches/Manta-knolla-isohack/Engine/Control/RTRT.cc        Wed Jul  5 
14:58:07 2006
@@ -30,6 +30,14 @@
 #include <Core/Util/NotFinished.h>
 #include <MantaSSE.h>
 
+#ifndef OCTREE_HACK
+#define OCTREE_HACK
+#endif
+
+#ifdef OCTREE_HACK
+#include <Model/Primitives/OctreeVolume.h>
+#endif
+
 #include <sgi_stl_warnings_off.h>
 #include <sstream>
 #include <iostream>
@@ -92,6 +100,7 @@
   animFrameState.frameNumber = 0;
   animFrameState.frameTime = 0;
   timeMode = MantaInterface::RealTime;
+  animate = false;
   timeScale = 1;
   frameRate = 15;
   pipelineNeedsSetup = true;
@@ -193,6 +202,16 @@
   NOT_FINISHED("RTRT::setTimeMode");
 }
 
+void RTRT::toggleAnimation()
+{
+  animate = !animate;
+}
+
+bool RTRT::getToggleAnimation()
+{
+  return animate;
+}
+
 void RTRT::beginRendering(bool blockUntilFinished)
 {
   runningLock.lock();
@@ -282,7 +301,15 @@
   }
   for(;;){
     // P0 update frame number, time, etc.
-    if(proc == 0){
+    if(proc == 0){    
+#ifdef OCTREE_HACK
+      if (animate)
+      {
+          std::vector<void*> guiObjects = getScene()->getGUIObjects();
+          OctreeVolume* ov = (OctreeVolume*)(guiObjects[0]);
+          ov->increment_timestep();
+      }
+#endif
       animFrameState.frameNumber++;
       switch(timeMode){
       case RealTime:

Modified: branches/Manta-knolla-isohack/Engine/Control/RTRT.h
==============================================================================
--- branches/Manta-knolla-isohack/Engine/Control/RTRT.h (original)
+++ branches/Manta-knolla-isohack/Engine/Control/RTRT.h Wed Jul  5 14:58:07 
2006
@@ -123,6 +123,8 @@
     virtual void registerTerminationCallback( CallbackBase_1Data< 
MantaInterface *> *);
 
     // Control of time/animation
+    virtual void toggleAnimation();
+    virtual bool getToggleAnimation();
     virtual void setTimeMode(TimeMode tm, double rate);
 
     // Parallel processing
@@ -289,6 +291,7 @@
     bool pipelineNeedsSetup;
 
     // Time control
+    bool animate;
     TimeMode timeMode;
     double timeScale;
     double frameRate;

Modified: branches/Manta-knolla-isohack/Interface/MantaInterface.h
==============================================================================
--- branches/Manta-knolla-isohack/Interface/MantaInterface.h    (original)
+++ branches/Manta-knolla-isohack/Interface/MantaInterface.h    Wed Jul  5 
14:58:07 2006
@@ -139,7 +139,12 @@
     enum TimeMode {
       RealTime, FixedRate, Static, FixedSamplingRate
     };
+    
+    // Control of time/animation
+    virtual void toggleAnimation() = 0;
+    virtual bool getToggleAnimation() = 0;
     virtual void setTimeMode(TimeMode tm, double rate) = 0;
+
 
     // Parallel processing
     virtual void changeNumWorkers(int) = 0;

Modified: branches/Manta-knolla-isohack/Interface/Scene.h
==============================================================================
--- branches/Manta-knolla-isohack/Interface/Scene.h     (original)
+++ branches/Manta-knolla-isohack/Interface/Scene.h     Wed Jul  5 14:58:07 
2006
@@ -33,6 +33,16 @@
     {
       object = newobject;
     }
+    
+    void addGUIObject(void* guiobject)
+    {
+      guiObjects.push_back(guiobject);
+    }
+    
+    const std::vector<void*>& getGUIObjects() const
+    {
+      return guiObjects;
+    }
 
     const Background* getBackground() const
     {
@@ -83,6 +93,7 @@
       BasicCameraData cameradata;
     };
     std::vector<Bookmark*> bookmarks;
+    std::vector<void*> guiObjects;
     int currentBookmark;
   };
 }

Modified: branches/Manta-knolla-isohack/Model/Primitives/OctreeVolume.h
==============================================================================
--- branches/Manta-knolla-isohack/Model/Primitives/OctreeVolume.h       
(original)
+++ branches/Manta-knolla-isohack/Model/Primitives/OctreeVolume.h       Wed 
Jul  5 14:58:07 2006
@@ -102,8 +102,8 @@
         //the maximum depth of the octree, finest resolution
         int max_depth;
                
-       //the depth of caps; always == max_depth-2
-       int cap_depth;
+        //the depth of caps; always == max_depth-2
+        int cap_depth;
         
         //the width of the kernel that is allegedly reading the octree data.
         //  This determines the ghosting overlap, if any, of the min/max 
values
@@ -168,6 +168,8 @@
         {
             if (current_timestep < num_timesteps - 1)
                 current_timestep++;
+            else
+                current_timestep = 0;
         }
         
         inline int get_timestep() const
@@ -234,15 +236,15 @@
             return max_depth;
         }
                
-       inline int get_cap_depth() const
+        inline int get_cap_depth() const
                {
                    return cap_depth;
                }
                
-       inline int get_pre_cap_depth() const
+        inline int get_pre_cap_depth() const
                {
                    return pre_cap_depth;
-       }
+        }
 
         OctreeVolume();
 

Modified: branches/Manta-knolla-isohack/UserInterface/XWindowUI.cc
==============================================================================
--- branches/Manta-knolla-isohack/UserInterface/XWindowUI.cc    (original)
+++ branches/Manta-knolla-isohack/UserInterface/XWindowUI.cc    Wed Jul  5 
14:58:07 2006
@@ -22,6 +22,11 @@
 #include <unistd.h>
 #include <sys/select.h>
 
+#define OCTREE_HACK
+#ifdef OCTREE_HACK
+#include <Model/Primitives/OctreeVolume.h>
+#endif
+
 #include <sgi_stl_warnings_off.h>
 #include <iostream>
 #include <sstream>
@@ -422,7 +427,16 @@
                Callback::create(this, &XWindowUI::add_bookmark));
   register_key(0, XStringToKeysym("c"),
                "output camera",
-               Callback::create(this, &XWindowUI::output_camera));           
                                   
+               Callback::create(this, &XWindowUI::output_camera));
+  register_key(0, XStringToKeysym("a"),
+               "toggle animation",
+               Callback::create(this, &XWindowUI::animate));
+  register_key(0, XStringToKeysym("i"),
+               "increase/decrease generic user value",
+               Callback::create(this, &XWindowUI::uservalue));
+  register_key(0, XStringToKeysym("I"),
+               "increase/decrease generic user value",
+               Callback::create(this, &XWindowUI::uservalue));
   register_key(0, XStringToKeysym("Escape"),
                "quit after this frame, press again to immediately quit",
                Callback::create(this, &XWindowUI::quitkey));
@@ -471,6 +485,36 @@
   rtrt_interface->addTransaction("numWorkers",
                                  rtrt_interface->numWorkers(),
                                  changeProcs(value));
+}
+
+void XWindowUI::animate(unsigned int, unsigned long key, int)
+{
+  rtrt_interface->toggleAnimation();
+  if (rtrt_interface->getToggleAnimation())
+    cerr << "animation is ON." << endl;
+  else
+    cerr << "animation is OFF." << endl;
+}
+
+void XWindowUI::uservalue(unsigned int, unsigned long key, int)
+{
+#ifdef OCTREE_HACK
+  std::vector<void*> guiObjects = 
rtrt_interface->getScene()->getGUIObjects();
+  OctreeVolume* ov = (OctreeVolume*)(guiObjects[0]);
+  char str[32];
+  if(key == XStringToKeysym("i"))
+  {
+    ov->increment_isovalue();
+    sprintf(str, "isovalue = %3d\r", ov->get_isovalue());
+    cerr << str;
+  }
+  else
+  {
+    ov->decrement_isovalue();
+    sprintf(str, "isovalue = %3d\r", ov->get_isovalue());
+    cerr << str;
+  }
+#endif
 }
 
 void XWindowUI::quitkey(unsigned int, unsigned long, int)

Modified: branches/Manta-knolla-isohack/UserInterface/XWindowUI.h
==============================================================================
--- branches/Manta-knolla-isohack/UserInterface/XWindowUI.h     (original)
+++ branches/Manta-knolla-isohack/UserInterface/XWindowUI.h     Wed Jul  5 
14:58:07 2006
@@ -72,6 +72,8 @@
     void prockey(unsigned int, unsigned long, int);
     void quitkey(unsigned int, unsigned long, int);
     void autoview(unsigned int, unsigned long, int);
+    void animate(unsigned int, unsigned long, int);
+    void uservalue(unsigned int, unsigned long, int);
 
     void next_bookmark(unsigned int, unsigned long, int);              
     void add_bookmark(unsigned int, unsigned long, int);               

Modified: branches/Manta-knolla-isohack/scenes/octisovol.cc
==============================================================================
--- branches/Manta-knolla-isohack/scenes/octisovol.cc   (original)
+++ branches/Manta-knolla-isohack/scenes/octisovol.cc   Wed Jul  5 14:58:07 
2006
@@ -153,6 +153,7 @@
                
        // Add the tree to the scene.
        scene->setObject( group );
+    scene->addGUIObject( ov );
     
     float fov = 45.f;
     float view_dist = 0.5f * bounds[1].data[0] * (1.0f + 1.0f / tanf(0.5f * 
fov));





Archive powered by MHonArc 2.6.16.

Top of page