Nimbin[12]?SDL & Graphics / sdl_runtime_compiler / src/systems/collision.hpp

sdl_runtime_compiler git · main

SDL3 game for running and compiling code at runtime

sdl3 c++ compiler dlopen cmake · first commit 2026-04-19 · last commit 2026-07-03 (3 months ago) · synced 3 days ago · upstream: git.ide3.de/hsnr/sdl-runtime-compiler

C++ 72.3% C 26.2%
git clone https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler.gitwget https://git.christianimmanuel.de/sdl-graphics/sdl_runtime_compiler/archive/sdl_runtime_compiler.tar.gz
src/systems/collision.hpp 820 B · 35 lines raw
#pragma once

#include "utils/globals.hpp"

namespace
Nimbin
{

class GameObject;

namespace Collision
{
    struct Manifold
    {
        Vec3   normal  {};
        double overlap {};
        bool   hit     = false;
    };

    struct SweptResult
    {
        Vec3   normal {};
        double t      = 0.0;
        bool   hit    = false;
    };

    void        resolve_Objects(GameObject& a, GameObject& b);
    bool        aabb_Overlap   (const GameObject& a, const GameObject& b);
    Manifold    aabb_Manifold  (const GameObject& a, const GameObject& b);
    Vec3        reflect        (const Vec3& vel, const Vec3& normal, double restitution);
    SweptResult swept_RayAabb  (const Vec3& origin, const Vec3& dir,
                                const Vec3& box_min, const Vec3& box_max);
}

} // namespace Nimbin