| 65 | |
| 66 | |
| 67 | void EveProjectBracket::UpdateValue( double time ) |
| 68 | { |
| 69 | Vector3 pos; |
| 70 | if( m_trackBall ) |
| 71 | { |
| 72 | m_trackBall->GetValueAt( &pos, BeOS->GetCurrentFrameTime() ); |
| 73 | |
| 74 | pos *= m_ballTrackingScaling; |
| 75 | } |
| 76 | else if( m_trackTransform ) |
| 77 | { |
| 78 | pos = m_trackTransform->GetWorldPosition(); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | pos = m_trackPosition; |
| 83 | } |
| 84 | |
| 85 | pos = TransformCoord( pos, Tr2Renderer::GetViewTransform() ); |
| 86 | |
| 87 | bool isInFront = ( pos.z <= 0.0f ); |
| 88 | m_isInFront = isInFront; |
| 89 | |
| 90 | m_cameraDistance = Length( pos ); |
| 91 | |
| 92 | Vector3 projectedPosition; |
| 93 | const TriViewport& vp = Tr2Renderer::GetViewport(); |
| 94 | |
| 95 | projectedPosition = TransformCoord( pos, Tr2Renderer::GetProjectionTransform() ); |
| 96 | Vec3TransformByViewport( projectedPosition, vp ); |
| 97 | |
| 98 | float x = projectedPosition.x; |
| 99 | float y = projectedPosition.y; |
| 100 | |
| 101 | m_rawProjectedPosition.x = x; |
| 102 | m_rawProjectedPosition.y = y; |
| 103 | |
| 104 | // Brackets behind the camera with the 'dock' flag cleared are hidden |
| 105 | if( ( !isInFront && !m_dock ) ) |
| 106 | { |
| 107 | SetBracketDisplayState( false ); |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | // Brackets outside the display range are hidden |
| 112 | if( ( m_cameraDistance < m_minDispRange ) || ( m_cameraDistance > m_maxDispRange ) ) |
| 113 | { |
| 114 | SetBracketDisplayState( false ); |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | // Turn brackets on again, if needed |
| 119 | SetBracketDisplayState( true ); |
| 120 | |
| 121 | float left = vp.x + m_marginLeft; |
| 122 | float right = vp.x + vp.width - m_marginRight; |
| 123 | float top = vp.y + m_marginTop; |
| 124 | float bottom = vp.y + vp.height - m_marginBottom; |
no test coverage detected