summary refs log tree commit diff
path: root/src/Quaternions.cpp
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2023-08-24 04:21:46 +0900
committerNguyễn Gia Phong <cnx@loang.net>2023-08-24 04:30:20 +0900
commitefd25d51cdd7a9cadda1c0f6983905fc17545f14 (patch)
tree8dea973669d8dfe4e7209c9f419bf8cbbf483323 /src/Quaternions.cpp
parent2598835c54a3869a477d287d2845bbe42790a359 (diff)
downloadblackshades-2.5.1.tar.gz
Fix decal fading animation 2.5.1
Also fix missing decal regression.

Fixes: 48417e11854f8 ("Make XYZ C-compatible")
Diffstat (limited to 'src/Quaternions.cpp')
-rw-r--r--src/Quaternions.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/Quaternions.cpp b/src/Quaternions.cpp
deleted file mode 100644
index 9b32dc0..0000000
--- a/src/Quaternions.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <cmath>
-
-#include "Quaternions.h"
-
-bool PointInTriangle(XYZ *p, XYZ normal, XYZ *p1, XYZ *p2, XYZ *p3)
-{
-	bool bInter = false;
-	float pointv[3] { p->x, p->y, p->z };
-	float p1v[3] { p1->x, p1->y, p1->z };
-	float p2v[3] { p2->x, p2->y, p2->z };
-	float p3v[3] { p3->x, p3->y, p3->z };
-	float normalv[3] { normal.x, normal.y, normal.z };
-
-	int i = 0, j = 0;
-#define ABS(X) (((X)<0.f)?-(X):(X) )
-#define MAX(A, B) (((A)<(B))?(B):(A))
-	float max = MAX(MAX(ABS(normalv[0]), ABS(normalv[1])), ABS(normalv[2]));
-#undef MAX
-	if (max == ABS(normalv[0])) {i = 1; j = 2;} // y, z
-	if (max == ABS(normalv[1])) {i = 0; j = 2;} // x, z
-	if (max == ABS(normalv[2])) {i = 0; j = 1;} // x, y
-#undef ABS
-
-	float u0 = pointv[i] - p1v[i];
-	float v0 = pointv[j] - p1v[j];
-	float u1 = p2v[i] - p1v[i];
-	float v1 = p2v[j] - p1v[j];
-	float u2 = p3v[i] - p1v[i];
-	float v2 = p3v[j] - p1v[j];
-
-	if (u1 > -1.0e-05f && u1 < 1.0e-05f)// == 0.0f)
-	{
-		float b = u0 / u2;
-		if (0.0f <= b && b <= 1.0f)
-		{
-			float a = (v0 - b * v2) / v1;
-			if ((a >= 0.0f) && (( a + b ) <= 1.0f))
-				bInter = 1;
-		}
-	}
-	else
-	{
-		float b = (v0 * u1 - u0 * v1) / (v2 * u1 - u2 * v1);
-		if (0.0f <= b && b <= 1.0f)
-		{
-			float a = (u0 - b * u2) / u1;
-			if ((a >= 0.0f) && (( a + b ) <= 1.0f ))
-				bInter = 1;
-		}
-	}
-
-	return bInter;
-}
-
-float LineFacetd(XYZ p1,XYZ p2,XYZ pa,XYZ pb,XYZ pc, XYZ n, XYZ *p)
-{
-
-   //Calculate the parameters for the plane
-   float d = - n.x * pa.x - n.y * pa.y - n.z * pa.z;
-
-   //Calculate the position on the line that intersects the plane
-   float denom = n.x * (p2.x - p1.x) + n.y * (p2.y - p1.y) + n.z * (p2.z - p1.z);
-   if (abs(denom) < 0.0000001)        // Line and plane don't intersect
-      return 0;
-   float mu = - (d + n.x * p1.x + n.y * p1.y + n.z * p1.z) / denom;
-   p->x = p1.x + mu * (p2.x - p1.x);
-   p->y = p1.y + mu * (p2.y - p1.y);
-   p->z = p1.z + mu * (p2.z - p1.z);
-   if (mu < 0 || mu > 1)   // Intersection not along line segment
-      return 0;
-
-   if(!PointInTriangle( p, n, &pa, &pb, &pc)){return 0;}
-   return 1;
-}