| 40 | } |
| 41 | |
| 42 | void EveConnector::AddLine( EveCurveLineSet* lineSet ) |
| 43 | { |
| 44 | float length, angle; |
| 45 | Vector3 v, v2, v3; |
| 46 | Vector3 n( 0, 1, 0 ); |
| 47 | float radiusX = m_destPosition.x; |
| 48 | float radiusY = m_destPosition.y; |
| 49 | float rotation = m_destPosition.z; |
| 50 | bool fade = false; |
| 51 | // Currently we assume we always project onto the x,0,z plane. This may change later on, in that case using sourcePosition |
| 52 | // as a point in the plane and for the relative position |
| 53 | switch( m_type ) |
| 54 | { |
| 55 | case StraightAnchor: |
| 56 | v = TriVectorProjectOnPlane( m_destPosition, m_sourcePosition, n ); |
| 57 | m_lineLength = Length( v - m_destPosition ); |
| 58 | AddStraightLine( lineSet, m_destPosition, v ); |
| 59 | break; |
| 60 | case CurvedAnchor: |
| 61 | v = TriVectorRotateToPlane( m_destPosition, m_sourcePosition, n ); |
| 62 | v2 = m_destPosition - m_sourcePosition; |
| 63 | v3 = v - m_sourcePosition; |
| 64 | length = Length( v2 ); |
| 65 | angle = acos( Dot( Normalize( v2 ), Normalize( v3 ) ) ); |
| 66 | m_lineLength = length * angle; |
| 67 | AddSpheredSegment( lineSet, m_destPosition, v, m_sourcePosition ); |
| 68 | break; |
| 69 | case XZ_Circle: |
| 70 | v = m_destPosition - m_sourcePosition; |
| 71 | length = Length( v ); |
| 72 | m_lineLength = TRI_PI * length * 0.5f; |
| 73 | AddCircle( lineSet, m_sourcePosition, length ); |
| 74 | break; |
| 75 | case XZ_CircleStraight: |
| 76 | v = TriVectorProjectOnPlane( m_destPosition, m_sourcePosition, n ); |
| 77 | v = v - m_sourcePosition; |
| 78 | length = Length( v ); |
| 79 | m_lineLength = TRI_PI * length * 0.5f; |
| 80 | AddCircle( lineSet, m_sourcePosition, length ); |
| 81 | break; |
| 82 | case Circle: |
| 83 | AddCircle( lineSet, m_sourcePosition, m_length, m_normal ); |
| 84 | break; |
| 85 | case Ellipse: |
| 86 | AddEllipse( lineSet, m_sourcePosition, radiusX, radiusY, rotation, m_normal ); |
| 87 | break; |
| 88 | case PointToPoint: |
| 89 | v = m_destPosition - m_sourcePosition; |
| 90 | m_lineLength = Length( v ); |
| 91 | if( m_length && m_lineLength > m_length ) |
| 92 | { |
| 93 | v = Normalize( v ) * m_length; |
| 94 | v += m_sourcePosition; |
| 95 | fade = true; |
| 96 | } |
| 97 | else |
| 98 | { |
| 99 | v = m_destPosition; |
nothing calls this directly
no test coverage detected