| 488 | } |
| 489 | |
| 490 | Vector3 Tr2Renderer::ProjectWorldToScreen( const Vector3& worldPos, const Tr2Viewport& vp ) |
| 491 | { |
| 492 | Vector4 p( worldPos.x, worldPos.y, worldPos.z, 1.0f ); |
| 493 | p = p * GetViewTransform(); |
| 494 | p = p * GetProjectionTransform(); |
| 495 | if( p.w ) |
| 496 | { |
| 497 | p *= 1.0f / p.w; |
| 498 | } |
| 499 | |
| 500 | return Vector3( vp.m_x + vp.m_width * ( 0.5f + 0.5f * p.x ), |
| 501 | vp.m_y + vp.m_height * ( 0.5f - 0.5f * p.y ), |
| 502 | vp.m_minZ + p.z * vp.m_maxZ ); |
| 503 | } |
| 504 | |
| 505 | const Matrix& Tr2Renderer::GetInverseProjectionTransform() |
| 506 | { |
nothing calls this directly
no test coverage detected