Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
73 lines
1.3 KiB
C++
73 lines
1.3 KiB
C++
#include "munga.h"
|
|
#pragma hdrstop
|
|
|
|
#include "line.h"
|
|
#include "plane.h"
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Line&
|
|
Line::operator=(const Vector3D &vector)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&vector);
|
|
//
|
|
// Make sure length of vector is non-zero
|
|
//
|
|
length = vector.Length();
|
|
Verify(length);
|
|
//
|
|
// Normalize the vector and put it into the line
|
|
//
|
|
direction.x = vector.x/length;
|
|
direction.y = vector.y/length;
|
|
direction.z = vector.z/length;
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Line&
|
|
Line::operator=(const Point3D &point)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&point);
|
|
//
|
|
// Copy the point over into the line.
|
|
//
|
|
origin.x = point.x;
|
|
origin.y = point.y;
|
|
origin.z = point.z;
|
|
return *this;
|
|
}
|
|
|
|
Scalar
|
|
Line::DistanceTo(
|
|
const Plane &plane,
|
|
Scalar *product
|
|
) const
|
|
{
|
|
*product = direction * plane.normal;
|
|
if (Small_Enough(*product))
|
|
{
|
|
Check_Fpu();
|
|
return -1.0f;
|
|
}
|
|
Scalar result = -plane.DistanceTo(origin) / *product;
|
|
Check_Fpu();
|
|
return result;
|
|
}
|
|
|
|
Scalar
|
|
Line::DistanceTo(
|
|
const Sphere &,//sphere,
|
|
Scalar *//penetration
|
|
) const
|
|
{
|
|
return -1.0f; // HACK
|
|
}
|