sdl3_3d_oop_basic_game git · main
SDL3 3D OOP basic game (entities, systems, CMake)
C++ 99%git clone https://git.christianimmanuel.de/sdl-graphics/sdl3_3d_oop_basic_game.gitwget https://git.christianimmanuel.de/sdl-graphics/sdl3_3d_oop_basic_game/archive/sdl3_3d_oop_basic_game.tar.gzsrc/entities/world.hpp raw
#pragma once
#include <array>
#include "entities/player.hpp"
#include "entities/camera.hpp"
#define MAP_BOX_SCALE 16
#define MAP_BOX_EDGES_LEN (12 + MAP_BOX_SCALE * 2)
struct Edge {
Vec3 a;
Vec3 b;
};
struct SweepResult {
Vec3 pos;
Vec3 vel;
bool hit_x{};
bool hit_y{};
bool hit_z{};
};
class World {
public:
World();
PlayerCollision resolvePlayer(const Player& player) const;
void draw(SDL_Renderer* renderer, const Camera& camera) const;
Vec3 spawnPoint() const;
float scale() const;
private:
void initEdges();
float world_scale{16.0f};
std::array<Edge, MAP_BOX_EDGES_LEN> edges{};
};