More 2D improvements

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-09-30 17:32:06 +03:00
parent 389c1f9934
commit 3fcf769aff

View File

@@ -1,5 +1,6 @@
#include "LunarWM_wayland.h"
#include "LunarWM_core.h"
#include "LunarWM_render.h"
#include "common.h"
#include "raylib.h"
@@ -1577,8 +1578,6 @@ static void handle_output_frame(struct wl_listener *listener, void *data)
}
if (!wlr_output_commit_state(wlr_output, &state)) {
wlr_log(WLR_ERROR, "Failed to commit state for output %s",
wlr_output->name);
wlr_output_state_finish(&state);
wlr_output_schedule_frame(wlr_output);
return;
@@ -1602,6 +1601,10 @@ static void handle_output_frame(struct wl_listener *listener, void *data)
rlFramebufferAttach(wm->renderer.tmp_rt.id, wm->renderer.tmp_rt.depth.id,
RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_RENDERBUFFER, 0);
if (!wm->xr.available) {
wm->renderer.camera.target = SphericalToVector3(wm->wm.pointer);
}
int const hud_size = wm->cman->cfg.displays.hud.size;
if (!IsTextureValid(wm->renderer.hud_rt.texture)) {
wm->renderer.hud_rt = LoadRenderTexture(hud_size, hud_size);
@@ -1647,6 +1650,13 @@ static void handle_output_frame(struct wl_listener *listener, void *data)
}
EndTextureMode();
if (wm->renderer.first_frame) {
LunarWM_set_recenter_from_camera(wm);
wm->renderer.first_frame = false;
wm->wm.pointer = get_forward_spherical_with_nearest(
wm->renderer.camera.target, wm->cman->cfg.space.radius);
}
wlr_output_state_finish(&state);
}