Archival snapshot of the Virtual World Entertainment Tesla cockpit software, 1994-1996: MUNGA engine and L4 pod layer source (Borland C++ 5.0), BT/RP game code, and game content (models, audio, maps, gauges, Division renderer data). Includes third-party libraries: Division dVS/DPL graphics, HMI SOS audio, WATTCP networking. Files are preserved byte-for-byte (.gitattributes disables all line-ending conversion). README.md documents the layout, target hardware, and toolchain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
160 lines
4.3 KiB
C++
160 lines
4.3 KiB
C++
//===========================================================================//
|
|
// File: origin.cc //
|
|
// Project: MUNGA Brick: Math Library //
|
|
// Contents: Implementation details for the position class //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// 11/19/94 JMA Initial coding. //
|
|
// 11/29/94 JMA Added origin concatenation //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#include <munga.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(ORIGIN_HPP)
|
|
#include <origin.hpp>
|
|
#endif
|
|
|
|
#if !defined(MOTION_HPP)
|
|
#include <motion.hpp>
|
|
#endif
|
|
|
|
#if !defined(LINMTRX_HPP)
|
|
#include <linmtrx.hpp>
|
|
#endif
|
|
|
|
const Origin
|
|
Origin::Identity(Point3D::Identity, Quaternion::Identity);
|
|
|
|
#if defined(USE_SIGNATURE)
|
|
int
|
|
Is_Signature_Bad(const volatile Origin *)
|
|
{
|
|
return False;
|
|
}
|
|
#endif
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Origin::Origin(const LinearMatrix &matrix)
|
|
{
|
|
Check(&matrix);
|
|
linearPosition = matrix;
|
|
angularPosition = matrix;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Origin&
|
|
Origin::operator=(const Origin &origin)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&origin);
|
|
|
|
angularPosition = origin.angularPosition;
|
|
linearPosition = origin.linearPosition;
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Origin&
|
|
Origin::operator=(const LinearMatrix &matrix)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&matrix);
|
|
|
|
angularPosition = matrix;
|
|
linearPosition = matrix;
|
|
return *this;
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Logical
|
|
Origin::operator==(const Origin &origin) const
|
|
{
|
|
Check(this);
|
|
return (memcmp(this, &origin, sizeof(Origin)) == 0);
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Origin&
|
|
Origin::AddScaled(
|
|
const Origin& source,
|
|
const Motion& delta,
|
|
Scalar t
|
|
)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&source);
|
|
Check(&delta);
|
|
Verify(t >= 0.0f);
|
|
|
|
linearPosition.AddScaled(source.linearPosition, delta.linearMotion, t);
|
|
angularPosition.AddScaled(source.angularPosition, delta.angularMotion, t);
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
//#############################################################################
|
|
//
|
|
Origin&
|
|
Origin::Lerp(
|
|
const Origin &start,
|
|
const Origin &end,
|
|
Scalar t
|
|
)
|
|
{
|
|
Check_Pointer(this);
|
|
Check(&start);
|
|
Check(&end);
|
|
|
|
linearPosition.Lerp(start.linearPosition, end.linearPosition, t);
|
|
angularPosition.Lerp(start.angularPosition, end.angularPosition, t);
|
|
Check(this);
|
|
return *this;
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
ostream&
|
|
operator<<(
|
|
ostream& stream,
|
|
const Origin& p
|
|
)
|
|
{
|
|
return stream << '{' << p.linearPosition << ',' << p.angularPosition << '}';
|
|
}
|
|
|
|
//
|
|
//###########################################################################
|
|
//###########################################################################
|
|
//
|
|
Logical
|
|
Origin::TestInstance() const
|
|
{
|
|
return angularPosition.TestInstance();
|
|
}
|
|
#if defined(TEST_CLASS)
|
|
# include "origin.tcp"
|
|
#endif
|
|
|