Compare commits
2 Commits
b20e7202fe
...
e281ba593c
Author | SHA1 | Date | |
---|---|---|---|
|
e281ba593c | ||
|
a20be2c523 |
@ -29,6 +29,10 @@ static inline Vec2 vec2_scale(Vec2 a, float s) {
|
|||||||
return (Vec2) { a.x * s, a.y * s };
|
return (Vec2) { a.x * s, a.y * s };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline float vec2_length(Vec2 a) {
|
||||||
|
return sqrtf(a.x * a.x + a.y * a.y);
|
||||||
|
}
|
||||||
|
|
||||||
static inline Vec3 vec3_add(Vec3 a, Vec3 b) {
|
static inline Vec3 vec3_add(Vec3 a, Vec3 b) {
|
||||||
return (Vec3) { a.x + b.x, a.y + b.y, a.z + b.z };
|
return (Vec3) { a.x + b.x, a.y + b.y, a.z + b.z };
|
||||||
}
|
}
|
||||||
@ -98,10 +102,8 @@ static inline Vec3 vec3_rotate(Vec3 v, float angle, Vec3 axis) {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define m_vec2_from(p_any_vec2) (_Generic((p_any_vec2), \
|
|
||||||
Vec2i: vec2_from_vec2i, \
|
|
||||||
)(p_any_vec2))
|
|
||||||
|
|
||||||
|
/* TODO: remove. */
|
||||||
#define m_vec_add(p_any_vec0, p_any_vec1) (_Generic((p_any_vec0), \
|
#define m_vec_add(p_any_vec0, p_any_vec1) (_Generic((p_any_vec0), \
|
||||||
Vec2: vec2_add, \
|
Vec2: vec2_add, \
|
||||||
Vec3: vec3_add \
|
Vec3: vec3_add \
|
||||||
|
@ -414,6 +414,9 @@ void render(void) {
|
|||||||
|
|
||||||
|
|
||||||
void draw_camera(Vec3 position, float fov, Vec3 up, Vec3 direction) {
|
void draw_camera(Vec3 position, float fov, Vec3 up, Vec3 direction) {
|
||||||
|
if (fabsf(0.0f - fov) < 0.00001f || fov > (M_PIf / 2))
|
||||||
|
log_warn("Invalid fov given (%f)", (double)fov);
|
||||||
|
|
||||||
Camera const camera = {
|
Camera const camera = {
|
||||||
.fov = fov,
|
.fov = fov,
|
||||||
.pos = position,
|
.pos = position,
|
||||||
@ -428,6 +431,9 @@ void draw_camera(Vec3 position, float fov, Vec3 up, Vec3 direction) {
|
|||||||
|
|
||||||
/* TODO: https://stackoverflow.com/questions/62493770/how-to-add-roll-in-camera-class */
|
/* TODO: https://stackoverflow.com/questions/62493770/how-to-add-roll-in-camera-class */
|
||||||
DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position, float fov, float roll, float pitch, float yaw) {
|
DrawCameraFromPrincipalAxesResult draw_camera_from_principal_axes(Vec3 position, float fov, float roll, float pitch, float yaw) {
|
||||||
|
if (fabsf(0.0f - fov) < 0.00001f || fov > (M_PIf / 2))
|
||||||
|
log_warn("Invalid fov given (%f)", (double)fov);
|
||||||
|
|
||||||
(void)roll;
|
(void)roll;
|
||||||
|
|
||||||
float yawc, yaws, pitchc, pitchs;
|
float yawc, yaws, pitchc, pitchs;
|
||||||
|
Loading…
Reference in New Issue
Block a user