Ignore:
Timestamp:
11/07/05 23:17:14 (19 years ago)
Author:
bittner
Message:

vss preprocessor updates

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

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/AxisAlignedBox3.h

    r376 r387  
    5454    return  mMax[axis]; 
    5555  } 
    56    
     56 
     57        float Size(const int axis) const { 
     58    return  Max(axis) - Min(axis); 
     59  } 
     60 
    5761  // Read-only const access tomMin and max vectors using references 
    5862  const Vector3& Min() const { return mMin;} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Intersectable.h

    r382 r387  
    1717        int mId; 
    1818 
     19        // universal counter 
     20        int mCounter; 
     21         
    1922        // object based pvs 
    2023        KdPvs mKdPvs; 
     
    5154  virtual float IntersectionComplexity() = 0; 
    5255   
    53   virtual int Type() const = 0; 
     56        virtual int NumberOfFaces() const = 0; 
     57 
     58        virtual int Type() const = 0; 
    5459 
    5560  virtual int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal) = 0; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Mesh.h

    r372 r387  
    192192  virtual float IntersectionComplexity() {  return (float)mMesh->mFaces.size(); } 
    193193 
     194        virtual int NumberOfFaces() const {  return mMesh->mFaces.size(); } 
     195 
    194196  virtual int Type() const { return MESH_INSTANCE; } 
    195197 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp

    r372 r387  
    9292} 
    9393 
     94int 
     95SplitFilenames(const string str, 
     96                                                         vector<string> &filenames) 
     97{ 
     98        int pos = 0; 
     99 
     100        while(1) { 
     101                int npos = str.find(';', pos); 
     102                 
     103                if (npos < 0 || npos - pos < 1) 
     104                        break; 
     105                filenames.push_back(string(str, pos, npos - pos)); 
     106                pos = npos + 1; 
     107        } 
     108         
     109        filenames.push_back(string(str, pos, str.size() - pos)); 
     110        return filenames.size(); 
     111} 
     112 
    94113bool 
    95114Preprocessor::LoadScene(const string filename) 
     
    101120   
    102121  Parser *parser; 
    103  
    104   if (strstr(filename.c_str(), ".x3d")) 
    105     parser = new X3dParser; 
    106   else 
    107     parser = new UnigraphicsParser; 
    108  
    109   bool result = parser->ParseFile(filename, &mSceneGraph->mRoot); 
    110  
    111          
    112          
    113   delete parser; 
    114  
    115         if (result) 
     122        vector<string> filenames; 
     123        int files = SplitFilenames(filename, filenames); 
     124        cout<<files<<endl; 
     125        bool result = false; 
     126        if (files == 1) { 
     127                 
     128                if (strstr(filename.c_str(), ".x3d")) 
     129                        parser = new X3dParser; 
     130                else 
     131                        parser = new UnigraphicsParser; 
     132 
     133                cout<<filename<<endl; 
     134                result = parser->ParseFile(filename, &mSceneGraph->mRoot); 
     135 
     136                delete parser; 
     137 
     138        } else { 
     139                // root for different files 
     140                mSceneGraph->mRoot = new SceneGraphNode; 
     141                for (int i= 0; i < filenames.size(); i++) { 
     142                        if (strstr(filenames[i].c_str(), ".x3d")) 
     143                                parser = new X3dParser; 
     144                        else 
     145                                parser = new UnigraphicsParser; 
     146                         
     147                        SceneGraphNode *node; 
     148                        if (parser->ParseFile(filenames[i], &node)) { 
     149                                mSceneGraph->mRoot->mChildren.push_back(node); 
     150                                // at least one file parsed 
     151                                result = true; 
     152                        } 
     153                        delete parser; 
     154                } 
     155        } 
     156         
     157 
     158        if (result) { 
    116159                mSceneGraph->AssignObjectIds(); 
     160                int intersectables, faces; 
     161                mSceneGraph->GetStatistics(intersectables, faces); 
     162                cout<<filename<<" parsed successfully."<<endl; 
     163                cout<<"#NUM_OBJECTS (Total numner of objects)\n"<<intersectables<<endl; 
     164                cout<<"#NUM_FACES (Total numner of faces)\n"<<faces<<endl; 
     165        } 
     166 
    117167         
    118168  return result; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SceneGraph.cpp

    r339 r387  
    7777  return id; 
    7878} 
     79 
     80void 
     81SceneGraph::GetStatistics(int &intersectables, int &faces) const 
     82{ 
     83  stack<SceneGraphNode *> nodeStack; 
     84   
     85  nodeStack.push(mRoot); 
     86  faces = 0; 
     87        intersectables = 0; 
     88  while (!nodeStack.empty()) { 
     89    SceneGraphNode *node = nodeStack.top(); 
     90    nodeStack.pop(); 
     91                 
     92    ObjectContainer::const_iterator mi = node->mGeometry.begin(); 
     93    for (; mi != node->mGeometry.end(); mi++) { 
     94                        intersectables++; 
     95                        faces += (*mi)->NumberOfFaces(); 
     96                } 
     97     
     98    SceneGraphNodeContainer::iterator ni = node->mChildren.begin(); 
     99    for (; ni != node->mChildren.end(); ni++) { 
     100      nodeStack.push(*ni); 
     101    } 
     102  } 
     103         
     104} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SceneGraph.h

    r372 r387  
    2626  bool Export(const string filename); 
    2727   
    28   int CollectObjects(ObjectContainer *instances); 
    29  
     28  int 
     29        CollectObjects(ObjectContainer *instances); 
     30         
    3031  int 
    3132        AssignObjectIds(); 
     33 
     34        void 
     35        GetStatistics(int &intersectables, int &faces) const; 
    3236 
    3337protected: 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r386 r387  
    7676         
    7777        if (mKdTree->CastRay(ray)) { 
     78                 
    7879                objectB = ray.intersections[0].mObject; 
    7980          pointB = ray.Extrap(ray.intersections[0].mT); 
     81 
    8082        } else { 
    8183                objectB = NULL; 
     
    9294        VssRay *vssRay  = NULL; 
    9395 
    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) { 
    104                 vssRay = new VssRay(pointA, 
    105                                                                                                 pointB, 
    106                                                                                                 objectA, 
    107                                                                                                 objectB); 
    108                 mVssRays.push_back(vssRay); 
    109                 hits ++; 
    110  
     96        bool validSample = true; 
     97        if (detectEmptyViewSpace) { 
     98                if (Distance(pointA, pointB) < 
     99                                Distance(viewPoint, pointA) + Distance(viewPoint, pointB) - Limits::Small) { 
     100                        validSample = false; 
     101                } 
     102        } 
     103         
     104        if (validSample) { 
     105                if (objectA) { 
     106                        vssRay = new VssRay(pointB, 
     107                                                                                                        pointA, 
     108                                                                                                        objectB, 
     109                                                                                                        objectA); 
     110                        mVssRays.push_back(vssRay); 
     111                        hits ++; 
     112                } 
     113                 
     114                if (objectB) { 
     115                        vssRay = new VssRay(pointA, 
     116                                                                                                        pointB, 
     117                                                                                                        objectA, 
     118                                                                                                        objectB); 
     119                        mVssRays.push_back(vssRay); 
     120                        hits ++; 
     121                } 
    111122        } 
    112123         
     
    122133        if (viewSpaceBox) 
    123134                box =*viewSpaceBox; 
    124         else 
     135        else  
    125136                box = mKdTree->GetBox(); 
    126137         
     
    146157   
    147158  mSceneGraph->CollectObjects(&mObjects); 
    148         cout<<"#NUM_OBJECTS (Total numner of objects)\n"<<mObjects.size()<<endl; 
    149159         
    150160  long startTime = GetTime(); 
     
    155165 
    156166        AxisAlignedBox3 box = mKdTree->GetBox(); 
    157         box.Enlarge(box.Size()*-Vector3(0.45, 0.45, 0.45)); 
    158  
    159         bool useViewSpaceBox = false; 
     167 
     168         
     169        if (1) 
     170                box.Enlarge(box.Size()*-Vector3(0.45, 0.45, 0.45)); 
     171        else { 
     172                // sample city like heights 
     173                box.SetMin(1, box.Min(1) + box.Size(1)*0.1); 
     174                box.SetMax(1, box.Min(1) + box.Size(1)*0.2); 
     175        } 
     176         
     177        bool useViewSpaceBox = true; 
    160178        if (useViewSpaceBox) 
    161179                viewSpaceBox = &box; 
     
    243261        vssTree->Construct(mVssRays, viewSpaceBox); 
    244262 
     263        cout<<"VssTree root PVS size = "<<vssTree->GetRootPvsSize()<<endl; 
    245264         
    246265 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.cpp

    r386 r387  
    272272                        ri++) 
    273273                if ((*ri).mRay->IsActive()) { 
    274                         Intersectable *object = (*ri).mRay->mOriginObject; 
     274                        Intersectable *object; 
     275#if BIDIRECTIONAL_RAY 
     276                        object = (*ri).mRay->mOriginObject; 
    275277                        if (object && !object->Mailed()) { 
    276278                                pvsSize++; 
    277279                                object->Mail(); 
    278280                        } 
     281#endif 
    279282                        object = (*ri).mRay->mTerminationObject; 
    280283                        if (object && !object->Mailed()) { 
     
    365368         
    366369  if (splitType == ESplitRegular) { 
    367                 int sRaysBack, sRaysFront; 
    368                 int dRaysBack, dRaysFront; 
    369                 int sPvsBack, sPvsFront; 
    370                 int dPvsBack, dPvsFront; 
    371                  
    372                  
    373                 int sAxis = box.Size().DrivingAxis(); 
    374                 float sPosition = (box.Min()[sAxis] + box.Max()[sAxis])*0.5f; 
    375                 float sCostRatio = EvalCostRatio(leaf, 
    376                                                                                                                                                  sAxis, 
    377                                                                                                                                                  sPosition, 
    378                                                                                                                                                  sRaysBack, 
    379                                                                                                                                                  sRaysFront, 
    380                                                                                                                                                  sPvsBack, 
    381                                                                                                                                                  sPvsFront 
     370                costRatio = BestCostRatioRegular(leaf, 
     371                                                                                                                                                 axis, 
     372                                                                                                                                                 position, 
     373                                                                                                                                                 raysBack, 
     374                                                                                                                                                 raysFront, 
     375                                                                                                                                                 pvsBack, 
     376                                                                                                                                                 pvsFront 
    382377                                                                                                                                                 ); 
    383                 //              cout<<"srays back="<<sRaysBack<<" rays front="<<sRaysFront<<" pvs back="<<sPvsBack<< 
    384                 //                      " pvs front="<<sPvsFront<<endl; 
    385  
    386                 AxisAlignedBox3 dirBox = GetDirBBox(leaf); 
    387                 int dAxis = dirBox.Size().DrivingAxis(); 
    388                 float dPosition = (dirBox.Min()[dAxis] + dirBox.Max()[dAxis])*0.5f; 
    389                 float dCostRatio = EvalCostRatio(leaf, 
    390                                                                                                                                                  dAxis+3, 
    391                                                                                                                                                  dPosition, 
    392                                                                                                                                                  dRaysBack, 
    393                                                                                                                                                  dRaysFront, 
    394                                                                                                                                                  dPvsBack, 
    395                                                                                                                                                  dPvsFront 
    396                                                                                                                                                  ); 
    397                  
    398                 //              cout<<"drays back="<<dRaysBack<<" rays front="<<dRaysFront<<" pvs back="<<dPvsBack<< 
    399                 //                      " pvs front="<<dPvsFront<<endl; 
    400  
    401                 if (sCostRatio < dCostRatio) { 
    402                         costRatio = sCostRatio; 
    403                         axis = sAxis; 
    404                         position = sPosition; 
    405                         raysBack = sRaysBack; 
    406                         raysFront = sRaysFront; 
    407                         pvsBack = sPvsBack; 
    408                         pvsFront = sPvsFront; 
    409                          
    410                 } else { 
    411                         costRatio = dCostRatio; 
    412                         axis = dAxis+3; 
    413                         position = dPosition; 
    414                         raysBack = dRaysBack; 
    415                         raysFront = dRaysFront; 
    416                         pvsBack = dPvsBack; 
    417                         pvsFront = dPvsFront; 
    418                 } 
    419                  
     378 
    420379        } else { 
    421380    if (splitType == ESplitHeuristic) 
     
    487446                                // determine the side of this ray with respect to the plane 
    488447                                int side = (*ri).ComputeRayIntersection(axis, position, (*ri).mRay->mT); 
    489                                  
    490448                                //                              (*ri).mRay->mSide = side; 
    491449                                 
     
    496454                                        raysFront++; 
    497455                                 
    498 #if BIDIRECTIONAL_RAY 
    499                                 AddObject2Pvs((*ri).mRay->mOriginObject, side, pvsBack, pvsFront); 
    500 #endif 
    501456                                AddObject2Pvs((*ri).mRay->mTerminationObject, side, pvsBack, pvsFront); 
    502  
    503457      } 
    504458                 
     
    536490 
    537491                                //                              (*ri).mRay->mSide = side; 
    538  
    539 #if BIDIRECTIONAL_RAY 
    540                                 AddObject2Pvs((*ri).mRay->mOriginObject, side, pvsBack, pvsFront); 
    541 #endif 
    542492                                AddObject2Pvs((*ri).mRay->mTerminationObject, side, pvsBack, pvsFront); 
    543493 
     
    551501                 
    552502                //              float sum = raysBack*(position - minBox) + raysFront*(maxBox - position); 
    553                 float sum = pvsBack*(position - minBox) + pvsFront*(maxBox - position); 
     503                float sum = 
     504                        pvsBack*(position - minBox) + 
     505                        pvsFront*(maxBox - position); 
    554506                //              float sum = pvsBack + pvsFront; 
    555507                newCost = ct_div_ci + sum/sizeBox; 
     
    566518float 
    567519VssTree::BestCostRatioRegular( 
    568                                                                                                                         VssTreeLeaf *node, 
     520                                                                                                                        VssTreeLeaf *leaf, 
    569521                                                                                                                        int &axis, 
    570522                                                                                                                        float &position, 
     
    573525                                                                                                                        int &pvsBack, 
    574526                                                                                                                        int &pvsFront 
    575                                                                                                                          
    576527                                                                                                                        ) 
    577528{ 
    578          
    579         return 0; 
     529        int nRaysBack[6], nRaysFront[6]; 
     530        int nPvsBack[6], nPvsFront[6]; 
     531        float nPosition[6]; 
     532        float nCostRatio[6]; 
     533        int bestAxis = -1; 
     534         
     535        AxisAlignedBox3 sBox = GetBBox(leaf); 
     536        AxisAlignedBox3 dBox = GetDirBBox(leaf); 
     537        // int sAxis = box.Size().DrivingAxis(); 
     538        int sAxis = sBox.Size().DrivingAxis(); 
     539        int dAxis = dBox.Size().DrivingAxis() + 3; 
     540 
     541        bool onlyDrivingAxis = true;  
     542 
     543        for (axis = 0; axis < 6; axis++) { 
     544                if (!onlyDrivingAxis || axis == sAxis || axis == dAxis) { 
     545                        if (axis < 3) 
     546                                nPosition[axis] = (sBox.Min()[axis] + sBox.Max()[axis])*0.5f; 
     547                        else 
     548                                nPosition[axis] = (dBox.Min()[axis-3] + dBox.Max()[axis-3])*0.5f; 
     549                         
     550                        nCostRatio[axis] = EvalCostRatio(leaf, 
     551                                                                                                                                                         axis, 
     552                                                                                                                                                         nPosition[axis], 
     553                                                                                                                                                         nRaysBack[axis], 
     554                                                                                                                                                         nRaysFront[axis], 
     555                                                                                                                                                         nPvsBack[axis], 
     556                                                                                                                                                         nPvsFront[axis] 
     557                                                                                                                                                         ); 
     558                         
     559                        if ( bestAxis == -1) 
     560                                bestAxis = axis; 
     561                        else 
     562                                if ( nCostRatio[axis] < nCostRatio[bestAxis] ) 
     563                                        bestAxis = axis; 
     564                } 
     565        } 
     566 
     567        axis = bestAxis; 
     568        position = nPosition[bestAxis]; 
     569 
     570        raysBack = nRaysBack[bestAxis]; 
     571        raysFront = nRaysFront[bestAxis]; 
     572 
     573        pvsBack = nPvsBack[bestAxis]; 
     574        pvsFront = nPvsFront[bestAxis]; 
     575         
     576        return nCostRatio[bestAxis]; 
    580577} 
    581578 
    582579float 
    583580VssTree::BestCostRatioHeuristic( 
    584                                                                                                                                 VssTreeLeaf *node, 
     581                                                                                                                                VssTreeLeaf *leaf, 
    585582                                                                                                                                int &axis, 
    586583                                                                                                                                float &position, 
     
    591588                                                                                                                                ) 
    592589{ 
    593         AxisAlignedBox3 box = GetBBox(node); 
    594         AxisAlignedBox3 dirBox = GetDirBBox(node); 
    595  
     590        AxisAlignedBox3 box = GetBBox(leaf); 
     591        //      AxisAlignedBox3 dirBox = GetDirBBox(node); 
     592         
    596593        axis = box.Size().DrivingAxis(); 
    597          
    598         SortSplitCandidates(node, axis); 
    599    
    600   // go through the lists, count the number of objects left and right 
    601   // and evaluate the following cost funcion: 
    602   // C = ct_div_ci  + (ql*rl + qr*rr)/queries 
    603  
    604   int rl=0, rr=node->rays.size(); 
    605          
    606   float minBox = box.Min(axis); 
    607   float maxBox = box.Max(axis); 
    608   float sizeBox = maxBox - minBox; 
    609    
    610   float minBand = minBox + 0.1*(maxBox - minBox); 
    611   float maxBand = minBox + 0.9*(maxBox - minBox); 
    612    
    613   float sum = rr*sizeBox; 
    614   float minSum = 1e20; 
    615    
    616   for(vector<SortableEntry>::const_iterator ci = splitCandidates->begin(); 
    617       ci < splitCandidates->end(); 
    618       ci++) { 
    619      
    620     switch ((*ci).type) { 
    621     case SortableEntry::ERayMin: 
    622       rl++; 
    623       break; 
    624     case SortableEntry::ERayMax: 
    625       rr--; 
    626       break; 
    627     } 
    628                  
    629     if ((*ci).value > minBand && (*ci).value < maxBand) { 
    630        
    631       sum = rl*((*ci).value - minBox) + rr*(maxBox - (*ci).value); 
    632        
    633       //      cout<<"pos="<<(*ci).value<<"\t q=("<<ql<<","<<qr<<")\t r=("<<rl<<","<<rr<<")"<<endl; 
    634       //      cout<<"cost= "<<sum<<endl; 
    635        
    636       if (sum < minSum) { 
     594                 
     595        SortSplitCandidates(leaf, axis); 
     596   
     597        // go through the lists, count the number of objects left and right 
     598        // and evaluate the following cost funcion: 
     599        // C = ct_div_ci  + (ql*rl + qr*rr)/queries 
     600         
     601        int rl=0, rr = leaf->rays.size(); 
     602        int pl=0, pr = leaf->mPvsSize; 
     603        float minBox = box.Min(axis); 
     604        float maxBox = box.Max(axis); 
     605        float sizeBox = maxBox - minBox; 
     606         
     607        float minBand = minBox + 0.1*(maxBox - minBox); 
     608        float maxBand = minBox + 0.9*(maxBox - minBox); 
     609         
     610        float sum = rr*sizeBox; 
     611        float minSum = 1e20; 
     612         
     613        Intersectable::NewMail(); 
     614        // set all object as belonging to the fron pvs 
     615        for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
     616                        ri != leaf->rays.end(); 
     617                        ri++) 
     618                if ((*ri).mRay->IsActive()) { 
     619                        Intersectable *object = (*ri).mRay->mTerminationObject; 
     620                        if (object) 
     621                                if (!object->Mailed()) { 
     622                                        object->Mail(); 
     623                                        object->mCounter = 1; 
     624                                } else 
     625                                        object->mCounter++; 
     626                } 
     627         
     628        Intersectable::NewMail(); 
     629         
     630        for(vector<SortableEntry>::const_iterator ci = splitCandidates->begin(); 
     631                        ci < splitCandidates->end(); 
     632                        ci++) { 
     633                VssRay *ray; 
     634                switch ((*ci).type) { 
     635                case SortableEntry::ERayMin: { 
     636                        rl++; 
     637                        ray = (VssRay *) (*ci).data; 
     638                        Intersectable *object = ray->mTerminationObject; 
     639                        if (object && !object->Mailed()) { 
     640                                object->Mail(); 
     641                                pl++; 
     642                        } 
     643                        break; 
     644                } 
     645                case SortableEntry::ERayMax: { 
     646                        rr--; 
     647                        ray = (VssRay *) (*ci).data; 
     648                        Intersectable *object = ray->mTerminationObject; 
     649                        if (object) { 
     650                                if (--object->mCounter == 0) 
     651                                        pr--; 
     652                        } 
     653                        break; 
     654                } 
     655                } 
     656                if ((*ci).value > minBand && (*ci).value < maxBand) { 
     657                         
     658                        sum = pl*((*ci).value - minBox) + pr*(maxBox - (*ci).value); 
     659                         
     660                        //      cout<<"pos="<<(*ci).value<<"\t q=("<<ql<<","<<qr<<")\t r=("<<rl<<","<<rr<<")"<<endl; 
     661                        //      cout<<"cost= "<<sum<<endl; 
     662                         
     663                        if (sum < minSum) { 
    637664                                minSum = sum; 
    638665                                position = (*ci).value; 
     
    641668                                raysFront = rr; 
    642669                                 
     670                                pvsBack = pl; 
     671                                pvsFront = pr; 
     672                                 
    643673      } 
    644674    } 
    645675  } 
    646676   
    647   float oldCost = node->rays.size(); 
     677  float oldCost = leaf->mPvsSize; 
    648678  float newCost = ct_div_ci + minSum/sizeBox; 
    649679  float ratio = newCost/oldCost; 
     
    652682  //  cout<<"costRatio="<<ratio<<" pos="<<position<<" t="<<(position - minBox)/(maxBox - minBox) 
    653683  //      <<"\t q=("<<queriesBack<<","<<queriesFront<<")\t r=("<<raysBack<<","<<raysFront<<")"<<endl; 
    654  
    655684        return ratio; 
    656685} 
     
    12901319  return totalRayCount - rayCount; 
    12911320} 
     1321 
     1322 
     1323int 
     1324VssTree::GetPvsSize(VssTreeNode *node, const AxisAlignedBox3 &box) const 
     1325{ 
     1326        stack<VssTreeNode *> tstack; 
     1327  tstack.push(root); 
     1328 
     1329        Intersectable::NewMail(); 
     1330        int pvsSize = 0; 
     1331         
     1332  while (!tstack.empty()) { 
     1333    VssTreeNode *node = tstack.top(); 
     1334    tstack.pop(); 
     1335     
     1336  
     1337    if (node->IsLeaf()) { 
     1338                        VssTreeLeaf *leaf = (VssTreeLeaf *)node; 
     1339                        for(VssTreeNode::RayInfoContainer::iterator ri = leaf->rays.begin(); 
     1340                                        ri != leaf->rays.end(); 
     1341                                        ri++) 
     1342                                if ((*ri).mRay->IsActive()) { 
     1343                                        Intersectable *object; 
     1344#if BIDIRECTIONAL_RAY 
     1345                                        object = (*ri).mRay->mOriginObject; 
     1346                                        if (object && !object->Mailed()) { 
     1347                                                pvsSize++; 
     1348                                                object->Mail(); 
     1349                                        } 
     1350#endif 
     1351                                        object = (*ri).mRay->mTerminationObject; 
     1352                                        if (object && !object->Mailed()) { 
     1353                                                pvsSize++; 
     1354                                                object->Mail(); 
     1355                                        } 
     1356                                } 
     1357                } else { 
     1358                        VssTreeInterior *in = (VssTreeInterior *)node; 
     1359                        if (in->axis < 3) { 
     1360                                if (box.Max(in->axis) >= in->position ) 
     1361                                        tstack.push(in->front); 
     1362                                 
     1363                                if (box.Min(in->axis) <= in->position ) 
     1364                                        tstack.push(in->back); 
     1365                        } else { 
     1366                                // both nodes for directional splits 
     1367                                tstack.push(in->front); 
     1368                                tstack.push(in->back); 
     1369                        } 
     1370                } 
     1371        } 
     1372        return pvsSize; 
     1373} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssTree.h

    r386 r387  
    469469                                leafb->rays.size()*b.bbox.GetVolume(); 
    470470#endif 
    471 #if 0 
     471#if 1 
    472472                        return 
    473                                 leafa->mPvsSize*a.bbox.GetVolume()* 
     473                                leafa->mPvsSize*a.bbox.GetVolume() 
    474474                                < 
    475475                                leafb->mPvsSize*b.bbox.GetVolume(); 
     
    481481                                leafb->mPvsSize; 
    482482#endif 
    483 #if 1 
     483#if 0 
    484484                        return 
    485485                                leafa->mPvsSize/(leafa->rays.size()+1) 
     
    487487                                leafb->mPvsSize/(leafb->rays.size()+1); 
    488488#endif 
    489 #if o 
     489#if 0 
    490490                        return 
    491491                                leafa->mPvsSize*leafa->rays.size() 
     
    754754        EvalLeafPvs(VssTreeLeaf *leaf); 
    755755 
     756        int 
     757        GetRootPvsSize() const { 
     758                return GetPvsSize(root, bbox); 
     759        } 
     760         
     761        int 
     762        GetPvsSize(VssTreeNode *node, const AxisAlignedBox3 &box) const; 
    756763         
    757764}; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/default.env

    r386 r387  
    99#       filename vienna.x3d 
    1010# filename ../data/vienna/vienna-simple.x3d 
    11 # filename ../data/vienna/vienna-buildings.x3d 
     11#filename ../data/vienna/vienna-buildings.x3d 
     12#filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d 
     13#;../data/vienna/vienna-plane.x3d 
    1214# filename ../data/vienna/viewcells-25-sel.x3d 
    13 filename ../data/atlanta/atlanta2.x3d 
     15# filename ../data/atlanta/atlanta2.x3d 
    1416# filename ../data/soda/soda.dat 
    15 # filename ../data/soda/soda5.dat 
     17filename ../data/soda/soda5.dat 
    1618} 
    1719 
     
    2224 
    2325VssPreprocessor { 
    24         totalSamples 1000000 
     26        totalSamples 100000 
    2527        samplesPerPass  50000 
    2628} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp

    r386 r387  
    5252 
    5353  p->LoadScene(filename); 
    54  
     54         
    5555  p->BuildKdTree(); 
    5656  p->KdTreeStatistics(cout); 
Note: See TracChangeset for help on using the changeset viewer.