Changeset 386 for trunk


Ignore:
Timestamp:
11/07/05 11:27:38 (19 years ago)
Author:
bittner
Message:

VssPreprocessor? updates - directional rays, x3dexporter updates - removed duplicated code for ray exports

Location:
trunk/VUT/GtpVisibilityPreprocessor/src
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/Camera.cpp

    r374 r386  
    4848  //  - components*mWidth; 
    4949   
    50   vector<Ray> rays; 
     50  vector<Ray *> rays; 
    5151 
    5252  long t1 = GetTime(); 
     
    7474      pbuffer+=components; 
    7575       
    76       if (exportRays && (x==222) && (y==97)) 
    77         rays.push_back(ray); 
     76      if (exportRays && (x==222) && (y==97)) { 
     77                                Ray *nray = new Ray(ray); 
     78                                rays.push_back(nray); 
     79                        } 
    7880    } 
    7981    //    pbuffer-=2*components*mWidth; 
     
    9799    exporter->SetWireframe(); 
    98100    exporter->ExportKdTree(*tree); 
    99         //exporter->ExportBspTree(*bsptree); 
     101                //exporter->ExportBspTree(*bsptree); 
    100102    exporter->ExportRays(rays, 10000); 
    101103    exporter->SetFilled(); 
    102104    int k =0; 
    103105    for (int j=0; j < rays.size(); j++) 
    104       if (rays[j].kdLeaves.size()) { 
    105         Ray *ray = &(rays[j]); 
    106         int i; 
    107         if (1) 
    108         for (i= 0; i < ray->kdLeaves.size(); i++) 
    109           exporter->ExportBox(tree->GetBox(ray->kdLeaves[i])); 
    110         if (0) 
    111                 for (i= 0; i < ray->testedObjects.size(); i++) 
    112                         exporter->ExportIntersectable(ray->testedObjects[i]); 
    113  
     106      if (rays[j]->kdLeaves.size()) { 
     107                                Ray *ray = rays[j]; 
     108                                int i; 
     109                                if (1) 
     110                                        for (i= 0; i < ray->kdLeaves.size(); i++) 
     111                                                exporter->ExportBox(tree->GetBox(ray->kdLeaves[i])); 
     112                                if (0) 
     113                                        for (i= 0; i < ray->testedObjects.size(); i++) 
     114                                                exporter->ExportIntersectable(ray->testedObjects[i]); 
     115                                 
    114116      } 
    115  
     117                 
    116118    delete exporter; 
    117119  } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Camera.h

    r312 r386  
    4242  } 
    4343 
     44        void SetDirection(const Vector3 &dir) { 
     45    mDirection = dir; 
     46    Precompute(); 
     47  } 
     48 
    4449  void LookInBox(const AxisAlignedBox3 &box) 
    4550  { 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h

    r383 r386  
    88#include "Material.h" 
    99#include "Containers.h" 
     10#include "VssRay.h" 
    1011 
    1112class KdTree; 
     
    4950  ExportBspTree(const BspTree &tree) = 0; 
    5051 
    51   virtual bool 
    52   ExportRays(const vector<Ray> &rays, 
    53              const float length=1000, 
    54              const RgbColor &color = RgbColor(1,1,1) 
    55              ) = 0; 
     52//    virtual bool 
     53//    ExportRays(const vector<Ray> &rays, 
     54//           const float length=1000, 
     55//           const RgbColor &color = RgbColor(1,1,1) 
     56//           ) = 0; 
    5657   
    5758  virtual bool 
    5859  ExportRays(const RayContainer &rays, 
    59              const float length=1000, 
    60              const RgbColor &color = RgbColor(1,1,1) 
    61              ) = 0; 
     60                                                 const float length=1000, 
     61                                                 const RgbColor &color = RgbColor(1,1,1) 
     62                                                 ) = 0; 
     63 
     64        virtual bool 
     65  ExportRays(const VssRayContainer &rays, 
     66                                                 const RgbColor &color = RgbColor(1,1,1) 
     67                                                 ) = 0; 
    6268 
    6369  virtual void  
  • trunk/VUT/GtpVisibilityPreprocessor/src/Material.h

    r162 r386  
    3232  { 
    3333  } 
    34    
     34 
     35        Material(const RgbColor &color):mDiffuseColor(color), 
     36                                                                                                                                        mAmbientColor(color), 
     37                                                                                                                                        mSpecularColor(0,0,0) 
     38        { 
     39        } 
     40 
    3541  friend Material RandomMaterial(); 
    3642   
  • trunk/VUT/GtpVisibilityPreprocessor/src/MutualVisibility.cpp

    r359 r386  
    529529    mesh->AddRectangle(shaft->mSource); 
    530530    mesh->AddRectangle(shaft->mTarget); 
    531     vector<Ray> rays; 
     531    vector<Ray *> rays; 
    532532    for (int j=0; j < 4; j++) { 
    533       Ray ray; 
    534       shaft->GetRaySegment(j, ray); 
     533      Ray *ray = new Ray; 
     534      shaft->GetRaySegment(j, *ray); 
    535535      rays.push_back(ray); 
    536536    } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r385 r386  
    386386  int pvsOut = Min((int)objects.size(), 10); 
    387387 
    388   vector<Ray> rays[10]; 
     388  RayContainer rays[10]; 
    389389 
    390390  while (totalSamples < mTotalSamples) { 
     
    455455                                        } 
    456456 
    457                                         if ( i < pvsOut ) 
    458                                                 rays[i].push_back(ray); 
     457                                        if ( i < pvsOut ) { 
     458                                                Ray *nray = new Ray(ray); 
     459                                                rays[i].push_back(nray); 
     460                                        } 
    459461                 
    460462                                        if (!ray.intersections.empty()) { 
     
    462464                                                for (int j = 0; j < pvsOut; j++) { 
    463465                                                        if (objects[j] == ray.intersections[0].mObject) { 
    464                                                                 rays[j].push_back(ray); 
     466                                                                Ray *nray = new Ray(ray); 
     467                                                                rays[j].push_back(nray); 
    465468                                                        } 
    466469                                                } 
     
    635638 
    636639                for (i=0; i < pvsOut; i++)  
    637                 exporter->ExportRays(rays[i], 1000, RgbColor(1, 0, 0)); 
     640                        exporter->ExportRays(rays[i], 1000, RgbColor(1, 0, 0)); 
    638641                exporter->SetFilled(); 
    639                    
     642                 
    640643                delete exporter; 
    641644        } 
     
    833836                //-- some random view cells and rays for output 
    834837                const int raysOut = min((int)mSampleRays.size(), 20000); 
    835                 vector<Ray> vcRays[leafOut]; 
     838                vector<Ray *> vcRays[leafOut]; 
    836839                vector<BspLeaf *> bspLeaves; 
    837840                for (int i = 0; i < leafOut; ++ i) 
     
    852855                                        if (bspLeaves[i]->GetViewCell() == leaf->GetViewCell())  
    853856                                        { 
    854                                                 vcRays[i].push_back(*ray); 
     857                                                vcRays[i].push_back(ray); 
    855858                                        } 
    856859                                } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r383 r386  
    3636} 
    3737 
    38 VssRay *  
     38int 
    3939VssPreprocessor::CastRay( 
    4040                                                                                                 Vector3 &viewPoint, 
     
    4242                                                                                                 ) 
    4343{ 
     44        int hits = 0; 
    4445        static Ray ray; 
    4546        AxisAlignedBox3 box = mKdTree->GetBox(); 
     
    6566                 
    6667        } 
    67          
    68         SetupRay(ray, viewPoint, -direction); 
     68 
     69        bool detectEmptyViewSpace = true; 
     70         
     71        if (detectEmptyViewSpace) { 
     72                SetupRay(ray, pointA, -direction); 
     73        } else 
     74                SetupRay(ray, viewPoint, -direction); 
     75         
    6976         
    7077        if (mKdTree->CastRay(ray)) { 
     
    8491 
    8592        VssRay *vssRay  = NULL; 
    86          
    87         if (objectA || objectB) { 
     93 
     94        if (objectA) { 
     95                vssRay = new VssRay(pointB, 
     96                                                                                                pointA, 
     97                                                                                                objectB, 
     98                                                                                                objectA); 
     99                mVssRays.push_back(vssRay); 
     100                hits ++; 
     101        } 
     102         
     103        if (objectB) { 
    88104                vssRay = new VssRay(pointA, 
    89105                                                                                                pointB, 
    90106                                                                                                objectA, 
    91107                                                                                                objectB); 
    92         } 
    93          
    94         return vssRay; 
     108                mVssRays.push_back(vssRay); 
     109                hits ++; 
     110 
     111        } 
     112         
     113        return hits; 
    95114} 
    96115 
     
    156175                        Vector3 direction = GetDirection(viewpoint); 
    157176                         
    158                         VssRay *vssRay = CastRay(viewpoint, direction); 
    159                          
    160                         if (vssRay) { 
    161                                 sampleContributions = vssRay->HitCount(); 
    162                                 mVssRays.push_back(vssRay); 
    163                         } 
     177                        sampleContributions = CastRay(viewpoint, direction); 
     178                         
    164179                         
    165180                        //-- CORR matt: put block inside loop 
     
    198213        cout << "#totalRayStackSize=" << mVssRays.size() << endl <<flush; 
    199214 
     215        cout<<"Exporting vss rays..."<<endl<<flush; 
     216         
     217        int exportRays = 10000; 
     218 
     219        if (exportRays) { 
     220                float prob = exportRays/(float)mVssRays.size(); 
     221                 
     222                Exporter *exporter = NULL; 
     223                exporter = Exporter::GetExporter("vss-rays.x3d"); 
     224                exporter->SetWireframe(); 
     225                exporter->ExportKdTree(*mKdTree); 
     226                if (viewSpaceBox) { 
     227                        exporter->SetForcedMaterial(RgbColor(1,0,0)); 
     228                        exporter->ExportBox(*viewSpaceBox); 
     229                        exporter->ResetForcedMaterial(); 
     230                } 
     231                VssRayContainer rays; 
     232                for (int i=0; i < mVssRays.size(); i++) 
     233                        if (RandomValue(0,1) < prob) 
     234                                rays.push_back(mVssRays[i]); 
     235                exporter->ExportRays(rays, RgbColor(1, 0, 0)); 
     236 
     237                delete exporter; 
     238        } 
     239        cout<<"done."<<endl<<flush; 
     240 
    200241        VssTree *vssTree = new VssTree; 
    201242 
    202243        vssTree->Construct(mVssRays, viewSpaceBox); 
    203          
     244 
     245         
     246 
     247 
    204248  return true; 
    205249} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.h

    r382 r386  
    4141 
    4242         
    43         VssRay *  
     43        int 
    4444        CastRay( 
    4545                                        Vector3 &viewPoint, 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssRay.h

    r382 r386  
    3939  Vector3 mTermination; 
    4040         
     41        /// Termination object for the ray 
     42        /// only the termination object is actually used 
    4143        Intersectable *mOriginObject; 
    4244        Intersectable *mTerminationObject; 
     
    6264                Vector3 dir = GetDir(); 
    6365 
     66#define BIDIRECTIONAL_RAY 0 
     67#if BIDIRECTIONAL_RAY 
    6468                if (dir.y < 0) { 
    6569                        // swap objects and poits        
     
    6872                        dir = -dir; 
    6973                } 
    70                  
     74#endif 
    7175                if (dir.x > 0.0f) mFlags |= FPosDirX; 
    7276    if (dir.y > 0.0f) mFlags |= FPosDirY; 
     
    8589 
    8690        int HitCount() const { 
     91#if BIDIRECTIONAL_RAY 
    8792                if (mOriginObject && mTerminationObject) 
    8893                        return 2; 
     
    9095                        return 1; 
    9196                return 0; 
     97#else 
     98                return (mTerminationObject) ? 1 : 0; 
     99#endif 
    92100        } 
    93101         
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.cpp

    r382 r386  
    109109    splitType = ESplitRegular; 
    110110  else 
    111     if (name.compare("heuristics") == 0) 
    112       splitType = ESplitVolume; 
     111    if (name.compare("heuristic") == 0) 
     112      splitType = ESplitHeuristic; 
    113113                else { 
    114114                        cerr<<"Invalid VssTree split type "<<name<<endl; 
     
    301301 
    302302   
     303        int lastMem = 0; 
    303304  while (!tStack.empty()) { 
    304305 
    305     if ( GetMemUsage() > maxMemory ) { 
     306                float mem = GetMemUsage(); 
     307                 
     308                if ( lastMem/10 != ((int)mem)/10) { 
     309                        cout<<mem<<" MB"<<endl; 
     310                } 
     311                lastMem = (int)mem; 
     312                 
     313                if (  mem > maxMemory ) { 
    306314      // count statistics on unprocessed leafs 
    307315      while (!tStack.empty()) { 
     
    411419                 
    412420        } else { 
    413     if (splitType == ESplitVolume) 
    414       costRatio = BestCostRatio(leaf, 
    415                                                                                                                                 axis, 
    416                                                                                                                                 position, 
    417                                                                                                                                 raysBack, 
    418                                                                                                                                 raysFront); 
     421    if (splitType == ESplitHeuristic) 
     422      costRatio = BestCostRatioHeuristic(leaf, 
     423                                                                                                                                                                 axis, 
     424                                                                                                                                                                 position, 
     425                                                                                                                                                                 raysBack, 
     426                                                                                                                                                                 raysFront, 
     427                                                                                                                                                                 pvsBack, 
     428                                                                                                                                                                 pvsFront 
     429                                                                                                                                                                 ); 
    419430                else { 
    420431                        cerr<<"VssTree: Unknown split heuristics\n"; 
     
    424435 
    425436        if (costRatio > termMaxCostRatio) { 
    426                 cout<<"Too big cost ratio "<<costRatio<<endl; 
     437                //              cout<<"Too big cost ratio "<<costRatio<<endl; 
    427438                return -1; 
    428439        } 
     
    485496                                        raysFront++; 
    486497                                 
     498#if BIDIRECTIONAL_RAY 
    487499                                AddObject2Pvs((*ri).mRay->mOriginObject, side, pvsBack, pvsFront); 
     500#endif 
    488501                                AddObject2Pvs((*ri).mRay->mTerminationObject, side, pvsBack, pvsFront); 
    489502 
     
    524537                                //                              (*ri).mRay->mSide = side; 
    525538 
     539#if BIDIRECTIONAL_RAY 
    526540                                AddObject2Pvs((*ri).mRay->mOriginObject, side, pvsBack, pvsFront); 
     541#endif 
    527542                                AddObject2Pvs((*ri).mRay->mTerminationObject, side, pvsBack, pvsFront); 
    528543 
     
    550565 
    551566float 
    552 VssTree::BestCostRatio( 
    553                                                                                          VssTreeLeaf *node, 
    554                                                                                          int &axis, 
    555                                                                                          float &position, 
    556                                                                                          int &raysBack, 
    557                                                                                          int &raysFront 
    558                                                                                          ) 
     567VssTree::BestCostRatioRegular( 
     568                                                                                                                        VssTreeLeaf *node, 
     569                                                                                                                        int &axis, 
     570                                                                                                                        float &position, 
     571                                                                                                                        int &raysBack, 
     572                                                                                                                        int &raysFront, 
     573                                                                                                                        int &pvsBack, 
     574                                                                                                                        int &pvsFront 
     575                                                                                                                         
     576                                                                                                                        ) 
     577{ 
     578         
     579        return 0; 
     580} 
     581 
     582float 
     583VssTree::BestCostRatioHeuristic( 
     584                                                                                                                                VssTreeLeaf *node, 
     585                                                                                                                                int &axis, 
     586                                                                                                                                float &position, 
     587                                                                                                                                int &raysBack, 
     588                                                                                                                                int &raysFront, 
     589                                                                                                                                int &pvsBack, 
     590                                                                                                                                int &pvsFront 
     591                                                                                                                                ) 
    559592{ 
    560593        AxisAlignedBox3 box = GetBBox(node); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.h

    r382 r386  
    463463      VssTreeLeaf *leafa = (VssTreeLeaf *) a.node; 
    464464      VssTreeLeaf *leafb = (VssTreeLeaf *) b.node; 
    465       //      return leafa->rays.size()*a.bbox.GetVolume() < leafb->rays.size()*b.bbox.GetVolume(); 
    466       return  
     465#if 0 
     466                        return 
    467467                                leafa->rays.size()*a.bbox.GetVolume() 
    468468                                < 
    469469                                leafb->rays.size()*b.bbox.GetVolume(); 
     470#endif 
     471#if 0 
     472                        return 
     473                                leafa->mPvsSize*a.bbox.GetVolume()* 
     474                                < 
     475                                leafb->mPvsSize*b.bbox.GetVolume(); 
     476#endif 
     477#if 0 
     478                        return 
     479                                leafa->mPvsSize 
     480                                < 
     481                                leafb->mPvsSize; 
     482#endif 
     483#if 1 
     484                        return 
     485                                leafa->mPvsSize/(leafa->rays.size()+1) 
     486                                > 
     487                                leafb->mPvsSize/(leafb->rays.size()+1); 
     488#endif 
     489#if o 
     490                        return 
     491                                leafa->mPvsSize*leafa->rays.size() 
     492                                < 
     493                                leafb->mPvsSize*leafb->rays.size(); 
     494#endif 
    470495    } 
    471496  }; 
     
    527552 
    528553  // type of the splitting to use fo rthe tree construction 
    529   enum {ESplitRegular, ESplitVolume }; 
     554  enum {ESplitRegular, ESplitHeuristic }; 
    530555  int splitType; 
    531556         
     
    620645   
    621646        float 
    622         BestCostRatio( 
    623                                                                 VssTreeLeaf *node, 
    624                                                                 int &axis, 
    625                                                                 float &position, 
    626                                                                 int &raysBack, 
    627                                                                 int &raysFront 
    628                                                                 ); 
     647        BestCostRatioHeuristic( 
     648                                                                                                 VssTreeLeaf *node, 
     649                                                                                                 int &axis, 
     650                                                                                                 float &position, 
     651                                                                                                 int &raysBack, 
     652                                                                                                 int &raysFront, 
     653                                                                                                 int &pvsBack, 
     654                                                                                                 int &pvsFront 
     655                                                                                                 ); 
     656 
     657        float 
     658        BestCostRatioRegular( 
     659                                                                                         VssTreeLeaf *node, 
     660                                                                                         int &axis, 
     661                                                                                         float &position, 
     662                                                                                         int &raysBack, 
     663                                                                                         int &raysFront, 
     664                                                                                         int &pvsBack, 
     665                                                                                         int &pvsFront 
     666 
     667                                                                                         ); 
    629668         
    630669        float 
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp

    r383 r386  
    88#include "ViewCell.h" 
    99#include "Polygon3.h" 
     10#include "VssRay.h" 
    1011 
    1112X3dExporter::X3dExporter(const string filename):Exporter(filename) 
     
    2627 
    2728 
    28 bool 
    29 X3dExporter::ExportRays(const vector<Ray> &rays, 
    30                         const float length, 
    31                         const RgbColor &color) 
    32 { 
    33   vector<Ray>::const_iterator ri = rays.begin(); 
    34   stream<<"<Shape>"<<endl; 
    35   stream<<"<Appearance>"<<endl; 
    36   stream<<"<Material ambientColor=\""<<color.r<<" "<<color.g<<" "<<color.b<< 
    37     "\" />"<<endl; 
    38   stream<<"</Appearance>"<<endl; 
    39    
    40   stream<<"<IndexedLineSet coordIndex=\""<<endl; 
    41  
    42   int index = 0; 
    43   for (; ri != rays.end(); ri++) { 
    44     stream<<index<<" "<<index+1<<" -1\n"; 
    45     index+=2; 
    46   } 
    47    
    48   stream<<"\" >"<<endl; 
    49    
    50   stream<<"<Coordinate  point=\""<<endl; 
    51    
    52   ri = rays.begin(); 
    53   for (; ri != rays.end(); ri++) { 
    54     Vector3 a = (*ri).GetLoc(); 
     29//  bool 
     30//  X3dExporter::ExportRays(const vector<Ray> &rays, 
     31//                                                                                              const float length, 
     32//                                                                                              const RgbColor &color) 
     33//  { 
     34//    vector<Ray>::const_iterator ri = rays.begin(); 
     35//    stream<<"<Shape>"<<endl; 
     36//    stream<<"<Appearance>"<<endl; 
     37//    stream<<"<Material ambientColor=\""<<color.r<<" "<<color.g<<" "<<color.b<< 
     38//      "\" />"<<endl; 
     39//    stream<<"</Appearance>"<<endl; 
     40   
     41//    stream<<"<IndexedLineSet coordIndex=\""<<endl; 
     42 
     43//    int index = 0; 
     44//    for (; ri != rays.end(); ri++) { 
     45//      stream<<index<<" "<<index+1<<" -1\n"; 
     46//      index+=2; 
     47//    } 
     48   
     49//    stream<<"\" >"<<endl; 
     50   
     51//    stream<<"<Coordinate  point=\""<<endl; 
     52   
     53//    ri = rays.begin(); 
     54//    for (; ri != rays.end(); ri++) { 
     55//      Vector3 a = (*ri).GetLoc(); 
    5556     
    56     Vector3 b; 
    57     if (length < 0) 
    58       b = (*ri).GetLoc() - length*(*ri).GetDir(); 
    59     else 
    60       if ((*ri).intersections.size()==0) 
    61         b = (*ri).GetLoc() + length*(*ri).GetDir(); 
    62       else 
    63         b = (*ri).Extrap((*ri).intersections[0].mT); 
     57//      Vector3 b; 
     58//      if (length < 0) 
     59//        b = (*ri).GetLoc() - length*(*ri).GetDir(); 
     60//      else 
     61//        if ((*ri).intersections.size()==0) 
     62//      b = (*ri).GetLoc() + length*(*ri).GetDir(); 
     63//        else 
     64//      b = (*ri).Extrap((*ri).intersections[0].mT); 
    6465     
    65     stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
    66     stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n"; 
    67   } 
    68    
    69   stream<<"\" >"<<endl; 
    70   stream<<"</Coordinate>"<<endl; 
    71   stream<<"</IndexedLineSet>"<<endl; 
    72   stream<<"</Shape>"<<endl; 
    73   return true; 
    74 } 
     66//      stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
     67//      stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n"; 
     68//    } 
     69   
     70//    stream<<"\" >"<<endl; 
     71//    stream<<"</Coordinate>"<<endl; 
     72//    stream<<"</IndexedLineSet>"<<endl; 
     73//    stream<<"</Shape>"<<endl; 
     74//    return true; 
     75//  } 
     76 
    7577 
    7678bool 
    7779X3dExporter::ExportRays(const RayContainer &rays, 
    78                                                 const float length, 
    79                                                 const RgbColor &color) 
     80                                                                                                const float length, 
     81                                                                                                const RgbColor &color) 
    8082{ 
    8183  RayContainer::const_iterator ri = rays.begin(); 
     
    121123  stream<<"</Shape>"<<endl; 
    122124 
     125  return true; 
     126} 
     127 
     128bool 
     129X3dExporter::ExportRays(const VssRayContainer &rays, 
     130                                                                                                const RgbColor &color) 
     131{ 
     132  VssRayContainer::const_iterator ri = rays.begin(); 
     133 
     134  stream<<"<Shape>"<<endl; 
     135  stream<<"<Appearance>"<<endl; 
     136  stream<<"<Material ambientColor=\""<<color.r<<" "<<color.g<<" "<<color.b<< 
     137    "\" />"<<endl; 
     138  stream<<"</Appearance>"<<endl; 
     139   
     140  stream<<"<IndexedLineSet coordIndex=\""<<endl; 
     141 
     142  int index = 0; 
     143  for (; ri != rays.end(); ri++) { 
     144    stream<<index<<" "<<index+1<<" -1\n"; 
     145    index+=2; 
     146  } 
     147   
     148  stream<<"\" >"<<endl; 
     149   
     150  stream<<"<Coordinate  point=\""<<endl; 
     151   
     152  ri = rays.begin(); 
     153  for (; ri != rays.end(); ri++) { 
     154    Vector3 a = (*ri)->GetOrigin(); 
     155     
     156    Vector3 b = (*ri)->GetTermination(); 
     157    stream<<a.x<<" "<<a.y<<" "<<a.z<<" ,"; 
     158    stream<<b.x<<" "<<b.y<<" "<<b.z<<" ,\n"; 
     159  } 
     160   
     161  stream<<"\" >"<<endl; 
     162  stream<<"</Coordinate>"<<endl; 
     163  stream<<"</IndexedLineSet>"<<endl; 
     164  stream<<"</Shape>"<<endl; 
     165         
    123166  return true; 
    124167} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h

    r383 r386  
    1010#include "Exporter.h" 
    1111#include "Containers.h" 
     12#include "VssRay.h" 
    1213 
    1314class SceneGraphNode; 
     
    3031 
    3132 
    32   bool 
    33   ExportRays(const vector<Ray> &rays, 
    34              const float length=1000, 
    35              const RgbColor &color = RgbColor(1,1,1)); 
     33//    bool 
     34//    ExportRays(const vector<Ray> &rays, 
     35//           const float length=1000, 
     36//           const RgbColor &color = RgbColor(1,1,1)); 
    3637 
    3738  bool 
     
    8283  bool 
    8384  ExportRays(const RayContainer &rays, 
    84                         const float length=1000, 
    85                         const RgbColor &color = RgbColor(1,1,1)); 
     85                                                const float length=1000, 
     86                                                const RgbColor &color = RgbColor(1,1,1)); 
    8687 
     88        bool 
     89        ExportRays(const VssRayContainer &rays, 
     90                                                 const RgbColor &color = RgbColor(1,1,1)); 
     91                 
    8792  virtual void 
    8893  ExportBspViewCellPartition(const BspTree &tree, const int maxPvs = 0); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/default.env

    r382 r386  
    1111# filename ../data/vienna/vienna-buildings.x3d 
    1212# filename ../data/vienna/viewcells-25-sel.x3d 
    13 # filename ../data/atlanta/atlanta2.x3d 
    14 #       filename ../data/soda/soda.dat 
    15 filename ../data/soda/soda5.dat 
     13filename ../data/atlanta/atlanta2.x3d 
     14# filename ../data/soda/soda.dat 
     15# filename ../data/soda/soda5.dat 
    1616} 
    1717 
     
    2222 
    2323VssPreprocessor { 
    24         totalSamples 200000 
     24        totalSamples 1000000 
    2525        samplesPerPass  50000 
    2626} 
     
    3232        minPvs          10 
    3333        minSize         0.00001 
    34         maxCostRatio    1.0 
    35         maxRayContribution 0.5 
     34        maxCostRatio    0.95 
     35        maxRayContribution 0.2 
    3636         
    37         maxTotalMemory  500 
    38         maxStaticMemory 200 
     37        maxTotalMemory  400 
     38        maxStaticMemory 20 
    3939 
    4040        splitType regular 
  • trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp

    r374 r386  
    121121  } 
    122122 
     123        Camera camera; 
    123124  if (0) { 
    124     Camera camera; 
    125125    //camera.LookAtBox(p->mKdTree->GetBox()); 
    126126                camera.LookInBox(p->mKdTree->GetBox()); 
    127127                camera.SetPosition(camera.mPosition + Vector3(0,300,0)); 
    128128    camera.SnapImage("camera.jpg", p->mKdTree); 
    129                  
    130      
     129        } 
     130        if (0) { 
    131131    camera.LookInBox(p->mKdTree->GetBox()); 
    132132    camera.SetPosition(camera.mPosition - Vector3(0,100,0)); 
    133133    camera.SnapImage("camera2.jpg", p->mKdTree); 
     134  } 
     135 
     136        if (0) { 
     137    camera.SetPosition( p->mKdTree->GetBox().Center() - Vector3(0,-100,0) ); 
     138                camera.SetDirection(Vector3(1, 0, 0)); 
     139                camera.SnapImage("camera3.jpg", p->mKdTree); 
    134140  } 
    135141 
Note: See TracChangeset for help on using the changeset viewer.