basic level rendering

This commit is contained in:
2026-04-01 02:40:09 -03:00
parent 9490f162e3
commit 339fe842fb
11 changed files with 53 additions and 20 deletions

View File

@@ -26,14 +26,13 @@ bounds_of(const trb::game::scene &scene) {
auto min = glm::vec3(std::numeric_limits<float>::infinity());
auto max = glm::vec3(-std::numeric_limits<float>::infinity());
const auto is_mesh_node = [](const auto &v) {
return std::holds_alternative<trb::game::mesh_node>(v);
};
for (const auto &mesh : scene.meshes) {
const auto transform = [mesh](glm::vec3 p) {
return glm::vec3(mesh.transform * glm::vec4(p, 1.0f));
};
for (const auto [position, normal, uv] : mesh.vertices) {
min = glm::min(min, position);
max = glm::max(max, position);
min = glm::min(min, transform(position));
max = glm::max(max, transform(position));
}
}
@@ -103,7 +102,7 @@ void engine::run() {
try {
const auto [map_min, map_max] = ::bounds_of(level_border);
const auto [view, projection] = ::calculate_camera_matrices(
map_min, map_max, 1920.0f / 1080.0f, 1.1f);
map_min, map_max, 1920.0f / 1080.0f, 3.0f);
renderer.render(level_border_render_ids, view, projection);
} catch (const vuk::VkException &ex) {
if (ex.what() != std::string("Out of date.")) {