/apps/demos/scenery: add walking

This commit is contained in:
veclavtalica
2025-01-02 13:26:16 +03:00
parent dc2535358e
commit 4277852fc5
3 changed files with 154 additions and 31 deletions

View File

@ -33,6 +33,10 @@ static inline float vec3_dot(Vec3 a, Vec3 b) {
return a.x * b.x + a.y * b.y + a.z * b.z;
}
static inline float vec3_length(Vec3 a) {
return sqrtf(a.x * a.x + a.y * a.y + a.z * a.z);
}
static inline Vec3 vec3_cross(Vec3 a, Vec3 b) {
return (Vec3) {
a.y * b.z - a.z * b.y,
@ -78,6 +82,10 @@ static inline Vec3 vec3_rotate(Vec3 v, float angle, Vec3 axis) {
Vec2i: vec2_from_vec2i, \
)(p_any_vec2))
#define m_vec_add(p_any_vec0, p_any_vec1) (_Generic((p_any_vec0), \
Vec3: vec3_add \
)(p_any_vec0, p_any_vec1))
#define m_vec_sub(p_any_vec0, p_any_vec1) (_Generic((p_any_vec0), \
Vec3: vec3_sub \
)(p_any_vec0, p_any_vec1))