Changeset 1844


Ignore:
Timestamp:
12/04/06 22:38:56 (17 years ago)
Author:
mattausch
Message:

implemented object space compression

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
7 edited

Legend:

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

    r1843 r1844  
    26922692 
    26932693 
    2694 } 
     2694void BvHierarchy::Compress() 
     2695{ 
     2696} 
     2697 
     2698 
     2699} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.h

    r1843 r1844  
    627627        float GetRenderCostIncrementially(BvhNode *node) const; 
    628628 
     629        void Compress(); 
    629630        void CreateUniqueObjectIds(); 
    630631 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp

    r1843 r1844  
    657657} 
    658658 
     659 
    659660void HierarchyManager::InitialiseObjectSpaceSubdivision(const ObjectContainer &objects) 
    660661{ 
     
    23532354 
    23542355 
     2356void HierarchyManager::CompressObjectSpace() 
     2357{ 
     2358        //mBvHierarchy->Compress(); 
     2359        mVspTree->CompressObjects(); 
     2360 
    23552361void HierarchyManager::CreateUniqueObjectIds() 
    23562362{ 
     
    23592365 
    23602366 
    2361  
    2362 } 
     2367} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1843 r1844  
    292292        void CollectObjects(const AxisAlignedBox3 &box, ObjectContainer &objects); 
    293293 
     294        void CompressObjectSpace(); 
    294295        void CreateUniqueObjectIds(); 
    295296 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Pvs.h

    r1842 r1844  
    212212        bool GetSampleContribution(T sample, const float pdf, float &contribution); 
    213213 
    214         /** Adds sample to PVS.  
    215                 @contribution contribution of sample (0 or 1) 
    216                 @returns true if sample was not already in PVS. 
    217         */ 
    218         //bool AddSample(T sample, const float pdf, float &contribution); 
    219  
    220214        /** Adds sample to PVS. 
    221215                @returns contribution of sample (0 or 1) 
     
    241235                @returns contribution of sample (0 or 1) 
    242236        */ 
    243         float AddSamples(const vector<PvsEntry<T, S> > &samples); 
     237        //float AddSamples(const vector<PvsEntry<T, S> > &samples); 
    244238 
    245239        /** Adds sample to PVS. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp

    r1779 r1844  
    33883388} 
    33893389 
    3390 } 
     3390 
     3391void VspTree::CompressObjects(VspLeaf *leaf) 
     3392{ 
     3393        bool compressed = true; 
     3394 
     3395        Intersectable::NewMail(2); 
     3396 
     3397        while (compressed) 
     3398        { 
     3399                ObjectPvsIterator oit = leaf->GetViewCell()->GetPvs().GetIterator(); 
     3400                vector<BvhNode *> parents; 
     3401                ObjectPvs newPvs; 
     3402 
     3403                compressed = false; 
     3404 
     3405                while (oit.HasMoreEntries()) 
     3406                { 
     3407                        const ObjectPvsEntry &entry = oit.Next(); 
     3408                        BvhNode *obj = dynamic_cast<BvhNode *>(entry.mObject); 
     3409 
     3410                        if (!obj->IsRoot()) 
     3411                        { 
     3412                                BvhNode *parent = obj->GetParent(); 
     3413 
     3414                                if (!parent->Mailed()) 
     3415                                { 
     3416                                        parent->Mail(); 
     3417                                } 
     3418                                else 
     3419                                { 
     3420                                        // sibling was already found =>  
     3421                                        // this entry can be exchanged by the parent 
     3422                                        parents.push_back(parent); 
     3423                                        parent->Mail(1); 
     3424                                        compressed = true; 
     3425                                } 
     3426                        } 
     3427                } 
     3428                 
     3429                oit = leaf->GetViewCell()->GetPvs().GetIterator(); 
     3430 
     3431                while (oit.HasMoreEntries()) 
     3432                { 
     3433                        const ObjectPvsEntry &entry = oit.Next(); 
     3434                        BvhNode *obj = dynamic_cast<BvhNode *>(entry.mObject); 
     3435 
     3436                        if (!obj->IsRoot()) 
     3437                        { 
     3438                                BvhNode *parent = obj->GetParent(); 
     3439 
     3440                                // add only entries that cannot be exchaned with the parent 
     3441                                if (parent->Mailed(1)) 
     3442                                { 
     3443                                        newPvs.AddSampleDirty(obj, entry.mData.mSumPdf); 
     3444                                } 
     3445                        } 
     3446                } 
     3447 
     3448                // add parents 
     3449                vector<BvhNode *>::const_iterator bit, bit_end = parents.end(); 
     3450                for (bit = parents.begin(); bit != bit_end; ++ bit) 
     3451                { 
     3452                        newPvs.AddSampleDirty(*bit, 1); 
     3453                } 
     3454 
     3455                leaf->GetViewCell()->SetPvs(newPvs); 
     3456        } 
     3457} 
     3458 
     3459 
     3460void VspTree::CompressObjects() 
     3461{ 
     3462        vector<VspLeaf *> leaves; 
     3463        CollectLeaves(leaves); 
     3464 
     3465        vector<VspLeaf *>::const_iterator lit, lit_end = leaves.end(); 
     3466 
     3467        for (lit = leaves.begin(); lit != lit_end; ++ lit) 
     3468        { 
     3469                CompressObjects(*lit); 
     3470        } 
     3471} 
     3472 
     3473} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.h

    r1779 r1844  
    10281028                                        AxisAlignedBox3 *forcedBoundingBox); 
    10291029 
     1030        void CompressObjects(); 
     1031 
     1032        void CompressObjects(VspLeaf *leaf); 
     1033 
    10301034protected: 
    10311035 
Note: See TracChangeset for help on using the changeset viewer.