upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_sandbox.cpp
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-23 17:24:37 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-23 17:24:37 -0500
commitf6a1a114a19bd9a3fa13ce869f5cccb0b68577cd (patch)
tree4e1c894ef474e65004cbd064abdca38091b76431 /runtime/test/vk_sandbox.cpp
parente6b8e21d3ec1d72cdddda0943c7d4a6f82e275b2 (diff)
parent0c5c0b40ad2e4106adb1d7696b40b2ae09b7cee6 (diff)
Merge remote-tracking branch 'origin/pr/9706'
Diffstat (limited to 'runtime/test/vk_sandbox.cpp')
-rw-r--r--runtime/test/vk_sandbox.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/test/vk_sandbox.cpp b/runtime/test/vk_sandbox.cpp
index ffd4309c0..7ae9e8db6 100644
--- a/runtime/test/vk_sandbox.cpp
+++ b/runtime/test/vk_sandbox.cpp
@@ -33,6 +33,7 @@
33#include <cstdlib> 33#include <cstdlib>
34#include <cstring> 34#include <cstring>
35#include <fstream> 35#include <fstream>
36#include <optional>
36#include <string> 37#include <string>
37#include <unordered_map> 38#include <unordered_map>
38#include <vector> 39#include <vector>
@@ -639,7 +640,7 @@ int main(int argc, char** argv) {
639 if (make_swap() < 0) { std::fprintf(stderr, "cannot create a swapchain (TRANSFER_DST unsupported?)\n"); return 1; } 640 if (make_swap() < 0) { std::fprintf(stderr, "cannot create a swapchain (TRANSFER_DST unsupported?)\n"); return 1; }
640 VkSemaphoreCreateInfo semi{VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO}; 641 VkSemaphoreCreateInfo semi{VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO};
641 VkSemaphore acquired; CHECK(vkCreateSemaphore(dev, &semi, nullptr, &acquired)); 642 VkSemaphore acquired; CHECK(vkCreateSemaphore(dev, &semi, nullptr, &acquired));
642 Ground ground; ground.build(scene); 643 std::optional<Ground> ground;
643 auto last = std::chrono::steady_clock::now(); 644 auto last = std::chrono::steady_clock::now();
644 bool shot_held = false; 645 bool shot_held = false;
645 int frame = 0; 646 int frame = 0;
@@ -662,6 +663,10 @@ int main(int argc, char** argv) {
662 cam.pos[0] += r[0] * side * v; cam.pos[1] += r[1] * side * v; 663 cam.pos[0] += r[0] * side * v; cam.pos[1] += r[1] * side * v;
663 cam.pos[2] += (float(key('E')) - float(key('Q'))) * v; 664 cam.pos[2] += (float(key('E')) - float(key('Q'))) * v;
664 } else { 665 } else {
666 if (!ground) {
667 ground.emplace().build(scene);
668 last = std::chrono::steady_clock::now(); // Exclude grid construction from the next movement step.
669 }
665 const float h = std::hypot(f[0], f[1]) > 1e-4f ? std::hypot(f[0], f[1]) : 1; 670 const float h = std::hypot(f[0], f[1]) > 1e-4f ? std::hypot(f[0], f[1]) : 1;
666 if (cam.mode == 1) cam.speed = fwd * (key(VK_SHIFT) ? 7.f : 2.5f); 671 if (cam.mode == 1) cam.speed = fwd * (key(VK_SHIFT) ? 7.f : 2.5f);
667 else { cam.speed += fwd * 12.f * dt; cam.speed *= std::pow(0.6f, dt); cam.yaw -= side * dt * std::clamp(cam.speed / 10.f, -1.f, 1.f); } 672 else { cam.speed += fwd * 12.f * dt; cam.speed *= std::pow(0.6f, dt); cam.yaw -= side * dt * std::clamp(cam.speed / 10.f, -1.f, 1.f); }
@@ -669,7 +674,7 @@ int main(int argc, char** argv) {
669 if (cam.mode == 1) { cam.pos[0] += r[0] * side * 2.5f * dt; cam.pos[1] += r[1] * side * 2.5f * dt; } 674 if (cam.mode == 1) { cam.pos[0] += r[0] * side * 2.5f * dt; cam.pos[1] += r[1] * side * 2.5f * dt; }
670 const float eye = cam.mode == 1 ? 1.7f : 1.2f; 675 const float eye = cam.mode == 1 ? 1.7f : 1.2f;
671 float gz; 676 float gz;
672 if (ground.height(cam.pos[0], cam.pos[1], cam.pos[2] - eye + 0.6f, gz)) cam.pos[2] = gz + eye; 677 if (ground->height(cam.pos[0], cam.pos[1], cam.pos[2] - eye + 0.6f, gz)) cam.pos[2] = gz + eye;
673 } 678 }
674 uint32_t idx = 0; 679 uint32_t idx = 0;
675 if (!swap) { // minimised at start or since the last resize 680 if (!swap) { // minimised at start or since the last resize