mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 08:05:58 +01:00
Renderer: add init animation
This commit is contained in:
parent
11e87986a2
commit
ddfeebad3d
4 changed files with 39 additions and 12 deletions
|
@ -158,12 +158,13 @@ void CHyprOpenGLImpl::end() {
|
||||||
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
||||||
|
|
||||||
if (m_RenderData.mouseZoomFactor != 1.f) {
|
if (m_RenderData.mouseZoomFactor != 1.f) {
|
||||||
const auto MOUSEPOS = g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition;
|
const auto ZOOMCENTER =
|
||||||
monbox.x -= MOUSEPOS.x;
|
m_RenderData.mouseZoomUseMouse ? g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition : m_RenderData.pMonitor->vecSize / 2.f;
|
||||||
monbox.y -= MOUSEPOS.y;
|
monbox.x -= ZOOMCENTER.x;
|
||||||
|
monbox.y -= ZOOMCENTER.y;
|
||||||
scaleBox(&monbox, m_RenderData.mouseZoomFactor);
|
scaleBox(&monbox, m_RenderData.mouseZoomFactor);
|
||||||
monbox.x += *PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize.x / 2 : MOUSEPOS.x;
|
monbox.x += *PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize.x / 2 : ZOOMCENTER.x;
|
||||||
monbox.y += *PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize.y / 2 : MOUSEPOS.y;
|
monbox.y += *PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize.y / 2 : ZOOMCENTER.y;
|
||||||
|
|
||||||
if (monbox.x > 0)
|
if (monbox.x > 0)
|
||||||
monbox.x = 0;
|
monbox.x = 0;
|
||||||
|
@ -177,9 +178,10 @@ void CHyprOpenGLImpl::end() {
|
||||||
|
|
||||||
clear(CColor(11.0 / 255.0, 11.0 / 255.0, 11.0 / 255.0, 1.0));
|
clear(CColor(11.0 / 255.0, 11.0 / 255.0, 11.0 / 255.0, 1.0));
|
||||||
|
|
||||||
m_bEndFrame = true;
|
m_bEndFrame = true;
|
||||||
m_bApplyFinalShader = true;
|
m_bApplyFinalShader = true;
|
||||||
m_RenderData.useNearestNeighbor = true;
|
if (m_RenderData.mouseZoomUseMouse)
|
||||||
|
m_RenderData.useNearestNeighbor = true;
|
||||||
|
|
||||||
renderTexture(m_RenderData.pCurrentMonData->primaryFB.m_cTex, &monbox, 1.f, 0);
|
renderTexture(m_RenderData.pCurrentMonData->primaryFB.m_cTex, &monbox, 1.f, 0);
|
||||||
|
|
||||||
|
@ -189,9 +191,10 @@ void CHyprOpenGLImpl::end() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset our data
|
// reset our data
|
||||||
m_RenderData.pMonitor = nullptr;
|
m_RenderData.pMonitor = nullptr;
|
||||||
m_iWLROutputFb = 0;
|
m_iWLROutputFb = 0;
|
||||||
m_RenderData.mouseZoomFactor = 1.f;
|
m_RenderData.mouseZoomFactor = 1.f;
|
||||||
|
m_RenderData.mouseZoomUseMouse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::initShaders() {
|
void CHyprOpenGLImpl::initShaders() {
|
||||||
|
@ -816,7 +819,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::markBlurDirtyForMonitor(CMonitor* pMonitor) {
|
void CHyprOpenGLImpl::markBlurDirtyForMonitor(CMonitor* pMonitor) {
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pMonitor->activeWorkspace);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pMonitor->activeWorkspace);
|
||||||
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(pMonitor->activeWorkspace);
|
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(pMonitor->activeWorkspace);
|
||||||
|
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL && PFULLWINDOW && !PFULLWINDOW->m_vRealSize.isBeingAnimated() &&
|
if (PWORKSPACE->m_bHasFullscreenWindow && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL && PFULLWINDOW && !PFULLWINDOW->m_vRealSize.isBeingAnimated() &&
|
||||||
|
|
|
@ -76,6 +76,7 @@ struct SCurrentRenderData {
|
||||||
|
|
||||||
SRenderModifData renderModif;
|
SRenderModifData renderModif;
|
||||||
float mouseZoomFactor = 1.f;
|
float mouseZoomFactor = 1.f;
|
||||||
|
bool mouseZoomUseMouse = true; // true by default
|
||||||
bool useNearestNeighbor = false;
|
bool useNearestNeighbor = false;
|
||||||
|
|
||||||
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
|
Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1);
|
||||||
|
|
|
@ -788,6 +788,20 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
if (!*PDAMAGEBLINK)
|
if (!*PDAMAGEBLINK)
|
||||||
damageBlinkCleanup = 0;
|
damageBlinkCleanup = 0;
|
||||||
|
|
||||||
|
static bool firstLaunch = true;
|
||||||
|
|
||||||
|
float zoomInFactorFirstLaunch = 1.f;
|
||||||
|
|
||||||
|
if (firstLaunch) {
|
||||||
|
firstLaunch = false;
|
||||||
|
m_tRenderTimer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_tRenderTimer.getSeconds() < 1.5f) { // TODO: make the animation system more damage-flexible so that this can be migrated to there
|
||||||
|
zoomInFactorFirstLaunch = 2.f - g_pAnimationManager->getBezier("default")->getYForPoint(m_tRenderTimer.getSeconds() / 1.5);
|
||||||
|
damageMonitor(pMonitor);
|
||||||
|
}
|
||||||
|
|
||||||
startRender = std::chrono::high_resolution_clock::now();
|
startRender = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
if (*PDEBUGOVERLAY == 1) {
|
if (*PDEBUGOVERLAY == 1) {
|
||||||
|
@ -970,6 +984,12 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
else
|
else
|
||||||
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = 1.f;
|
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = 1.f;
|
||||||
|
|
||||||
|
if (zoomInFactorFirstLaunch > 1.f) {
|
||||||
|
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = zoomInFactorFirstLaunch;
|
||||||
|
g_pHyprOpenGL->m_RenderData.mouseZoomUseMouse = false;
|
||||||
|
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = false;
|
||||||
|
}
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("render", RENDER_LAST_MOMENT);
|
EMIT_HOOK_EVENT("render", RENDER_LAST_MOMENT);
|
||||||
|
|
||||||
g_pHyprOpenGL->end();
|
g_pHyprOpenGL->end();
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../helpers/Workspace.hpp"
|
#include "../helpers/Workspace.hpp"
|
||||||
#include "../Window.hpp"
|
#include "../Window.hpp"
|
||||||
#include "OpenGL.hpp"
|
#include "OpenGL.hpp"
|
||||||
|
#include "../helpers/Timer.hpp"
|
||||||
|
|
||||||
struct SMonitorRule;
|
struct SMonitorRule;
|
||||||
|
|
||||||
|
@ -69,6 +70,8 @@ class CHyprRenderer {
|
||||||
float m_fCrashingDistort = 0.5f;
|
float m_fCrashingDistort = 0.5f;
|
||||||
wl_event_source* m_pCrashingLoop = nullptr;
|
wl_event_source* m_pCrashingLoop = nullptr;
|
||||||
|
|
||||||
|
CTimer m_tRenderTimer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*);
|
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, wlr_box*);
|
||||||
void renderWorkspaceWithFullscreenWindow(CMonitor*, CWorkspace*, timespec*);
|
void renderWorkspaceWithFullscreenWindow(CMonitor*, CWorkspace*, timespec*);
|
||||||
|
|
Loading…
Reference in a new issue