MXVK Vulkan Framework
0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
ship.cpp
Go to the documentation of this file.
1
#include "
ship.hpp
"
2
3
namespace
space
{
4
5
glm::vec3
Ship::forward
()
const
{
6
glm::mat4 rot(1.0f);
7
rot = glm::rotate(rot, glm::radians(
rotation
.y), glm::vec3(0.0f, 1.0f, 0.0f));
8
rot = glm::rotate(rot, glm::radians(
rotation
.x), glm::vec3(1.0f, 0.0f, 0.0f));
9
return
normalize_or_zero
(glm::vec3(rot * glm::vec4(0.0f, 0.0f, -1.0f, 0.0f)));
10
}
11
12
}
// namespace space
ship.hpp
Player ship state for the Asteroids simulation.
space::Ship::rotation
glm::vec3 rotation
Euler rotation in degrees.
Definition
ship.hpp:26
space::Ship::forward
glm::vec3 forward() const
Returns the normalized world-space direction in which the ship points.
Definition
ship.cpp:5
space
Definition
asteroids3d_types.hpp:28
space::normalize_or_zero
glm::vec3 normalize_or_zero(const glm::vec3 &value)
Normalizes a direction with a stable fallback.
Definition
asteroids3d_types.hpp:224
examples
asteroids-net
ship.cpp
Generated by
1.16.1