Toast Engine
Loading...
Searching...
No Matches
anchor_mask.hpp
Go to the documentation of this file.
1
7
8#pragma once
9
10#include <cstdint>
11
12namespace physics {
13
14enum class AnchorFace : uint8_t {
15 neg_x = 0b000001,
16 pos_x = 0b000010,
17 neg_y = 0b000100,
18 pos_y = 0b001000,
19 neg_z = 0b010000,
20 pos_z = 0b100000,
21};
22
23using AnchorMask = uint8_t;
24inline constexpr AnchorMask k_anchor_null = 0;
25inline constexpr AnchorMask k_anchor_bottom = static_cast<AnchorMask>(AnchorFace::neg_z);
26
27constexpr auto anchorFaceBit(AnchorFace face) -> AnchorMask {
28 return static_cast<AnchorMask>(face);
29}
30
31constexpr auto hasAnchorFace(AnchorMask mask, AnchorFace face) -> bool {
32 return (mask & anchorFaceBit(face)) != 0;
33}
34
35}