From f4afeeef49b12fffb4ce9e5860c0a79b6809d74b Mon Sep 17 00:00:00 2001 From: Morten Hustveit Date: Tue, 2 Dec 2014 14:54:28 -0500 Subject: 3dmath: Use const-correct function declarations --- 3dmath.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '3dmath.h') diff --git a/3dmath.h b/3dmath.h index 4135f3b..0b6e035 100644 --- a/3dmath.h +++ b/3dmath.h @@ -1,3 +1,3 @@ -float dot(float x[3], float y[3]); +float dot(const float x[3], const float y[3]); void normalize(float x[3]); -float sphere_intersect(float y[3], float r[3], float s[3], float d[3], float c[3], float R); +float sphere_intersect(float y[3], float r[3], const float s[3], const float d[3], const float c[3], float R); -- cgit v1.2.3 From ef3f2085ff238469207d099562d61635e1f9e138 Mon Sep 17 00:00:00 2001 From: Morten Hustveit Date: Tue, 2 Dec 2014 15:02:25 -0500 Subject: 3dmath.c: Throw restrict on all parameters to sphere_intersect This saves 3ms / frame on yelena. --- 3dmath.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '3dmath.h') diff --git a/3dmath.h b/3dmath.h index 0b6e035..3a984cb 100644 --- a/3dmath.h +++ b/3dmath.h @@ -1,3 +1,6 @@ float dot(const float x[3], const float y[3]); void normalize(float x[3]); -float sphere_intersect(float y[3], float r[3], const float s[3], const float d[3], const float c[3], float R); + +float sphere_intersect(float* restrict y, float* restrict r, + const float* restrict s, const float* restrict d, + const float* restrict c, float R); -- cgit v1.2.3 From 6cee50ceb0d153622b89fb813060419f5985857d Mon Sep 17 00:00:00 2001 From: Morten Hustveit Date: Tue, 2 Dec 2014 21:32:20 -0500 Subject: Subtract the central sphere, and update the animation to match --- 3dmath.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '3dmath.h') diff --git a/3dmath.h b/3dmath.h index 3a984cb..1635c40 100644 --- a/3dmath.h +++ b/3dmath.h @@ -1,6 +1,8 @@ +#define POW2(x) ((x) * (x)) + float dot(const float x[3], const float y[3]); void normalize(float x[3]); float sphere_intersect(float* restrict y, float* restrict r, const float* restrict s, const float* restrict d, - const float* restrict c, float R); + const float* restrict c, float R, int invert); -- cgit v1.2.3