summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--maths.c6
-rw-r--r--maths.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/maths.c b/maths.c
index 4496a2c..861643a 100644
--- a/maths.c
+++ b/maths.c
@@ -254,13 +254,14 @@ int vec_dot(const int* a, const int* b, int d) {
return r;
}
-void persp(int* v, int asp) {
+int* persp(int* v, int asp) {
v[2] += !v[2];
v[0] = ((v[0] << fbits) / v[2]);
v[1] = ((v[1] << fbits) / v[2]) * asp >> fbits;
+ return v;
}
-void ndc2clip(int* c, int* p) {
+int* ndc2clip(const int* c, int* p) {
register int hw = c[2] >> 1;
register int hh = c[3] >> 1;
p[0] = ((hw << fbits) * p[0]) >> fbits;
@@ -269,4 +270,5 @@ void ndc2clip(int* c, int* p) {
p[1] >>= fbits;
p[0] += hw;
p[1] += hh;
+ return p;
}
diff --git a/maths.h b/maths.h
index 6d33c6f..af2a027 100644
--- a/maths.h
+++ b/maths.h
@@ -41,7 +41,7 @@ int* mtx_apply(const int* m, int* v);
int* vec_cpy(int* d, const int* s, int c);
int* vec_ref(int* d, const int* i, const int* n, int c);
int vec_dot(const int* a, const int* b, int d);
-void persp(int* v, int asp);
-void ndc2clip(int* c, int* p);
+int* persp(int* v, int asp);
+int* ndc2clip(const int* c, int* p);
#endif