9#include <vulkan/vulkan.h>
26 VkVertexInputBindingDescription bindingDescription{};
27 bindingDescription.binding = 0;
28 bindingDescription.stride =
sizeof(
Vertex);
29 bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
31 return bindingDescription;
36 std::vector<VkVertexInputAttributeDescription> attributeDescriptions(3);
38 attributeDescriptions[0].binding = 0;
39 attributeDescriptions[0].location = 0;
40 attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT;
41 attributeDescriptions[0].offset = offsetof(
Vertex,
pos);
43 attributeDescriptions[1].binding = 0;
44 attributeDescriptions[1].location = 1;
45 attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT;
46 attributeDescriptions[1].offset = offsetof(
Vertex,
normal);
48 attributeDescriptions[2].binding = 0;
49 attributeDescriptions[2].location = 2;
50 attributeDescriptions[2].format = VK_FORMAT_R32G32_SFLOAT;
53 return attributeDescriptions;
68 constexpr static inline glm::dvec3
chest_size = glm::dvec3(8.0, 12.0, 4.0) *
unit;
69 constexpr static inline glm::dvec3
head_size = glm::dvec3(8.0, 8.0, 8.0) *
unit;
70 constexpr static inline glm::dvec3
leg_size = glm::dvec3(4.0, 12.0, 4.0) *
unit;
71 constexpr static inline glm::dvec3
arm_size = glm::dvec3(4.0, 12.0, 4.0) *
unit;
96 m_start_time = std::chrono::steady_clock::now().time_since_epoch();
97 m_should_stop =
false;
103 m_should_stop =
true;
108 return static_cast<double>((std::chrono::steady_clock::now().time_since_epoch() - m_start_time).count()) / 1e9;
118 return m_direction * amplitude_x * glm::sin(frequency *
time_since_start());
128 m_should_stop =
false;
132 m_start_time = std::chrono::steady_clock::now().time_since_epoch();
133 m_direction = -m_direction;
140 bool m_is_active =
false;
141 bool m_should_stop =
false;
143 std::chrono::nanoseconds m_start_time = std::chrono::nanoseconds(0);
145 constexpr static inline double amplitude_x = 0.5;
147 constexpr static inline double duration_s = 0.35;
149 constexpr static inline double frequency = glm::pi<double>() / duration_s;
164 m_start_time = std::chrono::steady_clock::now().time_since_epoch();
165 m_should_stop =
true;
170 m_should_stop =
true;
175 return static_cast<double>((std::chrono::steady_clock::now().time_since_epoch() - m_start_time).count()) / 1e9;
205 m_should_stop =
false;
209 m_start_time = std::chrono::steady_clock::now().time_since_epoch();
216 bool m_is_active =
false;
217 bool m_should_stop =
false;
218 std::chrono::nanoseconds m_start_time = std::chrono::nanoseconds(0);
220 constexpr static inline double amplitude_x = 1.0;
221 constexpr static inline double amplitude_y = -0.8;
222 constexpr static inline double amplitude_z = 0.3;
224 constexpr static inline double duration_s = 0.2;
226 constexpr static inline double frequency = glm::pi<double>() / duration_s;
Definition: Model.hpp:154
double time_since_start() const
Definition: Model.hpp:173
AttackAnimation()=default
double angleY() const
Definition: Model.hpp:188
double angleX() const
Definition: Model.hpp:183
void update()
Definition: Model.hpp:198
double angleZ() const
Definition: Model.hpp:193
void stop()
Definition: Model.hpp:168
void start()
Definition: Model.hpp:161
bool isActive() const
Definition: Model.hpp:178
~AttackAnimation()=default
void update()
Definition: Model.hpp:121
void stop()
Definition: Model.hpp:101
void start()
Definition: Model.hpp:93
double time_since_start() const
Definition: Model.hpp:106
double angle() const
Definition: Model.hpp:116
bool isActive() const
Definition: Model.hpp:111
PlayerModel()
Definition: Model.hpp:57
static constexpr glm::dvec3 arm_size
Definition: Model.hpp:71
static constexpr glm::vec3 right_leg_pos
Definition: Model.hpp:81
static constexpr double unit
Definition: Model.hpp:66
static constexpr glm::dvec3 chest_size
Definition: Model.hpp:68
PlayerModel & operator=(PlayerModel &other)=delete
static constexpr glm::vec3 left_leg_pos
Definition: Model.hpp:80
static constexpr glm::dvec3 head_size
Definition: Model.hpp:69
static constexpr glm::vec3 right_arm_pos
Definition: Model.hpp:83
PlayerModel & operator=(PlayerModel &&other)=delete
PlayerModel(PlayerModel &&other)=delete
static constexpr glm::vec3 head_pos
Definition: Model.hpp:79
~PlayerModel()
Definition: Model.hpp:58
static constexpr glm::dvec3 leg_size
Definition: Model.hpp:70
static constexpr glm::vec3 chest_pos
Definition: Model.hpp:78
static constexpr double player_height
Definition: Model.hpp:65
static constexpr glm::vec3 left_arm_pos
Definition: Model.hpp:82
PlayerModel(PlayerModel &other)=delete
glm::vec3 normal
Definition: Model.hpp:21
static std::vector< VkVertexInputAttributeDescription > getAttributeDescriptions()
Definition: Model.hpp:34
glm::vec2 texCoord
Definition: Model.hpp:22
static VkVertexInputBindingDescription getBindingDescription()
Definition: Model.hpp:24
glm::vec3 pos
Definition: Model.hpp:20