Changeset 577


Ignore:
Timestamp:
01/25/06 17:45:45 (18 years ago)
Author:
mattausch
Message:

fixed loading function: the view cell manager is chosen depending on
the type in the file. the view space box is saved with the file

Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/Preprocessor.vcproj

    r544 r577  
    2020                                Name="VCCLCompilerTool" 
    2121                                Optimization="0" 
    22                                 AdditionalIncludeDirectories="..\support;..\support\devil\include;..\support\zlib\include;..\include;"$(QTDIR)"" 
     22                                AdditionalIncludeDirectories="..\support;..\support\devil\include;..\support\zlib\include;..\include;"$(QTDIR)"\include;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\src;"$(CG_INC_PATH)"" 
    2323                                PreprocessorDefinitions="WIN32;_DEBUG;_LIB" 
    2424                                MinimalRebuild="TRUE" 
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r575 r577  
    1313#;../data/vienna/vienna-plane.x3d 
    1414#       filename ../data/vienna/viewcells-25-sel.x3d 
    15         filename ../data/atlanta/atlanta2.x3d 
     15#       filename ../data/atlanta/atlanta2.x3d 
    1616#       filename ../data/soda/soda.dat 
    17 #       filename ../data/soda/soda5.dat 
     17        filename ../data/soda/soda5.dat 
    1818} 
    1919 
     
    9898        useViewcells true 
    9999        updateSubdivision true 
    100 loadInitialSamples true 
     100        loadInitialSamples false 
    101101        storeInitialSamples false 
    102102} 
     
    176176        # samples used for view cell construction 
    177177        Construction { 
    178                 samples 5000000 
    179                 samplesPerPass 500000 
    180         } 
    181          
    182         loadFromFile false 
     178                samples 500000 
     179                samplesPerPass 50000 
     180        } 
     181 
    183182        exportToFile false 
     183        loadFromFile true 
     184 
    184185        #type kdTree 
    185186        #type vspKdTree 
     
    270271VspBspTree { 
    271272        Construction { 
    272                 samples 900000 
     273                samples 90000 
    273274                epsilon 0.005 
    274275                randomize false 
     
    314315                #maxAccRayLength        100 
    315316                 
    316                 maxViewCells            50000 
     317                maxViewCells            500 
    317318                 
    318319                # used for pvs criterium 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp

    r576 r577  
    190190bool Preprocessor::PrepareViewCells() 
    191191{ 
    192         //-- parse type of view cell container 
    193         char viewCellsStr[64]; 
    194         environment->GetStringValue("ViewCells.type", viewCellsStr); 
    195  
    196         mViewCellsManager = CreateViewCellsManager(viewCellsStr); 
     192        //-- parse view cells construction method 
     193        environment->GetBoolValue("ViewCells.loadFromFile", mLoadViewCells); 
     194        char buf[100]; 
     195         
     196        if (mLoadViewCells) 
     197        { 
     198                environment->GetStringValue("ViewCells.filename", buf); 
     199                mViewCellsManager = ViewCellsManager::LoadViewCells(buf, &mObjects); 
     200        } 
     201        else 
     202        { 
     203                //-- parse type of view cell container 
     204                char viewCellsStr[64]; 
     205                environment->GetStringValue("ViewCells.type", viewCellsStr); 
     206            mViewCellsManager = CreateViewCellsManager(viewCellsStr); 
     207        } 
    197208 
    198209        float objRenderCost = 0, vcOverhead = 0, moveSpeed = 0; 
     
    207218        mViewCellsManager->SetRenderer(mRenderSimulator); 
    208219 
    209         //-- parse view cells construction method 
    210         environment->GetBoolValue("ViewCells.loadFromFile", mLoadViewCells); 
    211         char buf[100]; 
    212  
    213         if (mLoadViewCells) 
    214         { 
    215                 environment->GetStringValue("ViewCells.filename", buf); 
    216                 mViewCellsFilename = buf; 
    217         } 
    218220 
    219221        if (mUseGlRenderer || mUseGlDebugger) 
     
    228230        environment->GetBoolValue("Preprocessor.detectEmptyViewSpace", mDetectEmptyViewSpace); 
    229231         
    230  
    231  
    232232        return true; 
    233233} 
     
    242242        else if (strcmp(name, "bspTree") == 0) 
    243243        { 
     244                Debug << "view cell type: Bsp" << endl; 
     245 
    244246                mBspTree = new BspTree(); 
    245  
    246                 Debug << "view cell type: Bsp" << endl; 
    247  
    248247                mViewCellsManager = new BspViewCellsManager(mBspTree); 
    249248        } 
    250249        else if (strcmp(name, "vspBspTree") == 0) 
    251250        { 
     251                Debug << "view cell type: VspBsp" << endl; 
     252 
    252253                mVspBspTree = new VspBspTree(); 
    253  
    254                 Debug << "view cell type: VspBsp" << endl; 
    255  
    256254                mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 
    257255        } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.h

    r576 r577  
    154154 
    155155  bool mLoadViewCells; 
    156  
    157   string mViewCellsFilename; 
    158156   
    159157  bool mDetectEmptyViewSpace; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/RssPreprocessor.cpp

    r576 r577  
    467467 
    468468  mViewSpaceBox = NULL; 
    469   mViewCellsManager->SetViewSpaceBox(mKdTree->GetBox()); 
    470    
    471    
    472   //-- load view cells from file if requested 
    473   if (mLoadViewCells) {  
    474         // load now because otherwise bounding box not correct 
    475         mViewCellsManager->LoadViewCells(mViewCellsFilename, &mObjects); 
    476         // $$JB tmp make all viewcelss valid 
    477         mViewCellsManager->SetValidity(0, 9999999999);  
    478  
    479   } 
    480   else 
    481   { 
     469 
     470  // if not already loaded, construct view cells from file 
     471  if (!mLoadViewCells) {         
     472         
     473          mViewCellsManager->SetViewSpaceBox(mKdTree->GetBox()); 
     474 
    482475          // construct view cells using it's own set of samples 
    483476          mViewCellsManager->Construct(this); 
     
    487480          mViewCellsManager->PrintStatistics(Debug); 
    488481  } 
    489    
     482 
     483 
    490484  int rssPass = 0; 
    491485  int rssSamples = 0; 
     
    515509   
    516510  if (mExportRays) { 
     511         
    517512        char filename[64]; 
    518513        sprintf(filename, "rss-rays-initial.x3d"); 
    519514        ExportRays(filename, mVssRays, mExportNumRays); 
     515         
    520516  } 
    521517   
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.cpp

    r575 r577  
    5252        environment->GetIntValue("ViewCells.Construction.samplesPerPass", mSamplesPerPass); 
    5353 
     54        environment->GetBoolValue("ViewCells.exportToFile", mExportViewCells); 
     55 
    5456        mMinPvsSize = emptyViewCells ? 1 : 0; 
    5557 
     
    236238} 
    237239 
     240 
    238241void 
    239242ViewCellsManager::SetValidity( 
     
    275278} 
    276279 
    277 bool ViewCellsManager::LoadViewCells(const string filename, ObjectContainer *objects) 
     280 
     281bool ViewCellsManager::LoadViewCellsGeometry(const string filename) 
    278282{ 
    279283        X3dParser parser; 
     
    575579{ 
    576580        mViewSpaceBox = box; 
     581        mTotalAreaValid = false; 
    577582} 
    578583 
     
    21762181                FinalizeViewCells(true); 
    21772182                EvaluateViewCellsStats(); 
     2183 
    21782184                return 0; 
    21792185        } 
     
    22792285        FinalizeViewCells(true); 
    22802286 
     2287        // for output we need unique ids for each view cell 
     2288        CreateUniqueViewCellIds(); 
     2289 
    22812290        // write view cells to disc 
    22822291        if (mExportViewCells) 
     
    23682377                        delete exporter; 
    23692378                } 
     2379        } 
     2380 
     2381        if (1) 
     2382        { 
     2383                cout << "exporting depth map ... "; 
     2384 
     2385                Exporter *exporter = Exporter::GetExporter("depth_map.x3d"); 
     2386                if (exporter) 
     2387                { 
     2388                        if (1) 
     2389                        { 
     2390                                exporter->SetWireframe(); 
     2391                                exporter->ExportBox(mViewSpaceBox); 
     2392                                exporter->SetFilled(); 
     2393                        } 
     2394 
     2395                        if (mExportGeometry) 
     2396                        { 
     2397                                exporter->ExportGeometry(objects); 
     2398                        } 
     2399 
     2400                        const int maxDepth = mVspBspTree->mBspStats.maxDepth; 
     2401 
     2402                        ViewCellContainer::const_iterator vit, vit_end = mViewCells.end(); 
     2403 
     2404                        for (vit = mViewCells.begin(); vit != mViewCells.end(); ++ vit) 
     2405                        { 
     2406                                BspViewCell *vc = dynamic_cast<BspViewCell *>(*vit); 
     2407 
     2408                                vector<BspLeaf *>::const_iterator lit, lit_end = vc->mLeaves.end(); 
     2409 
     2410                                for (lit = vc->mLeaves.begin(); lit != lit_end; ++ lit) 
     2411                                { 
     2412                                        BspLeaf *leaf = *lit; 
     2413 
     2414                                        Material m;  
     2415 
     2416                                        float relDepth = (float)leaf->GetDepth() / (float)maxDepth; 
     2417                                        m.mDiffuseColor.r = relDepth; 
     2418                                        m.mDiffuseColor.g = 0.0f; 
     2419                                        m.mDiffuseColor.b = 1.0f - relDepth; 
     2420 
     2421                    exporter->SetForcedMaterial(m); 
     2422                                 
     2423 
     2424                                        BspNodeGeometry geom; 
     2425                                        mVspBspTree->ConstructGeometry(leaf, geom); 
     2426                                        exporter->ExportPolygons(geom.mPolys); 
     2427                                } 
     2428                        } 
     2429 
     2430                        delete exporter; 
     2431                } 
     2432 
     2433 
     2434                cout << "finished" << endl; 
    23702435        } 
    23712436 
     
    26612726void VspBspViewCellsManager::CreateMesh(ViewCell *vc) 
    26622727{ 
     2728        if (vc->GetMesh()) 
     2729                delete vc->GetMesh(); 
     2730 
    26632731        BspNodeGeometry geom; 
    26642732        BspViewCell *bspVc = dynamic_cast<BspViewCell *>(vc); 
     
    26722740 
    26732741 
    2674 bool VspBspViewCellsManager::LoadViewCells(const string filename, ObjectContainer *objects) 
     2742ViewCellsManager *ViewCellsManager::LoadViewCells(const string filename,  
     2743                                                                                                  ObjectContainer *objects) 
    26752744{ 
    26762745        ViewCellsParser parser; 
    26772746 
    2678         DEL_PTR(mVspBspTree); 
    2679         mVspBspTree = new VspBspTree(); 
    2680  
    2681         bool success ;//= parser.ParseFile(filename, &this, objects); 
    2682         mVspBspTree->RepairViewCellsLeafLists(); 
    2683         mVspBspTree->mBox = GetViewSpaceBox(); 
    2684         ResetViewCells(); 
    2685  
    2686         mViewCellsFinished = true; 
    2687         mMaxPvsSize = (int)objects->size(); 
    2688  
    2689         FinalizeViewCells(true); 
    2690  
    2691         Debug << (int)mViewCells.size() << " view cells loaded" << endl; 
    2692  
    2693         return success; 
     2747        ViewCellsManager *vm = NULL; 
     2748 
     2749        if (parser.ParseFile(filename, &vm, objects)) 
     2750        { 
     2751                vm->PrepareLoadedViewCells(); 
     2752                vm->ResetViewCells(); 
     2753 
     2754                vm->mViewCellsFinished = true; 
     2755                vm->mMaxPvsSize = (int)objects->size(); 
     2756 
     2757                vm->FinalizeViewCells(true); 
     2758 
     2759                Debug << (int)vm->mViewCells.size() << " view cells loaded" << endl; 
     2760 
     2761                //vm->ExportViewCells("test.xml"); 
     2762        } 
     2763        else 
     2764        { 
     2765                Debug << "failed loading view cells" << endl; 
     2766                DEL_PTR(vm); 
     2767        } 
     2768 
     2769 
     2770        return vm; 
    26942771} 
    26952772 
     
    27062783        std::ofstream stream; 
    27072784 
    2708         // for output we need unique ids 
    2709         CreateUniqueViewCellIds(); 
     2785        // for output we need unique ids for each view cell 
     2786        //CreateUniqueViewCellIds(); 
    27102787 
    27112788        stream.open(filename.c_str()); 
    27122789        stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"<<endl; 
    27132790        stream << "<Visibility_Solution>" << endl; 
     2791 
     2792        //-- the view space bounding box 
     2793        stream << "<ViewSpaceBox"  
     2794                   << " min=\"" << mViewSpaceBox.Min().x << " " << mViewSpaceBox.Min().y << " " << mViewSpaceBox.Min().z << "\"" 
     2795                   << " max=\"" << mViewSpaceBox.Max().x << " " << mViewSpaceBox.Max().y << " " << mViewSpaceBox.Max().z << "\" />" << endl; 
     2796 
     2797        //-- the type of the view cells hierarchy 
     2798        stream << "<Hierarchy name=\"vspBspTree\" />" << endl; 
    27142799 
    27152800        //-- load the view cells itself, i.e., the ids and the pvs 
     
    27662851 
    27672852 
    2768  
     2853void VspBspViewCellsManager::PrepareLoadedViewCells() 
     2854{ 
     2855        // TODO: do I still need this here? 
     2856        mVspBspTree->RepairViewCellsLeafLists(); 
     2857} 
     2858 
     2859 
     2860//////////////////////////////////77 
    27692861ViewCellsManager *ViewCellsManagerFactory::Create(const string mName) 
    27702862{ 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsManager.h

    r575 r577  
    120120                @return true on success 
    121121    */ 
    122     virtual bool LoadViewCells(const string filename, ObjectContainer *objects); 
    123  
     122    virtual bool LoadViewCellsGeometry(const string filename); 
     123 
     124         
    124125        /** Constructs view cell from base triangle. The ViewCell is extruded along the normal vector. 
    125126                @param the base triangle 
     
    314315        virtual void FinalizeViewCells(const bool createMesh); 
    315316 
     317 
     318        /** Loads view cells from file. The view cells manager is created with respect to the loaded 
     319                view cells. 
     320 
     321                @returns the view cells manager if loading was successful, false otherwise 
     322        */ 
     323        static ViewCellsManager *LoadViewCells(const string filename, ObjectContainer *objects); 
     324 
    316325protected: 
    317326 
     
    366375        void ExportViewCell(ViewCell *viewCell, ofstream &stream); 
    367376 
    368         /// the view cell corresponding to space ouside the valid view space 
    369         //ViewCell *mOutOfBoundsCell; 
     377 
     378        /**  
     379                Takes different measures to prepares the view cells after loading them from disc. 
     380        */ 
     381        virtual void PrepareLoadedViewCells() {}; 
    370382 
    371383        /// Renders the view cells. 
     
    641653        void CreateMesh(ViewCell *vc); 
    642654 
    643         bool LoadViewCells(const string filename, ObjectContainer *objects); 
     655        //bool LoadViewCellsGeometry(const string filename, ObjectContainer *objects); 
    644656        bool ExportViewCells(const string filename); 
    645657 
     
    671683        void ExportColor(Exporter *exporter, ViewCell *vc) const; 
    672684 
     685        void PrepareLoadedViewCells(); 
     686 
    673687        /// the view space partition BSP tree. 
    674688        VspBspTree *mVspBspTree; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsParser.cpp

    r575 r577  
    6161//  StdInParseHandlers: Constructors and Destructor 
    6262// --------------------------------------------------------------------------- 
    63 ViewCellsParseHandlers::ViewCellsParseHandlers(ViewCellsManager **viewCells, 
    64                                                                                            ObjectContainer *objects): 
     63ViewCellsParseHandlers::ViewCellsParseHandlers(ObjectContainer *objects): 
    6564  mElementCount(0) 
    6665  , mAttrCount(0) 
    6766  , mCharacterCount(0) 
    6867  , mSpaceCount(0) 
     68  , mViewCellsManager(NULL) 
     69  , mVspBspTree(NULL) 
     70  , mBspTree(NULL) 
    6971{ 
    7072        mObjects = objects; 
    71         viewCells = &mViewCellsManager; 
    72         //mPreprocessor = preprocessor; 
    7373} 
    7474 
     
    142142                                                                                         AttributeList& attributes) 
    143143{ 
     144        if (element == "Interior")  
     145        { 
     146                cout << "["; 
     147                StartBspInterior(attributes); 
     148        } 
     149 
     150        if (element == "Leaf")  
     151        { 
     152                StartBspLeaf(attributes); 
     153        } 
     154} 
     155 
     156 
     157void ViewCellsParseHandlers::startElement(const XMLCh* const name, 
     158                                                                                  AttributeList& attributes) 
     159{ 
     160        StrX lname(name); 
     161        string element(lname.LocalForm()); 
     162 
     163        // decides the used view cell hierarchy 
     164        if (element == "Hierarchy") 
     165        { 
     166                cout << "h"; 
     167                StartHierarchy(attributes); 
     168        } 
     169         
     170        // decides the used view cell hierarchy 
     171        if (element == "ViewSpaceBox") 
     172        { 
     173                cout << "vsb"; 
     174                StartViewSpaceBox(attributes); 
     175        } 
     176 
    144177        if (element == "ViewCell") 
    145178        { 
     
    148181        } 
    149182 
    150         if (element == "Interior")  
    151         { 
    152                 cout << "["; 
    153                 StartBspInterior(attributes); 
    154         } 
    155  
    156         if (element == "Leaf")  
    157         { 
    158                 StartBspLeaf(attributes); 
    159         } 
    160 } 
    161  
    162  
    163 void ViewCellsParseHandlers::startElement(const XMLCh* const name, 
    164                                                                                   AttributeList& attributes) 
    165 { 
    166         StrX lname(name); 
    167         string element(lname.LocalForm()); 
     183        // use different methods for the given view cell hierarchy types 
     184        if (mViewCellsManager) 
     185        { 
     186                switch (mViewCellsManager->GetType()) 
     187                { 
     188                case ViewCellsManager::BSP: 
     189                case ViewCellsManager::VSP_BSP: 
     190                        startBspElement(element, attributes); 
     191                        break; 
    168192         
    169         if (element == "Hierarchy") 
    170         { 
    171                 cout << "h"; 
    172                 StartHierarchy(attributes); 
    173         } 
    174  
    175         switch (mViewCellsManager->GetType()) 
    176         { 
    177         case ViewCellsManager::BSP: 
    178         case ViewCellsManager::VSP_BSP: 
    179                 startBspElement(element, attributes); 
    180                 break; 
    181          
    182         default: 
    183                 Debug << "not implemented" << endl; 
    184                 break; 
    185  
    186         } 
    187          
     193                default: 
     194                        Debug << "not implemented" << endl; 
     195                        break; 
     196                } 
     197        } 
     198 
    188199        ++ mElementCount; 
    189200        mAttrCount += attributes.getLength(); 
     
    272283 
    273284 
     285void ViewCellsParseHandlers::StartViewSpaceBox(AttributeList& attributes) 
     286{ 
     287        int len = attributes.getLength(); 
     288 
     289        Vector3 bmin, bmax; 
     290 
     291        for (int i = 0; i < len; ++ i)  
     292        { 
     293                string attrName(StrX(attributes.getName(i)).LocalForm()); 
     294                StrX attrValue(attributes.getValue(i)); 
     295                const char *ptr = attrValue.LocalForm(); 
     296 
     297                if (attrName == "min")  
     298                { 
     299                        sscanf(ptr, "%f %f %f", 
     300                                   &bmin.x, &bmin.y, &bmin.z); 
     301                } 
     302                else if (attrName == "max")  
     303                { 
     304                        sscanf(ptr, "%f %f %f", 
     305                                   &bmax.x, &bmax.y, &bmax.z); 
     306                } 
     307        } 
     308 
     309        mViewSpaceBox = AxisAlignedBox3(bmin, bmax); 
     310 
     311        Debug << "view space box: " << mViewSpaceBox << endl; 
     312} 
     313 
     314 
    274315void ViewCellsParseHandlers::StartBspLeaf(AttributeList& attributes) 
    275316{ 
     
    284325        { 
    285326                if (mViewCellsManager->GetType() == ViewCellsManager::BSP) 
     327                { 
    286328                        mBspTree->mRoot = leaf; 
    287                 else 
     329                } 
     330                else if (mViewCellsManager->GetType() == ViewCellsManager::VSP_BSP) 
     331                { 
    288332                        mVspBspTree->mRoot = leaf; 
     333                } 
    289334        } 
    290335 
     
    369414        { 
    370415                if (mViewCellsManager->GetType() == ViewCellsManager::BSP) 
     416                { 
    371417                        mBspTree->mRoot = interior; 
     418                } 
    372419                else 
     420                { 
    373421                        mVspBspTree->mRoot = interior; 
     422                } 
    374423        } 
    375424 
     
    381430void ViewCellsParseHandlers::CreateViewCellsManager(const char *name) 
    382431{ 
    383          
    384432        if (strcmp(name, "bspTree") == 0) 
    385433        { 
     434                Debug << "view cell type: Bsp" << endl; 
     435 
    386436                mBspTree = new BspTree(); 
    387  
    388                 Debug << "view cell type: Bsp" << endl; 
    389  
    390437                mCurrentNode = mBspTree->GetRoot(); 
    391438 
     
    394441        else if (strcmp(name, "vspBspTree") == 0) 
    395442        { 
     443                Debug << "view cell type: VspBsp" << endl; 
     444 
    396445                mVspBspTree = new VspBspTree(); 
    397  
    398                 Debug << "view cell type: VspBsp" << endl; 
    399446                mCurrentNode = mVspBspTree->GetRoot(); 
    400447 
    401448                mViewCellsManager = new VspBspViewCellsManager(mVspBspTree); 
     449 
     450                Debug << "creating vsp bsp view cells manager" << endl; 
    402451        } 
    403452        /*else if (strcmp(name, "vspKdTree") == 0) 
     
    412461                exit(1); 
    413462        } 
     463 
     464        mViewCellsManager->SetViewSpaceBox(mViewSpaceBox); 
    414465} 
    415466 
     
    503554  //  to do. 
    504555  // 
    505   ViewCellsParseHandlers handler(viewCells, objects); 
     556  ViewCellsParseHandlers handler(objects); 
    506557  parser->setDocumentHandler(&handler); 
    507558  parser->setErrorHandler(&handler); 
     
    558609  XMLPlatformUtils::Terminate(); 
    559610   
     611   // assign new view cells manager 
     612  *viewCells = handler.mViewCellsManager; 
     613 
    560614  if (errorCount > 0) 
    561615    return false; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellsParserXerces.h

    r575 r577  
    2323  //  Constructors and Destructor 
    2424  // ----------------------------------------------------------------------- 
    25   ViewCellsParseHandlers(ViewCellsManager **viewCellsManager, 
    26                                                  ObjectContainer *objects); 
     25  ViewCellsParseHandlers(ObjectContainer *objects); 
    2726  ~ViewCellsParseHandlers(); 
    2827   
     
    7271  ObjectContainer *mObjects; 
    7372 
     73  AxisAlignedBox3 mViewSpaceBox; 
     74 
    7475  // Handlers for X3D 
    7576  void StartBspLeaf(AttributeList& attributes); 
     
    8384 
    8485  void startBspElement(string element, AttributeList& attributes); 
     86  void StartViewSpaceBox(AttributeList&  attributes); 
    8587  // ----------------------------------------------------------------------- 
    8688  //  Handlers for the SAX ErrorHandler interface 
  • trunk/VUT/GtpVisibilityPreprocessor/src/VssPreprocessor.cpp

    r574 r577  
    417417                vm->CastBeam(beam); 
    418418 
    419                 Debug << "found " << beam.mViewCells.size() << " view cells and "  
    420                           << beam.mKdNodes.size() << " kd nodes" << endl; 
     419                Debug << "found " << (int)beam.mViewCells.size() << " view cells and "  
     420                          << (int)beam.mKdNodes.size() << " kd nodes" << endl; 
    421421 
    422422                BeamSampleStatistics stats; 
     
    526526  { 
    527527        mViewSpaceBox = box; 
    528         mViewCellsManager->SetViewSpaceBox(*box); 
    529528  } 
    530529  else 
    531530  { 
    532531        mViewSpaceBox = NULL; 
    533         mViewCellsManager->SetViewSpaceBox(mKdTree->GetBox()); 
    534   } 
    535    
     532  } 
     533   
     534  AxisAlignedBox3 vbox = mViewSpaceBox ? *mViewSpaceBox : mKdTree->GetBox(); 
     535 
    536536  //-- load view cells from file if requested 
    537   if (mLoadViewCells) 
    538   {      
    539           // load now because otherwise bounding box not correct 
    540           mViewCellsManager->LoadViewCells(mViewCellsFilename, &mObjects); 
    541   } 
    542   else 
    543   { 
     537  if (!mLoadViewCells) 
     538  { 
     539          mViewCellsManager->SetViewSpaceBox(vbox); 
    544540          // construct view cells using it's own set of samples 
    545541          mViewCellsManager->Construct(this); 
Note: See TracChangeset for help on using the changeset viewer.