shithub: tinygl

Download patch

ref: b0b998d7815e1b24b405403d284638eff9f6e564
parent: 07eeeb88a263f338c4df4bd991b562d801b64f99
author: MHS <gek@katherine>
date: Mon Mar 15 21:45:12 EDT 2021

Automatic commit.

--- a/include-demo/3dMath.h
+++ b/include-demo/3dMath.h
@@ -451,8 +451,8 @@
 				downv4(s2),
 				downv4(s1)
 			);
-	float lv3 = lengthv3(diff);
-	float l = (s1.d[3] + s2.d[3]-lv3);
+	f_ lv3 = lengthv3(diff);
+	f_ l = (s1.d[3] + s2.d[3]-lv3);
 	
 	if(l < 0 || lv3 == 0) {
 		ret.d[3] = 0;return ret;
@@ -464,6 +464,21 @@
 		,l
 	);
 	return ret;
+}
+static inline int boxvboxbool (aabb b1, aabb b2){
+		vec3 sumextents = addv3(b1.e,b2.e);
+		vec3 b1c = downv4(b1.c);
+		vec3 b2c = downv4(b2.c);	
+		if(
+			!(
+				(fabs(b1c.d[0] - b2c.d[0]) <= sumextents.d[0]) &&
+				(fabs(b1c.d[1] - b2c.d[1]) <= sumextents.d[1]) &&
+				(fabs(b1c.d[2] - b2c.d[2]) <= sumextents.d[2])
+			)
+		){
+			return 0;
+		}
+		return 1;
 }
 static inline vec4 boxvbox( aabb b1,  aabb b2){ //Just points along the minimum separating axis, Nothing fancy.
 	vec4 ret = (vec4){