Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r923 - in trunk/fox/afr_demo: . Engine/Control Engine/ImageTraversers Model/Cameras StandAlone


Chronological Thread 
  • From: abhinav@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r923 - in trunk/fox/afr_demo: . Engine/Control Engine/ImageTraversers Model/Cameras StandAlone
  • Date: Thu, 9 Feb 2006 20:31:32 -0700 (MST)

Author: abhinav
Date: Thu Feb  9 20:31:31 2006
New Revision: 923

Added:
   trunk/fox/afr_demo/Engine/Control/AFRGlobals.cc
   trunk/fox/afr_demo/Engine/Control/AFRGlobals.h
Modified:
   trunk/fox/afr_demo/CMakeLists.txt
   trunk/fox/afr_demo/Engine/ImageTraversers/AFRImageTraverser.cc
   trunk/fox/afr_demo/Engine/ImageTraversers/AFRImageTraverser.h
   trunk/fox/afr_demo/Model/Cameras/AFRCamera.cc
   trunk/fox/afr_demo/Model/Cameras/AFRCamera.h
   trunk/fox/afr_demo/StandAlone/afr.cc
Log:
Added the global variable for afrpipeline in order to act as currenttime 
accessor.




Modified: trunk/fox/afr_demo/CMakeLists.txt
==============================================================================
--- trunk/fox/afr_demo/CMakeLists.txt   (original)
+++ trunk/fox/afr_demo/CMakeLists.txt   Thu Feb  9 20:31:31 2006
@@ -41,7 +41,8 @@
     Model/Cameras/AFRPinholeCamera.h
     Model/Cameras/AFRCamera.cc
     Model/Cameras/AFRCamera.h
-
+    Engine/Control/AFRGlobals.h
+    Engine/Control/AFRGlobals.cc
     )
 
   # Add a library with the code.

Added: trunk/fox/afr_demo/Engine/Control/AFRGlobals.cc
==============================================================================
--- (empty file)
+++ trunk/fox/afr_demo/Engine/Control/AFRGlobals.cc     Thu Feb  9 20:31:31 
2006
@@ -0,0 +1,4 @@
+#include <Engine/Control/AFRGlobals.h>
+using namespace Manta;
+using namespace Manta::Afr;
+AFRPipeline* AFRGlobals::globalAFRPipeline = NULL;

Added: trunk/fox/afr_demo/Engine/Control/AFRGlobals.h
==============================================================================
--- (empty file)
+++ trunk/fox/afr_demo/Engine/Control/AFRGlobals.h      Thu Feb  9 20:31:31 
2006
@@ -0,0 +1,19 @@
+#ifndef AFR_GLOBALS_H
+#define AFR_GLOBALS_H
+
+#include <iostream>
+namespace Manta {
+
+  using namespace std;
+  namespace Afr {
+     class AFRPipeline;
+     class AFRGlobals
+     {
+        public:
+           static AFRPipeline *globalAFRPipeline;
+     };
+  }
+}
+
+
+#endif

Modified: trunk/fox/afr_demo/Engine/ImageTraversers/AFRImageTraverser.cc
==============================================================================
--- trunk/fox/afr_demo/Engine/ImageTraversers/AFRImageTraverser.cc      
(original)
+++ trunk/fox/afr_demo/Engine/ImageTraversers/AFRImageTraverser.cc      Thu 
Feb  9 20:31:31 2006
@@ -18,6 +18,122 @@
 
 { }
 
+void AFRImageTraverser::AFRContext::reset_counters() 
+{
+     traceRays_time = adjustTiles_time = updateStats_time = 
large_traceRays_time = small_traceRays_time = 0.0;
+     total_traceRays = total_adjustTiles = total_updateStats = 
large_total_traceRays = small_total_traceRays = 0;
+}
+
+        // Performance counter methods.
+Real AFRImageTraverser::AFRContext::beginTraceRays()
+{
+   return AFRGlobals::globalAFRPipeline->getCurrentTime();
+}
+
+void AFRImageTraverser::AFRContext::endTraceRays( Real begin_time , int 
numrays)
+{
+   total_traceRays+=numrays;
+   traceRays_time += 
(AFRGlobals::globalAFRPipeline->getCurrentTime()-begin_time);
+}
+
+Real AFRImageTraverser::AFRContext::beginSmallTraceRays()
+{
+   return AFRGlobals::globalAFRPipeline->getCurrentTime();
+}
+
+void AFRImageTraverser::AFRContext::endSmallTraceRays( Real begin_time , int 
numrays)
+{
+   small_total_traceRays+=numrays;
+   small_traceRays_time += 
(AFRGlobals::globalAFRPipeline->getCurrentTime()-begin_time);
+}
+
+Real AFRImageTraverser::AFRContext::beginLargeTraceRays()
+{
+   return AFRGlobals::globalAFRPipeline->getCurrentTime();
+}
+
+void AFRImageTraverser::AFRContext::endLargeTraceRays( Real begin_time , int 
numrays)
+{
+   large_total_traceRays+=numrays;
+   large_traceRays_time += 
(AFRGlobals::globalAFRPipeline->getCurrentTime()-begin_time);
+}
+
+Real AFRImageTraverser::AFRContext::beginAdjustTiles()
+{
+   total_adjustTiles++;
+   return AFRGlobals::globalAFRPipeline->getCurrentTime();
+}
+
+void AFRImageTraverser::AFRContext::endAdjustTiles( Real begin_time )
+{
+   adjustTiles_time += 
(AFRGlobals::globalAFRPipeline->getCurrentTime()-begin_time);
+}
+
+Real AFRImageTraverser::AFRContext::beginUpdateStats()
+{
+   return AFRGlobals::globalAFRPipeline->getCurrentTime();
+}
+
+void AFRImageTraverser::AFRContext::endUpdateStats( Real begin_time , int 
numsamples)
+{
+   total_updateStats+=numsamples;
+   updateStats_time += 
(AFRGlobals::globalAFRPipeline->getCurrentTime()-begin_time);
+}
+
+ostream& AFRImageTraverser::AFRContext::output( ostream &out )
+{
+        out << "\t" 
+              << traceRays_time << " "
+              << adjustTiles_time << " "
+              << updateStats_time << " "
+            
+              << total_traceRays << " "
+              << total_adjustTiles << " "
+              << total_updateStats
+              << std::endl;
+          //reset_counters();
+
+        return out;
+}
+
+void AFRImageTraverser::AFRContext::print()
+{
+        cout << "\t" 
+              << traceRays_time << " "
+              << adjustTiles_time << " "
+              << updateStats_time << " "
+            
+              << total_traceRays << " "
+              << total_adjustTiles << " "
+              << total_updateStats
+              << endl;
+}
+
+void AFRImageTraverser::AFRContext::writetofile(FILE *fp, const float 
currenttime)
+{
+        fprintf(fp,"%6.2f      %6.2f   %9d      %6.2f   %9d      %6.2f   %9d 
     %9.2f   %9.2f %9.2f\n",
+                currenttime, traceRays_time, total_traceRays,
+                adjustTiles_time, total_adjustTiles,
+                updateStats_time, total_updateStats,
+                (float)total_traceRays/(float)traceRays_time,
+                (float)total_updateStats/(float)updateStats_time,
+                (float)total_adjustTiles/(float)adjustTiles_time);
+}
+
+void AFRImageTraverser::AFRContext::writetofileLS(FILE *fp, const float 
currenttime) 
+{
+        fprintf(fp,"%6.2f      %6.2f   %9d      %6.2f   %9d      %6.2f   %9d 
     %9.2f   %9.2f %9.2f\n",
+                currenttime, traceRays_time, total_traceRays,
+                small_traceRays_time, small_total_traceRays,
+                large_traceRays_time, large_total_traceRays,
+                (float)total_traceRays/(float)traceRays_time,
+                (float)small_total_traceRays/(float)small_traceRays_time,
+                (float)large_total_traceRays/(float)large_traceRays_time);
+}
+
+
+
+
 AFRImageTraverser::AFRImageTraverser( const vector<string>& args ) :
   debug_window( 0 )
 {

Modified: trunk/fox/afr_demo/Engine/ImageTraversers/AFRImageTraverser.h
==============================================================================
--- trunk/fox/afr_demo/Engine/ImageTraversers/AFRImageTraverser.h       
(original)
+++ trunk/fox/afr_demo/Engine/ImageTraversers/AFRImageTraverser.h       Thu 
Feb  9 20:31:31 2006
@@ -16,7 +16,7 @@
 #include <Engine/ImageTraversers/AFR/sample.h>
 
 #include <Engine/ImageTraversers/AFRDebugWindow.h>
-#include <Model/Cameras/PinholeCamera.h>
+#include <Engine/Control/AFRGlobals.h>
 #ifdef __ia64__
 #include <malloc.h>
 #include <ia64intrin.h>
@@ -36,7 +36,7 @@
     
     class AFRImageTraverser : public ImageTraverser {
     
-    friend class AFRPipeline;
+    //friend class AFRPipeline;
 
     private:
       AFRDebugWindow *debug_window;
@@ -71,70 +71,22 @@
         AFRContext();
 
         // Reset method.
-        void reset_counters() {
-          traceRays_time = adjustTiles_time = updateStats_time = 
large_traceRays_time = small_traceRays_time = 0.0;
-          total_traceRays = total_adjustTiles = total_updateStats = 
large_total_traceRays = small_total_traceRays = 0;
-        }
-
+        void reset_counters();
         // Performance counter methods.
-        inline Real beginTraceRays()                { return 
SCIRun::Time::currentSeconds(); };
-        inline void endTraceRays( Real begin_time , int numrays) { 
total_traceRays+=numrays; traceRays_time += 
(SCIRun::Time::currentSeconds()-begin_time); };
-
-        inline Real beginSmallTraceRays()                { return 
SCIRun::Time::currentSeconds(); };
-        inline void endSmallTraceRays( Real begin_time , int numrays) { 
small_total_traceRays+=numrays; small_traceRays_time += 
(SCIRun::Time::currentSeconds()-begin_time); };
-        
-        inline Real beginLargeTraceRays()                { return 
SCIRun::Time::currentSeconds(); };
-        inline void endLargeTraceRays( Real begin_time , int numrays) { 
large_total_traceRays+=numrays; large_traceRays_time += 
(SCIRun::Time::currentSeconds()-begin_time); };
-
-        inline Real beginAdjustTiles()                { total_adjustTiles++; 
return SCIRun::Time::currentSeconds(); };
-        inline void endAdjustTiles( Real begin_time ) { adjustTiles_time += 
(SCIRun::Time::currentSeconds()-begin_time); };
-
-        inline Real beginUpdateStats()                { return 
SCIRun::Time::currentSeconds(); };
-        inline void endUpdateStats( Real begin_time , int numsamples) { 
total_updateStats+=numsamples; updateStats_time += 
(SCIRun::Time::currentSeconds()-begin_time); };
-
-        inline ostream &output( ostream &out ) {
-          out << "\t" 
-              << traceRays_time << " "
-              << adjustTiles_time << " "
-              << updateStats_time << " "
-            
-              << total_traceRays << " "
-              << total_adjustTiles << " "
-              << total_updateStats
-              << std::endl;
-          //reset_counters();
-
-          return out;
-        }
-        inline void print() {
-          cout << "\t" 
-              << traceRays_time << " "
-              << adjustTiles_time << " "
-              << updateStats_time << " "
-            
-              << total_traceRays << " "
-              << total_adjustTiles << " "
-              << total_updateStats
-              << endl;
-        }
-        inline void writetofile(FILE *fp, const float currenttime) {
-          fprintf(fp,"%6.2f      %6.2f   %9d      %6.2f   %9d      %6.2f   
%9d      %9.2f   %9.2f %9.2f\n",
-              currenttime, traceRays_time, total_traceRays,
-              adjustTiles_time, total_adjustTiles,
-              updateStats_time, total_updateStats,
-              (float)total_traceRays/(float)traceRays_time,
-              (float)total_updateStats/(float)updateStats_time,
-              (float)total_adjustTiles/(float)adjustTiles_time);
-        }
-        inline void writetofileLS(FILE *fp, const float currenttime) {
-          fprintf(fp,"%6.2f      %6.2f   %9d      %6.2f   %9d      %6.2f   
%9d      %9.2f   %9.2f %9.2f\n",
-                  currenttime, traceRays_time, total_traceRays,
-                  small_traceRays_time, small_total_traceRays,
-                  large_traceRays_time, large_total_traceRays,
-                  (float)total_traceRays/(float)traceRays_time,
-                  (float)small_total_traceRays/(float)small_traceRays_time,
-                  (float)large_total_traceRays/(float)large_traceRays_time);
-        }
+        Real beginTraceRays();
+        void endTraceRays( Real begin_time , int numrays);
+        Real beginSmallTraceRays();
+        void endSmallTraceRays( Real begin_time , int numrays);
+        Real beginLargeTraceRays();
+        void endLargeTraceRays( Real begin_time , int numrays);
+        Real beginAdjustTiles();
+        void endAdjustTiles( Real begin_time );
+        Real beginUpdateStats();
+        void endUpdateStats( Real begin_time , int numsamples);
+        ostream &output( ostream &out );
+        void print();
+        void writetofile(FILE *fp, const float currenttime);
+        void writetofileLS(FILE *fp, const float currenttime);
       };
     
       
//////////////////////////////////////////////////////////////////////////

Modified: trunk/fox/afr_demo/Model/Cameras/AFRCamera.cc
==============================================================================
--- trunk/fox/afr_demo/Model/Cameras/AFRCamera.cc       (original)
+++ trunk/fox/afr_demo/Model/Cameras/AFRCamera.cc       Thu Feb  9 20:31:31 
2006
@@ -1,22 +1,21 @@
 
 #include <Model/Cameras/AFRCamera.h>
+#include <Engine/Control/AFRGlobals.h>
 
 using namespace Manta;
 using namespace Manta::Afr;
-
-AFRPipeline* AFRCamera::afrRoot=NULL;
-
-    
///////////////////////////////////////////////////////////////////////////
-    // Make an update to the cam with a timestamp.
-    void AFRCamera::update() {
-       Real tst = afrRoot->getCurrentTime();
-       if(fabs(tst-time_stamp[current])>0.010)
-       {
-          int ncurr = (current+1)%Size;
-          cam[ncurr]->reset(cam[current]->getPosition(), 
cam[current]->getUp(), cam[current]->getLookAt());
-          // also we need to copy the projection matrices
-          cam[ncurr]->copyProjectionMatrices(cam[current]);
-          current = ncurr;
-       }
-       time_stamp[current] = tst;
-    }
\ No newline at end of file
+///////////////////////////////////////////////////////////////////////////
+// Make an update to the cam with a timestamp.
+void AFRCamera::update()
+{
+   Real tst = AFRGlobals::globalAFRPipeline->getCurrentTime();
+   if(fabs(tst-time_stamp[current])>0.010)
+   {
+      int ncurr = (current+1)%Size;
+      cam[ncurr]->reset(cam[current]->getPosition(), cam[current]->getUp(), 
cam[current]->getLookAt());
+      // also we need to copy the projection matrices
+      cam[ncurr]->copyProjectionMatrices(cam[current]);
+      current = ncurr;
+   }
+   time_stamp[current] = tst;
+}

Modified: trunk/fox/afr_demo/Model/Cameras/AFRCamera.h
==============================================================================
--- trunk/fox/afr_demo/Model/Cameras/AFRCamera.h        (original)
+++ trunk/fox/afr_demo/Model/Cameras/AFRCamera.h        Thu Feb  9 20:31:31 
2006
@@ -52,7 +52,7 @@
   using std::string;
   using std::vector;
   using SCIRun::InternalError;
-  
+  class AFRPipeline;
   
/////////////////////////////////////////////////////////////////////////////
   
/////////////////////////////////////////////////////////////////////////////
   // This class contains a cam of cameras.
@@ -66,7 +66,6 @@
         int current;
    
   public:
-     static AFRPipeline *afrRoot;
     
///////////////////////////////////////////////////////////////////////////
     // Constructors.
     AFRCamera( const Point &eye_, const Point &lookat_, const Vector &up_, 
Real fov_ ) :

Modified: trunk/fox/afr_demo/StandAlone/afr.cc
==============================================================================
--- trunk/fox/afr_demo/StandAlone/afr.cc        (original)
+++ trunk/fox/afr_demo/StandAlone/afr.cc        Thu Feb  9 20:31:31 2006
@@ -50,7 +50,7 @@
 #include <Engine/ImageTraversers/AFImageTraverser.h>
 #include <Engine/Control/AFRPipeline.h>
 #include <Model/Cameras/AFRCamera.h>
-
+#include <Engine/Control/AFRGlobals.h>
 // Default scene includes.
 #include <Core/Color/ColorDB.h>
 #include <Interface/LightSet.h>
@@ -206,7 +206,7 @@
     Camera* currentCamera = new AFRCamera( Point( 3, 3, 2 ),
                                                   Point( 0, 0, 0.3 ),
                                                   Vector( 0, 0, 1 ), 60 );
-    AFRCamera::afrRoot = (AFRPipeline*)rtrt;
+    AFRGlobals::globalAFRPipeline = (AFRPipeline*)rtrt;
     // Defaults for command line args.
     int xres = 512, yres = 512;
     string stack_file = "";




  • [MANTA] r923 - in trunk/fox/afr_demo: . Engine/Control Engine/ImageTraversers Model/Cameras StandAlone, abhinav, 02/09/2006

Archive powered by MHonArc 2.6.16.

Top of page