use tiled atlas texture sampling, increase shader speed using inv sqrt

This commit is contained in:
asrael 2026-02-02 17:48:25 -06:00
parent 0c0aa792c1
commit 1f717b7c61
57 changed files with 3681 additions and 2982 deletions

View file

@ -393,13 +393,16 @@ pxl8_result pxl8_update(pxl8* sys) {
}
#ifdef PXL8_ASYNC_THREADS
if (game->world && (pxl8_world_local_player(game->world))) {
if (game->world) {
pxl8_input_msg msg = {0};
msg.move_x = (pxl8_key_down(&game->input, "d") ? 1.0f : 0.0f) - (pxl8_key_down(&game->input, "a") ? 1.0f : 0.0f);
msg.move_y = (pxl8_key_down(&game->input, "w") ? 1.0f : 0.0f) - (pxl8_key_down(&game->input, "s") ? 1.0f : 0.0f);
msg.look_dx = (f32)pxl8_mouse_dx(&game->input);
msg.look_dy = (f32)pxl8_mouse_dy(&game->input);
if (game->input.mouse_relative_mode) {
msg.look_dx = (f32)pxl8_mouse_dx(&game->input);
msg.look_dy = (f32)pxl8_mouse_dy(&game->input);
}
msg.buttons = pxl8_key_down(&game->input, "space") ? 1 : 0;
pxl8_world_push_input(game->world, &msg);
}
pxl8_net_update(game->net, dt);
@ -409,7 +412,6 @@ pxl8_result pxl8_update(pxl8* sys) {
pxl8_net_update(game->net, dt);
pxl8_world_sync(game->world, game->net);
}
pxl8_world_update(game->world, &game->input, dt);
#endif
@ -563,9 +565,6 @@ void pxl8_set_relative_mouse_mode(pxl8* sys, bool enabled) {
sys->hal->set_relative_mouse_mode(sys->platform_data, enabled);
if (sys->game) {
sys->game->input.mouse_relative_mode = enabled;
#ifdef PXL8_ASYNC_THREADS
pxl8_world_pause_sim(sys->game->world, !enabled);
#endif
}
}

View file

@ -2,6 +2,14 @@
#include <string.h>
#if defined(__GNUC__) || defined(__clang__)
#define pxl8_likely(x) __builtin_expect(!!(x), 1)
#define pxl8_unlikely(x) __builtin_expect(!!(x), 0)
#else
#define pxl8_likely(x) (x)
#define pxl8_unlikely(x) (x)
#endif
#ifndef pxl8_min
#define pxl8_min(a, b) ((a) < (b) ? (a) : (b))
#endif