Move r_viewport variables into a class

This commit is contained in:
Magnus Norddahl 2017-02-01 16:02:21 +01:00
commit e78e76a593
35 changed files with 336 additions and 277 deletions

View file

@ -146,11 +146,12 @@ TriMatrix TriMatrix::worldToView()
TriMatrix TriMatrix::viewToClip()
{
auto viewport = swrenderer::RenderViewport::Instance();
float near = 5.0f;
float far = 65536.0f;
float width = (float)(FocalTangent * near);
float top = (float)(swrenderer::CenterY / swrenderer::InvZtoScale * near);
float bottom = (float)(top - viewheight / swrenderer::InvZtoScale * near);
float top = (float)(viewport->CenterY / viewport->InvZtoScale * near);
float bottom = (float)(top - viewheight / viewport->InvZtoScale * near);
return frustum(-width, width, bottom, top, near, far);
}