-------------------------------------------------------------------------------------- Description: Sets view and projection transform to be used for picking. Arguments: fx - X offset of the frustum in post-projected space fy - Y offset of the frustum in post-projected space proj - Current projection transform view - Current view transform viewport - Current viewport ------------------------------
| 175 | // viewport - Current viewport |
| 176 | // -------------------------------------------------------------------------------------- |
| 177 | void ITr2PickableScene::SetupTransformsForPicking( float fx, float fy, TriProjection* proj, TriView* view, TriViewport* viewport ) |
| 178 | { |
| 179 | Tr2Renderer::SetViewTransform( view->GetTransform() ); |
| 180 | proj->SetProjection(); |
| 181 | // |
| 182 | // Projection is set up to scale the image such that the viewport is covered by one pixel. |
| 183 | Vector2 scaling( float( viewport->width ), float( viewport->height ) ); |
| 184 | // translate the projection so that we center around the pick ray origin, |
| 185 | // while remembering to scale this value as well: |
| 186 | Vector2 translation; |
| 187 | translation.x = -fx * scaling.x; |
| 188 | translation.y = -fy * scaling.y; |
| 189 | Tr2Renderer::AdjustProjection( scaling, translation ); |
| 190 | |
| 191 | // We do NOT set the viewport here. It will get set automatically when SetRenderTarget is called. |
| 192 | } |
| 193 | |
| 194 | // -------------------------------------------------------------------------------------- |
| 195 | // Description: |
nothing calls this directly
no test coverage detected