Second pass idLib integration.

This commit is contained in:
Justin Marshall
2026-08-08 19:30:03 -07:00
parent 55a14323f2
commit 1b718f17f6
114 changed files with 9696 additions and 331 deletions
+18
View File
@@ -0,0 +1,18 @@
#include "sphere.h"
bool idSphere::LineIntersection(const idVec3& start, const idVec3& end) const {
const idVec3 fromCenter = start - origin;
const idVec3 direction = end - start;
const float projection = -fromCenter.Dot(direction);
if (projection <= 0.0f) return fromCenter.LengthSqr() < radius * radius;
const float directionLengthSqr = direction.LengthSqr();
if (projection >= directionLengthSqr) {
const idVec3 endFromCenter = end - origin;
return endFromCenter.LengthSqr() < radius * radius;
}
const idVec3 closest = fromCenter
+ direction * (projection / directionLengthSqr);
return closest.LengthSqr() < radius * radius;
}