summaryrefslogtreecommitdiffhomepage
path: root/src/raycast.hpp
blob: 6463a143545845fd09708dfb6af4b9b73a9a88e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "src/object-id.hpp"
#include "src/collision.hpp"
#include "src/point.hpp"

namespace floormat {

class world;

} // namespace floormat

namespace floormat::rc {

struct raycast_diag_s;

struct raycast_result_s
{
    point from, to, collision;
    collision_data collider;
    float time = 0;
    bool has_result : 1 = false,
         success    : 1 = false;
};

[[nodiscard]] raycast_result_s raycast(world& w, point from, point to, object_id self);
[[nodiscard]] raycast_result_s raycast_with_diag(raycast_diag_s& diag, world& w, point from, point to, object_id self);

} // namespace floormat::rc

namespace floormat {

using floormat::rc::raycast;

} // namespace floormat