Changeset 1701


Ignore:
Timestamp:
10/30/06 19:05:41 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp

    r1694 r1701  
    234234        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
    235235 
    236         if (!exportSingleMesh) 
     236        if (0&&!exportSingleMesh) 
    237237        { 
    238238                for (oit = objects.begin(); oit != oit_end; ++ oit) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1697 r1701  
    457457        { 
    458458                // decide upon next split type 
    459                 const float vspPriority =  viewSpaceQueue.Top() ? viewSpaceQueue.Top()->GetPriority() : -1e20f; 
    460                 const float ospPriority =  objectSpaceQueue.Top() ? objectSpaceQueue.Top()->GetPriority() : -1e20f; 
     459                const float vspPriority = viewSpaceQueue.Top() ? viewSpaceQueue.Top()->GetPriority() : -1e20f; 
     460                const float ospPriority = objectSpaceQueue.Top() ? objectSpaceQueue.Top()->GetPriority() : -1e20f; 
    461461                 
    462462                cout << "new decicion, vsp: " << vspPriority << ", osp: " << ospPriority << endl; 
     
    946946        while (!splitQueue.Empty()) 
    947947        { 
     948                const float priority = splitQueue.Top()->GetPriority(); 
    948949                const float threshold = oldCandidate ? oldCandidate->GetPriority() : 1e20f; 
     950 
     951                // minimum slope reached 
     952                if ((steps >= maxSteps) || ((priority < threshold) && !(steps < minSteps))) 
     953                { 
     954                        cout << "\n**************** breaking on " << priority << " smaller than " << threshold << endl; 
     955                        break; 
     956                } 
     957                 
    949958                SubdivisionCandidate *sc = NextSubdivisionCandidate(splitQueue);  
    950                  
    951                 const float priority = sc->GetPriority(); 
    952                  
    953                 //float rc = (float)sc->GetRenderCostDecrease() / (mInitialRenderCost - mHierarchyStats.mTotalCost + 1.0f); 
    954                 //float mc = (float)sc->GetPvsEntriesIncr() / (float)mHierarchyStats.mPvsEntries;        
    955                 //cout << "dRc: " << sc->GetRenderCostDecrease() << " dMem: " << sc->GetPvsEntriesIncr() << " ratio1 " << rc << " ratio2 " << mc << " const: " << 1.0f - GetMemoryConst() << endl; 
    956  
     959                                 
    957960                //////// 
    958961                //-- subdivide leaf node of either type 
     
    968971 
    969972                DEL_PTR(sc); 
    970  
    971                 // minimum slope reached 
    972                 if ((steps >= maxSteps) ||  
    973                         ((priority < threshold) && !(steps < minSteps))) 
    974                 { 
    975                         cout << "\n**************** breaking on " << priority << " smaller than " << threshold << endl; 
    976                         break; 
    977                 } 
    978  
    979973        } 
    980974 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h

    r1697 r1701  
    7777  Intersectable(): mMailbox(0), mReferences(0), mBvhLeaf(0), mVssRays(NULL) {} 
    7878 
    79   virtual Intersectable::~Intersectable() {DEL_PTR(mVssRays);}; 
     79  virtual Intersectable::~Intersectable() {DEL_PTR(mVssRays);} 
    8080 
    8181  void SetId(const int id) { mId = id; } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1697 r1701  
    8888 
    8989                        Vector3 pt2 = sceneBox.Min() + scale2 * (sceneBox.Max() - sceneBox.Min()); 
    90  
    91                         //Vector3 boxSize = sceneBox.Size() * Vector3(0.0025, 0.01, 0.0025); 
    9290                        Vector3 boxSize = sceneBox.Size() * Vector3(0.005f, 0.02f, 0.005f); 
    9391 
     
    315313        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
    316314 
     315        //AxisAlignedBox3 bbox = mSceneGraph->GetBox(); bbox.Enlarge(30.0); 
    317316        for (oit = objects.begin(); oit != oit_end; ++ oit) 
    318317        { 
     
    323322                        Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem(); 
    324323 
     324                        //if (bbox.IsInside(tri.mVertices[0]) && bbox.IsInside(tri.mVertices[1]) && bbox.IsInside(tri.mVertices[2])) 
     325                        //{ 
    325326                        samplesOut << "v " << tri.mVertices[0].x << " " << tri.mVertices[0].y << " " << tri.mVertices[0].z << endl; 
    326327                        samplesOut << "v " << tri.mVertices[1].x << " " << tri.mVertices[1].y << " " << tri.mVertices[1].z << endl; 
    327328                        samplesOut << "v " << tri.mVertices[2].x << " " << tri.mVertices[2].y << " " << tri.mVertices[2].z << endl; 
     329                        //} 
    328330                } 
    329331                else 
     
    482484                        } 
    483485 
     486                        //if (!strstr(filename.c_str(), "plane")) mSceneGraph->GetRoot()->UpdateBox(); 
     487 
    484488                        delete parser; 
    485489                } 
     
    500504                cout<<"#NUM_OBJECTS (Total numner of objects)\n"<<intersectables<<endl; 
    501505                cout<<"#NUM_FACES (Total numner of faces)\n"<<faces<<endl; 
     506                 
    502507                mObjects.reserve(intersectables); 
    503508                mSceneGraph->CollectObjects(&mObjects); 
    504509                mSceneGraph->GetRoot()->UpdateBox(); 
     510 
    505511                cout << "finished loading" << endl; 
    506512                if (0) 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1696 r1701  
    286286        long startTime = GetTime(); 
    287287 
    288         mPreprocessor->GenerateRays(samplesPerPass, sampleType, simpleRays); 
     288        // create one third of each type 
     289        int stype; 
     290         
     291        stype = SamplingStrategy::OBJECT_BASED_DISTRIBUTION; 
     292        mPreprocessor->GenerateRays(samplesPerPass / 3, sampleType, simpleRays); 
     293         
     294        stype = SamplingStrategy::SPATIAL_BOX_BASED_DISTRIBUTION; 
     295        mPreprocessor->GenerateRays(samplesPerPass / 3, sampleType, simpleRays); 
     296         
     297        stype = SamplingStrategy::DIRECTION_BASED_DISTRIBUTION; 
     298        mPreprocessor->GenerateRays(samplesPerPass / 3, sampleType, simpleRays); 
     299 
    289300        cout << "generated " << samplesPerPass << " samples in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl; 
    290301 
     
    10901101        case PER_TRIANGLE: 
    10911102                {//cout << "pertriangle" << endl; 
    1092                         // HACK 
    1093                         MeshInstance *mi = dynamic_cast<MeshInstance *>(obj); 
    1094  
    1095                         // HACK: assume meshes are triangles 
    1096                         if (mi->GetMesh()) 
    1097                         { 
    1098                                 return (float)mi->GetMesh()->mFaces.size(); 
    1099                         } 
     1103                        return (float)obj->NumberOfFaces(); 
    11001104                } 
    11011105        default: 
     
    57545758        Debug << "view cell stats prefix: " << statsPrefix << endl; 
    57555759 
    5756         // should directional sampling be used? 
    5757         bool dirSamples =  
    5758                 (mEvaluationSamplingType == SamplingStrategy::DIRECTION_BASED_DISTRIBUTION); 
    5759  
    57605760        cout << "reseting pvs ... "; 
    57615761                 
  • GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp

    r1697 r1701  
    226226                { 
    227227                        cerr << "already in obj format" << endl; 
    228                         if (1) 
    229                         preprocessor->ExportObj("test.obj", preprocessor->mObjects); 
     228                        if (0)  preprocessor->ExportObj("test.obj", preprocessor->mObjects); 
    230229                } 
    231230                else 
     
    233232                        const string objname = GetInternFilename(filename, ".obj"); 
    234233 
    235                         //cout << "exporting scene to " << objname << endl; 
     234                        cout << "exporting scene to " << objname << endl; 
    236235                        bool success = preprocessor->ExportObj(objname, preprocessor->mObjects); 
    237236 
     
    246245                } 
    247246        } 
     247//      Exporter *exporter= Exporter::GetExporter("test1.wrl"); 
     248//      AxisAlignedBox3 bbox = preprocessor->mKdTree->GetBox();  
     249//      bbox.Scale(Vector3(1, 1, 0.5)); 
     250//exporter->ExportGeometry(preprocessor->mObjects);cout<<"here2"<<endl; 
    248251 
    249252        // parse view cells related options 
Note: See TracChangeset for help on using the changeset viewer.