Changeset 1977 for GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
- Timestamp:
- 01/15/07 08:37:28 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1974 r1977 2027 2027 stat.avgPvs += pvsCost; 2028 2028 2029 const float pvsEntries = mViewCellsTree->GetPvsEntries(viewcell);2029 const float pvsEntries = (float)mViewCellsTree->GetPvsEntries(viewcell); 2030 2030 stat.avgPvsEntries += pvsEntries; 2031 2031 2032 2033 2032 if (mPerViewCellStat[i].pvsSize > 0.0f) 2034 2033 mPerViewCellStat[i].relPvsIncrease = (pvsCost - mPerViewCellStat[i].pvsSize)/mPerViewCellStat[i].pvsSize; … … 2280 2279 } 2281 2280 2281 } 2282 2283 2284 float ViewCellsManager::ComputeSampleContribution(VssRay &ray, 2285 const bool addRays, 2286 ViewCell *currentViewCell) 2287 { 2288 ray.mPvsContribution = 0; 2289 ray.mRelativePvsContribution = 0.0f; 2290 2291 if (!ray.mTerminationObject) 2292 return 0.0f; 2293 2294 static Ray hray; 2295 hray.Init(ray); 2296 2297 float tmin = 0, tmax = 1.0; 2298 2299 if (!GetViewSpaceBox().GetRaySegment(hray, tmin, tmax) || (tmin > tmax)) 2300 { 2301 // cerr<<"ray outside view space box\n"; 2302 return 0; 2303 } 2304 2305 Vector3 origin = hray.Extrap(tmin); 2306 Vector3 termination = hray.Extrap(tmax); 2307 2308 // traverse the view space subdivision 2309 if (!LineSegmentIntersects(origin, 2310 termination, 2311 currentViewCell)) 2312 { 2313 return 0; 2314 } 2315 2316 // optain pvs entry (can be different from hit object) 2317 Intersectable *terminationObj = GetIntersectable(ray, true); 2318 2319 ComputeViewCellContribution(currentViewCell, 2320 ray, 2321 terminationObj, 2322 ray.mTermination, 2323 addRays); 2324 2325 #if USE_RAY_LENGTH_AS_CONTRIBUTION 2326 float c = 0.0f; 2327 if (terminationObj) 2328 c = ray.Length(); 2329 ray.mRelativePvsContribution = ray.mPvsContribution = c; 2330 return c; 2331 #else 2332 return ABS_CONTRIBUTION_WEIGHT*ray.mPvsContribution + 2333 (1.0f - ABS_CONTRIBUTION_WEIGHT)*ray.mRelativePvsContribution; 2334 #endif 2282 2335 } 2283 2336 … … 3330 3383 3331 3384 3385 bool BspViewCellsManager::LineSegmentIntersects(const Vector3 &origin, 3386 const Vector3 &termination, 3387 ViewCell *viewCell) 3388 { 3389 return false; 3390 } 3391 3392 3332 3393 void ViewCellsManager::ExportMergedViewCells(const ObjectContainer &objects) 3333 3394 { … … 4316 4377 4317 4378 4379 bool KdViewCellsManager::LineSegmentIntersects(const Vector3 &origin, 4380 const Vector3 &termination, 4381 ViewCell *viewCell) 4382 { 4383 return false; 4384 } 4385 4386 4318 4387 void KdViewCellsManager::CreateMesh(ViewCell *vc) 4319 4388 { … … 5089 5158 { 5090 5159 return mVspBspTree->CastLineSegment(origin, termination, viewcells); 5160 } 5161 5162 5163 bool VspBspViewCellsManager::LineSegmentIntersects(const Vector3 &origin, 5164 const Vector3 &termination, 5165 ViewCell *viewCell) 5166 { 5167 return false; 5091 5168 } 5092 5169 … … 6105 6182 ViewCellContainer &viewcells) 6106 6183 { 6107 return mHierarchyManager->GetVspTree()->CastLineSegment(origin, termination, viewcells); 6184 return mHierarchyManager-> 6185 GetVspTree()->CastLineSegment(origin, termination, viewcells); 6186 } 6187 6188 6189 bool VspOspViewCellsManager::LineSegmentIntersects(const Vector3 &origin, 6190 const Vector3 &termination, 6191 ViewCell *viewCell) 6192 { 6193 return mHierarchyManager-> 6194 GetVspTree()->LineSegmentIntersects(origin, termination, viewCell); 6108 6195 } 6109 6196
Note: See TracChangeset
for help on using the changeset viewer.