summaryrefslogtreecommitdiff
path: root/src/math/vec3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/vec3.c')
-rw-r--r--src/math/vec3.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/math/vec3.c b/src/math/vec3.c
index d2fb652..5d273d8 100644
--- a/src/math/vec3.c
+++ b/src/math/vec3.c
@@ -16,6 +16,11 @@ void vec3_cross(Vec3* v1, Vec3* v2, Vec3* out) {
out->z = v1->x*v2->y - v1->y*v2->x;
}
+Vec3 vec3_make(float x, float y, float z) {
+ Vec3 v = {x, y, z};
+ return v;
+}
+
void vec3_scale(Vec3* v, float k, Vec3* out) {
ssr_assert(v && out);
out->x = v->x * k;
@@ -23,6 +28,13 @@ void vec3_scale(Vec3* v, float k, Vec3* out) {
out->z = v->z * k;
}
+void vec3_scale3(Vec3* v, Vec3* scalar, Vec3* out) {
+ ssr_assert(v && scalar && out);
+ out->x = v->x * scalar->x;
+ out->y = v->y * scalar->y;
+ out->z = v->z * scalar->z;
+}
+
void vec3_plus(Vec3* v1, Vec3* v2, Vec3* out) {
ssr_assert(v1 && v2 && out);
out->x = v1->x + v2->x;