MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getWaterCoverage

Method getWaterCoverage

Engine/source/environment/river.cpp:1351–1384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1349}
1350
1351F32 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
1386F32 River::getSurfaceHeight( const Point2F &pos ) const
1387{

Callers 3

isInWaterMethod · 0.45
isInWaterMethod · 0.45
prepRenderImageMethod · 0.45

Calls 6

mClampFFunction · 0.85
isOverlappedMethod · 0.60
getCenterMethod · 0.45
sizeMethod · 0.45
intersectBoxMethod · 0.45
distanceToSurfaceMethod · 0.45

Tested by

no test coverage detected