Ignore:
Timestamp:
11/15/06 16:07:29 (18 years ago)
Author:
mattausch
Message:

bvhnode is now derived from Intersectable

File:
1 edited

Legend:

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

    r1750 r1758  
    14511451                { 
    14521452                        BvhLeaf *leaf = mBvHierarchy->GetLeaf(obj); 
    1453                         BvhIntersectable *bvhObj = mBvHierarchy->GetOrCreateBvhIntersectable(leaf); 
    14541453                         
    1455                         return vc->AddPvsSample(bvhObj, pdf, contribution); 
     1454                        return vc->AddPvsSample(leaf, pdf, contribution); 
    14561455                } 
    14571456        default: 
     
    15221521                                                                                                  const Vector3 &point) const 
    15231522{ 
    1524    
    1525   if (!obj) 
    1526         return NULL; 
    1527    
    1528   switch (mObjectSpaceSubdivisionType) 
     1523 
     1524        if (!obj) 
     1525                return NULL; 
     1526 
     1527        switch (mObjectSpaceSubdivisionType) 
    15291528        { 
    15301529        case HierarchyManager::KD_BASED_OBJ_SUBDIV: 
    1531           { 
    1532                 KdLeaf *leaf = mOspTree->GetLeaf(point, NULL); 
    1533                 return mOspTree->GetOrCreateKdIntersectable(leaf); 
    1534           } 
     1530                { 
     1531                        KdLeaf *leaf = mOspTree->GetLeaf(point, NULL); 
     1532                        return mOspTree->GetOrCreateKdIntersectable(leaf); 
     1533                } 
    15351534        case HierarchyManager::BV_BASED_OBJ_SUBDIV: 
    1536           { 
    1537                 BvhLeaf *leaf = mBvHierarchy->GetLeaf(obj); 
    1538                 return mBvHierarchy->GetOrCreateBvhIntersectable(leaf); 
    1539           } 
     1535                { 
     1536                        BvhLeaf *leaf = mBvHierarchy->GetLeaf(obj); 
     1537                        return leaf; 
     1538                } 
    15401539        default: 
    1541           return obj; 
     1540                return obj; 
    15421541        } 
    15431542} 
     
    15461545                                                                                                  const bool isTermination) const 
    15471546{ 
    1548   Intersectable *obj = NULL; 
     1547        Intersectable *obj = NULL; 
    15491548        Vector3 pt; 
    15501549        KdNode *node; 
    15511550 
    15521551        ray.GetSampleData(isTermination, pt, &obj, &node); 
    1553          
     1552 
    15541553        if (!obj) 
    1555           return NULL; 
     1554                return NULL; 
    15561555 
    15571556        switch (mObjectSpaceSubdivisionType) 
     
    15591558        case HierarchyManager::KD_BASED_OBJ_SUBDIV: 
    15601559                { 
    1561                   KdLeaf *leaf = mOspTree->GetLeaf(pt, node); 
     1560                        KdLeaf *leaf = mOspTree->GetLeaf(pt, node); 
    15621561                        return mOspTree->GetOrCreateKdIntersectable(leaf); 
    15631562                } 
     
    15651564                { 
    15661565                        BvhLeaf *leaf = mBvHierarchy->GetLeaf(obj); 
    1567                         return mBvHierarchy->GetOrCreateBvhIntersectable(leaf); 
     1566                        return leaf; 
    15681567                } 
    15691568        default: 
    1570           break; 
     1569                break; 
    15711570        } 
    15721571        return obj; 
     
    18391838                ObjectPvsEntry entry = pit.Next(); 
    18401839 
    1841                 BvhIntersectable *intersect = dynamic_cast<BvhIntersectable *>(entry.mObject); 
    1842  
    1843                 BvhLeaf *leaf = intersect->GetItem(); 
    1844                 BvhNode *activeNode = leaf->GetActiveNode(); 
     1840                BvhNode *activeNode; 
     1841                BvhNode *intersect = dynamic_cast<BvhNode *>(entry.mObject); 
     1842 
     1843                // hack for choosing which node to account for 
     1844                if (intersect->IsLeaf()) 
     1845                        activeNode = dynamic_cast<BvhLeaf *>(intersect)->GetActiveNode(); 
     1846                else 
     1847                        activeNode = intersect; 
    18451848 
    18461849                if (!activeNode->Mailed()) 
Note: See TracChangeset for help on using the changeset viewer.