2023-07-03 15:40:28 +00:00
|
|
|
#include "vec.h"
|
2023-07-05 08:37:27 +00:00
|
|
|
#include <GL/gl.h>
|
2023-07-03 15:40:28 +00:00
|
|
|
|
|
|
|
vec3 vec3_new(float x, float y, float z) {
|
|
|
|
vec3 r = { x, y, z };
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec3 vec3_splat(float f) {
|
|
|
|
vec3 r = { f, f, f };
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec3 vec3_add(vec3 a, vec3 b) {
|
|
|
|
vec3 r = { a.x + b.x, a.y + b.y, a.z + b.z };
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec3 vec3_sub(vec3 a, vec3 b) {
|
|
|
|
vec3 r = { a.x - b.x, a.y - b.y, a.z - b.z };
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec3 vec3_mult(vec3 a, float s) {
|
|
|
|
vec3 r = { a.x * s, a.y * s, a.z * s };
|
|
|
|
return r;
|
2023-07-05 08:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void glVertexVec(vec3 v) {
|
|
|
|
glVertex3f(v.x, v.y, v.z);
|
|
|
|
}
|
|
|
|
void glColorVec(vec3 v) {
|
|
|
|
glColor3f(v.x, v.y, v.z);
|
2023-07-03 15:40:28 +00:00
|
|
|
}
|