Changeset 303 for trunk/VUT


Ignore:
Timestamp:
10/03/05 16:10:35 (19 years ago)
Author:
mattausch
Message:

debug variant of scen geometry bsp insertion

Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r302 r303  
    88#       filename glasgow1.x3d 
    99#       filename vienna.x3d 
    10         filename ../data/vienna/vienna-simple.x3d 
    11 #       filename ../data/vienna/viewcells-25-sel.x3d 
     10#       filename ../data/vienna/vienna-simple.x3d 
     11        filename ../data/vienna/viewcells-25-sel.x3d 
    1212#       filename ../data/atlanta/atlanta2.x3d 
    1313#       filename ../data/soda/soda.dat 
     
    1515#       viewcells ../data/atlanta/atlanta_viewcells_large.x3d 
    1616#       viewcells ../data/atlanta/atlanta_viewcells_large2.x3d 
    17 #       viewcells ../data/vienna/viewcells-25-sel.x3d 
    18         viewcells ../data/vienna/viewcells-25.x3d 
     17        viewcells ../data/vienna/viewcells-25-sel.x3d 
     18#       viewcells ../data/vienna/viewcells-25.x3d 
    1919#       viewcells ../data/vienna/viewcells-large-sel.x3d 
    2020} 
     
    7575        # least splits + balanced polygons 
    7676        #splitPlaneStrategy 12 
     77        splitPlaneStrategy 32 
    7778        #axis aligned + vertical axis 
    78         splitPlaneStrategy 66 
     79        #splitPlaneStrategy 66 
     80         
    7981        # axis aligned + balanced view cells 
    8082        # splitPlaneStrategy 18 
     83         
    8184        # largest polygon area 
    8285        #splitPlaneStrategy 32 
     86         
    8387        # axus aligned + balanced polygons 
    8488        #splitPlaneStrategy 72 
     89         
    8590#       constructionMethod rays 
    86         constructionMethod viewCells 
    87 #       constructionMethod sceneGeometry 
     91#       constructionMethod viewCells 
     92        constructionMethod sceneGeometry 
    8893        maxCandidates 25 
    8994        maxViewCells 999999 
    9095        Termination { 
    91                 maxPolysForAxisAligned 200 
    92                 maxPolygons 0 
     96                maxPolysForAxisAligned 50 
     97                maxPolygons 5 
    9398                maxDepth 100 
    9499        } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp

    r297 r303  
    9595        ObjectContainer objects; 
    9696        RayContainer rays; 
    97  
     97ViewCellContainer dummy; 
    9898        switch (BspTree::sConstructionMethod) 
    9999        { 
     
    102102                break; 
    103103        case BspTree::SCENE_GEOMETRY: 
     104#if 0 
    104105                CLEAR_CONTAINER(mViewCells); // we generate new view cells 
    105  
    106106                mSceneGraph->CollectObjects(&objects); 
    107107                mBspTree->Construct(objects, &mViewCells); 
     108#else 
     109                for (int i=0; i< mViewCells.size(); ++i) 
     110                        objects.push_back(mViewCells[i]); 
     111                 
     112                mBspTree->Construct(objects, &dummy); 
     113#endif 
    108114                break; 
    109115        case BspTree::RAYS: 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r302 r303  
    2222float BspTree::sCt_div_ci = 1.0f; 
    2323float BspTree::sSplitBorder = 1.0f; 
    24 float BspTree::sMaxCostRatio = 0.9; 
     24float BspTree::sMaxCostRatio = 0.9f; 
    2525 
    2626//-- factors for bsp tree split plane heuristics 
     
    260260mRoot(NULL),  
    261261mViewCell(viewCell), 
    262 //mStorePolys(true) 
    263 mStorePolys(false) 
     262mStorePolys(true) 
     263//mStorePolys(false) 
    264264{ 
    265265        Randomize(); // initialise random generator for heuristics 
     
    437437                else // reached leaf => subdivide current viewcell 
    438438                { 
    439                         if (tData.mPolygons->size() > 0) 
    440                                 Debug << "Subdividing further: polygon size: " << (int)tData.mPolygons->size() << ", view cell: " << tData.mViewCell << endl; 
     439                        //if (tData.mPolygons->size() > 0) 
     440                        //      Debug << "Subdividing further: polygon size: " << (int)tData.mPolygons->size() << ", view cell: " << tData.mViewCell << endl; 
    441441 
    442442                        BspNode *root = Subdivide(tStack, tData, viewCells);             
     
    504504                        // TODO: handle transformed mesh instances 
    505505                default: 
     506                        Debug << "intersectable type not supported" << endl; 
    506507                        break; 
    507508                } 
     
    528529        // construct tree from viewcell polygons 
    529530        Construct(polys); 
    530         //Export("bsp.x3d"); 
    531531} 
    532532 
     
    542542        mStat.polys = Copy2PolygonSoup(objects, *polys); 
    543543 
     544        bool tmpStorePolys = mStorePolys; 
     545        mStorePolys = false; 
     546 
    544547        // construct tree from polygon soup 
    545548        Construct(polys, viewCells); 
     549 
     550        mStorePolys = tmpStorePolys; 
     551        // filter scene bounding box down the tree in order to store split polygons 
     552        if (mStorePolys) 
     553        { 
     554                Mesh *polyMesh = new Mesh(); 
     555 
     556                for (int i = 0; i < 6; ++i) 
     557                        polyMesh->AddRectangle(mBox.GetFace(i)); 
     558 
     559                PolygonContainer *polys = new PolygonContainer(); 
     560                                AddMesh2Polygons(polyMesh, *polys, NULL); 
     561                 
     562                InsertPolygons(polys); 
     563 
     564                delete polyMesh; 
     565        } 
    546566} 
    547567 
     
    585605        if ((tData.mPolygons->size() <= sTermMaxPolygons) || (tData.mDepth >= sTermMaxDepth)) 
    586606        { 
    587 //#ifdef _DEBUG 
     607#ifdef _DEBUG 
    588608                Debug << "subdivision terminated at depth " << tData.mDepth << ", #polys: " << (int)tData.mPolygons->size() << endl; 
    589 //#endif 
     609#endif 
    590610 
    591611                EvaluateLeafStats(tData); 
     
    602622                } 
    603623                //-- add viewcell stored in split polygon 
    604                 else 
    605                 { 
    606                         if (leaf->GetViewCell()) 
    607                                 Debug << "ERROR: leaf already has view cell " << endl;//leaf->mViewCellIdx << endl; 
    608  
    609                         //leaf->mViewCellIdx = counter; Debug << "insert view cell " << tData.mViewCell << endl; 
     624                else if (leaf->GetViewCell()) 
    610625                        leaf->SetViewCell(tData.mViewCell); 
    611                 } 
    612          
     626                //else Debug << "Leaf already has view cell " << endl; 
     627 
    613628                // remaining polygons are discarded or added to node 
    614629                tData.mNode->ProcessPolygons(tData.mPolygons, mStorePolys); 
     
    635650         
    636651    if (!viewCells) 
    637         { 
     652        {       // extract the pointer to the view cells 
    638653                ExtractViewCells(&backViewCell, 
    639654                                                 &frontViewCell, 
     
    643658                                                 backPolys->empty()); 
    644659        } 
    645      
     660         
    646661        // don't need coincident polygons anymore 
    647662        interior->ProcessPolygons(&coincident, mStorePolys); 
     
    683698                        foundFront = true; 
    684699                } 
     700                //if (foundFront) Debug << "front viewCell: " << *frontViewCell << endl; 
     701                //if (foundBack) Debug << "back viewCell: " << *backViewCell << endl; 
    685702        } 
    686703} 
     
    921938        { 
    922939                Vector3 tinyAxis(0,0,0); tinyAxis[mBox.Size().TinyAxis()] = 1.0f; 
    923                 // want to put a penalty on the dot product between the "tiny" vertical axis 
     940                // we put a penalty on the dot product between the "tiny" vertical axis 
    924941                // and the split plane axis 
     942                // NOTE: weight with poly size because vertical split more important if too many polygons 
    925943                val += sVerticalSplitsFactor *  
    926944                           fabs(DotProd(candidatePlane.mNormal, tinyAxis)) * (float)polys.size(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r302 r303  
    513513 
    514514        /// if polygons should be stored in the tree 
    515         bool mStorePolys; 
     515        bool mStoreSplitPolys; 
    516516 
    517517        /// view cell corresponding to unbounded space 
  • trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp

    r302 r303  
    4040 
    4141  // if BSP tree construction method needs predefined view cells 
    42   if (BspTree::sConstructionMethod == BspTree::VIEW_CELLS) 
     42 
     43  if (1)//(BspTree::sConstructionMethod == BspTree::VIEW_CELLS) 
    4344  { 
    4445          if (vcFilename != "") 
     
    5253  p->BuildBspTree(); 
    5354  p->BspTreeStatistics(Debug); 
    54   p->Export("vc_bsptree.x3d", false, false, true); 
     55  p->Export("vc_bsptree2.x3d", false, false, true); 
    5556 
     57#if 0 
    5658  //-- export the complementary view cells 
    5759  // i.e., the view cells not associated with leafs in the tree. 
     
    7072  if (exporter)  
    7173  {      
     74          Debug << Exporting complementary view cells" << endl; 
    7275          exporter->ExportViewCells(&vc_compl); // export view cells 
    7376          delete exporter; 
    7477  } 
     78#endif 
    7579 
    7680#endif 
Note: See TracChangeset for help on using the changeset viewer.