Ignore:
Timestamp:
01/19/06 23:36:01 (18 years ago)
Author:
mattausch
Message:

started implementing merge visualization !not working!!

File:
1 edited

Legend:

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

    r556 r557  
    139139 
    140140 
     141float ViewCellsManager::GetViewSpaceVolume() 
     142{ 
     143        return mViewSpaceBox.GetVolume()*(2.0f*sqr(M_PI)); 
     144} 
     145 
     146 
    141147bool ViewCellsManager::ViewPointValid(const Vector3 &viewPoint) const 
    142148{ 
     
    428434        //hray.Init(ray.GetOrigin(), ray.GetDir(), Ray::LINE_SEGMENT); 
    429435        if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 
    430         return; 
     436                return; 
    431437 
    432438        Vector3 origin = hray.Extrap(tmin); 
     
    679685{ 
    680686        // compute view cell area as subsititute for probability 
    681 #if 0 
    682         return GetArea(viewCell) / GetViewSpaceBox().SurfaceArea(); 
     687#if 1 
     688        return GetVolume(viewCell) / GetViewSpaceBox().GetVolume(); 
    683689#else 
    684690        return GetArea(viewCell) / GetAccVcArea(); 
     
    835841                cout << "exporting view cells after merge ... "; 
    836842                Exporter *exporter = Exporter::GetExporter("merged_view_cells.x3d"); 
     843 
    837844 
    838845                if (exporter) 
     
    18881895        VssRayContainer savedRays; 
    18891896 
    1890         Debug << "construction samples: " << mConstructionSamples << " rays: " << rays.size() << endl; 
     1897        Debug << "construction samples: " << mConstructionSamples << " rays: " << (int)rays.size() << endl; 
    18911898        GetRaySets(rays, mConstructionSamples, constructionRays, &savedRays); 
    18921899 
     
    21762183                                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
    21772184                        } 
    2178  
     2185                         
    21792186                        ExportViewCellsForViz(exporter); 
    21802187                        delete exporter; 
    21812188                } 
     2189        } 
     2190 
     2191        // export shuffled view cells 
     2192        if (1) 
     2193        { 
     2194                cout << "exporting shuffled view cells ..."; 
     2195 
     2196                Exporter *exporter = Exporter::GetExporter("shuffled_view_cells.x3d"); 
     2197                if (exporter) 
     2198                { 
     2199                        if (1) 
     2200                        { 
     2201                                exporter->SetWireframe(); 
     2202                                exporter->ExportBox(mViewSpaceBox); 
     2203                                exporter->SetFilled(); 
     2204                        } 
     2205 
     2206                        if (mExportGeometry) 
     2207                        { 
     2208                                exporter->ExportGeometry(objects); 
     2209                        } 
     2210 
     2211                        ViewCellContainer::const_iterator vit, vit_end = mViewCells.end(); 
     2212 
     2213                        Material vm, lm; 
     2214 
     2215                        for (vit = mViewCells.begin(); vit != mViewCells.end(); ++ vit) 
     2216                        { 
     2217                                BspViewCell *vc = dynamic_cast<BspViewCell *>(*vit); 
     2218 
     2219                                vm = RandomMaterial(); 
     2220 
     2221                                lm = vm; 
     2222                                         
     2223                                vm.mDiffuseColor.r -= 0.3f; 
     2224                                vm.mDiffuseColor.g -= 0.3f; 
     2225                                vm.mDiffuseColor.b -= 0.3f; 
     2226 
     2227                                vector<BspLeaf *>::const_iterator lit, lit_end = vc->mLeaves.end(); 
     2228 
     2229                                for (lit = vc->mLeaves.begin(); lit != lit_end; ++ lit) 
     2230                                { 
     2231                                        BspLeaf *leaf = *lit; 
     2232 
     2233                                        if (leaf->Mailed()) 
     2234                                                exporter->SetForcedMaterial(lm); 
     2235                                        else 
     2236                                                exporter->SetForcedMaterial(vm); 
     2237                                         
     2238                                        BspNodeGeometry geom; 
     2239                                        mVspBspTree->ConstructGeometry(leaf, geom); 
     2240                                        exporter->ExportPolygons(geom.mPolys); 
     2241                                } 
     2242                        } 
     2243                         
     2244                        delete exporter; 
     2245                } 
     2246 
    21822247 
    21832248                cout << "finished" << endl; 
     
    23752440                        importance = (float)bspVc->mLeaves.size() / 
    23762441                                (float)mViewCellsStats.maxLeaves; 
    2377  
    2378                         if (CheckValid(vc)) 
    2379                                 m.mDiffuseColor.b = 1.0f; 
    2380                         m.mDiffuseColor.r = importance; 
    2381                         m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 
    23822442                } 
    23832443                break; 
     
    23872447                                (float)(mVspBspTree->GetStatistics().maxDepth * 2); 
    23882448 
    2389                         if (CheckValid(vc)) 
    2390                                 m.mDiffuseColor.b = 1.0f; 
    2391                         m.mDiffuseColor.r = importance; 
    2392                         m.mDiffuseColor.g = 1.0f - m.mDiffuseColor.r; 
    23932449                } 
    23942450                break; 
Note: See TracChangeset for help on using the changeset viewer.