-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase_types.hpp
More file actions
68 lines (56 loc) · 2.05 KB
/
base_types.hpp
File metadata and controls
68 lines (56 loc) · 2.05 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
#include "pch.h"
#include "sern.hpp"
namespace br2proj {
using matrix4x4 = aiMatrix4x4;
using vector3 = aiVector3D;
using vector2 = aiVector2D;
using quaternion = aiQuaternion;
using string = std::string;
using size_t = std::size_t;
template<typename T, std::size_t Size>
using array = std::array<T, Size>;
template<typename T>
using vector = std::vector<T>;
template<std::size_t Size>
using byte_array = std::array<std::uint8_t, Size>;//TODO перейти на std::byte или unsigned char
template<std::floating_point T>
struct vector2t { T x, y; };
template<std::floating_point T>
struct vector3t { T x, y, z; };
template<std::integral T>
struct trianglet { T a, b, c; };
template<typename T>
struct bound_boxt { T start, end; };
//Фиксированные и доступные для сериализации типы
template<std::size_t Size>
using fstring = array<char, Size>;
using byte = std::byte;
using uint16 = std::uint16_t;
using int16 = std::int16_t;
using int32 = std::int32_t;
using uint32 = std::uint32_t;
using int64 = std::int64_t;
using float32 = float;
static_assert(std::numeric_limits<float32>::is_iec559);
template <int16 V>
using eint16 = sern::enumb<decltype(V), V>;
template <int32 V>
using eint32 = sern::enumb<decltype(V), V>;
template <uint16 V>
using euint16 = sern::enumb<decltype(V), V>;
template <uint32 V>
using euint32 = sern::enumb<decltype(V), V>;
template <int16 Min, int16 Max>
using ebint16 = sern::ebnumb<int16, Min, Max>;
template <int32 Min, int32 Max>
using ebint32 = sern::ebnumb<int32, Min, Max>;
template <uint16 Min, uint16 Max>
using ebuint16 = sern::ebnumb<uint16, Min, Max>;
template <uint32 Min, uint32 Max>
using ebuint32 = sern::ebnumb<uint32, Min, Max>;
template<class TEnum>//std::underlying_type_t<TEnum> First = , std::underlying_type_t<TEnum> Last =
using eb_enum = sern::ebnumb<TEnum, TEnum::first, TEnum::last>;
template<size_t Size>
using ealign = sern::ealign<Size, byte, array<byte, Size>>;
}