Changeset 384 for trunk


Ignore:
Timestamp:
11/07/05 01:27:32 (19 years ago)
Author:
mattausch
Message:

fixed bug in pvs criterium, computing real area

Location:
trunk/VUT
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r383 r384  
    126126        #splitPlaneStrategy 130 
    127127         
    128         splitPlaneStrategy 1024 
     128        splitPlaneStrategy 1032 
    129129         
    130130        maxPolyCandidates 50 
     
    133133        Termination { 
    134134                # autopartition 
    135                 maxRays 1000 
    136                 maxPolygons 1 
     135                maxRays 300 
     136                maxPolygons 0 
    137137                maxDepth 80 
    138138                 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp

    r375 r384  
    432432        return count; 
    433433} 
     434 
     435float Polygon3::GetArea(const PolygonContainer &cell) 
     436{ 
     437        float area = 0; 
     438        PolygonContainer::const_iterator pit; 
     439 
     440        for (pit = cell.begin(); pit != cell.end(); ++ pit) 
     441                area += (*pit)->GetArea(); 
     442 
     443        return area; 
     444} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.h

    r375 r384  
    8787        Vector3 GetNormal() const; 
    8888 
    89         /** Includes polygons to axis aligned box. 
    90         */ 
    91         static void IncludeInBox(const PolygonContainer &polys, AxisAlignedBox3 &box); 
    92  
    9389        /** Casts ray to polygon. 
    9490        */ 
    9591        int CastRay(const Ray &ray, float &t, const float nearestT); 
    9692 
    97         /** Classify polygons with respect to the plane. 
    98             @returns one of BACK_SIDE, FRONT_SIDE, SPLIT, COINCIDENT 
     93         
     94        /** The piercing rays of the polygon are inherited by the child fragments 
     95                @parm front_piece the front fragment inheriting the front rays 
     96                @param back_piece the back fragment inheriting the back rays 
    9997        */ 
    100         static int ClassifyPlane(const PolygonContainer &polys, const Plane3 &plane); 
     98        void InheritRays(Polygon3 &front_piece,  
     99                                         Polygon3 &back_piece) const; 
     100 
    101101 
    102102        /// vertices are connected in counterclockwise order. 
     
    112112        RayContainer mPiercingRays; 
    113113 
    114         /** The piercing rays of the polygon are inherited by the child fragments 
    115                 @parm front_piece the front fragment inheriting the front rays 
    116                 @param back_piece the back fragment inheriting the back rays 
     114 
     115 
     116        /** Includes polygons to axis aligned box. 
    117117        */ 
    118         void InheritRays(Polygon3 &front_piece,  
    119                                          Polygon3 &back_piece) const; 
     118        static void IncludeInBox(const PolygonContainer &polys, AxisAlignedBox3 &box); 
     119 
     120        /** Classify polygons with respect to the plane. 
     121            @returns one of BACK_SIDE, FRONT_SIDE, SPLIT, COINCIDENT 
     122        */ 
     123        static int ClassifyPlane(const PolygonContainer &polys, const Plane3 &plane); 
    120124 
    121125 
     
    123127        */ 
    124128        static int ParentObjectsSize(const PolygonContainer &polys); 
     129 
     130        static float GetArea(const PolygonContainer &cell); 
    125131}; 
    126132 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r383 r384  
    945945        const float objRt = 1.0f;  
    946946         // const overhead for crossing a view cell border 
    947         const float vcOverhead = 0.01f; 
     947        const float vcOverhead = 0;//0.01f; 
    948948         
    949949        // total area of view cells 
     
    955955 
    956956        ViewCellContainer::const_iterator it, it_end = viewCells.end(); 
    957         PolygonContainer::const_iterator pit; 
    958  
     957         
    959958        for (it = viewCells.begin(); it != it_end; ++ it) 
    960959        { 
     
    965964                mBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(*it), cell); 
    966965 
    967                 for (pit = cell.begin(); pit != cell.end(); ++ pit) 
    968                         area += (*pit)->GetArea(); 
    969                  
    970                 renderTime += area * RenderPvs(*(*it), objRt); 
     966                area = Polygon3::GetArea(cell); 
     967                 
     968                renderTime += area * RenderPvs(*(*it), objRt) + vcOverhead; 
    971969                totalArea += area; 
    972970        } 
     
    974972        renderTime /= totalArea; 
    975973 
    976         Debug << "render time without overhead: " << renderTime * 1e-3 << endl; 
    977          
    978         renderTime += (float)viewCells.size() * vcOverhead; 
     974        //Debug << "render time without overhead: " << renderTime * 1e-3 << endl; 
     975        //renderTime += (float)viewCells.size() * vcOverhead; 
    979976 
    980977        return renderTime; 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp

    r372 r384  
    6565ViewCell *ViewCell::ExtrudeViewCell(const Triangle3 &baseTri, const float height) 
    6666{ 
    67  int i;  
    68  // one mesh per view cell 
     67        // one mesh per view cell 
    6968        Mesh *mesh = new Mesh(); 
    7069         
     
    8685 
    8786        // add base vertices and calculate top vertices 
    88                 for (i = 0; i < 3; ++ i) 
    89                  mesh->mVertices.push_back(baseTri.mVertices[i]); 
     87        for (int i = 0; i < 3; ++ i) 
     88                mesh->mVertices.push_back(baseTri.mVertices[i]); 
    9089         
    9190        // add top vertices      
    92                                                                                                                                 for (i = 0; i < 3; ++ i) 
     91        for (int i = 0; i < 3; ++ i) 
    9392                mesh->mVertices.push_back(baseTri.mVertices[i] + height * triNorm); 
    9493         
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r383 r384  
    10881088 
    10891089        // use heuristics to find appropriate plane 
    1090         return SelectPlaneHeuristics(leaf,  
    1091                                          polys,  
    1092                                                                  rays,  
    1093                                                                  sMaxPolyCandidates,  
     1090        return SelectPlaneHeuristics(leaf, polys, rays, sMaxPolyCandidates,  
    10941091                                                                 sMaxRayCandidates); 
    10951092} 
     
    11091106        int candidateIdx = limit; 
    11101107 
     1108        // only for pvs criterium 
     1109        PolygonContainer cell; 
     1110        vector<Plane3 *> planes; 
     1111        vector<bool> sides; 
     1112        float pvsSize = 0; 
     1113 
     1114        if (sSplitPlaneStrategy & PVS) 
     1115        { 
     1116                ConstructGeometry(leaf, cell); 
     1117                ExtractSplitPlanes(leaf, planes, sides); 
     1118                pvsSize = ComputePvsSize(rays); 
     1119        } 
     1120 
    11111121        for (int i = 0; i < limit; ++ i) 
    11121122        { 
     
    11151125                // evaluate current candidate 
    11161126                const float candidateCost =  
    1117                         SplitPlaneCost(leaf, 
    1118                                        polys[candidateIdx]->GetSupportingPlane(),  
    1119                                                    polys, rays); 
     1127                        SplitPlaneCost(polys[candidateIdx]->GetSupportingPlane(),  
     1128                                                   polys, rays, cell, planes, sides, pvsSize); 
    11201129 
    11211130                //Debug << polys[candidateIdx] << endl; 
     
    11511160 
    11521161                const float candidateCost = 
    1153                         SplitPlaneCost(leaf, Plane3(pt[0], pt[1], pt[2]),  
    1154                                                    polys, rays); 
     1162                        SplitPlaneCost(Plane3(pt[0], pt[1], pt[2]),  
     1163                                                   polys, rays, cell, planes, sides, pvsSize); 
    11551164 
    11561165                if (candidateCost < lowestCost) 
     
    11631172        } 
    11641173 
     1174        CLEAR_CONTAINER(cell); 
     1175 
    11651176        if (chooseFromRays) 
    11661177        { 
     
    11861197} 
    11871198 
    1188 float BspTree::SplitPlaneCost(BspLeaf *leaf,  
    1189                                                           const Plane3 &candidatePlane,  
     1199float BspTree::SplitPlaneCost(const Plane3 &candidatePlane,  
    11901200                                                          const PolygonContainer &polys) const 
    11911201{ 
     
    12831293        if (sSplitPlaneStrategy & BALANCED_POLYS) 
    12841294                val += sBalancedPolysFactor * fabs(sumBalancedPolys) / (float)polys.size(); 
    1285  
     1295         
    12861296        if (sSplitPlaneStrategy & LEAST_SPLITS)     
    12871297                val += sLeastSplitsFactor * sumSplits / (float)polys.size(); 
     
    12971307        if (sSplitPlaneStrategy & BALANCED_VIEW_CELLS) 
    12981308                if (totalViewCells != 0) 
    1299                         val += sBalancedViewCellsFactor * fabs(sumBalancedViewCells) /  
    1300                                 (float)totalViewCells; 
     1309                        val += sBalancedViewCellsFactor * fabs(sumBalancedViewCells) / (float)totalViewCells; 
    13011310         
    13021311        return val; 
     
    13261335} 
    13271336 
    1328 float BspTree::SplitPlaneCost(BspLeaf *leaf, 
    1329                                                           const Plane3 &candidatePlane,  
    1330                                                           const BoundedRayContainer &rays) const 
     1337float BspTree::SplitPlaneCost(const Plane3 &candidatePlane,  
     1338                                                          const BoundedRayContainer &rays, 
     1339                                                          const float frontArea, 
     1340                                                          const float backArea, 
     1341                                                          const int pvsSize) const 
    13311342{ 
    13321343        float val = 0; 
     
    13441355        Intersectable::NewMail(); const int frontAndBackId = ViewCell::sMailId; 
    13451356 
    1346         PolygonContainer cell; 
    1347         PolygonContainer front; 
    1348         PolygonContainer back; 
    1349  
    1350         vector<Plane3 *> planes; 
    1351         vector<bool> sides; 
    1352  
    1353         ExtractSplitPlanes(leaf, planes, sides); 
    1354  
    1355         ConstructGeometry(leaf, cell); 
    1356         ConstructChildGeometry(front, cell, planes, sides, candidatePlane, true); 
    1357         ConstructChildGeometry(back, cell, planes, sides, candidatePlane, false); 
    1358  
    1359         CLEAR_CONTAINER(cell); 
    1360         CLEAR_CONTAINER(front); 
    1361         CLEAR_CONTAINER(back); 
    1362          
    13631357        int frontRays = 0; 
    13641358        int backRays = 0; 
    1365  
    1366         // todo create geometry of left and right leaves 
    1367          
     1359                 
    13681360        BoundedRayContainer::const_iterator rit, rit_end = rays.end(); 
    13691361 
     
    13941386                                // assure that we only count a object  
    13951387                                // once for the front and once for the back side of the plane 
    1396                                 ComputePvs(*ray->intersections[0].mObject,  
    1397                                                    frontPvs,  
    1398                                                backPvs,  
    1399                                                    cf,  
    1400                                                    frontId,  
    1401                                                    backId,  
    1402                                                    frontAndBackId); 
     1388                                AddToPvs(*ray->intersections[0].mObject,  
     1389                                                   frontPvs, backPvs,  
     1390                                                   cf, frontId, backId, frontAndBackId); 
    14031391                        } 
    14041392 
    14051393                        // the source object in the origin of the ray 
    1406                         ComputePvs(*ray->sourceObject.mObject,  
    1407                                            frontPvs,  
    1408                                        backPvs,  
    1409                                            cf,  
    1410                                            frontId,  
    1411                                            backId,  
    1412                                            frontAndBackId); 
    1413  
    1414                         if ((cf == Ray::BACK) || (cf == Ray::FRONT_BACK) || (cf == Ray::BACK_FRONT)) 
    1415                                 ++ backRays; 
    1416                         if ((cf == Ray::FRONT) || (cf == Ray::FRONT_BACK) || (cf == Ray::BACK_FRONT)) 
    1417                                 ++ frontRays; 
     1394                        AddToPvs(*ray->sourceObject.mObject,  
     1395                                           frontPvs, backPvs,  
     1396                                           cf, frontId, backId, frontAndBackId); 
     1397 
     1398                        if (0) 
     1399                        { 
     1400                                if ((cf == Ray::BACK) || (cf == Ray::FRONT_BACK) || (cf == Ray::BACK_FRONT)) 
     1401                                        ++ backRays; 
     1402                                if ((cf == Ray::FRONT) || (cf == Ray::FRONT_BACK) || (cf == Ray::BACK_FRONT)) 
     1403                                        ++ frontRays; 
     1404                        } 
    14181405                } 
    14191406        } 
     
    14281415 
    14291416        if (sSplitPlaneStrategy & PVS) 
    1430                 if (!rays.empty()) // HACK (should divide by maximal possible pvs) 
    1431                         val += sPvsFactor * (frontPvs * (float)frontRays + (backPvs * (float)backRays)) /  
    1432                         (float)rays.size();  
     1417                if (0 && !rays.empty()) // HACK (should divide by maximal possible pvs) 
     1418                        val += sPvsFactor * (frontPvs * (float)frontRays + (backPvs * (float)backRays)) / (float)rays.size();  
     1419                else 
     1420                        val += sPvsFactor * (frontPvs * frontArea + (backPvs * backArea)) / 
     1421                                ((frontArea + backArea) * (float)pvsSize); 
    14331422 
    14341423        //Debug << "pvs: " << pvsSize << " val " << val << endl; 
     
    14361425} 
    14371426 
    1438  
    1439 /*void BspTree::CreateChildrenGeometry(PolygonContainer &cell,  
    1440                                                                          PolygonContainer &front,  
    1441                                                                          PolygonContainer &back,  
    1442                                                                          Plane3 &splitPlane) 
    1443 { 
    1444 }*/ 
    1445  
    1446 void BspTree::ComputePvs(Intersectable &obj,  
    1447                                                  float &frontPvs, 
    1448                                                  float &backPvs, 
    1449                                                  const int cf,  
    1450                                                  const int frontId,  
    1451                                                  const int backId,  
    1452                                                  const int frontAndBackId) const 
    1453 { 
    1454         if (cf == Ray::COINCIDENT) 
     1427void BspTree::AddToPvs(Intersectable &obj, 
     1428                                           float &frontPvs, 
     1429                                           float &backPvs, 
     1430                                           const int cf,  
     1431                                           const int frontId,  
     1432                                           const int backId,  
     1433                                           const int frontAndBackId) const 
     1434{ 
     1435        if (cf == Ray::COINCIDENT) //TODO: really belongs to no pvs? 
    14551436                return; 
    14561437 
     
    14591440                if ((obj.mMailbox != frontId) &&  
    14601441                        (obj.mMailbox != frontAndBackId)) 
     1442                { 
    14611443                        frontPvs += 1.0; 
    14621444 
    1463                 if (obj.mMailbox != backId) 
    1464                         obj.mMailbox = frontId; 
    1465                 else 
    1466                         obj.mMailbox = frontAndBackId;                                   
     1445                        if (obj.mMailbox != backId) 
     1446                                obj.mMailbox = frontId; 
     1447                        else 
     1448                                obj.mMailbox = frontAndBackId;                                   
     1449                } 
    14671450        } 
    14681451        else if (cf == Ray::BACK) 
     
    14791462                } 
    14801463        } 
     1464        // object belongs to both pvs 
    14811465        else if ((cf == Ray::FRONT_BACK) || (cf == Ray::BACK_FRONT)) 
    14821466        { 
    1483                 if (obj.mMailbox == backId) 
    1484                         frontPvs += 1.0; 
    1485                 else if (obj.mMailbox == frontId) 
    1486                         backPvs += 1.0; 
    1487                 else if (obj.mMailbox != frontAndBackId) // can add to both PVS 
    1488                 { 
    1489                         frontPvs += 1.0; 
    1490                         backPvs += 1.0; 
    1491                 } 
    1492                 obj.mMailbox = frontAndBackId; 
    1493         } 
    1494 } 
    1495  
    1496 float BspTree::SplitPlaneCost(BspLeaf *leaf, 
    1497                                                           const Plane3 &candidatePlane,  
     1467                if (obj.mMailbox !=  frontAndBackId) 
     1468                { 
     1469                        if (obj.mMailbox != frontId) 
     1470                                frontPvs += 1.0; 
     1471                        if (obj.mMailbox != backId) 
     1472                                backPvs += 1.0; 
     1473                 
     1474                        obj.mMailbox = frontAndBackId; 
     1475                } 
     1476        } 
     1477} 
     1478 
     1479float BspTree::SplitPlaneCost(const Plane3 &candidatePlane,  
    14981480                                                          const PolygonContainer &polys,                                                           
    1499                                                           const BoundedRayContainer &rays) const 
     1481                                                          const BoundedRayContainer &rays, 
     1482                                                          const PolygonContainer &cell, 
     1483                                                          const vector<Plane3 *> &planes, 
     1484                                                          const vector<bool> &sides, 
     1485                                                          const int pvsSize) const 
    15001486{ 
    15011487        float val = 0; 
     
    15171503                (sSplitPlaneStrategy & BLOCKED_RAYS)) 
    15181504        { 
    1519         val += SplitPlaneCost(leaf, candidatePlane, polys); 
     1505        val += SplitPlaneCost(candidatePlane, polys); 
    15201506        } 
    15211507 
     
    15251511                (sSplitPlaneStrategy & PVS)) 
    15261512        { 
    1527                 val += SplitPlaneCost(leaf, candidatePlane, rays); 
     1513                float frontArea = 0; 
     1514                float backArea = 0; 
     1515 
     1516                if (sSplitPlaneStrategy & PVS) 
     1517                { 
     1518                        PolygonContainer frontCell; 
     1519                        PolygonContainer backCell; 
     1520 
     1521                        // construct child geometry with regard to the candidate split plane 
     1522                        ConstructChildGeometry(frontCell, cell, planes, sides, candidatePlane, true); 
     1523                        ConstructChildGeometry(backCell, cell, planes, sides, candidatePlane, false); 
     1524 
     1525                        frontArea = Polygon3::GetArea(frontCell); 
     1526                        backArea = Polygon3::GetArea(backCell); 
     1527 
     1528                        CLEAR_CONTAINER(frontCell); 
     1529                        CLEAR_CONTAINER(backCell); 
     1530                } 
     1531                 
     1532                val += SplitPlaneCost(candidatePlane, rays, frontArea, backArea, pvsSize); 
    15281533        } 
    15291534 
     
    20392044} 
    20402045 
    2041 bool BspTree::ConstructChildGeometry(PolygonContainer &newCell, 
     2046bool BspTree::ConstructChildGeometry(PolygonContainer &childCell, 
    20422047                                                                         const PolygonContainer &cell, 
    20432048                                                                         const vector<Plane3 *> &planes, 
     
    20492054        Polygon3 *planePoly = GetBoundingBox().CrossSection(splitPlane); 
    20502055 
    2051         bool inside = true; 
    2052  
    20532056        // polygon is split by all other planes 
    2054         for (int i = 0; (i < planes.size()) && inside; ++ i) 
     2057        for (int i = 0; (i < (int)planes.size()) && planePoly; ++ i) 
    20552058        { 
    20562059                const int cf = planePoly->ClassifyPlane(*planes[i]); 
     
    20802083                                        } 
    20812084                                         
    2082                                         inside = true; 
     2085                                        if (!planePoly->Valid()) 
     2086                                                DEL_PTR(planePoly); 
    20832087                                } 
    20842088                                break; 
    20852089                        case Polygon3::BACK_SIDE: 
    20862090                                if (sides[i])  
    2087                                         inside = false; 
     2091                                        DEL_PTR(planePoly); 
    20882092                                break; 
    20892093                        case Polygon3::FRONT_SIDE: 
    20902094                                if (!sides[i]) 
    2091                                         inside = false; 
     2095                                        DEL_PTR(planePoly); 
     2096                                break; 
     2097                        case Polygon3::COINCIDENT: 
    20922098                                break; 
    20932099                        default: 
     
    20962102        } 
    20972103         
    2098         //-- finally add polygon 
    2099         if (inside) 
    2100                 newCell.push_back(planePoly); 
    2101         else 
    2102         { 
    2103                 //just copy polygons 
    2104                 DEL_PTR(planePoly); 
     2104        if (!planePoly) 
     2105        { 
     2106                //geometry is not changed at all, hence just copy polygons 
    21052107                PolygonContainer::const_iterator it, it_end = cell.end(); 
    21062108                 
    21072109                for (it = cell.begin(); it != it_end; ++ it) 
    2108                         newCell.push_back(*it); 
     2110                        childCell.push_back(new Polygon3((*it)->mVertices)); 
    21092111 
    21102112                return false; 
    21112113        } 
    21122114 
    2113         //-- plane poly splits all other candidates 
     2115        //-- plane poly splits all other cell polygons 
    21142116        for (int i = 0; i < (int)cell.size(); ++ i) 
    21152117        { 
    2116                 inside = true; 
    2117                  
    21182118                const int cf = cell[i]->ClassifyPlane(splitPlane); 
    21192119                         
     
    21232123                        case Polygon3::SPLIT: 
    21242124                                { 
    2125                                         Polygon3 *poly = new Polygon3(*cell[i]); 
     2125                                        Polygon3 *poly = new Polygon3(cell[i]->mVertices); 
    21262126 
    21272127                                        Polygon3 *frontPoly = new Polygon3(); 
     
    21332133                                        DEL_PTR(poly); 
    21342134 
    2135                                         if (sides[i] == true) 
     2135                                        if (side == true) 
    21362136                                        { 
    2137                                                 newCell.push_back(frontPoly); 
     2137                                                poly = frontPoly; 
    21382138                                                DEL_PTR(backPoly); 
    21392139                                        } 
    21402140                                        else 
    21412141                                        { 
    2142                                                 newCell.push_back(backPoly); 
     2142                                                poly = backPoly; 
    21432143                                                DEL_PTR(frontPoly); 
    21442144                                        } 
     2145                                        if (!poly->Valid()) 
     2146                                                DEL_PTR(poly); 
     2147                                        else 
     2148                                                childCell.push_back(poly); 
    21452149                                } 
     2150                                 
    21462151                                break; 
    21472152                        case Polygon3::BACK_SIDE: 
    2148                                 if (!sides[i])  
    2149                                         newCell.push_back(new Polygon3(*cell[i])); 
    2150                          
     2153                                if (!side)  
     2154                                        childCell.push_back(new Polygon3(cell[i]->mVertices));                   
    21512155                                break; 
    21522156                        case Polygon3::FRONT_SIDE: 
    2153                                 if (sides[i]) 
    2154                                         newCell.push_back(new Polygon3(*cell[i])); 
    2155                                         inside = false; 
     2157                                if (side) 
     2158                                        childCell.push_back(new Polygon3(cell[i]->mVertices));   
     2159                                break; 
     2160                        case Polygon3::COINCIDENT: 
     2161                                childCell.push_back(new Polygon3(cell[i]->mVertices)); 
    21562162                                break; 
    21572163                        default: 
     2164                                 
    21582165                                break; 
    21592166                } 
    21602167        } 
    21612168 
     2169        //-- finally add the new polygon 
     2170        childCell.push_back(planePoly); 
     2171         
    21622172        return true; 
    21632173} 
     
    22292239                                                DEL_PTR(frontPoly); 
    22302240                                        } 
    2231                                         inside = true; 
     2241                                         
    22322242                                        break; 
    22332243 
     
    22392249                                        if (!sides[j]) 
    22402250                                                inside = false; 
     2251                                        break; 
     2252                                case Polygon3::COINCIDENT: 
    22412253                                        break; 
    22422254                                default: 
     
    24182430        return NULL; 
    24192431} 
     2432 
     2433int BspTree::ComputePvsSize(const BoundedRayContainer &rays) const 
     2434{ 
     2435        int pvsSize = 0; 
     2436 
     2437        BoundedRayContainer::const_iterator rit, rit_end = rays.end(); 
     2438 
     2439        Intersectable::NewMail(); 
     2440 
     2441        for (rit = rays.begin(); rit != rays.end(); ++ rit) 
     2442        { 
     2443                Ray *ray = (*rit)->mRay; 
     2444                 
     2445                if (!ray->intersections.empty()) 
     2446                { 
     2447                        if (!ray->intersections[0].mObject->Mailed()) 
     2448                        { 
     2449                                ray->intersections[0].mObject->Mail(); 
     2450                                ++ pvsSize; 
     2451                        } 
     2452                } 
     2453                if (!ray->sourceObject.mObject->Mailed()) 
     2454                { 
     2455                        ray->sourceObject.mObject->Mail(); 
     2456                        ++ pvsSize; 
     2457                } 
     2458        } 
     2459 
     2460        return pvsSize; 
     2461} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r383 r384  
    459459                @returns true if plane contributes to the cell. 
    460460        */ 
    461         bool ConstructChildGeometry(PolygonContainer &newCell, 
     461        bool ConstructChildGeometry(PolygonContainer &childCell, 
    462462                                                            const PolygonContainer &cell, 
    463463                                                            const vector<Plane3 *> &planes, 
     
    535535        /** Evaluates the contribution of the candidate split plane. 
    536536                 
    537                 @param canditatePlane the candidate split plane 
     537                @param candidatePlane the candidate split plane 
    538538                @param polys the polygons the split can be based on 
    539539                @param rays the rays the split can be based on 
     540 
    540541                @returns the cost of the candidate split plane 
    541542        */ 
    542         float SplitPlaneCost(BspLeaf *leaf,  
    543                                  const Plane3 &candidatePlane, 
     543        float SplitPlaneCost(const Plane3 &candidatePlane, 
    544544                                                 const PolygonContainer &polys,                                                   
    545                                                  const BoundedRayContainer &rays) const; 
     545                                                 const BoundedRayContainer &rays, 
     546                                                 const PolygonContainer &cell, 
     547                                                 const vector<Plane3 *> &plane, 
     548                                                 const vector<bool> &sides, 
     549                                                 const int pvsSize) const; 
    546550 
    547551        /** Strategies where the effect of the split plane is tested 
     
    549553                @returns the cost of the candidate split plane 
    550554        */ 
    551         float SplitPlaneCost(BspLeaf *leaf,  
    552                                  const Plane3 &candidatePlane, 
     555        float SplitPlaneCost(const Plane3 &candidatePlane, 
    553556                                                 const PolygonContainer &polys) const; 
    554557 
    555558        /** Strategies where the effect of the split plane is tested 
    556559            on all input polygons. 
     560 
    557561                @returns the cost of the candidate split plane 
    558562        */ 
    559         float SplitPlaneCost(BspLeaf *leaf, 
    560                                  const Plane3 &candidatePlane, 
    561                                                  const BoundedRayContainer &polys) const; 
     563        float SplitPlaneCost(const Plane3 &candidatePlane, 
     564                                                 const BoundedRayContainer &rays, 
     565                                                 const float frontArea, 
     566                                                 const float backArea, 
     567                                                 const int pvsSize) const; 
    562568 
    563569        /** Filters next view cell down the tree and inserts it into the appropriate leaves 
     
    721727        /** Computes the pvs of the front and back leaf with a given classification. 
    722728        */ 
    723         void ComputePvs(Intersectable &obj,  
     729        void AddToPvs(Intersectable &obj,  
    724730                                        float &frontPvs, 
    725731                                        float &backPvs, 
     
    729735                                        const int frontAndBackId) const; 
    730736         
     737        int ComputePvsSize(const BoundedRayContainer &rays) const; 
     738 
    731739        /// Pointer to the root of the tree 
    732740        BspNode *mRoot; 
Note: See TracChangeset for help on using the changeset viewer.