Changeset 404 for trunk/VUT/GtpVisibilityPreprocessor
- Timestamp:
- 11/10/05 19:01:38 (19 years ago)
- Location:
- trunk/VUT/GtpVisibilityPreprocessor
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r402 r404 128 128 splitPlaneStrategy 1024 129 129 130 maxPolyCandidates 50130 maxPolyCandidates 0 131 131 maxRayCandidates 50 132 132 133 133 Termination { 134 134 # autopartition 135 maxRays 100136 maxPolygons 10137 maxDepth 50138 minPvs 20139 minArea 0.00 1135 maxRays 300 136 maxPolygons -1 137 maxDepth 40 138 minPvs 35 139 minArea 0.005 140 140 141 141 # axis aligned splits -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp
r396 r404 136 136 } 137 137 138 int Polygon3::ClassifyPlane(const Plane3 &plane ) const138 int Polygon3::ClassifyPlane(const Plane3 &plane, const float tolerance) const 139 139 { 140 140 VertexContainer::const_iterator it; … … 147 147 for (it = mVertices.begin(); it != mVertices.end(); ++ it) 148 148 { 149 const int side = plane.Side(*it, Vector3::sDistTolerance);149 const int side = plane.Side(*it, tolerance); 150 150 151 151 if (side > 0) … … 176 176 177 177 return COINCIDENT; // plane and polygon are coincident 178 } 179 180 int Polygon3::ClassifyPlane(const Plane3 &plane) const 181 { 182 return ClassifyPlane(plane, Vector3::sDistTolerance); 178 183 } 179 184 -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.h
r396 r404 65 65 */ 66 66 int ClassifyPlane(const Plane3 &plane) const; 67 68 69 70 /** Classify polygon with respect to the plane. 71 @returns one of BACK_SIDE, FRONT_SIDE, SPLIT, COINCIDENT 72 */ 73 int ClassifyPlane(const Plane3 &plane, const float tolerance) const; 67 74 68 75 /** Side of the polygon with respect to the plane. -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r400 r404 912 912 exporter->SetForcedMaterial(m); 913 913 914 //exporter->SetWireframe(); 914 // exporter->SetWireframe(); 915 exporter->SetFilled(); 915 916 916 917 // output PVS of view cell -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r402 r404 872 872 873 873 874 //-- create front and back leaf 874 875 875 876 BspInterior *parent = leaf->GetParent(); … … 1089 1090 Plane3 bestPlane; 1090 1091 1091 int limit = sMaxPolyCandidates > 0 ? 1092 Min((int)data.mPolygons->size(), sMaxPolyCandidates) : (int)data.mPolygons->size(); 1092 int limit = Min((int)data.mPolygons->size(), sMaxPolyCandidates); 1093 1093 1094 1094 int candidateIdx = limit; … … 1096 1096 for (int i = 0; i < limit; ++ i) 1097 1097 { 1098 Debug << i << " "; 1098 1099 candidateIdx = GetNextCandidateIdx(candidateIdx, *data.mPolygons); 1099 1100 … … 1119 1120 Plane3 plane; 1120 1121 1121 if ( 1)1122 if (0) 1122 1123 { 1123 1124 Vector3 pt[3]; 1124 1125 int idx[3]; 1125 1126 int cmaxT = 0; 1127 int cminT = 0; 1128 bool chooseMin = false; 1129 1126 1130 for (int j = 0; j < 3; j ++) 1127 1131 { 1128 1132 idx[j] = Random((int)rays->size() * 2); 1129 1133 1130 if (idx[j] < (int)rays->size()) 1131 pt[j] = (*rays)[idx[j]]->mRay->Extrap((*rays)[idx[j]]->mMinT); 1134 if (idx[j] >= (int)rays->size()) 1135 { 1136 idx[j] -= (int)rays->size(); 1137 1138 chooseMin = (cminT < 2); 1139 } 1132 1140 else 1133 {1134 idx[j] -= (int)rays->size(); 1135 pt[j] = (*rays)[idx[j]]->mRay->Extrap((*rays)[idx[j]]->mMaxT);1136 }1141 chooseMin = (cmaxT < 2); 1142 1143 BoundedRay *bRay = (*rays)[idx[j]]; 1144 pt[j] = chooseMin ? bRay->mRay->Extrap(bRay->mMinT) : bRay->mRay->Extrap(bRay->mMaxT); 1137 1145 } 1138 1146 … … 1431 1439 1432 1440 // give penalty for unbalanced cell 1433 if (((pFront * 0.2 ) > pBack) || (pFront < (pBack * 0.2)))1441 if (((pFront * 0.2 + 0.00001) > pBack) || (pFront < (pBack * 0.2 + 0.00001))) 1434 1442 val += 0.5; 1435 1443 } 1436 /* Debug << "totalpvs: " << pvs << " ptotal: " << pOverall 1444 1445 if ((val < 0.00001) || (frontPvs + backPvs < pvs)) 1446 { 1447 // create three unique ids for pvs heuristics 1448 Intersectable::NewMail(); backId = ViewCell::sMailId; 1449 Intersectable::NewMail(); frontId = ViewCell::sMailId; 1450 Intersectable::NewMail(); frontAndBackId = ViewCell::sMailId; 1451 1452 1453 BoundedRayContainer::const_iterator rit, rit_end = rays.end(); 1454 1455 int fpvs = 0; int bpvs = 0; 1456 for (rit = rays.begin(); rit != rays.end(); ++ rit) 1457 { 1458 Ray *ray = (*rit)->mRay; 1459 const float minT = (*rit)->mMinT; 1460 const float maxT = (*rit)->mMaxT; 1461 1462 const int cf = 1463 ray->ClassifyPlane(candidatePlane, minT, maxT); 1464 1465 Debug << "classification: " << cf << endl; 1466 if (!ray->intersections.empty()) 1467 { 1468 // in case the ray intersects an objcrs 1469 // assure that we only count a object 1470 // once for the front and once for the back side of the plane 1471 IncPvs(*ray->intersections[0].mObject, fpvs, bpvs, 1472 cf, frontId, backId, frontAndBackId); 1473 } 1474 // the source object in the origin of the ray 1475 if (ray->sourceObject.mObject) 1476 { 1477 IncPvs(*ray->sourceObject.mObject, fpvs, bpvs, 1478 cf, frontId, backId, frontAndBackId); 1479 } 1480 1481 } 1482 1483 Debug << "totalpvs: " << pvs << " ptotal: " << pOverall 1437 1484 << " frontpvs: " << frontPvs << " pFront: " << pFront 1438 1485 << " backpvs: " << backPvs << " pBack: " << pBack 1439 << " val " << val << endl; 1440 */ 1486 << " val " << val << " new size: " << ComputePvsSize(rays) 1487 << " fp " << fpvs << " bp " << bpvs << endl << endl; 1488 1489 } 1441 1490 return val; 1442 1491 } … … 1450 1499 const int frontAndBackId) const 1451 1500 { 1452 if (cf == Ray::COINCIDENT) //TODO: really belongsto no pvs?1453 1501 // TODO: does this really belong to no pvs? 1502 //if (cf == Ray::COINCIDENT) return; 1454 1503 1455 1504 if (cf == Ray::FRONT) … … 1479 1528 } 1480 1529 } 1481 // object belongs to both pvs1482 else if ((cf == Ray::FRONT_BACK) || (cf == Ray::BACK_FRONT) )1530 // object belongs to both PVS 1531 else if ((cf == Ray::FRONT_BACK) || (cf == Ray::BACK_FRONT) ||(cf == Ray::COINCIDENT)) 1483 1532 { 1484 1533 if (obj.mMailbox != frontAndBackId) … … 2362 2411 for (int i = 0; i < (int)mPolys.size(); ++ i) 2363 2412 { 2364 const int cf = mPolys[i]->ClassifyPlane(splitPlane );2413 const int cf = mPolys[i]->ClassifyPlane(splitPlane, 0.00001); 2365 2414 2366 2415 // split new polygon with all previous planes … … 2395 2444 case Polygon3::COINCIDENT: 2396 2445 //front.mPolys.push_back(CreateReversePolygon(mPolys[i])); 2397 //back.mPolys.push_back(new Polygon3(mPolys[i]->mVertices));2446 back.mPolys.push_back(new Polygon3(mPolys[i]->mVertices)); 2398 2447 break; 2399 2448 default: … … 2424 2473 2425 2474 const int cf = 2426 planePoly->ClassifyPlane(plane );2475 planePoly->ClassifyPlane(plane, 0.00001); 2427 2476 2428 2477 // split new polygon with all previous planes
Note: See TracChangeset
for help on using the changeset viewer.