void PlayerViewport::Render(float frameSeconds, const RenderInfo& screenRenderInfo) { const RenderTarget* current = RenderTarget::GetCurrentTarget(); //Render the world. worldRendTarg.EnableDrawingInto(); //TODO: Fix culling. RenderingState(RenderingState::C_NONE).EnableState(); ScreenClearer(true, true, false, Vector4f(1.0f, 0.0f, 1.0f, 0.0f)).ClearScreen(); Vector3f camPos = LevelConstants::Instance.GetPlayerEyePos(Target->Pos, Target->LookDir); Camera cam(camPos, Target->LookDir, Vector3f(0.0f, 0.0f, 1.0f), false); cam.PerspectiveInfo.SetFOVDegrees(Settings::Instance.FOVDegrees); cam.PerspectiveInfo.Width = (float)worldRendTarg.GetWidth(); cam.PerspectiveInfo.Height = (float)worldRendTarg.GetHeight(); cam.PerspectiveInfo.zNear = LevelConstants::Instance.CameraZNear; cam.PerspectiveInfo.zFar = LevelConstants::Instance.CameraZFar; Matrix4f viewM, projM; cam.GetViewTransform(viewM); cam.GetPerspectiveProjection(projM); RenderInfo worldRenderInfo(Lvl.GetTimeSinceGameStart(), &cam, &viewM, &projM); Lvl.Render(frameSeconds, worldRenderInfo); worldRendTarg.DisableDrawingInto(); //Render post-processing. RenderTarget* finalRnd = PostProcessing::Instance.Apply(worldRendColor, worldRendDepth); if (current != 0) { current->EnableDrawingInto(); } else { Viewport(0, 0, World->GetWindow()->getSize().x, World->GetWindow()->getSize().y).Use(); } //Do the final render to the screen. RenderingState(RenderingState::C_NONE).EnableState(); SetTex(finalRnd->GetColorTextures()[0].MTex); GUITexture::Render(frameSeconds, screenRenderInfo); }