MCPcopy Create free account
hub / github.com/carbonengine/trinity / DrawDoubleArrow

Method DrawDoubleArrow

trinity/Tr2DebugRenderer.cpp:536–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536void Tr2DebugRenderer::DrawDoubleArrow( Tr2DebugObjectReference owner, const Vector3& start, const Vector3& end, float radius, float pointerLength, uint32_t segments, Effect effect, Tr2DebugColor color )
537{
538 Matrix transform = LineTransform( start, end );
539
540 float length = XMVectorGetX( XMVector3Length( start - end ) );
541
542 if( radius <= 0 )
543 {
544 radius = length * pointerLength * 0.15f;
545
546 const Vector2 vertices0[] = {
547 Vector2( -length / 2, 0 ),
548 Vector2( -length / 2 + length * pointerLength, radius * 2 ),
549 Vector2( -length / 2 + length * pointerLength, 0 )
550 };
551 Vector2 n0 = LineNormal( vertices0[0], vertices0[1] );
552 const Vector2 normals0[] = {
553 n0,
554 n0,
555 Vector2( 1, 0 ),
556 Vector2( 1, 0 )
557 };
558 DrawExtrusionShape( owner, transform, vertices0, normals0, sizeof( vertices0 ) / sizeof( vertices0[0] ), segments, effect, color );
559
560 const Vector2 vertices1[] = {
561 Vector2( length / 2 - length * pointerLength, 0 ),
562 Vector2( length / 2 - length * pointerLength, radius * 2 ),
563 Vector2( length / 2, 0 )
564 };
565 Vector2 n1 = LineNormal( vertices1[1], vertices1[2] );
566 const Vector2 normals1[] = {
567 Vector2( -1, 0 ),
568 Vector2( -1, 0 ),
569 n1,
570 n1
571 };
572 DrawExtrusionShape( owner, transform, vertices1, normals1, sizeof( vertices1 ) / sizeof( vertices1[0] ), segments, effect, color );
573
574 DrawLine( owner, start + transform.GetY() * length * pointerLength, start + transform.GetY() * length * ( 1 - pointerLength ), color );
575 }
576 else
577 {
578 const Vector2 vertices[] = {
579 Vector2( -length / 2, 0 ),
580 Vector2( -length / 2 + length * pointerLength, radius * 2 ),
581 Vector2( -length / 2 + length * pointerLength, radius ),
582 Vector2( length / 2 - pointerLength * length, radius ),
583 Vector2( length / 2 - pointerLength * length, radius * 2 ),
584 Vector2( length / 2, 0 )
585 };
586 Vector2 n0 = LineNormal( vertices[0], vertices[1] );
587 Vector2 n1 = LineNormal( vertices[4], vertices[5] );
588 const Vector2 normals[] = {
589 n0,
590 n0,
591 Vector2( 1, 0 ),
592 Vector2( 1, 0 ),
593 Vector2( 0, 1 ),

Callers

nothing calls this directly

Calls 3

LineTransformFunction · 0.85
LineNormalFunction · 0.85
GetYMethod · 0.45

Tested by

no test coverage detected