mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 22:45:59 +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;
|
||||||
|
@ -179,6 +180,7 @@ void CHyprOpenGLImpl::end() {
|
||||||
|
|
||||||
m_bEndFrame = true;
|
m_bEndFrame = true;
|
||||||
m_bApplyFinalShader = true;
|
m_bApplyFinalShader = true;
|
||||||
|
if (m_RenderData.mouseZoomUseMouse)
|
||||||
m_RenderData.useNearestNeighbor = true;
|
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);
|
||||||
|
@ -192,6 +194,7 @@ void CHyprOpenGLImpl::end() {
|
||||||
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() {
|
||||||
|
|
|
@ -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