| 1349 | } |
| 1350 | |
| 1351 | F32 River::getWaterCoverage( const Box3F &worldBox ) const |
| 1352 | { |
| 1353 | PROFILE_SCOPE( River_GetWaterCoverage ); |
| 1354 | |
| 1355 | if ( !mWorldBox.isOverlapped(worldBox) ) |
| 1356 | return 0.0f; |
| 1357 | |
| 1358 | Point3F bottomPnt = worldBox.getCenter(); |
| 1359 | bottomPnt.z = worldBox.minExtents.z; |
| 1360 | |
| 1361 | F32 farthest = 0.0f; |
| 1362 | |
| 1363 | for ( U32 i = 0; i < mSegments.size(); i++ ) |
| 1364 | { |
| 1365 | const RiverSegment &segment = mSegments[i]; |
| 1366 | |
| 1367 | if ( !segment.worldbounds.isOverlapped(worldBox) ) |
| 1368 | continue; |
| 1369 | |
| 1370 | if ( !segment.intersectBox( worldBox ) ) |
| 1371 | continue; |
| 1372 | |
| 1373 | F32 distance = segment.distanceToSurface( bottomPnt ); |
| 1374 | |
| 1375 | if ( distance > farthest ) |
| 1376 | farthest = distance; |
| 1377 | } |
| 1378 | |
| 1379 | F32 height = worldBox.maxExtents.z - worldBox.minExtents.z; |
| 1380 | F32 distance = mClampF( farthest, 0.0f, height ); |
| 1381 | F32 coverage = distance / height; |
| 1382 | |
| 1383 | return coverage; |
| 1384 | } |
| 1385 | |
| 1386 | F32 River::getSurfaceHeight( const Point2F &pos ) const |
| 1387 | { |
no test coverage detected