IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
math
public
ice
math
lookat.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/math.hxx
>
6
7
namespace
ice::math
8
{
9
10
inline
auto
lookat
(
11
vec<3, f32>
pos,
12
vec<3, f32>
target,
13
vec<3, f32>
up
14
)
noexcept
->
mat<4, 4, f32>
;
15
16
inline
auto
lookat
(
17
vec<3, f32>
pos,
18
vec<3, f32>
target,
19
vec<3, f32>
up
20
)
noexcept
->
mat<4, 4, f32>
21
{
22
vec<3, f32>
const
dir =
normalize
(pos - target);
23
vec<3, f32>
const
right =
normalize
(
cross
(up, dir));
24
vec<3, f32>
const
view_up =
cross
(dir, right);
25
26
mat<4, 4, f32>
const
temp {
27
right.
v
[0][0], view_up.
v
[0][0], dir.
v
[0][0], 0.0f,
28
right.
v
[0][1], view_up.
v
[0][1], dir.
v
[0][1], 0.0f,
29
right.
v
[0][2], view_up.
v
[0][2], dir.
v
[0][2], 0.0f,
30
0.0f, 0.0f, 0.0f, 1.0f,
31
};
32
return
temp *
translate
(-pos);
33
}
34
35
}
// namespace core::math
math.hxx
ice::math
Definition
algorithm.hxx:8
ice::math::vec
mat< Size, 1, T > vec
Definition
vector.hxx:172
ice::math::normalize
auto normalize(vec< Size, T > value) noexcept -> vec< Size, T >
Definition
vector_operations.hxx:137
ice::math::lookat
auto lookat(vec< 3, f32 > pos, vec< 3, f32 > target, vec< 3, f32 > up) noexcept -> mat< 4, 4, f32 >
Definition
lookat.hxx:16
ice::math::translate
constexpr auto translate(vec< 2, f32 > displacement) noexcept -> mat< 3, 3, f32 >
Definition
translate.hxx:20
ice::math::cross
constexpr auto cross(vec< 3, f32 > left, vec< 3, f32 > right) noexcept -> vec< 3, f32 >
Definition
vector_operations.hxx:115
ice::math::mat
Definition
matrix.hxx:12
ice::math::mat::v
T v[count_columns][count_rows]
Definition
matrix.hxx:17
Generated by
1.18.0