summaryrefslogtreecommitdiff
path: root/src/math/vec4.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/vec4.c')
-rw-r--r--src/math/vec4.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/math/vec4.c b/src/math/vec4.c
new file mode 100644
index 0000000..4216a08
--- /dev/null
+++ b/src/math/vec4.c
@@ -0,0 +1,24 @@
+#include <math.h>
+
+#include "math.h"
+#include "../util/assert.h"
+#include "../core/mem.h"
+
+
+
+void vec4_dividew(Vec4* v, Vec3* out) {
+ ssr_assert(out && v);
+ float w = 1.f / v->w;
+ out->x = v->x * w ;
+ out->y = v->y * w;
+ out->z = v->z * w;
+}
+
+void vec4_tostring(Vec4* v, char buf[]) {
+ sprintf(buf, "%8.3f %8.3f %8.3f %8.3f", v->x, v->y, v->z, v->w);
+}
+
+void vec4_print(Vec4* v) {
+ vec4_tostring(v, printbuffer);
+ printf("\n%s\n", printbuffer);
+} \ No newline at end of file