Skip to content

Commit

Permalink
Fixed|UI|Client: Using the correct frame for busy transitions
Browse files Browse the repository at this point in the history
Previously there was an arbitrary 0.5 second threshold for determining
if the captured busy frame was still fine for a transition (checked when
a new request for a busy frame occurred).

This arbitrary threshold was removed and the busy frame is only
discarded when the regular game is running without a busy transition.

Also did some cleanup: removing obsolete/commented code.

IssueID #1939
  • Loading branch information
skyjake committed Mar 15, 2015
1 parent 31ae35a commit 5bcb1d1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 55 deletions.
9 changes: 0 additions & 9 deletions doomsday/apps/client/include/ui/busyvisual.h
Expand Up @@ -29,17 +29,8 @@
extern "C" {
#endif

//void BusyVisual_LoadTextures(void);
void BusyVisual_ReleaseTextures(void);

//void BusyVisual_PrepareFont(void);
void BusyVisual_PrepareResources(void);

/**
* Busy Mode visual drawer function. The entire frame is drawn here.
*/
//void BusyVisual_Render(void);

/**
* @todo Does the console transition animation really belong in the busy visual?
*/
Expand Down
15 changes: 0 additions & 15 deletions doomsday/apps/client/src/busymode.cpp
Expand Up @@ -258,8 +258,6 @@ void BusyMode_FreezeGameForBusyMode(void)
static void preBusySetup(int initialMode)
{
#ifdef __CLIENT__
//ClientWindow::main().busy().renderTransitionFrame();

// Are we doing a transition effect?
busyWillAnimateTransition = animatedTransitionActive(initialMode);
if(busyWillAnimateTransition)
Expand All @@ -269,12 +267,6 @@ static void preBusySetup(int initialMode)

busyWasIgnoringInput = ClientApp::inputSystem().ignoreEvents();

// Load any resources needed beforehand.
//BusyVisual_PrepareResources();

//BusyVisual_PrepareFont();
//BusyVisual_LoadTextures();

// Limit frame rate to 60, no point pushing it any faster while busy.
ClientApp::app().loop().setRate(60);

Expand All @@ -293,18 +285,11 @@ static void postBusyCleanup()
ClientApp::inputSystem().ignoreEvents(busyWasIgnoringInput);
DD_ResetTimer();

//BusyVisual_ReleaseTextures();

// Back to unlimited frame rate.
ClientApp::app().loop().setRate(0);

// Switch the window to normal UI.
ClientWindowSystem::main().setMode(ClientWindow::Normal);

if(!Con_TransitionInProgress())
{
ClientWindow::main().busy().releaseTransitionFrame();
}
#endif
}

Expand Down
9 changes: 0 additions & 9 deletions doomsday/apps/client/src/ui/busyvisual.cpp
Expand Up @@ -36,15 +36,6 @@ static void releaseScreenshotTexture()
ClientWindow::main().busy().releaseTransitionFrame();
}

void BusyVisual_ReleaseTextures()
{
// Don't release yet if doing a transition.
if(!Con_TransitionInProgress())
{
releaseScreenshotTexture();
}
}

void BusyVisual_PrepareResources(void)
{
BusyTask* task = BusyMode_CurrentTask();
Expand Down
21 changes: 1 addition & 20 deletions doomsday/apps/client/src/ui/widgets/busywidget.cpp
Expand Up @@ -159,13 +159,11 @@ bool BusyWidget::handleEvent(Event const &)
return true;
}

static TimeDelta const TRANSITION_FRAME_VALID_DURATION = 0.5; // seconds

void BusyWidget::renderTransitionFrame()
{
LOG_AS("BusyWidget");

if(d->haveTransitionFrame() && d->frameDrawnAt.since() < TRANSITION_FRAME_VALID_DURATION)
if(d->haveTransitionFrame())
{
// We already have a valid frame, no need to render again.
LOGDEV_GL_VERBOSE("Skipping rendering of transition frame (got one already)");
Expand All @@ -178,24 +176,10 @@ void BusyWidget::renderTransitionFrame()
DENG_ASSERT_IN_MAIN_THREAD();
DENG_ASSERT_GL_CONTEXT_ACTIVE();

//GLTexture::Size size(rule().width().valuei() / 2,
// rule().height().valuei() / 2);

Rectanglei grabRect = Rectanglei::fromSize(root().window().canvas().size());

LOGDEV_GL_VERBOSE("Rendering transition frame, size ") << grabRect.size().asText();

/*
if(BusyMode_IsTransitionAnimated())
{
// Animation transitions are drawn only inside GameWidget, so just
// grab that portion of the screen.
grabRect = root().window().game().rule().recti();
}
// Grab the game view's rectangle, as that's where the transition will be drawn.
GLuint grabbed = root().window().grabAsTexture(grabRect, ClientWindow::GrabHalfSized);*/

d->transitionFrame.resize(grabRect.size());
if(!d->transitionFrame.isReady())
{
Expand All @@ -207,9 +191,6 @@ void BusyWidget::renderTransitionFrame()
.setViewport(Rectangleui::fromSize(d->transitionFrame.size()))
.apply();

//d->transitionTex.reset(new GLTexture); //grabbed, grabRect.size() / 2));
//d->transitionTex->setUndefinedImage(grabRect.size(), Image::RGB_888);

root().window().as<ClientWindow>().drawGameContent();

GLState::pop().apply();
Expand Down
9 changes: 7 additions & 2 deletions doomsday/apps/client/src/ui/widgets/gamewidget.cpp
Expand Up @@ -27,6 +27,7 @@
#include "ui/busyvisual.h"
#include "ui/clientwindowsystem.h"
#include "ui/widgets/taskbarwidget.h"
#include "ui/widgets/busywidget.h"
#include "dd_def.h"
#include "dd_main.h"
#include "dd_loop.h"
Expand Down Expand Up @@ -152,8 +153,12 @@ void GameWidget::update()

GL_ProcessDeferredTasks(FRAME_DEFERRED_UPLOAD_TIMEOUT);

// Request update of window contents.
//root().as<ClientRootWidget>().window().draw();
// Release the busy transition frame now when we can be sure that busy mode
// is over / didn't start at all.
if(!Con_TransitionInProgress())
{
ClientWindow::main().busy().releaseTransitionFrame();
}
}

void GameWidget::drawContent()
Expand Down

0 comments on commit 5bcb1d1

Please sign in to comment.