mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Small rendering optimization for the system and gamelist views
This commit is contained in:
parent
c41cc5a94f
commit
97d26718a3
|
@ -416,26 +416,20 @@ void GamelistView::render(const glm::mat4& parentTrans)
|
||||||
const ViewController::State viewState {ViewController::getInstance()->getState()};
|
const ViewController::State viewState {ViewController::getInstance()->getState()};
|
||||||
bool stationaryApplicable {false};
|
bool stationaryApplicable {false};
|
||||||
|
|
||||||
auto renderChildFunc = [this, &viewState](int i, glm::mat4 trans) {
|
auto renderChildCondFunc = [this, &viewState](int i, glm::mat4 trans) {
|
||||||
if (getChild(i)->getRenderDuringTransitions()) {
|
bool renderChild {false};
|
||||||
|
if (!ViewController::getInstance()->isCameraMoving())
|
||||||
|
renderChild = true;
|
||||||
|
else if (viewState.previouslyViewed == ViewController::ViewMode::NOTHING)
|
||||||
|
renderChild = true;
|
||||||
|
else if (viewState.viewing == viewState.previouslyViewed)
|
||||||
|
renderChild = true;
|
||||||
|
else if (static_cast<ViewTransitionAnimation>(Settings::getInstance()->getInt(
|
||||||
|
"TransitionsGamelistToSystem")) != ViewTransitionAnimation::SLIDE &&
|
||||||
|
viewState.viewing == ViewController::ViewMode::SYSTEM_SELECT)
|
||||||
|
renderChild = true;
|
||||||
|
if (renderChild)
|
||||||
getChild(i)->render(trans);
|
getChild(i)->render(trans);
|
||||||
}
|
|
||||||
else {
|
|
||||||
bool renderChild {false};
|
|
||||||
if (!ViewController::getInstance()->isCameraMoving())
|
|
||||||
renderChild = true;
|
|
||||||
else if (viewState.previouslyViewed == ViewController::ViewMode::NOTHING)
|
|
||||||
renderChild = true;
|
|
||||||
else if (viewState.viewing == viewState.previouslyViewed)
|
|
||||||
renderChild = true;
|
|
||||||
else if (static_cast<ViewTransitionAnimation>(Settings::getInstance()->getInt(
|
|
||||||
"TransitionsGamelistToSystem")) != ViewTransitionAnimation::SLIDE &&
|
|
||||||
viewState.viewing == ViewController::ViewMode::SYSTEM_SELECT)
|
|
||||||
renderChild = true;
|
|
||||||
|
|
||||||
if (renderChild)
|
|
||||||
getChild(i)->render(trans);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// If it's the startup animation, then don't apply stationary properties.
|
// If it's the startup animation, then don't apply stationary properties.
|
||||||
|
@ -489,11 +483,17 @@ void GamelistView::render(const glm::mat4& parentTrans)
|
||||||
if (viewState.getSystem() != mRoot->getSystem())
|
if (viewState.getSystem() != mRoot->getSystem())
|
||||||
continue;
|
continue;
|
||||||
mRenderer->popClipRect();
|
mRenderer->popClipRect();
|
||||||
renderChildFunc(i, mRenderer->getIdentity());
|
if (getChild(i)->getRenderDuringTransitions())
|
||||||
|
getChild(i)->render(mRenderer->getIdentity());
|
||||||
|
else
|
||||||
|
renderChildCondFunc(i, mRenderer->getIdentity());
|
||||||
clipRectFunc();
|
clipRectFunc();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
renderChildFunc(i, trans);
|
if (getChild(i)->getRenderDuringTransitions())
|
||||||
|
getChild(i)->render(trans);
|
||||||
|
else
|
||||||
|
renderChildCondFunc(i, trans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1476,27 +1476,20 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
||||||
glm::ivec2 {static_cast<int>(mSize.x), static_cast<int>(mSize.y)});
|
glm::ivec2 {static_cast<int>(mSize.x), static_cast<int>(mSize.y)});
|
||||||
};
|
};
|
||||||
|
|
||||||
auto renderChildFunc = [this, &viewState](GuiComponent* child, glm::mat4 trans) {
|
auto renderChildCondFunc = [this, &viewState](GuiComponent* child, glm::mat4 trans) {
|
||||||
if (child->getRenderDuringTransitions()) {
|
bool renderChild {false};
|
||||||
|
if (!ViewController::getInstance()->isCameraMoving())
|
||||||
|
renderChild = true;
|
||||||
|
else if (viewState.previouslyViewed == ViewController::ViewMode::NOTHING)
|
||||||
|
renderChild = true;
|
||||||
|
else if (viewState.viewing == viewState.previouslyViewed)
|
||||||
|
renderChild = true;
|
||||||
|
else if (static_cast<ViewTransitionAnimation>(Settings::getInstance()->getInt(
|
||||||
|
"TransitionsSystemToGamelist")) != ViewTransitionAnimation::SLIDE &&
|
||||||
|
viewState.viewing == ViewController::ViewMode::GAMELIST)
|
||||||
|
renderChild = true;
|
||||||
|
if (renderChild)
|
||||||
child->render(trans);
|
child->render(trans);
|
||||||
}
|
|
||||||
else {
|
|
||||||
bool renderChild {false};
|
|
||||||
if (!ViewController::getInstance()->isCameraMoving())
|
|
||||||
renderChild = true;
|
|
||||||
else if (viewState.previouslyViewed == ViewController::ViewMode::NOTHING)
|
|
||||||
renderChild = true;
|
|
||||||
else if (viewState.viewing == viewState.previouslyViewed)
|
|
||||||
renderChild = true;
|
|
||||||
else if (static_cast<ViewTransitionAnimation>(
|
|
||||||
Settings::getInstance()->getInt("TransitionsSystemToGamelist")) !=
|
|
||||||
ViewTransitionAnimation::SLIDE &&
|
|
||||||
viewState.viewing == ViewController::ViewMode::GAMELIST)
|
|
||||||
renderChild = true;
|
|
||||||
|
|
||||||
if (renderChild)
|
|
||||||
child->render(trans);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
clipRectFunc();
|
clipRectFunc();
|
||||||
|
@ -1543,11 +1536,17 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
||||||
if (renderChild) {
|
if (renderChild) {
|
||||||
if (childStationary) {
|
if (childStationary) {
|
||||||
mRenderer->popClipRect();
|
mRenderer->popClipRect();
|
||||||
renderChildFunc(child, mRenderer->getIdentity());
|
if (child->getRenderDuringTransitions())
|
||||||
|
child->render(mRenderer->getIdentity());
|
||||||
|
else
|
||||||
|
renderChildCondFunc(child, mRenderer->getIdentity());
|
||||||
clipRectFunc();
|
clipRectFunc();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
renderChildFunc(child, elementTrans);
|
if (child->getRenderDuringTransitions())
|
||||||
|
child->render(elementTrans);
|
||||||
|
else
|
||||||
|
renderChildCondFunc(child, elementTrans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1557,11 +1556,17 @@ void SystemView::renderElements(const glm::mat4& parentTrans, bool abovePrimary)
|
||||||
if (renderChild) {
|
if (renderChild) {
|
||||||
if (childStationary) {
|
if (childStationary) {
|
||||||
mRenderer->popClipRect();
|
mRenderer->popClipRect();
|
||||||
renderChildFunc(child, mRenderer->getIdentity());
|
if (child->getRenderDuringTransitions())
|
||||||
|
child->render(mRenderer->getIdentity());
|
||||||
|
else
|
||||||
|
renderChildCondFunc(child, mRenderer->getIdentity());
|
||||||
clipRectFunc();
|
clipRectFunc();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
renderChildFunc(child, elementTrans);
|
if (child->getRenderDuringTransitions())
|
||||||
|
child->render(elementTrans);
|
||||||
|
else
|
||||||
|
renderChildCondFunc(child, elementTrans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue