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

Method drawArrow

Engine/source/gfx/gfxDrawUtil.cpp:1427–1459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1425}
1426
1427void 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
1461void GFXDrawUtil::drawFrustum( const Frustum &f, const ColorI &color )
1462{

Callers 6

_renderMethod · 0.80
renderObjectMethod · 0.80
_renderEmitterInfoMethod · 0.80
renderSunDirectionMethod · 0.80
renderSceneMethod · 0.80
renderMethod · 0.80

Calls 4

mTanFunction · 0.85
mDegToRadFunction · 0.85
lenMethod · 0.45
normalizeMethod · 0.45

Tested by

no test coverage detected