- Timestamp:
- 11/09/05 15:22:39 (19 years ago)
- Location:
- trunk/VUT
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env
r392 r396 88 88 # input fromViewCells 89 89 # input fromSceneGeometry 90 samples 5000090 samples 100000 91 91 sideTolerance 0.005 92 92 } … … 126 126 #splitPlaneStrategy 130 127 127 128 splitPlaneStrategy 1024128 splitPlaneStrategy 8 129 129 130 130 maxPolyCandidates 50 131 maxRayCandidates 0131 maxRayCandidates 1024 132 132 133 133 Termination { … … 136 136 maxPolygons 0 137 137 maxDepth 50 138 minPvs -1 138 139 139 140 # axis aligned splits … … 156 157 exportSplits true 157 158 # how much samples should be used in visualization 158 samples 300000159 samples 1000 159 160 } 160 161 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Exporter.h
r386 r396 88 88 89 89 virtual void 90 ExportBspLeaves(const BspTree &tree ) = 0;90 ExportBspLeaves(const BspTree &tree, const int maxPvs = 0) = 0; 91 91 92 92 void SetExportRayDensity(const bool d) { mExportRayDensity = d; } -
trunk/VUT/GtpVisibilityPreprocessor/src/Plane3.h
r372 r396 30 30 } 31 31 32 void ReverseOrientation() 33 { 34 mNormal *= -1; 35 mD *= -1; 36 } 32 37 33 38 float Distance(const Vector3 &v) const { -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.cpp
r390 r396 439 439 440 440 for (pit = cell.begin(); pit != cell.end(); ++ pit) 441 {442 441 area += (*pit)->GetArea(); 443 } 442 444 443 return area; 445 444 } 445 446 447 Polygon3 *Polygon3::CreateReversePolygon() const 448 { 449 Polygon3 *revPoly = new Polygon3(); 450 451 VertexContainer::const_reverse_iterator rit, 452 rit_end = mVertices.rend(); 453 454 for(rit = mVertices.rbegin(); rit != rit_end; ++ rit) 455 revPoly->mVertices.push_back(*rit); 456 457 return revPoly; 458 } -
trunk/VUT/GtpVisibilityPreprocessor/src/Polygon3.h
r384 r396 99 99 Polygon3 &back_piece) const; 100 100 101 /** Returns new polygon with reverse orientation. 102 */ 103 Polygon3 *CreateReversePolygon() const; 101 104 102 105 /// vertices are connected in counterclockwise order. … … 111 114 /// Rays piercing this polygon 112 115 RayContainer mPiercingRays; 113 114 116 115 117 -
trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp
r392 r396 558 558 if (1) // export view cells 559 559 { 560 cout << "exporting view cells... ";560 cout << "exporting initial view cells (=leaves) ... "; 561 561 Exporter *exporter = Exporter::GetExporter("view_cells.x3d"); 562 562 if (exporter) 563 563 { 564 exporter->ExportBsp ViewCellPartition(*mBspTree, stat.maxPvs);564 exporter->ExportBspLeaves(*mBspTree, stat.maxPvs); 565 565 //exporter->ExportBspViewCellPartition(*mBspTree, 0); 566 566 delete exporter; … … 1065 1065 renderTime += area * RenderPvs(*(*it), objRt) + vcOverhead; 1066 1066 totalArea += area; 1067 CLEAR_CONTAINER(cell); 1067 1068 } 1068 1069 -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp
r394 r396 697 697 //-- terminate traversal 698 698 if (((int)tData.mPolygons->size() <= sTermMaxPolygons) || 699 ((int)tData.mRays->size() <= sTermMaxRays) 700 ( (int)tData.mPvs <= sTermMinPvs)||699 ((int)tData.mRays->size() <= sTermMaxRays) || 700 (tData.mPvs <= sTermMinPvs) || 701 701 (tData.mDepth >= sTermMaxDepth)) 702 702 … … 1343 1343 { 1344 1344 // construct child geometry with regard to the candidate split plane 1345 frontData.mCell = cell.ConstructChild(*this, candidatePlane, true); 1346 backData.mCell = cell.ConstructChild(*this, candidatePlane, false); 1347 1345 frontData.mCell = new BspNodeGeometry(); 1346 backData.mCell = new BspNodeGeometry(); 1347 1348 cell.SplitGeometry(*frontData.mCell, *backData.mCell, *this, candidatePlane); 1349 1348 1350 pFront = frontData.mArea = frontData.mCell->GetArea(); 1349 1351 pBack = backData.mArea = backData.mCell->GetArea(); … … 2008 2010 } 2009 2011 2010 void BspTree::ExtractSplitPlanes(BspNode *n, 2011 vector<Plane3> &planes, 2012 vector<bool> &sides) const 2012 void BspTree::ExtractHalfSpaces(BspNode *n, vector<Plane3> &halfSpaces) const 2013 2013 { 2014 2014 BspNode *lastNode; … … 2024 2024 { 2025 2025 BspInterior *interior = dynamic_cast<BspInterior *>(n); 2026 2027 planes.push_back(* dynamic_cast<BspInterior *>(interior)->GetPlane()); 2028 sides.push_back(interior->mFront == lastNode); 2026 Plane3 halfSpace = *dynamic_cast<BspInterior *>(interior)->GetPlane(); 2027 2028 if (interior->mFront != lastNode) 2029 halfSpace.ReverseOrientation(); 2030 2031 halfSpaces.push_back(halfSpace); 2029 2032 } 2030 2033 } … … 2034 2037 void BspTree::ConstructGeometry(BspNode *n, BspNodeGeometry &cell) const 2035 2038 { 2036 stack<BspNode *> tStack; 2037 2038 vector<Plane3> planes; 2039 vector<bool> sides; 2040 2041 ExtractSplitPlanes(n, cell.mPlanes, cell.mSides); 2039 PolygonContainer polys; 2040 ConstructGeometry(n, polys); 2041 cell.mPolys = polys; 2042 } 2043 2044 void BspTree::ConstructGeometry(BspViewCell *vc, PolygonContainer &cell) const 2045 { 2046 vector<BspLeaf *> leaves = vc->mBspLeaves; 2047 2048 vector<BspLeaf *>::const_iterator it, it_end = leaves.end(); 2049 2050 for (it = leaves.begin(); it != it_end; ++ it) 2051 ConstructGeometry(*it, cell); 2052 } 2053 2054 2055 void BspTree::ConstructGeometry(BspNode *n, PolygonContainer &cell) const 2056 { 2057 vector<Plane3> halfSpaces; 2058 ExtractHalfSpaces(n, halfSpaces); 2042 2059 2043 2060 PolygonContainer candidatePolys; 2044 2061 2045 // bounded planes are added to the polygons 2046 for (int i = 0; i < (int)cell.mPlanes.size(); ++ i) 2047 { 2048 candidatePolys.push_back(GetBoundingBox().CrossSection(cell.mPlanes[i])); 2062 // bounded planes are added to the polygons (reverse polygons 2063 // as they have to be outfacing 2064 for (int i = 0; i < (int)halfSpaces.size(); ++ i) 2065 { 2066 Polygon3 *p = GetBoundingBox().CrossSection(halfSpaces[i]); 2067 2068 if (p->Valid()) 2069 { 2070 candidatePolys.push_back(p->CreateReversePolygon()); 2071 DEL_PTR(p); 2072 } 2049 2073 } 2050 2074 … … 2062 2086 for (int i = 0; i < (int)candidatePolys.size(); ++ i) 2063 2087 { 2064 bool inside = true;2065 2066 2088 // polygon is split by all other planes 2067 for (int j = 0; (j < cell.mPlanes.size()) && inside; ++ j)2068 { 2069 if (i == j) // same plane2089 for (int j = 0; (j < (int)halfSpaces.size()) && candidatePolys[i]; ++ j) 2090 { 2091 if (i == j) // polygon and plane are coincident 2070 2092 continue; 2071 2093 … … 2073 2095 Polygon3 *frontPoly, *backPoly; 2074 2096 2075 const int cf = candidatePolys[i]->ClassifyPlane( cell.mPlanes[j]);2097 const int cf = candidatePolys[i]->ClassifyPlane(halfSpaces[j]); 2076 2098 2077 2099 switch (cf) … … 2080 2102 frontPoly = new Polygon3(); 2081 2103 backPoly = new Polygon3(); 2082 2083 candidatePolys[i]->Split( cell.mPlanes[j], *frontPoly,2104 2105 candidatePolys[i]->Split(halfSpaces[j], *frontPoly, 2084 2106 *backPoly, splitPts); 2107 2085 2108 DEL_PTR(candidatePolys[i]); 2086 2109 2087 if(sides[j] == true) 2088 { 2110 if (frontPoly->Valid()) 2089 2111 candidatePolys[i] = frontPoly; 2090 DEL_PTR(backPoly);2091 }2092 2112 else 2093 {2094 candidatePolys[i] = backPoly;2095 2113 DEL_PTR(frontPoly); 2096 } 2097 2114 2115 DEL_PTR(backPoly); 2098 2116 break; 2099 2100 2117 case Polygon3::BACK_SIDE: 2101 if (cell.mSides[j]) 2102 inside = false; 2118 DEL_PTR(candidatePolys[i]); 2103 2119 break; 2120 // just take polygon as it is 2104 2121 case Polygon3::FRONT_SIDE: 2105 if (!cell.mSides[j])2106 inside = false;2107 break;2108 2122 case Polygon3::COINCIDENT: 2109 break;2110 2123 default: 2111 2124 break; … … 2113 2126 } 2114 2127 2115 if (inside) 2116 cell.mPolys.push_back(candidatePolys[i]); 2117 else 2118 DEL_PTR(candidatePolys[i]); 2119 } 2120 } 2121 2122 void BspTree::ConstructGeometry(BspNode *n, PolygonContainer &cell) const 2123 { 2124 stack<BspNode *> tStack; 2125 2126 vector<Plane3> planes; 2127 vector<bool> sides; 2128 2129 ExtractSplitPlanes(n, planes, sides); 2130 2131 PolygonContainer candidatePolys; 2132 2133 // bounded planes are added to the polygons 2134 for (int i = 0; i < (int)planes.size(); ++ i) 2135 { 2136 candidatePolys.push_back(GetBoundingBox().CrossSection(planes[i])); 2137 } 2138 2139 // add faces of bounding box (also could be faces of the cell) 2140 for (int i = 0; i < 6; ++ i) 2141 { 2142 VertexContainer vertices; 2143 2144 for (int j = 0; j < 4; ++ j) 2145 vertices.push_back(mBox.GetFace(i).mVertices[j]); 2146 2147 candidatePolys.push_back(new Polygon3(vertices)); 2148 } 2149 2150 for (int i = 0; i < (int)candidatePolys.size(); ++ i) 2151 { 2152 bool inside = true; 2153 2154 // polygon is split by all other planes 2155 for (int j = 0; (j < planes.size()) && inside; ++ j) 2156 { 2157 if (i == j) // same plane 2158 continue; 2159 2160 VertexContainer splitPts; 2161 Polygon3 *frontPoly, *backPoly; 2162 2163 const int cf = candidatePolys[i]->ClassifyPlane(planes[j]); 2164 2165 switch (cf) 2166 { 2167 case Polygon3::SPLIT: 2168 frontPoly = new Polygon3(); 2169 backPoly = new Polygon3(); 2170 2171 candidatePolys[i]->Split(planes[j], *frontPoly, 2172 *backPoly, splitPts); 2173 DEL_PTR(candidatePolys[i]); 2174 2175 if(sides[j] == true) 2176 { 2177 candidatePolys[i] = frontPoly; 2178 DEL_PTR(backPoly); 2179 } 2180 else 2181 { 2182 candidatePolys[i] = backPoly; 2183 DEL_PTR(frontPoly); 2184 } 2185 2186 break; 2187 2188 case Polygon3::BACK_SIDE: 2189 if (sides[j]) 2190 inside = false; 2191 break; 2192 case Polygon3::FRONT_SIDE: 2193 if (!sides[j]) 2194 inside = false; 2195 break; 2196 case Polygon3::COINCIDENT: 2197 break; 2198 default: 2199 break; 2200 } 2201 } 2202 2203 if (inside) 2128 if (candidatePolys[i]) 2204 2129 cell.push_back(candidatePolys[i]); 2205 else 2206 DEL_PTR(candidatePolys[i]); 2207 } 2208 } 2209 2210 void BspTree::ConstructGeometry(BspViewCell *vc, PolygonContainer &cell) const 2211 { 2212 vector<BspLeaf *> leaves = vc->mBspLeaves; 2213 2214 vector<BspLeaf *>::const_iterator it, it_end = leaves.end(); 2215 2216 for (it = leaves.begin(); it != it_end; ++ it) 2217 ConstructGeometry(*it, cell); 2218 } 2130 } 2131 } 2132 2219 2133 2220 2134 int BspTree::FindNeighbors(BspNode *n, vector<BspLeaf *> &neighbors, … … 2229 2143 2230 2144 // planes needed to verify that we found neighbor leaf. 2231 vector<Plane3> planes; 2232 vector<bool> sides; 2233 2234 ExtractSplitPlanes(n, planes, sides); 2145 vector<Plane3> halfSpaces; 2146 ExtractHalfSpaces(n, halfSpaces); 2235 2147 2236 2148 while (!nodeStack.empty()) … … 2243 2155 if (node != n && (!onlyUnmailed || !node->Mailed())) 2244 2156 { 2245 // test all planes of current node on neighbour 2157 // test all planes of current node if candidate really 2158 // is neighbour 2246 2159 PolygonContainer neighborCandidate; 2247 2160 ConstructGeometry(node, neighborCandidate); 2248 2161 2249 2162 bool isAdjacent = true; 2250 for (int i = 0; (i < planes.size()) && isAdjacent; ++ i)2163 for (int i = 0; (i < halfSpaces.size()) && isAdjacent; ++ i) 2251 2164 { 2252 2165 const int cf = 2253 Polygon3::ClassifyPlane(neighborCandidate, planes[i]); 2254 2255 if ((cf == Polygon3::BACK_SIDE) && sides[i]) 2256 isAdjacent = false; 2257 else if ((cf == Polygon3::FRONT_SIDE) && !sides[i]) 2166 Polygon3::ClassifyPlane(neighborCandidate, halfSpaces[i]); 2167 2168 if (cf == Polygon3::BACK_SIDE) 2258 2169 isAdjacent = false; 2259 2170 } … … 2409 2320 *************************************************************/ 2410 2321 2411 BspNodeGeometry::BspNodeGeometry(const PolygonContainer &polys,2412 const vector<Plane3> &planes,2413 const vector<bool> &sides):2414 mPolys(polys), mPlanes(planes), mSides(sides)2415 {}2416 2417 BspNodeGeometry::BspNodeGeometry(const vector<Plane3> &planes,2418 const vector<bool> &sides):2419 mPlanes(planes), mSides(sides)2420 {}2421 2422 2322 BspNodeGeometry::~BspNodeGeometry() 2423 2323 { … … 2430 2330 } 2431 2331 2432 void BspNodeGeometry::SplitGeometry(BspNodeGeometry frontChild.2433 BspNodeGeometry backChild,2332 void BspNodeGeometry::SplitGeometry(BspNodeGeometry &front, 2333 BspNodeGeometry &back, 2434 2334 const BspTree &tree, 2435 const Plane3 &splitPlane, 2436 const bool side) const 2437 { 2438 //BspNodeGeometry *childCell = new BspNodeGeometry(mPlanes, mSides); 2439 2335 const Plane3 &splitPlane) const 2336 { 2440 2337 // get cross section of new polygon 2441 2338 Polygon3 *planePoly = tree.GetBoundingBox().CrossSection(splitPlane); 2442 2339 2443 Polygon3 *frontPoly = NULL;//new Polygon3(planePoly->mVertices); 2444 Polygon3 *backPoly = NULL; //new Polygon3(planePoly->mVertices); 2445 2446 // polygon is split by all other planes 2447 for (int i = 0; (i < (int)mPlanes.size()) && planePoly; ++ i) 2448 { 2449 const int cf = planePoly->ClassifyPlane(mPlanes[i]); 2450 2451 // split new polygon with all previous planes 2452 switch (cf) 2453 { 2454 case Polygon3::SPLIT: 2455 { 2456 VertexContainer splitPts; 2457 2458 frontPoly = new Polygon3(); 2459 backPoly = new Polygon3(); 2460 2461 planePoly->Split(mPlanes[i], *frontPoly, *backPoly, splitPts); 2462 DEL_PTR(planePoly); 2463 2464 if(mSides[i] == true) 2465 { 2466 planePoly = frontPoly; 2467 DEL_PTR(backPoly); 2468 } 2469 else 2470 { 2471 planePoly = backPoly; 2472 DEL_PTR(frontPoly); 2473 } 2474 2475 if (!planePoly->Valid()) 2476 DEL_PTR(planePoly); 2477 } 2478 break; 2479 case Polygon3::BACK_SIDE: 2480 if (mSides[i]) 2481 DEL_PTR(planePoly); 2482 break; 2483 case Polygon3::FRONT_SIDE: 2484 if (!mSides[i]) 2485 DEL_PTR(planePoly); 2486 break; 2487 case Polygon3::COINCIDENT: 2488 break; 2489 default: 2490 break; 2491 } 2492 } 2493 2340 planePoly = SplitPolygon(planePoly, tree); 2341 2494 2342 //-- plane poly splits all other cell polygons 2495 2343 for (int i = 0; i < (int)mPolys.size(); ++ i) … … 2513 2361 DEL_PTR(poly); 2514 2362 2515 if (side == true) 2516 { 2517 poly = frontPoly; 2518 DEL_PTR(backPoly); 2519 } 2520 else 2521 { 2522 poly = backPoly; 2523 DEL_PTR(frontPoly); 2524 } 2525 if (!poly->Valid()) 2526 DEL_PTR(poly); 2527 else 2528 childCell->mPolys.push_back(poly); 2363 if (frontPoly->Valid()) 2364 front.mPolys.push_back(frontPoly); 2365 if (backPoly->Valid()) 2366 back.mPolys.push_back(backPoly); 2529 2367 } 2530 2368 2531 2369 break; 2532 2370 case Polygon3::BACK_SIDE: 2533 if (!side) 2534 childCell->mPolys.push_back(new Polygon3(mPolys[i]->mVertices)); 2371 back.mPolys.push_back(new Polygon3(mPolys[i]->mVertices)); 2535 2372 break; 2536 2373 case Polygon3::FRONT_SIDE: 2537 if (side) 2538 childCell->mPolys.push_back(new Polygon3(mPolys[i]->mVertices)); 2374 front.mPolys.push_back(new Polygon3(mPolys[i]->mVertices)); 2539 2375 break; 2540 2376 case Polygon3::COINCIDENT: 2541 childCell->mPolys.push_back(new Polygon3(mPolys[i]->mVertices)); 2377 //front.mPolys.push_back(CreateReversePolygon(mPolys[i])); 2378 //back.mPolys.push_back(new Polygon3(mPolys[i]->mVertices)); 2542 2379 break; 2543 2380 default: 2381 break; 2382 } 2383 } 2384 2385 //-- finally add the new polygon to the child cells 2386 if (planePoly) 2387 { 2388 // add polygon with normal pointing into positive half space to back cell 2389 back.mPolys.push_back(planePoly); 2390 // add polygon with reverse orientation to front cell 2391 front.mPolys.push_back(planePoly->CreateReversePolygon()); 2392 } 2393 2394 //Debug << "returning new geometry " << mPolys.size() << " CHILD: " << childCell->mPolys.size() << endl; 2395 //Debug << "old area " << this->GetArea() << " new: " << childCell->GetArea() << endl; 2396 } 2397 2398 Polygon3 *BspNodeGeometry::SplitPolygon(Polygon3 *planePoly, 2399 const BspTree &tree) const 2400 { 2401 // polygon is split by all other planes 2402 for (int i = 0; (i < (int)mPolys.size()) && planePoly; ++ i) 2403 { 2404 Plane3 plane = mPolys[i]->GetSupportingPlane(); 2405 2406 const int cf = 2407 planePoly->ClassifyPlane(plane); 2408 2409 // split new polygon with all previous planes 2410 switch (cf) 2411 { 2412 case Polygon3::SPLIT: 2413 { 2414 VertexContainer splitPts; 2544 2415 2416 Polygon3 *frontPoly = new Polygon3(); 2417 Polygon3 *backPoly = new Polygon3(); 2418 2419 planePoly->Split(plane, *frontPoly, *backPoly, splitPts); 2420 DEL_PTR(planePoly); 2421 2422 if (backPoly->Valid()) 2423 planePoly = backPoly; 2424 else 2425 DEL_PTR(backPoly); 2426 } 2545 2427 break; 2546 } 2547 } 2548 2549 //-- finally add the new polygon 2550 if (planePoly) 2551 { 2552 childCell->mPolys.push_back(planePoly); 2553 childCell->mPlanes.push_back(splitPlane); 2554 childCell->mSides.push_back(side); 2555 } 2556 2557 Debug << "returning new geometry " << mPolys.size() << " CHILD: " << childCell->mPolys.size() << endl; 2558 2559 Debug << "old area " << this->GetArea() << " new: " << childCell->GetArea() << endl; 2560 return childCell; 2561 } 2562 2563 /*void BspNodeGeometry::SplitPolygon(Polygon3 *poly, 2564 const BspTree &tree) const 2565 { 2566 }*/ 2428 case Polygon3::FRONT_SIDE: 2429 DEL_PTR(planePoly); 2430 break; 2431 // polygon is taken as it is 2432 case Polygon3::BACK_SIDE: 2433 case Polygon3::COINCIDENT: 2434 default: 2435 break; 2436 } 2437 } 2438 2439 return planePoly; 2440 } -
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h
r392 r396 20 20 public: 21 21 BspNodeGeometry() 22 {}; 23 24 BspNodeGeometry(const PolygonContainer &polys, 25 const vector<Plane3> &planes, 26 const vector<bool> &sides); 27 BspNodeGeometry(const vector<Plane3> &planes, 28 const vector<bool> &sides); 22 {}; 29 23 30 24 ~BspNodeGeometry(); … … 34 28 /** Computes new cell based on the old cell definition and a new split plane 35 29 @param side indicates which side of the halfspace 36 @returns true if plane contributes to the cell.37 */38 BspNodeGeometry *ConstructChild(const BspTree &tree,39 const Plane3 &splitPlane,40 const bool side) const;41 42 vector<Plane3> mPlanes;43 vector<bool> mSides; 30 */ 31 void SplitGeometry(BspNodeGeometry &front, 32 BspNodeGeometry &back, 33 const BspTree &tree, 34 const Plane3 &splitPlane) const; 35 36 Polygon3 *SplitPolygon(Polygon3 *poly, const BspTree &tree) const; 37 44 38 PolygonContainer mPolys; 45 39 }; … … 732 726 /** Extracts the split planes representing the space bounded by node n. 733 727 */ 734 void Extract SplitPlanes(BspNode *n, vector<Plane3> &planes, vector<bool> &sides) const;728 void ExtractHalfSpaces(BspNode *n, vector<Plane3> &halfSpaces) const; 735 729 736 730 /** Computes the pvs of the front and back leaf with a given classification. -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.cpp
r390 r396 229 229 ViewCellContainer::const_iterator it, it_end = viewCells.end(); 230 230 231 232 231 if (maxPvs > 0) 233 232 mUseForcedMaterial = true; … … 257 256 258 257 void 259 X3dExporter::ExportBspLeaves(const BspTree &tree) 260 { 261 vector<BspLeaf *> leaves; 262 tree.CollectLeaves(leaves); 263 264 vector<BspLeaf *>::const_iterator it, it_end = leaves.end(); 265 266 for (it = leaves.begin(); it != it_end; ++ it) 267 { 268 PolygonContainer cell; 269 tree.ConstructGeometry(*it, cell); 270 ExportPolygons(cell); 258 X3dExporter::ExportBspLeaves(const BspTree &tree, const int maxPvs) 259 { 260 stack<pair<BspNode *, BspNodeGeometry *> > tStack; 261 ViewCell::NewMail(); 262 263 BspNodeGeometry *geom = new BspNodeGeometry(); 264 tree.ConstructGeometry(tree.GetRoot(), *geom); 265 266 tStack.push(pair<BspNode *, BspNodeGeometry *>(tree.GetRoot(), geom)); 267 268 if (maxPvs > 0) 269 mUseForcedMaterial = true; 270 271 while (!tStack.empty()) 272 { 273 BspNode *node = tStack.top().first; 274 BspNodeGeometry *cell = tStack.top().second; 275 tStack.pop(); 276 277 if (!node->IsLeaf()) 278 { 279 BspInterior *interior = dynamic_cast<BspInterior *>(node); 280 281 BspNodeGeometry *front = new BspNodeGeometry(); 282 BspNodeGeometry *back = new BspNodeGeometry(); 283 284 cell->SplitGeometry(*front, *back, tree, *interior->GetPlane()); 285 286 tStack.push(pair<BspNode *, BspNodeGeometry *>(interior->GetFront(), front)); 287 tStack.push(pair<BspNode *, BspNodeGeometry *>(interior->GetBack(), back)); 288 } 289 else 290 { 291 if (maxPvs > 0) 292 { 293 BspLeaf *leaf = dynamic_cast<BspLeaf *>(node); 294 295 mForcedMaterial.mDiffuseColor.b = 1.0f; 296 float importance = (float)leaf->GetViewCell()->GetPvs().GetSize() / (float)maxPvs; 297 298 mForcedMaterial.mDiffuseColor.r = importance; 299 mForcedMaterial.mDiffuseColor.g = 1.0f - mForcedMaterial.mDiffuseColor.r; 300 } 301 302 ExportPolygons(cell->mPolys); 303 } 304 305 DEL_PTR(cell); 271 306 } 272 307 } … … 532 567 } 533 568 534 stack<BspNode *> tStack;535 536 tStack.push(tree.GetRoot());537 538 Mesh *mesh = new Mesh;539 540 AxisAlignedBox3 box = tree.GetBoundingBox();541 569 bool savedWireframe = mWireframe; 542 570 543 571 SetWireframe(); 544 ExportBox(box); 572 573 ExportBox(tree.GetBoundingBox()); 545 574 546 575 if (!savedWireframe) -
trunk/VUT/GtpVisibilityPreprocessor/src/X3dExporter.h
r386 r396 94 94 95 95 virtual void 96 ExportBspLeaves(const BspTree &tree );96 ExportBspLeaves(const BspTree &tree, const int maxPvs = 0); 97 97 98 98 protected: -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrain.vcproj
r226 r396 21 21 Name="VCCLCompilerTool" 22 22 Optimization="0" 23 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";..\..\GtpVisibility\include;..\..\Ogre\include;..\include ;..\TestCulling"23 AdditionalIncludeDirectories=""$(OGRE_PATH)\Dependencies\include";"$(OGRE_PATH)\OgreMain\include";"$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\Dependencies\include\CEGUI";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include";"$(OGRE_ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\include";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include";..\..\GtpVisibility\include;..\..\Ogre\include;..\include" 24 24 PreprocessorDefinitions="_WINDOWS;_STLP_USE_DYNAMIC_LIB;OGRE_LIBRARY_IMPORTS;_DEBUG;WIN32;_STLP_DEBUG;PLUGIN_TERRAIN_IMPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 25 25 MinimalRebuild="TRUE" … … 37 37 AdditionalDependencies="Plugin_OctreeSceneManager.lib Plugin_VisibilitySceneManager.lib OGREMain_d.LIB CEGUIBase_d.lib OgreGUIRenderer_d.lib Plugin_DotSceneManager.lib" 38 38 OutputFile="$(OGRE_PATH)/Samples/Common/bin/Debug/TestCullingTerrain.exe" 39 LinkIncremental=" 2"40 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_ ADDONS_PATH)\dotsceneoctree\PlugIns\DotSceneManager\bin\$(ConfigurationName)";"..\Ogre\lib\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib""39 LinkIncremental="1" 40 AdditionalLibraryDirectories=""$(OGRE_PATH)\Dependencies\Lib\$(ConfigurationName)";"$(OGRE_PATH)\OgreMain\Lib\$(ConfigurationName)";"$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";"..\..\Ogre\lib\$(ConfigurationName)"" 41 41 GenerateDebugInformation="TRUE" 42 42 ProgramDatabaseFile="$(OutDir)/TestCullingTerrain.pdb"
Note: See TracChangeset
for help on using the changeset viewer.