From 310889bd2c4d22bca958c66ef63f97da4c72f0f0 Mon Sep 17 00:00:00 2001 From: mid <> Date: Sat, 10 May 2025 19:18:58 +0300 Subject: [PATCH] things --- src/main.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/main.c b/src/main.c index a5fc860..b887ee9 100644 --- a/src/main.c +++ b/src/main.c @@ -382,26 +382,12 @@ static int gr_lowres(int newW, int newH) { } k3TexUpdate(lowresDepth, k3_DEPTH, 0, newW, newH, NULL); - lowresOffscreen = k3OffscreenCreate(lowres, lowresDepth); + lowresOffscreen = k3OffscreenCreateMultisampled(lowres, lowresDepth, 4); } return !!lowresOffscreen; } -#define MAX_RAYS 64 -static struct LocalRay RaysToCast[MAX_RAYS]; -static size_t RaysToCastCount = 0; - -struct LocalRay *request_ray(struct LocalRay *lr) { - if(RaysToCastCount == MAX_RAYS) { - return NULL; - } - - memcpy(RaysToCast + RaysToCastCount, lr, sizeof(*lr)); - - return &RaysToCast[RaysToCastCount++]; -} - int main(int argc_, char **argv_) { argc = argc_; argv = argv_; @@ -480,9 +466,6 @@ int main(int argc_, char **argv_) { } } - game_raycast(RaysToCast, RaysToCastCount); - RaysToCastCount = 0; - while(accumulator >= 1. / GAME_TPS) { for(size_t i = 0; i < Game.entities.renderCount; i++) { glm_vec4_copy(Game.entities.render[i].pos, Game.entities.render[i].posLast); @@ -509,10 +492,10 @@ int main(int argc_, char **argv_) { glfwGetFramebufferSize(GameWnd, &width, &height); mat4 proj; - glm_perspective(glm_rad(LuaapiFov), (float) width / height, 0.01f, 100.f, proj); + glm_perspective(glm_rad(LuaapiFov), (float) width / height, 0.1f, 80.f, proj); /* Third-person camera movement */ - struct LocalRay camray; + struct LocalRay camray = {}; if(Game.spectated != ENT_ID_INVALID) { struct CRender *c = game_getcomponent(Game.spectated, render); if(c) { @@ -533,6 +516,9 @@ int main(int argc_, char **argv_) { } mat4 cam; + if(InstantCamShift) { + InstantCamShift--; + } if(LuaapiFirstPerson) { struct CRender *c = game_getcomponent(Game.spectated, render); @@ -551,10 +537,15 @@ int main(int argc_, char **argv_) { vec3 almostThere; if(LuaapiCamFocus) { + float lerpa = InstantCamShift ? 1 : 0.1; + glm_vec3_copy(LuaapiCamFocusPos, almostThere); glm_vec3_lerp(CamPos, almostThere, 0.1, CamPos); + glm_vec3_copy(LuaapiCamFocusPos, CamPos); glm_look(CamPos, LuaapiCamFocusDir, (vec3) {0, 1, 0}, cam); } else { + float lerpa = InstantCamShift ? 1 : 0.2; + vec3 dirneg; glm_vec3_negate_to(camray.dir, dirneg); @@ -668,7 +659,7 @@ int main(int argc_, char **argv_) { // Shadowmap debugging if(glfwGetKey(GameWnd, GLFW_KEY_F5) == GLFW_PRESS) { - k3BlitToScreen(shadowmapOffscreen, 0); + k3BlitToScreenEffect(shadowmapOffscreen, 0, k3_ARBFRAG, shadowmapDebugThing, NULL); } glfwSwapBuffers(GameWnd);