Changeset 1072


Ignore:
Timestamp:
07/03/06 02:03:59 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/Containers.h

    r1001 r1072  
    44#include <vector> 
    55#include <queue> 
     6#include <map> 
    67 
    78using namespace std; 
     
    5455typedef vector<IndexedBoundingBox> IndexedBoundingBoxContainer; 
    5556 
     57typedef std::map<int, Intersectable *> ObjectMap; 
     58 
    5659} 
    5760 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Intersectable.h

    r1020 r1072  
    88 
    99struct VssRayContainer; 
     10class KdLeaf; 
    1011 
    1112class Intersectable { 
     
    1718  int mMailbox; 
    1819   
    19   // unique object Id 
     20  /// unique object Id 
    2021  int mId; 
    2122   
    22   // universal counter 
     23  /// universal counter 
    2324  int mCounter; 
    2425         
    25   // object based pvs 
     26  /// object based pvs 
    2627  KdPvs mKdPvs; 
    2728   
     29  /// kd leaves that this intersectable belongs to 
     30  std::vector<KdLeaf *> mKdLeaves; 
     31 
    2832  enum { MESH_INSTANCE, TRANSFORMED_MESH_INSTANCE, SPHERE, VIEW_CELL, OGRE_MESH_INSTANCE }; 
    2933   
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.h

    r1002 r1072  
    188188  /** pointers to occluders contained in this node */ 
    189189  ObjectContainer mObjects; 
    190    
     190 
     191  /** Objects that are part of several leaves. 
     192  */ 
     193  ObjectMap mMultipleObjects; 
     194 
    191195  /** Ray set description of the rays passing through this node */ 
    192196  PassingRaySet mPassingRays; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1052 r1072  
    52535253 
    52545254                        // export rays 
    5255                         if (1 && mExportRays) 
     5255                        if (0 && mExportRays) 
    52565256                        { 
    52575257                                exporter->ExportRays(visRays, RgbColor(0, 1, 0)); 
     
    52625262                        // HACK: export without clip plane 
    52635263                        const bool b = mUseClipPlaneForViz; 
    5264                         mUseClipPlaneForViz = false; 
     5264                        if (0) 
     5265                                mUseClipPlaneForViz = false; 
    52655266 
    52665267                        ExportViewCellsForViz(exporter); 
     
    53365337 
    53375338                                raysOut = min((int)rays.size(), 100); 
    5338  
    5339                                 Debug  << "here12 " << raysOut << endl; 
    53405339 
    53415340                                // collect intial view cells 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r1047 r1072  
    12301230                        ++ contributingSamples; 
    12311231                 
     1232                // note: vss rays are never deleted 
    12321233                if (0) leaf->mVssRays.push_back(new VssRay(*ray)); 
    12331234        } 
     
    16101611                                        bestAxis = axis; 
    16111612                                } 
    1612                                 else if (nCostRatio[axis] < nCostRatio[bestAxis]) 
     1613                                /*else if (nCostRatio[axis] < nCostRatio[bestAxis]) 
     1614                                { 
    16131615                                        Debug << "taking split along longest axis (" << bestAxis << ") instead of  (" << axis << ")" << endl; 
    1614                                  
     1616                                }*/ 
     1617 
    16151618                        } 
    16161619                        else 
     
    16291632 
    16301633        //-- assign values 
     1634 
    16311635        axis = bestAxis; 
    16321636        pFront = nProbFront[bestAxis]; 
     
    16461650 
    16471651        //Debug << "best axis: " << bestAxis << " pos " << nPosition[bestAxis] << endl; 
    1648         //Debug << "!!!!!!!!!!!!!!" << endl; 
     1652 
    16491653        return nCostRatio[bestAxis]; 
    16501654} 
     
    16591663{ 
    16601664        // HACK matt: subdivide regularily to certain depth 
    1661         if (data.mDepth < 0)     
    1662         { 
    1663                 cout << "d: " << data.mDepth << endl; 
     1665        if (data.mDepth < 0)    // question matt: why depth < 0 ? 
     1666        { 
     1667                cout << "depth: " << data.mDepth << endl; 
     1668 
    16641669                // return axis aligned split 
    16651670                AxisAlignedBox3 box; 
     
    16751680                bestPlane = Plane3(norm, position); 
    16761681                splitAxis = axis; 
     1682 
    16771683                return true; 
    16781684        } 
     
    25092515 
    25102516 
    2511 void VspBspTree::CollectViewCells(ViewCellContainer &viewCells, bool onlyValid) const 
     2517void VspBspTree::CollectViewCells(ViewCellContainer &viewCells,  
     2518                                                                  bool onlyValid) const 
    25122519{ 
    25132520        ViewCell::NewMail(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.cpp

    r1052 r1072  
    777777                        ++ contributingSamples; 
    778778                 
     779                // warning: rays get never deleted! 
    779780                if (0) leaf->mVssRays.push_back(new VssRay(*ray)); 
    780781        } 
     
    803804        float pos; 
    804805 
    805         // float values => don't compare with exact values 
    806806        if (0) 
    807807        { 
     808                // float values => don't compare with exact values 
    808809                minBand += Limits::Small; 
    809810                maxBand -= Limits::Small; 
     
    816817                                 
    817818                pos = (*ri).ExtrapOrigin(axis); 
    818                 // clamp to min / max band 
    819                 if (0) ClipValue(pos, minBand, maxBand); 
    820819                 
     820                if (0) ClipValue(pos, minBand, maxBand); // clamp to min / max band 
    821821                mSplitCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMin : SortableEntry::ERayMax,  
    822822                                                                        pos, (*ri).mRay)); 
    823823 
    824824                pos = (*ri).ExtrapTermination(axis); 
    825                 // clamp to min / max band 
    826                 if (0) ClipValue(pos, minBand, maxBand); 
     825 
     826                if (0) ClipValue(pos, minBand, maxBand); // clamp to min / max band 
    827827 
    828828                mSplitCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMax : SortableEntry::ERayMin,  
     
    831831 
    832832        stable_sort(mSplitCandidates->begin(), mSplitCandidates->end()); 
     833} 
     834 
     835 
     836int VspTree::GetPvsContribution(Intersectable *object) const 
     837{ 
     838    int pvsContri = 0; 
     839 
     840        KdPvsMap::const_iterator kit, kit_end = object->mKdPvs.mEntries.end(); 
     841 
     842        Intersectable::NewMail(); 
     843 
     844        // Search kd leaves this object is attached to 
     845        for (kit = object->mKdPvs.mEntries.begin(); kit != kit_end; ++ kit) 
     846        { 
     847                KdNode *l = (*kit).first; 
     848 
     849                // new object found during sweep  
     850                // => increase pvs contribution of this kd node 
     851                if (!l->Mailed()) 
     852                { 
     853                        l->Mail(); 
     854                        ++ pvsContri; 
     855                } 
     856        } 
     857 
     858        return pvsContri; 
     859} 
     860 
     861 
     862void VspTree::PrepareHeuristics(const RayInfoContainer &rays) 
     863{        
     864        ObjectContainer objects; 
     865 
     866        // Collect all pvs that can be seen from the view cell 
     867        CollectPvs(rays, objects); 
     868 
     869        // adjust kd node info table 
     870        // for each object the entry must be updated  
     871        // which belongs to the same kd nodes 
     872        ObjectContainer::const_iterator oit, oit_end = objects.end(); 
     873 
     874        for (oit = objects.begin(); oit != oit_end; ++ oit) 
     875        { 
     876                Intersectable *obj = *oit; 
     877                // TODO 
     878                //UpdateKdNodeInfo(obj); 
     879        } 
     880} 
     881 
     882 
     883int VspTree::GetPvsIncr(Intersectable *object, const KdPvsMap &activeNodes) 
     884{ 
     885        // TODO: 
     886        // use kd info table to apply set theory in order to 
     887        // sort out dublicate pvs entries due to objects which 
     888        // belong to more than one kd leaves. 
     889#if TODO 
     890        KdPvsMap::const_iterator kit, kit_end = obj->mKdPvs.mEntries.end(); 
     891 
     892        // Search kd leaves this object is attached to 
     893        for (kit = obj->mKdPvs.mEntries.begin(); kit != kit_end; ++ kit) 
     894        { 
     895                KdNode *l = (*kit).first; 
     896 
     897                // new object found during sweep  
     898                // => increase pvs contribution of this kd node 
     899                if (!l->Mailed()) 
     900                { 
     901                        l->Mail(); 
     902                        ++ pvsContr; 
     903                } 
     904        } 
     905#endif 
     906        return 0; 
    833907} 
    834908 
     
    875949        RayInfoContainer::const_iterator ri, ri_end = rays.end(); 
    876950 
    877         // set all object as belonging to the front pvs 
     951        //-- set all object as belonging to the front pvs 
     952 
    878953        for(ri = rays.begin(); ri != ri_end; ++ ri) 
    879954        { 
     
    10151090 
    10161091 
     1092void VspTree::EvalPvsIncr(ObjectMap &multipleObjects, 
     1093                                                  KdLeaf *leaf,  
     1094                                                  const SortableEntry &ci, 
     1095                                                  int &pvsLeft, 
     1096                                                  int &pvsRight) const 
     1097{ 
     1098        int pvsSize = 0; 
     1099 
     1100        if (ci.type == SortableEntry::ERayMin) 
     1101        { 
     1102                if (!leaf->Mailed()) 
     1103                { 
     1104                        leaf->Mail(); 
     1105                        pvsLeft += (int)leaf->mObjects.size() - (int)leaf->mMultipleObjects.size(); 
     1106 
     1107                        // add duplicates 
     1108                        ObjectMap::const_iterator oit, oit_end = leaf->mMultipleObjects.end(); 
     1109 
     1110                        for (oit = leaf->mMultipleObjects.begin(); oit != oit_end; ++ oit) 
     1111                        { 
     1112                                const int id = (*oit)->first; 
     1113                                Intersectable *object = (*oit)->second; 
     1114 
     1115                                if (multipleObjects[id] != object) // object not previously in pvs 
     1116                                { 
     1117                                        multipleObjects[id] = object; 
     1118                                        ++ pvsLeft; 
     1119                                } 
     1120 
     1121                        } 
     1122                }                                        
     1123        } 
     1124        else if (ci.type == SortableEntry::ERayMax) 
     1125        { 
     1126                if (-- leaf->mCounter == 0) 
     1127                        pvsRight += (int)leaf->mObjects.size() - (int)leaf->mMultipleObjects.size(); 
     1128        } 
     1129} 
     1130 
     1131 
     1132float VspTree::EvalKdCostHeuristics(const RayInfoContainer &rays, 
     1133                                                                        const AxisAlignedBox3 &box, 
     1134                                                                        const int pvsSize, 
     1135                                                                        const int axis, 
     1136                                                                        float &position) 
     1137{ 
     1138        const float minBox = box.Min(axis); 
     1139        const float maxBox = box.Max(axis); 
     1140 
     1141        const float sizeBox = maxBox - minBox; 
     1142 
     1143        const float minBand = minBox + mMinBand * sizeBox; 
     1144        const float maxBand = minBox + mMaxBand * sizeBox; 
     1145 
     1146        SortSplitCandidates(rays, axis, minBand, maxBand); 
     1147 
     1148        // go through the lists, count the number of objects left and right 
     1149        // and evaluate the following cost funcion: 
     1150        // C = ct_div_ci  + (ql*rl + qr*rr)/queries 
     1151 
     1152        int pvsl = 0; 
     1153        int pvsr = pvsSize; 
     1154 
     1155        int pvsBack = pvsl; 
     1156        int pvsFront = pvsr; 
     1157 
     1158        float sum = (float)pvsSize * sizeBox; 
     1159        float minSum = 1e20f; 
     1160 
     1161         
     1162        // if no good split can be found, take mid split 
     1163        position = minBox + 0.5f * sizeBox; 
     1164         
     1165        // the relative cost ratio 
     1166        float ratio = /*Limits::Infinity;*/99999999.0f; 
     1167        bool splitPlaneFound = false; 
     1168 
     1169        Intersectable::NewMail(); 
     1170        KdNode::NewMail(); 
     1171 
     1172        RayInfoContainer::const_iterator ri, ri_end = rays.end(); 
     1173 
     1174        //-- set all kd nodes as belonging to the front pvs 
     1175 
     1176        for (ri = rays.begin(); ri != ri_end; ++ ri) 
     1177        { 
     1178                Intersectable *oObject = (*ri).mRay->mOriginObject; 
     1179 
     1180                if (oObject) 
     1181                { 
     1182                        KdPvsMap::const_iterator kit, kit_end = oObject->mKdPvs.mEntries.end(); 
     1183                 
     1184                        for (kit = oObject->mKdPvs.mEntries.begin(); kit != kit_end; ++ kit) 
     1185                        { 
     1186                                KdNode *node = (*kit).first; 
     1187 
     1188                                if (!node->Mailed()) 
     1189                                { 
     1190                                        node->Mail(); 
     1191                                        //node->mCounter = 1; 
     1192                                } 
     1193                                else 
     1194                                { 
     1195                                        //++ node->mCounter; 
     1196                                } 
     1197                        }        
     1198                } 
     1199 
     1200                Intersectable *tObject = (*ri).mRay->mTerminationObject; 
     1201 
     1202                if (tObject) 
     1203                { 
     1204                        KdPvsMap::const_iterator kit, kit_end = oObject->mKdPvs.mEntries.end(); 
     1205                 
     1206                        for (kit = tObject->mKdPvs.mEntries.begin(); kit != kit_end; ++ kit) 
     1207                        { 
     1208                                KdNode *node = (*kit).first; 
     1209 
     1210                                if (!node->Mailed()) 
     1211                                { 
     1212                                        node->Mail(); 
     1213                                        //node->mCounter = 1; 
     1214                                } 
     1215                                else 
     1216                                { 
     1217                                        //++ node->mCounter; 
     1218                                } 
     1219                        }        
     1220                } 
     1221        } 
     1222 
     1223        Intersectable::NewMail(); 
     1224 
     1225        vector<SortableEntry>::const_iterator ci, ci_end = mSplitCandidates->end(); 
     1226 
     1227        ObjectMap multipleObjectsLeft, multipleObjectsRight; 
     1228 
     1229 
     1230        // -- traverse through visibility events 
     1231 
     1232        for (ci = mSplitCandidates->begin(); ci != ci_end; ++ ci) 
     1233        { 
     1234                VssRay *ray; 
     1235                ray = (*ci).ray; 
     1236                 
     1237                Intersectable *oObject = ray->mOriginObject; 
     1238                 
     1239                KdPvsMap::const_iterator kit, kit_end = oObject->mKdPvs.mEntries.end(); 
     1240 
     1241                if (oObject) 
     1242                {        
     1243                        for (kit = oObject->mKdPvs.mEntries.begin(); kit != kit_end; ++ kit) 
     1244                        { 
     1245                KdLeaf *node = dynamic_cast<KdLeaf *>((*kit).first); 
     1246 
     1247                                EvalPvsIncr(multipleObjectsLeft, node, *ci, pvsl, pvsr); 
     1248                        } 
     1249                } 
     1250 
     1251                Intersectable *tObject = ray->mOriginObject; 
     1252 
     1253                if (tObject) 
     1254                {        
     1255                        for (kit = tObject->mKdPvs.mEntries.begin(); kit != kit_end; ++ kit) 
     1256                        { 
     1257                                KdLeaf *node = dynamic_cast<KdLeaf *>((*kit).first); 
     1258 
     1259                                EvalPvsIncr(multipleObjectsRight, node, *ci, pvsl, pvsr); 
     1260                        } 
     1261                } 
     1262 
     1263 
     1264                // Note: sufficient to compare size of bounding boxes of front and back side? 
     1265                if (((*ci).value >= minBand) && ((*ci).value <= maxBand)) 
     1266                { 
     1267                        sum = pvsl * ((*ci).value - minBox) + pvsr * (maxBox - (*ci).value); 
     1268 
     1269                        //Debug  << "pos=" << (*ci).value << "\t pvs=(" <<  pvsl << "," << pvsr << ")" << endl; 
     1270                        //Debug << "cost= " << sum << endl; 
     1271 
     1272                        if (sum < minSum) 
     1273                        { 
     1274                                splitPlaneFound = true; 
     1275 
     1276                                minSum = sum; 
     1277                                position = (*ci).value; 
     1278                                 
     1279                                pvsBack = pvsl; 
     1280                                pvsFront = pvsr; 
     1281                        } 
     1282                } 
     1283        } 
     1284         
     1285         
     1286        // -- compute cost 
     1287 
     1288        const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize(); 
     1289        const int upperPvsLimit = mViewCellsManager->GetMaxPvsSize(); 
     1290 
     1291        const float pOverall = sizeBox; 
     1292        const float pBack = position - minBox; 
     1293        const float pFront = maxBox - position; 
     1294 
     1295        const float penaltyOld = EvalPvsPenalty(pvsSize, lowerPvsLimit, upperPvsLimit); 
     1296    const float penaltyFront = EvalPvsPenalty(pvsFront, lowerPvsLimit, upperPvsLimit); 
     1297        const float penaltyBack = EvalPvsPenalty(pvsBack, lowerPvsLimit, upperPvsLimit); 
     1298         
     1299        const float oldRenderCost = penaltyOld * pOverall + Limits::Small; 
     1300        const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack; 
     1301 
     1302        if (splitPlaneFound) 
     1303        { 
     1304                ratio = newRenderCost / oldRenderCost; 
     1305        } 
     1306        //if (axis != 1) 
     1307        //Debug << "axis=" << axis << " costRatio=" << ratio << " pos=" << position << " t=" << (position - minBox) / (maxBox - minBox) 
     1308         //    <<"\t pb=(" << pvsBack << ")\t pf=(" << pvsFront << ")" << endl; 
     1309 
     1310        return ratio; 
     1311} 
     1312 
     1313 
     1314#if TODO 
     1315 
     1316float VspTree::EvalLocalCostHeuristicsNonIncremential(const RayInfoContainer &rays, 
     1317                                                                                                          const AxisAlignedBox3 &box, 
     1318                                                                                                          const int pvsSize, 
     1319                                                                                                          const int axis, 
     1320                                                                                                          float &position) 
     1321{ 
     1322        const float minBox = box.Min(axis); 
     1323        const float maxBox = box.Max(axis); 
     1324 
     1325        const float sizeBox = maxBox - minBox; 
     1326 
     1327        const float minBand = minBox + mMinBand * sizeBox; 
     1328        const float maxBand = minBox + mMaxBand * sizeBox; 
     1329 
     1330        SortSplitCandidates(rays, axis, minBand, maxBand); 
     1331 
     1332        // go through the lists, count the number of objects left and right 
     1333        // and evaluate the following cost funcion: 
     1334        // C = ct_div_ci  + (ql*rl + qr*rr)/queries 
     1335 
     1336        int pvsl = 0; 
     1337        int pvsr = pvsSize; 
     1338 
     1339        int pvsBack = pvsl; 
     1340        int pvsFront = pvsr; 
     1341 
     1342        float sum = (float)pvsSize * sizeBox; 
     1343        float minSum = 1e20f; 
     1344 
     1345         
     1346        // if no good split can be found, take mid split 
     1347        position = minBox + 0.5f * sizeBox; 
     1348         
     1349        // the relative cost ratio 
     1350        float ratio = /*Limits::Infinity;*/99999999.0f; 
     1351        bool splitPlaneFound = false; 
     1352 
     1353        Intersectable::NewMail(); 
     1354 
     1355        RayInfoContainer::const_iterator ri, ri_end = rays.end(); 
     1356 
     1357        //-- set all object as belonging to the front pvs 
     1358 
     1359        for(ri = rays.begin(); ri != ri_end; ++ ri) 
     1360        { 
     1361                // Note: sufficient to compare size of bounding boxes of front and back side? 
     1362                if (((*ci).value >= minBand) && ((*ci).value <= maxBand)) 
     1363                { 
     1364                        sum = pvsl * ((*ci).value - minBox) + pvsr * (maxBox - (*ci).value); 
     1365 
     1366                        //Debug  << "pos=" << (*ci).value << "\t pvs=(" <<  pvsl << "," << pvsr << ")" << endl; 
     1367                        //Debug << "cost= " << sum << endl; 
     1368 
     1369                        if (sum < minSum) 
     1370                        { 
     1371                                splitPlaneFound = true; 
     1372 
     1373                                minSum = sum; 
     1374                                position = (*ci).value; 
     1375                                 
     1376                                pvsBack = pvsl; 
     1377                                pvsFront = pvsr; 
     1378                        } 
     1379                } 
     1380        } 
     1381 
     1382         
     1383        // -- compute cost 
     1384 
     1385        const int lowerPvsLimit = mViewCellsManager->GetMinPvsSize(); 
     1386        const int upperPvsLimit = mViewCellsManager->GetMaxPvsSize(); 
     1387 
     1388        const float pOverall = sizeBox; 
     1389        const float pBack = position - minBox; 
     1390        const float pFront = maxBox - position; 
     1391 
     1392         
     1393        const float penaltyOld = EvalPvsPenalty(pvsSize, lowerPvsLimit, upperPvsLimit); 
     1394    const float penaltyFront = EvalPvsPenalty(pvsFront, lowerPvsLimit, upperPvsLimit); 
     1395        const float penaltyBack = EvalPvsPenalty(pvsBack, lowerPvsLimit, upperPvsLimit); 
     1396         
     1397        const float oldRenderCost = penaltyOld * pOverall + Limits::Small; 
     1398        const float newRenderCost = penaltyFront * pFront + penaltyBack * pBack; 
     1399 
     1400        if (splitPlaneFound) 
     1401        { 
     1402                ratio = newRenderCost / oldRenderCost; 
     1403        } 
     1404        //if (axis != 1) 
     1405        //Debug << "axis=" << axis << " costRatio=" << ratio << " pos=" << position << " t=" << (position - minBox) / (maxBox - minBox) 
     1406         //    <<"\t pb=(" << pvsBack << ")\t pf=(" << pvsFront << ")" << endl; 
     1407 
     1408        return ratio; 
     1409} 
     1410#endif 
     1411 
     1412 
    10171413float VspTree::SelectSplitPlane(const VspTraversalData &tData, 
    10181414                                                                AxisAlignedPlane &plane, 
     
    16992095 
    17002096 
     2097void VspTree::CollectPvs(const RayInfoContainer &rays,  
     2098                                                 ObjectContainer &objects) const 
     2099{ 
     2100        RayInfoContainer::const_iterator rit, rit_end = rays.end(); 
     2101 
     2102        Intersectable::NewMail(); 
     2103 
     2104        for (rit = rays.begin(); rit != rays.end(); ++ rit) 
     2105        { 
     2106                VssRay *ray = (*rit).mRay; 
     2107 
     2108                Intersectable *object; 
     2109                object = ray->mOriginObject; 
     2110 
     2111        if (object) 
     2112                { 
     2113                        if (!object->Mailed()) 
     2114                        { 
     2115                                object->Mail(); 
     2116                                objects.push_back(object); 
     2117                        } 
     2118                } 
     2119 
     2120                object = ray->mTerminationObject; 
     2121 
     2122                if (object) 
     2123                { 
     2124                        if (!object->Mailed()) 
     2125                        { 
     2126                                object->Mail(); 
     2127                                objects.push_back(object); 
     2128                        } 
     2129                } 
     2130        } 
     2131} 
     2132 
     2133 
    17012134int VspTree::ComputePvsSize(const RayInfoContainer &rays) const 
    17022135{ 
     
    25763009                  << "Depth: " << data.mDepth << " (max: " << mTermMaxDepth << "), " 
    25773010                  << "PVS: " << data.mPvs << " (min: " << mTermMinPvs << "), " 
    2578           //              << "Area: " << data.mProbability << " (min: " << mTermMinProbability << "), " 
     3011                  << "Area: " << data.mProbability << " (min: " << mTermMinProbability << "), " 
    25793012                  << "#rays: " << (int)data.mRays->size() << " (max: " << mTermMinRays << "), " 
    25803013                  << "#pvs: " << leaf->GetViewCell()->GetPvs().GetSize() << "), " 
     
    25863019 
    25873020 
     3021 
    25883022/*********************************************************************/ 
    25893023/*                class HierarchyManager implementation              */ 
    25903024/*********************************************************************/ 
     3025 
     3026 
    25913027 
    25923028HierarchyManager::HierarchyManager(VspTree &vspTree, OspTree &ospTree): 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspOspTree.h

    r1047 r1072  
    868868                                                   float &pBack); 
    869869 
    870         /** Sorts split candidates for surface area heuristics for axis aligned splits. 
     870        /** Sorts split candidates along the specified axis. 
     871                The split candidates are generated on possible visibility 
     872                events (i.e., where ray segments intersect the ray boundaries). 
     873                The sorted candidates are needed to compute the SAH. 
     874 
    871875                @param polys the input for choosing split candidates 
    872876                @param axis the current split axis 
     
    877881                                                         float minBand,  
    878882                                                         float maxBand); 
     883 
     884        /** Prepares objects for SAH. 
     885        */ 
     886        void PrepareHeuristics(const RayInfoContainer &rays); 
     887 
     888        /** Computes pvs increase with respect to the previous pvs for SAH. 
     889        */ 
     890        int GetPvsIncr(Intersectable *object, const KdPvsMap &activeNodes); 
     891 
     892        /** Returns absolute pvs contribution of this object. 
     893        */ 
     894        int GetPvsContribution(Intersectable *object) const; 
    879895 
    880896        /** Computes best cost for axis aligned planes. 
     
    886902                                                                  float &position); 
    887903 
     904        float EvalKdCostHeuristics(const RayInfoContainer &rays, 
     905                                                           const AxisAlignedBox3 &box, 
     906                                                           const int pvsSize, 
     907                                                           const int axis, 
     908                                                           float &position); 
     909         void EvalPvsIncr(ObjectMap &multipleObjects, 
     910                                          KdLeaf *leaf,  
     911                                          const SortableEntry &ci, 
     912                                          int &pvsLeft, 
     913                                          int &pvsRight) const; 
     914 
     915 
    888916        /** Subdivides the rays into front and back rays according to the split plane. 
    889917                 
     
    918946        */ 
    919947        int ComputePvsSize(const RayInfoContainer &rays) const; 
     948         
     949        /** Collects pvs from rays. 
     950        */ 
     951        void CollectPvs(const RayInfoContainer &rays, 
     952                                        ObjectContainer &objects) const; 
    920953 
    921954        /** Returns true if tree can be terminated. 
Note: See TracChangeset for help on using the changeset viewer.