Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1606 - in trunk: Engine/Display Model/Primitives UserInterface


Chronological Thread 
  • From: boulos@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1606 - in trunk: Engine/Display Model/Primitives UserInterface
  • Date: Fri, 3 Aug 2007 13:14:26 -0600 (MDT)

Author: boulos
Date: Fri Aug  3 13:14:25 2007
New Revision: 1606

Modified:
   trunk/Engine/Display/FileDisplay.cc
   trunk/Engine/Display/MultiDisplay.cc
   trunk/Model/Primitives/GridSpheres.cc
   trunk/Model/Primitives/PrimitiveCommon.cc
   trunk/UserInterface/AutomatorUI.cc
Log:
Engine/Display/FileDisplay.cc
Engine/Display/MultiDisplay.cc
Model/Primitives/GridSpheres.cc
Model/Primitives/PrimitiveCommon.cc
UserInterface/AutomatorUI.cc

 Bashing some signed vs unsigned comparisons, C++ init list ordering,
 and uninitialized variables.  GridSpheres still has a couple un-init
 variables, but someone who wrote the code will need to fill in
 appropriate "defaults"


Modified: trunk/Engine/Display/FileDisplay.cc
==============================================================================
--- trunk/Engine/Display/FileDisplay.cc (original)
+++ trunk/Engine/Display/FileDisplay.cc Fri Aug  3 13:14:25 2007
@@ -62,16 +62,16 @@
   prefix( "manta_frame" ),
   type_extension( "png" ),
   init_time( Time::currentSeconds() ),
-  use_timestamp( true )  
+  use_timestamp( true )
 {
 
   
/////////////////////////////////////////////////////////////////////////////
   // Parse args.
-  for (int i=0;i<args.size();++i) {
+  for (int i=0;i<static_cast<int>(args.size());++i) {
     if (args[i] == "-prefix") {
       if (!getArg( i, args, prefix )) {
         throw IllegalArgument( "FileDisplay", i, args );
-      }      
+      }
     }
     else if (args[i] == "-type") {
       if (!getStringArg( i, args, type_extension )) {
@@ -86,7 +86,7 @@
     else if (args[i] == "-skip") {
       if (!getArg( i, args, skip_frames )) {
         throw IllegalArgument( "FileDisplay", i, args );
-      }      
+      }
     }
     else if (args[i] == "-fps") {
       display_fps = true;
@@ -151,27 +151,25 @@
     else {
       number = file_number;
     }
-    
+
     // Record time to output file.
-    double start_time;
-    if (display_fps) {
-      start_time = Time::currentSeconds();
-    }
-    
+    double start_time = 0;
+    if (display_fps) start_time = Time::currentSeconds();
+
     // Determine resolution.
     bool stereo;
     int xres, yres;
     image->getResolution( stereo, xres, yres );
-    
+
     // Check for stereo.
     if (stereo) {
-      
+
       stringstream lss, rss;
-      
+
       // Output left and right images.
       lss << prefix << "_left_" << setfill( '0' ) << setw( width ) << number 
<< "." << type_extension;
       rss << prefix << "_right_" << setfill( '0' ) << setw( width ) << 
number << "." << type_extension;
-      
+
       // Send the image to the appropriate writer.
       if (writer == TGA_WRITER) {
         writeTGA( image, lss.str(), 0 );
@@ -182,7 +180,7 @@
         writeNRRD( image, rss.str(), 1 );
       }
     } else {
-      
+
       // Otherwise output a single image.
       stringstream ss;
       ss << prefix << "_"
@@ -190,7 +188,7 @@
          << setw( width )
          << number
          << "." << type_extension;
-      
+
       if (writer == TGA_WRITER) {
         writeTGA( image, ss.str(), 0 );
       }

Modified: trunk/Engine/Display/MultiDisplay.cc
==============================================================================
--- trunk/Engine/Display/MultiDisplay.cc        (original)
+++ trunk/Engine/Display/MultiDisplay.cc        Fri Aug  3 13:14:25 2007
@@ -36,20 +36,20 @@
 using namespace Manta;
 
 MultiDisplay::~MultiDisplay() {
-  
+
 }
 
 void MultiDisplay::setupDisplayChannel(SetupContext& context) {
 
   // Pass the setup call along.
-  for (int i=0;i<display.size();++i) {
+  for (unsigned int i=0;i<display.size();++i) {
     display[i]->setupDisplayChannel( context );
   }
 }
 
 void MultiDisplay::displayImage(const DisplayContext& context, const Image* 
image) {
 
-  for (int i=0;i<display.size();++i) {
+  for (unsigned int i=0;i<display.size();++i) {
     display[i]->displayImage( context, image );
-  }  
+  }
 }

Modified: trunk/Model/Primitives/GridSpheres.cc
==============================================================================
--- trunk/Model/Primitives/GridSpheres.cc       (original)
+++ trunk/Model/Primitives/GridSpheres.cc       Fri Aug  3 13:14:25 2007
@@ -143,21 +143,21 @@
   bzero(counts, 2*totalsize*sizeof(int));
 
   cerr<<"    0/6:  Allocation took "<<timer.time()<<" seconds\n";
-  
+
   // Generate map
   int* map=new int[totalsize];
   int idx=0;
   for (int x=0; x<totalcells; ++x) {
     for (int y=0; y<totalcells; ++y) {
       for (int z=0; z<totalcells; ++z) {
-       map[idx++]=mapIdx(x, y, z, depth);
+        map[idx++]=mapIdx(x, y, z, depth);
       }
     }
   }
 
   Real stime=timer.time();
   cerr<<"    1/6:  Generating map took "<<stime<<" seconds\n";
-  
+
   // Compute cell counts
   float* data=spheres;
   int tc2=totalcells*totalcells;
@@ -189,18 +189,18 @@
       int idx_y=idx_x + sy*totalcells;
       idx_x += tc2;
       for (int y=sy; y<=ey; ++y) {
-       int idx=idx_y + sz;
-       idx_y += totalcells;
-       for (int z=sz; z<=ez; ++z) {
-         int aidx=map[idx++];
-         counts[2*aidx + 1]++;
-       }
+        int idx=idx_y + sz;
+        idx_y += totalcells;
+        for (int z=sz; z<=ez; ++z) {
+          int aidx=map[idx++];
+          counts[2*aidx + 1]++;
+        }
       }
     }
 
     data += nvars;
   }
-  
+
   cerr<<"    2/6:  Counting cells took "<<timer.time()<<" seconds\n";
 
   int total=0;
@@ -251,13 +251,13 @@
 
     for (int x=sx; x<=ex; ++x) {
       for (int y=sy; y<=ey; ++y) {
-       int idx=totalcells*(totalcells*x + y) + sz;
-       for (int z=sz; z<=ez; ++z) {
-         int aidx=map[idx++];
-         int cur=current[aidx]++;
-         int pos=counts[2*aidx] + cur;
-         cells[pos]=nvars*i;
-       }
+        int idx=totalcells*(totalcells*x + y) + sz;
+        for (int z=sz; z<=ez; ++z) {
+          int aidx=map[idx++];
+          int cur=current[aidx]++;
+          int pos=counts[2*aidx] + cur;
+          cells[pos]=nvars*i;
+        }
       }
     }
 
@@ -299,14 +299,14 @@
       float* mm=new float[2*nvars*size];
       for (int i=0; i<size; ++i) {
         // Minimum
-       mcell->min=mm;
-       mm += nvars;
+        mcell->min=mm;
+        mm += nvars;
 
         // Maximum
-       mcell->max=mm;
-       mm += nvars;
+        mcell->max=mm;
+        mm += nvars;
 
-       mcell++;
+        mcell++;
       }
 
       size *= ncells*ncells*ncells;
@@ -524,7 +524,7 @@
                                 RayPacket& rays) const
 {
   rays.computeHitPositions();
-  for (unsigned int i=rays.begin(); i<rays.end(); ++i) {
+  for (int i=rays.begin(); i<rays.end(); ++i) {
     float* data=spheres + rays.scratchpad<int>(i);
     Vector n=rays.getHitPosition(i) - Vector(data[0], data[1], data[2]);
 
@@ -688,7 +688,7 @@
           (1 - signs.y())*(new_dt_dy - dt_dy);
         Real new_tnext_z=tnext_z + (1 - 2*signs.z())*new_iz*new_dt_dz +
           (1 - signs.z())*(new_dt_dz - dt_dz);
-      
+
         // Compute new cell corner and direction
         Vector new_cellcorner=(cellcorner - Vector(ix, iy, iz))*ncells;
         Vector new_celldir=celldir*ncells;
@@ -739,7 +739,7 @@
       int start=counts[2*idx];
       int nsph=counts[2*idx + 1];
       for (int j=0; j<nsph; ++j) {
-       float* data=spheres + cells[start + j];
+        float* data=spheres + cells[start + j];
 
         // XXX:  Range checking would go here...  Ignore for now
 
@@ -749,7 +749,7 @@
           float current_radius=data[ridx];
           if (current_radius <= 0)
             continue;
-          
+
           radius2=current_radius*current_radius;
         } else {
           radius2=radius*radius;
@@ -772,21 +772,21 @@
           break;
         tnear=tnext_x;
         tnext_x += dt_dx;
-       idx += didx_dx;
+        idx += didx_dx;
       } else if (tnext_y < tnext_z){
         iy += di_dy;
         if (iy == stop_y)
           break;
         tnear=tnext_y;
         tnext_y += dt_dy;
-       idx += didx_dy;
+        idx += didx_dy;
       } else {
         iz += di_dz;
         if (iz == stop_z)
           break;
         tnear=tnext_z;
         tnext_z += dt_dz;
-       idx += didx_dz;
+        idx += didx_dz;
       }
     }
   }
@@ -899,7 +899,7 @@
   Clamp(sx, 0, totalcells - 1);
   Clamp(sy, 0, totalcells - 1);
   Clamp(sz, 0, totalcells - 1);
-  
+
   Vector e=(box.getMax() - bounds.getMin())*inv_diagonal;
   ex=static_cast<int>(e.x()*totalcells);
   ey=static_cast<int>(e.y()*totalcells);
@@ -921,7 +921,7 @@
     int nx=ix%ncells;
     int ny=iy%ncells;
     int nz=iz%ncells;
-    
+
     return ((idx*ncells + nx)*ncells + ny)*ncells + nz;
   }
 }
@@ -931,13 +931,13 @@
   mcell.nspheres=0;
   mcell.min=new float[2*nvars];
   mcell.max=mcell.min + nvars;
-  
+
   // Initialize min/max
   for (int i=0; i<nvars; ++i) {
     mcell.min[i]=FLT_MAX;
     mcell.max[i]=-FLT_MAX;
   }
-  
+
   // Determine min/max
   int ncells3=ncells*ncells*ncells;
   if (depth>0) {
@@ -974,7 +974,7 @@
 
 void GridSpheres::mapDiffuseColors(Packet<Color>& diffuse, RayPacket& rays) 
const
 {
-  for (unsigned int i=rays.begin(); i<rays.end(); ++i) {
+  for (int i=rays.begin(); i<rays.end(); ++i) {
     int particle=rays.scratchpad<int>(i);
     float value=*(spheres + particle + cidx);
     float minimum=min[cidx];

Modified: trunk/Model/Primitives/PrimitiveCommon.cc
==============================================================================
--- trunk/Model/Primitives/PrimitiveCommon.cc   (original)
+++ trunk/Model/Primitives/PrimitiveCommon.cc   Fri Aug  3 13:14:25 2007
@@ -9,7 +9,7 @@
 static UniformMapper default_map;
 
 PrimitiveCommon::PrimitiveCommon(Material* material,
-                                const TexCoordMapper* in_tex)
+                                 const TexCoordMapper* in_tex)
   : material(material), tex(in_tex)
 {
   if(!tex)
@@ -27,7 +27,7 @@
   copy = static_cast<PrimitiveCommon*>(incoming);
   copy->material = material;
   copy->tex = tex;
-  
+
   return copy;
 }
 
@@ -41,16 +41,16 @@
   tex = new_tex;
 }
 
-Interpolable::InterpErr 
+Interpolable::InterpErr
 PrimitiveCommon::interpolate(const std::vector<Interpolable::keyframe_t> 
&keyframes)
 {
   //don't know how to interpolate between two materials, so lets
   //do nearest neighbor.

+
 
   float maxT=-1;
   int maxTindex=-1;
-  for (int frame=0; frame < keyframes.size(); ++frame) {
+  for (unsigned int frame=0; frame < keyframes.size(); ++frame) {
     if (keyframes[frame].t > maxT) {
       maxT = keyframes[frame].t;
       maxTindex = frame;
@@ -58,7 +58,7 @@
   }
   if (maxTindex < 0)
     return notInterpolable;
-  
+
   PrimitiveCommon *pc = 
dynamic_cast<PrimitiveCommon*>(keyframes[maxTindex].keyframe);
   if (pc == NULL)
     return notInterpolable;

Modified: trunk/UserInterface/AutomatorUI.cc
==============================================================================
--- trunk/UserInterface/AutomatorUI.cc  (original)
+++ trunk/UserInterface/AutomatorUI.cc  Fri Aug  3 13:14:25 2007
@@ -36,12 +36,12 @@
 using namespace SCIRun;
 
 AutomatorUI::AutomatorUI( MantaInterface *manta_interface_, int 
warmup_frames_, bool is_detached_ ) :
+  this_thread( 0 ),
+  startup_semaphore( "AutomatorUI semaphore", 0 ),
   manta_interface( manta_interface_ ),
   warmup_frames( warmup_frames_ ),
   is_detached( is_detached_ ),
   automator_mode( AUTOMATOR_EXIT ),
-  startup_semaphore( "AutomatorUI semaphore", 0 ),
-  this_thread( 0 ),
   terminate_callback( 0 )
 {
 }
@@ -61,10 +61,10 @@
                                        Callback::create(this, 
&AutomatorUI::release_automator) );
 
   do {
-    
+
     // Wait for the manta rendering threads to signal the semaphore.
     startup_semaphore.down();
-    
+
     // Run the automator function.
     run_automator();
 
@@ -92,7 +92,7 @@
 
   // Check to see if the automator is already started.
   if (this_thread == 0) {
-  
+
     // Create a thread for the automator.
     this_thread = new Thread( this, "AutomatorUI" );
 
@@ -110,7 +110,7 @@
 
     // Have manta call release_automator immediately.
     manta_interface->addOneShotCallback( MantaInterface::Relative, 0,
-                                         Callback::create(this, 
&AutomatorUI::release_automator) );    
+                                         Callback::create(this, 
&AutomatorUI::release_automator) );
   }
 
   // Otherwise start a thread.





Archive powered by MHonArc 2.6.16.

Top of page