FastEngine 0.9.4
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_vector.hpp
1/*
2 * Copyright 2025 Guillaume Guillet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _FGE_GRAPHIC_C_VECTOR_HPP_INCLUDED
18#define _FGE_GRAPHIC_C_VECTOR_HPP_INCLUDED
19
20#include <cstdint>
21#define GLM_FORCE_CTOR_INIT
22#define GLM_FORCE_DEPTH_ZERO_TO_ONE
23#define GLM_FORCE_LEFT_HANDED
24#include "glm/glm.hpp"
25
26#define FGE_NUMERIC_LIMITS_VECTOR_MAX(_vecType) (_vecType{std::numeric_limits<_vecType::value_type>::max()})
27#define FGE_NUMERIC_LIMITS_VECTOR_MIN(_vecType) (_vecType{std::numeric_limits<_vecType::value_type>::min()})
28
29namespace fge
30{
31
32template<class T>
33using Vector2 = glm::vec<2, T>;
34template<class T>
35using Vector3 = glm::vec<3, T>;
36
37using Vector2i = Vector2<int32_t>;
38using Vector2u = Vector2<uint32_t>;
39using Vector2f = Vector2<float>;
40using Vector2size = Vector2<std::size_t>;
41
42using Vector3i = Vector3<int32_t>;
43using Vector3u = Vector3<uint32_t>;
44using Vector3f = Vector3<float>;
45
46} // namespace fge
47
48namespace glm
49{
50
51inline glm::vec2 operator*(glm::mat4 const& left, glm::vec2 const& right)
52{
53 return left * glm::vec4(right, 0.0f, 1.0f);
54}
55
56} // namespace glm
57
58#endif //_FGE_GRAPHIC_C_VECTOR_HPP_INCLUDED