Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r372 - in branches/itanium2: Model/Groups scenes


Chronological Thread 
  • From: abe@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r372 - in branches/itanium2: Model/Groups scenes
  • Date: Thu, 9 Jun 2005 16:03:26 -0600 (MDT)

Author: abe
Date: Thu Jun  9 16:03:24 2005
New Revision: 372

Modified:
   branches/itanium2/Model/Groups/kdtree.cc
   branches/itanium2/Model/Groups/kdtree.h
   branches/itanium2/scenes/boeing777.cc
Log:
Added a few more options to the boeing demo like -np and -cutting, I use 
-cutting default most of the timee

Modified: branches/itanium2/Model/Groups/kdtree.cc
==============================================================================
--- branches/itanium2/Model/Groups/kdtree.cc    (original)
+++ branches/itanium2/Model/Groups/kdtree.cc    Thu Jun  9 16:03:24 2005
@@ -530,7 +530,7 @@
        return out;
 }
 
-int KDTree::load( const char *fn) {
+int KDTree::load( const char *fn, int np ) {
        
        double time_begin = Time::currentSeconds();
        
@@ -538,7 +538,7 @@
        if (strstr(fn, ".tri")) {
                LoadTris(fn, &tris, NULL, &normals, bbox );
        } else if (strstr(fn, ".v3c1")) {
-               LoadBin_V3C1(fn, &tris, &normals, bbox, 32 );
+               LoadBin_V3C1(fn, &tris, &normals, bbox, np );
        } else if (strstr(fn, ".bin") || strstr(fn, "n1v3")) {
                LoadBin_N1V3(fn, &tris, &normals, bbox );
        } else {

Modified: branches/itanium2/Model/Groups/kdtree.h
==============================================================================
--- branches/itanium2/Model/Groups/kdtree.h     (original)
+++ branches/itanium2/Model/Groups/kdtree.h     Thu Jun  9 16:03:24 2005
@@ -246,7 +246,8 @@
                        void computeBounds( BBox &box_ ) const { 
box_.extendByBox( bbox ); }
                        
                        // This function is called to load the data.
-                       int load(const char *fn);
+                       // np specifies the number of workers, for certain 
loading functions.
+                       int load( const char *fn, int np );
 
                };
        }

Modified: branches/itanium2/scenes/boeing777.cc
==============================================================================
--- branches/itanium2/scenes/boeing777.cc       (original)
+++ branches/itanium2/scenes/boeing777.cc       Thu Jun  9 16:03:24 2005
@@ -37,6 +37,8 @@
 using namespace Manta::Kdtree;
 using namespace SCIRun;
 
+enum CuttingPlaneType { CUTTING_NONE, CUTTING_DEFAULT, CUTTING_SPECIFIED };
+
 ///////////////////////////////////////////////////////////////////////////
 // This function constructs the Boeing 777 Test Scene using a KdTree.
 extern "C" 
@@ -44,16 +46,40 @@
        
        string file_name;
        
-       // Parse args.
+       Point plane_point;
+       Vector plane_normal;
+       
+       CuttingPlaneType cutting_type = CUTTING_NONE;
+       int workers_np = 1;
+       
+       // Parse args.i
        for (int i=0;i<args.size();++i) {
                if (args[i] == "-file") {
                        // Determine the index of the filename.
                        if (!getStringArg(i, args, file_name))
                                throw IllegalArgument("boeing777 -file 
<filename>", i, args);
                }
+               else if (args[i] == "-np") {
+                       if (!getIntArg(i, args, workers_np ))
+                               throw IllegalArgument("boeing777 -np <num 
build workers>", i, args);
+               }
+               else if (args[i] == "-cutting") {
+                       string cutting_string;
+                       if (getPointArg(i, args, plane_point ) && 
getVectorArg(i, args, plane_normal)) { 
+                               cutting_type = CUTTING_SPECIFIED;
+                       }
+                       else if (getStringArg(i, args, cutting_string) && 
cutting_string == "default") {
+                               cutting_type = CUTTING_DEFAULT;
+                               cerr << "Using default cutting plane." << 
std::endl;
+                       }
+                       else
+                               throw IllegalArgument("boeing777 -cutting 
[<point> <normal>]", i, args);
+               }
                else {
                        cerr << "Valid options for boeing777:" << endl;
                        cerr << "-file <filename>"             << endl;
+                       cerr << "-np   <num build workers>"    << endl;
+                       cerr << "-cutting [<point> <normal>]"  << endl;
                        throw IllegalArgument( "boeing777", i, args );
                }
        }
@@ -67,38 +93,37 @@
        
        double start_time = Time::currentSeconds();
        
-       kdtree->load( file_name.c_str() );
+       kdtree->load( file_name.c_str(), workers_np );
        
        double end_time = Time::currentSeconds();
        
        std::cout << "Total load time: " << (end_time-start_time)/60.0 << " 
minutes." 
                  << std::endl << std::endl;
        
-       // min = (0, -1200 -7)
-       // max = (2606, 1200, 716)
-       
        // Determine the bounds of the model.
        BBox bounds;
        kdtree->computeBounds( bounds );
        
        // Compute the middle of the model for a cutting plane.
-       Point  plane_point = bounds.center();
-       Vector plane_normal( 0.0, -1.0, 0.0 );
-       
-       std::cout << "Cutting plane point: "  << plane_point  << std::endl;
-       std::cout << "Cutting plane normal: " << plane_normal << std::endl;
+       if (cutting_type == CUTTING_DEFAULT) {
+               plane_point = bounds.center();
+               plane_normal = Vector( 0.0, -1.0, 0.0 );
+       }
+               
+       // Check to see if the model should be cut by a cutting plane.
+       if ((cutting_type == CUTTING_DEFAULT) || (cutting_type == 
CUTTING_SPECIFIED)) {
+       
+               std::cout << "Cutting plane point: "  << plane_point  << 
std::endl;
+               std::cout << "Cutting plane normal: " << plane_normal << 
std::endl;
+               
+               group->add( new CuttingPlane( plane_point, plane_normal, 
kdtree ) );
+       }
+       else { 
+               group->add( kdtree );
+       }
        
-       // Add the kdtree to the world group.
-       group->add( new CuttingPlane( plane_point, plane_normal, kdtree ) );
-       // group->add( kdtree );
-
        LightSet *lights = new LightSet();
        
-       // Add lights at each corner of the model.
-       // for (int i=0;i<8;i+=2) {
-       //      lights->add( new PointLight( bounds.getCorner(i), Color(RGB( 
0.15, 0.15, 0.15 )) ));
-       //}
-
        // lights->add( new PointLight( Point(5000,5000,5000), 
Color(RGB(1.0,1.0,1.0)) ));
        lights->add( new HeadLight( Vector( 0.0, 1.0, 0.0 ), 
Color(RGB(1.0,1.0,1.0)) ));
        




  • [MANTA] r372 - in branches/itanium2: Model/Groups scenes, abe, 06/09/2005

Archive powered by MHonArc 2.6.16.

Top of page