| 1425 | } |
| 1426 | |
| 1427 | void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color, F32 baseRad ) |
| 1428 | { |
| 1429 | GFXTransformSaver saver; |
| 1430 | |
| 1431 | // Direction and length of the arrow. |
| 1432 | VectorF dir = end - start; |
| 1433 | F32 len = dir.len(); |
| 1434 | dir.normalize(); |
| 1435 | len *= 0.2f; |
| 1436 | |
| 1437 | // Base of the cone will be a distance back from the end of the arrow |
| 1438 | // proportional to the total distance of the arrow... 0.3f looks about right. |
| 1439 | Point3F coneBase = end - dir * len * 0.3f; |
| 1440 | |
| 1441 | // Calculate the radius of the cone given that we want the cone to have |
| 1442 | // an angle of 25 degrees (just because it looks good). |
| 1443 | F32 coneLen = (baseRad != 0.0f) ? baseRad * 4.0 :( end - coneBase ).len(); |
| 1444 | F32 coneDiameter = (baseRad != 0.0f) ? baseRad*4.0f : mTan( mDegToRad(25.0f) ) * coneLen; |
| 1445 | |
| 1446 | // Draw the cone on at the arrow's tip. |
| 1447 | drawCone( desc, coneBase, end, coneDiameter / 2.0f, color ); |
| 1448 | |
| 1449 | // Get the difference in length from |
| 1450 | // the start of the cone to the end |
| 1451 | // of the cylinder so we can put the |
| 1452 | // end of the cylinder right against where |
| 1453 | // the cone starts. |
| 1454 | Point3F coneDiff = end - coneBase; |
| 1455 | |
| 1456 | // Draw the cylinder. |
| 1457 | F32 stickRadius = (baseRad != 0.0f) ? baseRad : len * 0.025f; |
| 1458 | drawCylinder( desc, start, end - coneDiff, stickRadius, color ); |
| 1459 | } |
| 1460 | |
| 1461 | void GFXDrawUtil::drawFrustum( const Frustum &f, const ColorI &color ) |
| 1462 | { |
no test coverage detected