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>
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
#include "munga.h"
|
|
#pragma hdrstop
|
|
|
|
#include "point3d.h"
|
|
#include "linmtrx.h"
|
|
#include "vector4d.h"
|
|
|
|
const Point3D Point3D::Identity(0.0f,0.0f,0.0f);
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Point3D& Point3D::operator=(const Vector4D& v)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&v);
|
|
Verify(v.w);
|
|
|
|
x = v.x / v.w;
|
|
y = v.y / v.w;
|
|
z = v.z / v.w;
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Point3D& Point3D::Multiply(const Point3D& p,const AffineMatrix& m)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&p);
|
|
Check(&m);
|
|
|
|
x = p.x * m(0,0) + p.y * m(1,0) + p.z * m(2,0) + m(3,0);
|
|
y = p.x * m(0,1) + p.y * m(1,1) + p.z * m(2,1) + m(3,1);
|
|
z = p.x * m(0,2) + p.y * m(1,2) + p.z * m(2,2) + m(3,2);
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Point3D& Point3D::MultiplyByInverse(const Point3D &p, const LinearMatrix &m)
|
|
{
|
|
x = p.x * m(0,0) + p.y * m(0,1) + p.z * m(0,2) - m(3,0) * m(0,0) - m(3,1) * m(0,1) - m(3,2) * m(0,2);
|
|
y = p.x * m(1,0) + p.y * m(1,1) + p.z * m(1,2) - m(3,0) * m(1,0) - m(3,1) * m(1,1) - m(3,2) * m(1,2);
|
|
z = p.x * m(2,0) + p.y * m(2,1) + p.z * m(2,2) - m(3,0) * m(2,0) - m(3,1) * m(2,1) - m(3,2) * m(2,2);
|
|
return *this;
|
|
}
|
|
|
|
#if defined(TEST_CLASS)
|
|
#include "point3d.tcp"
|
|
#endif
|