Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
matrix.h File Reference
#include "vec.h"
#include "endianness.h"

Go to the source code of this file.

Classes

class  Matrix
 
struct  DrawContext
 

Macros

#define M(a, b)   (tmp.r[b*3+a])
 
#define M(A, B)   (t.r[B*3+A])
 
#define M(A, B)   (t.r[B*3+A])
 
#define a   (trans.r[0])
 
#define b   (trans.r[3])
 
#define c   (trans.r[6])
 
#define d   (trans.r[1])
 
#define e   (trans.r[4])
 
#define f   (trans.r[7])
 
#define g   (trans.r[2])
 
#define h   (trans.r[5])
 
#define i   (trans.r[8])
 
#define a   (trans.r[0])
 
#define b   (trans.r[3])
 
#define c   (trans.r[6])
 
#define d   (trans.r[1])
 
#define e   (trans.r[4])
 
#define f   (trans.r[7])
 
#define g   (trans.r[2])
 
#define h   (trans.r[5])
 
#define i   (trans.r[8])
 
#define M(a, b)   (tmp.r[b*3+a])
 

Functions

const Matrix identity_matrix (1, 0, 0, 0, 1, 0, 0, 0, 1, QVector(0, 0, 0))
 
void ScaleMatrix (Matrix &matrix, const Vector &scale)
 
void VectorAndPositionToMatrix (Matrix &matrix, const Vector &v1, const Vector &v2, const Vector &v3, const QVector &pos)
 
void Zero (Matrix &matrix)
 
void Identity (Matrix &matrix)
 
void RotateAxisAngle (Matrix &tmp, const Vector &axis, const float angle)
 
void Translate (Matrix &matrix, const QVector &v)
 
void MultMatrix (Matrix &dest, const Matrix &m1, const Matrix &m2)
 
void CopyMatrix (Matrix &dest, const Matrix &source)
 
QVector Transform (const Matrix &t, const QVector &v)
 
Vector Transform (const Matrix &t, const Vector &v)
 
Vector InvTransformNormal (const Matrix &t, const Vector &v)
 
QVector InvTransformNormal (const Matrix &t, const QVector &v)
 
QVector InvTransform (const Matrix &t, const QVector &v)
 
Vector InvTransform (const Matrix &t, const Vector &v)
 
Vector TransformNormal (const Matrix &t, const Vector &v)
 
QVector TransformNormal (const Matrix &t, const QVector &v)
 
int invert (float b[], float a[])
 
void MatrixToVectors (const Matrix &m, Vector &p, Vector &q, Vector &r, QVector &c)
 
QVector InvScaleTransform (const Matrix &trans, QVector pos)
 
void InvertMatrix (Matrix &o, const Matrix &trans)
 
void Rotate (Matrix &tmp, const Vector &axis, float angle)
 

Macro Definition Documentation

#define a   (trans.r[0])

Referenced by InvertMatrix(), and InvScaleTransform().

#define a   (trans.r[0])
#define b   (trans.r[3])

Referenced by InvertMatrix(), and InvScaleTransform().

#define b   (trans.r[3])
#define c   (trans.r[6])
#define c   (trans.r[6])
#define d   (trans.r[1])
#define e   (trans.r[4])
#define f   (trans.r[7])

Referenced by AABBCache::AABBCache(), VsnetDownload::Server::Manager::addCmdDownload(), Angle(), AnimatedTexture::AnimatedTexture(), Animation::Animation(), TurretBin::AssignTargets(), AUDAdjustSound(), AUDCreateSoundMP3(), AUDLoadSoundFile(), VertexPointers::BackfaceCulling(), StarSystemGent::beginStar(), ROLES::buildroles(), ROLES::buildscripts(), Case0(), Point::ClampLength(), AnimatedTexture::Clone(), Opcode::Matrix4x4::CoFactor(), Collidable::Collidable(), UniverseUtil::ComputeSystemSerials(), CopySavedShips(), GameStarSystem::createBackground(), StarSystemGent::CreateStarSystem(), createTexture(), AnimatedTexture::CreateVideoTexture(), commandI::display(), DockingPorts::DockingPorts(), GameCockpit::Draw(), BaseInterface::Room::BaseText::Draw(), GFXSphereVertexList::Draw(), RText::draw_text(), Radar::BubbleDisplay::DrawBackground(), DrawDamageFlash(), Radar::PlaneDisplay::DrawGround(), VSSprite::DrawHere(), Animation::DrawNoTransform(), Animation::DrawNow(), DrawShield(), Radar::BubbleDisplay::DrawTargetMarker(), Radar::PlaneDisplay::DrawTargetMarker(), Radar::BubbleDisplay::DrawTrack(), Radar::PlaneDisplay::DrawTrack(), StarSystemGent::endStar(), EnvironmentMapGeneratorMain(), Audio::estimateGain(), EstimateGain(), PlanetaryOrbit::Execute(), Face(), FeedbackFilter(), findObjectsFromPosition(), CollideArray::flatten(), Universe::Generate1(), generateStarSystem(), getAITypes(), VSFileSystem::GetCorrectStarSysPath(), GetElMeshName(), Point::GetHashValue(), GetHelperPlayerSaveGame(), Audio::OpenALRenderableSource::getPlayingTimeImpl(), Audio::OpenALRenderableStreamingSource::getPlayingTimeImpl(), getProgramSource(), GFXCircle(), GFXDeviceToEye(), globQuerySphere(), GoTo(), FileUtil::HashCompute(), Point::Herp(), HSV_To_RGB(), Cockpit::Init(), Texture::InitTexture(), InvertMatrix(), InvScaleTransform(), lerp(), linear_interpolate_uncapped(), BaseInterface::Room::Link::Link(), Texture::Load(), LoadAccounts(), AIEvents::LoadAI(), AnimatedTexture::LoadFrame(), Mesh::LoadMeshes(), LoadMission(), Audio::TemplateManager::loadSourceTemplate(), LoadTex(), LoadWeapons(), Nebula::LoadXML(), FSM::LoadXML(), Faction::LoadXML(), StarSystem::LoadXML(), easyDomFactory< configNode >::LoadXML(), NetClient::loginAccept(), Universe::Loop(), LSSCache::LSSCache(), StarSystemGent::MakeJump(), StarSystemGent::MakePlanet(), OBBCache::OBBCache(), OPC_PointTriangleSqrDist(), OPC_SegmentOBBSqrDist(), OPC_SegmentSegmentSqrDist(), OPC_SegmentTriangleSqrDist(), Opcode::Point::operator HPoint(), Opcode::Matrix3x3::operator Matrix4x4(), Plane::operator*=(), NavigationSystem::ParseFile(), PaintText::parseFormat(), SaveGame::ParseSaveGame(), UnitUtil::PercentOperational(), planeBoxOverlap(), Radar::PlaneDisplay::PlaneDisplay(), Planet::Planet(), Opcode::Point::ProjectToScreen(), Unit::rayCollide(), Unit::reactToCollision(), StarSystemGent::readColorGrads(), StarSystemGent::readentity(), readnames(), AccountServer::recvMsg(), ClickList::requestIterator(), BVTCache::ResetCache(), RollLeft(), RollRight(), PhysicsSystem::Rotate(), NetServer::save(), SaveFileCopy(), Screenshot(), AccountServer::sendAuthorized(), Matrix4x4::SetCol(), Audio::SceneManager::setMaxDistance(), Audio::SceneManager::setMinGain(), EvadeLeftRightC::SetOppositeDir(), Matrix4x4::SetRow(), GameCockpit::SetupViewPort(), GalaxyXML::SGalaxy::SGalaxy(), Orders::FireAt::ShouldFire(), SphereCache::SphereCache(), SphereCollider::SphereTriOverlap(), SqrDistance(), Opcode::Ray::SquareDistance(), Opcode::Segment::SquareDistance(), NetServer::start(), t0(), StarSystemGent::Tab(), Takeoff(), TakeoffEveryZig(), Mission::terminateMission(), Audio::Test::testMultiStreaming(), Audio::Test::testMultiStreaming2(), Audio::Test::testSimpleScene(), Audio::Test::testSimpleSceneWDynTemplates(), Audio::Test::testStreaming(), TurretFAW(), Point::TweakSmaller(), Audio::OpenALRenderableSource::updateImpl(), Audio::OpenALRenderableStreamingSource::updateImpl(), CoordinateSelect::UpdateMouse(), VSSprite::VSSprite(), VSSwapHostFloatToLittle(), XMLSerializer::Write(), StarSystemGent::WriteLight(), FileUtil::WriteSaveFiles(), SaveGame::WriteSaveGame(), StarSystemGent::WriteUnit(), and Unit::WriteUnit().

#define f   (trans.r[7])
#define g   (trans.r[2])
#define h   (trans.r[5])
#define i   (trans.r[8])

Referenced by XMLDOM::_exportXML(), CockpitKeys::_PitchDown(), CockpitKeys::_PitchUp(), CockpitKeys::_YawLeft(), CockpitKeys::_YawRight(), BaseComputer::acceptMission(), Radar::CollectRadarTracks::acquire(), ChooseTargetClass< numTuple >::acquire(), ActivateAnimation(), AddAnimation(), Bolt::AddAnimation(), UnitUtil::addCargo(), NetClient::AddClientObject(), AddDocks(), GamePlanet::AddFog(), NetBuffer::addGFXLight(), Music::Addlist(), Picker::addListToDisplay(), NetBuffer::addMatrix(), NavPath::addNewPath(), UnitFactory::addPlanetBuffer(), ZoneMgr::addPosition(), GFXQuadList::AddQuad(), addQuote(), GamePlanet::AddRing(), GalaxyXML::SGalaxy::addSection(), AddSubUnits(), DecalQueue::AddTexture(), StarSystem::AddUnit(), NetServer::addUnitCargoSnapshot(), ZoneMgr::addZone(), Pilot::adjustSpecificRelationship(), ContinuousTerrain::AdjustTerrain(), AIEvents::AIEvresult::AIEvresult(), AllocVerticesForSystem(), AllUnitsCloseAndEngage(), alphanum(), AnimationDraw(), PhysicsSystem::ApplyImpulses(), Arrested(), TurretBin::AssignTargets(), AssignTBin(), AUDDestroy(), AUDListenerGain(), AUDRefreshSounds(), BaseComputer::BaseComputer(), BaseInterface::BaseInterface(), BaseInterface::Room::BaseShip::BaseShip(), beautify(), PointStarVlist::BeginDrawState(), FSM::beginElement(), StarSystemGent::beginStar(), bootstrap_first_loop(), bootstrap_main_loop(), ZoneMgr::broadcast(), NetServer::BroadcastFire(), ZoneMgr::broadcastNoSelf(), ZoneMgr::broadcastSample(), ZoneMgr::broadcastText(), NetServer::BroadcastUnfire(), build_sqrt_table(), buildCargoDescription(), ROLES::buildroles(), ROLES::buildscripts(), buyShip(), Background::Cache(), CanFaceTarget(), PickerCells::cellWithId(), Music::ChangeVolume(), fg_util::CheckFG(), NavPath::checkForCycles(), CPK3::CheckPK3(), ChooseNavPoint(), ChooseNearNavPoint(), Orders::FireAt::ChooseTargets(), cleanup(), MessageCenter::clear(), SimplePickerCells::clear(), clearDeleteQueue(), Order::ClearMessages(), BaseInterface::Room::Click(), AnimatedTexture::Clone(), GFXVertexList::ColIndVtxCopy(), ContinuousTerrain::Collide(), Opcode::HybridSphereCollider::Collide(), Opcode::HybridAABBCollider::Collide(), Opcode::HybridLSSCollider::Collide(), Opcode::HybridPlanesCollider::Collide(), Opcode::HybridOBBCollider::Collide(), Terrain::CollideAll(), collideTrees::collideTrees(), GFXVertexList::ColVtxCopy(), Order::Communicate(), CompareDest(), ComposeFunctions(), BaseUtil::CompPython(), ComputeAutoGuarantee(), Unit::computeLockingPercent(), concat(), concat_ostream(), BaseComputer::configureUpgradeCommitControls(), ContinuousTerrain::ContinuousTerrain(), CreateCargoForOwnerStarshipName(), NavComputer::createControls(), BaseComputer::createControls(), Order::createFullOrderDescription(), CreateLists(), BaseComputer::createModeButtons(), createObjects(), StarSystemGent::CreatePrimaries(), createTexture(), CreateTuple(), csReversibleTransform::csReversibleTransform(), csVector3::csVector3(), DealWithWarp(), collideTrees::Dec(), decode_color_block(), DeInitJoystick(), GFXQuadList::DelQuad(), CommunicatingAI::Destroy(), Briefing::Ship::Destroy(), Order::Destroy(), AnimatedTexture::Destroy(), ContinuousTerrain::DisableDraw(), GamePlanet::DisableLights(), ContinuousTerrain::DisableUpdate(), ROLES::discreteLog(), FileUtil::displayHash(), Packet::displayHex(), ZoneMgr::displayNPCs(), dockingdistance(), DockToSavedBases(), DONTUSE__NXSwapBigDoubleToLittleEndian(), DoParticles(), dotabs(), DownSampleTexture(), warptrails::Draw(), ContinuousTerrain::Draw(), Bolt::Draw(), TextInputDisplay::draw(), HaloSystem::Draw(), GameStarSystem::Draw(), GamePlanet::Draw(), Stars::Draw(), GameUnit< UnitType >::Draw(), Picker::draw(), WindowManager::draw(), BaseInterface::Room::Draw(), NavigationSystem::Draw(), BaseInterface::Draw(), GFXVertexList::Draw(), NavigationSystem::DrawCircle(), DrawDockingBoxes(), drawFilledPolygon(), DrawFrustum(), NavigationSystem::DrawGalaxy(), NavigationSystem::DrawGrid(), NavigationSystem::DrawHalfCircleBottom(), NavigationSystem::DrawHalfCircleTop(), NavigationSystem::DrawJump(), GameStarSystem::DrawJumpStars(), PaintText::drawLines(), NavigationSystem::DrawMission(), NavigationSystem::DrawNavCircle(), GameUnit< UnitType >::DrawNow(), Mesh::DrawNow(), NavigationSystem::DrawPlanet(), NavigationSystem::DrawSectorList(), NavigationSystem::DrawStation(), DropCargo(), DropHalfCargo(), PacketMem::dump(), eliminateZeroCargo(), ContinuousTerrain::EnableDraw(), GamePlanet::EnableLights(), ContinuousTerrain::EnableUpdate(), Enslave(), CollideArray::erase(), UnitCollection::erase(), BaseUtil::EraseLink(), BaseUtil::EraseObj(), Order::eraseOrder(), Order::eraseType(), NavPath::evaluate(), Orders::TurretAI::Execute(), FlyByJoystick::Execute(), Orders::MatchLinearVelocity::Execute(), PlanetaryOrbit::Execute(), AImissionScript::Execute(), Orders::AggressiveAI::Execute(), Order::Execute(), FireKeyboard::Execute(), ExecuteDirector(), GameUnit< UnitType >::Explode(), CPK3::ExtractFile(), CPK3::FileExists(), anonymous_namespace{autodocking.cpp}::FindDockingPort(), findGlobalClobberable(), findLocalClobberable(), Order::findOrder(), Order::findOrderList(), Radar::Sensor::FindTracksInRange(), anonymous_namespace{autodocking.cpp}::FindWaypoint(), NetClient::fireRequest(), CollideArray::flatten(), FlyByJoystick::FlyByJoystick(), Mesh::Fork(), Background::BackgroundClone::FreeClone(), FSM::FSM(), GameVegaConfig::GameVegaConfig(), Universe::Generate2(), StarSystemGent::generateCenter(), generateStarSystem(), getAITypes(), Hashtable< int, Logo, 257 >::GetAll(), Pilot::getAnger(), getAtmospheric(), ClassCache< Typ, Key >::getCachedMutable(), getCargoUnitName(), FSM::getCommMessageMood(), csBox3::GetConvexOutline(), getdatadir(), FSM::getDefaultState(), FSM::GetEdgesString(), GetFactionLookup(), NetBuffer::getGFXLight(), ContinuousTerrain::GetGroundPos(), ContinuousTerrain::GetGroundPosIdentTrans(), GetHelperPlayerSaveGame(), Universe::getJumpPath(), Mesh::getLOD(), getLogicOrInterrupt(), GetMadAt(), NetBuffer::getMatrix(), getMouseButtonStatus(), getNearestTarget(), getNearestTargetUnit(), StarSystemGent::GetNebFile(), getNetworkUnit(), getnoslash(), UnitUtil::getPhysicsPriority(), GalaxyXML::Galaxy::getPlanetVariable(), Mesh::GetPolys(), GFXVertexList::GetPolys(), GFXSphereVertexList::GetPolys(), UniverseUtil::getRandCargo(), FactionUtil::GetRandCommAnimation(), StarSystemGent::getRandName(), GetRandomBarMessage(), getRandomCachedAni(), getRandomCachedAniString(), GalaxyXML::SGalaxy::getRandSystem(), UniverseUtil::getSaveInfo(), GetTargetMessageQueue(), UniverseUtil::getUnit(), GetUnitDir(), GetUnitRow(), GalaxyXML::SGalaxy::getVariable(), csBox3::GetVisibleSides(), GFXBoxInFrustum(), GFXCircle(), GFXDeleteTexture(), GFXGetFramerate(), GFXInit(), GFXOptimizeList(), GFXPickLights(), GFXPopGlobalEffects(), GFXPushGlobalEffects(), GFXSetLightContext(), GFXSetMaterial(), GFXSphereVertexList::GFXSphereVertexList(), GFXTransferTexture(), GFXUploadLightState(), glut_keyboard_cb(), UnitUtil::hasCargo(), heightmapTransform(), HSV_To_RGB(), HudDamage(), GFXVertexList::IndVtxCopy(), Opcode::Triangle::Inflate(), StarDate::Init(), ChooseTargetClass< numTuple >::init(), GFXVertexList::Init(), InitJoystick(), InitKB(), VSFileSystem::InitPaths(), Planet::InitPlanet(), ChainPathNode::initSearchQueue(), SphereMesh::InitSphere(), StarDate::InitTrek(), InList(), UnitCollection::insert_unique(), Unit::InsideCollideTree(), ROLES::InternalGetRole(), ROLES::InternalGetStrRole(), InvertMatrix(), InvScaleTransform(), UniverseUtil::IOmessage(), CriteriaContains::isDestination(), ChainPathNode::isDestination(), isJumping(), isLocalSerial(), NavPath::isNeighborPath(), Matrix3x3::IsValid(), Matrix4x4::IsValid(), kbGetInput(), GamePlanet::Kill(), MessageCenter::last(), LeadMe(), light_rekey_frame(), LittleEndian(), AnimatedTexture::LoadAni(), NavComputer::loadChainLister(), FactionUtil::LoadContrabandLists(), NavComputer::loadCriteriaPickerCell(), NavigationSystem::CachedSystemIterator::SystemInfo::loadData(), FactionUtil::LoadFactionPlaylists(), BaseComputer::loadListPicker(), BaseComputer::loadMasterList(), Mesh::LoadMeshes(), BaseComputer::loadMissionsMasterList(), BaseComputer::loadNewsControls(), NavComputer::loadPathLister(), Unit::LoadRow(), BaseComputer::loadSellUpgradeControls(), BaseComputer::loadShipDealerControls(), loadsounds(), LoadTex(), Faction::LoadXML(), NetClient::loginChooseShip(), Logo::Logo(), VSFileSystem::LookForFile(), lookupMountSize(), LookupUnitRow(), VsnetTCPSocket::lower_selected(), StarSystemGent::Vector::Mag(), main(), StarSystemGent::MakeBigUnit(), MakeFogMesh(), StarSystemGent::MakeJumps(), Unit::makeMasterPartList(), MakeMesh(), StarSystemGent::MakePlanet(), StarSystemGent::makeRS(), MakeStarSystem(), mapToStringVec(), matchCargoToWeapon(), MatchingMood(), Mesh::Mesh(), Mix_SoftVolume_Change(), GFXQuadList::ModQuad(), mouseDrag(), mouseMotion(), BaseInterface::Room::MouseOver(), BaseInterface::MouseOver(), Music::Music(), Music::Mute(), Music::MuzakCycle(), myGlutJoystickCallback(), NavComputer::NavComputer(), NavigationSystem::NavigationSystem(), num_delayed_missions(), UniverseUtil::numActiveMissions(), GFXVertexList::numQuads(), NumStarsInGalaxy(), GFXVertexList::numTris(), BaseUtil::VideoAudioStreamListener::onEndOfStream(), Audio::OpenALStreamingSound::OpenALStreamingSound(), VertexCompare::operator()(), NavigationSystem::SystemIterator::operator++(), OrigMeshContainer::operator<(), Cockpit::PackUnitInfo(), VsnetDownload::RecvCmdDownload::parse(), Faction::ParseAllAllies(), Faction::ParseAllies(), ParseCommandLine(), __impl::parseFloat4(), parseFloat4(), PaintText::parseFragmentsWithCharBreak(), parseMountSizes(), UnitFactory::parsePlanetBuffer(), ParseSizeFlags(), UnitUtil::PercentOperational(), Mount::PhysicsAlignedFire(), PickleAllMissions(), Planet::Planet(), Music::Play(), BaseUtil::PlayVideo(), png_write(), PointStarVlist::PointStarVlist(), Radar::BubbleDisplay::PrepareAnimation(), Radar::PlaneDisplay::PrepareAnimation(), prettyPrintFloat(), CPK3::PrintFileContent(), GFXSphereVertexList::ProceduralModification(), FireKeyboard::ProcessCommMessage(), Orders::AggressiveAI::ProcessCurrentFgDirective(), processDelayedMissions(), Animation::ProcessDrawQueue(), Mesh::ProcessDrawQueue(), ProcessInput(), ProcessJoystick(), Orders::AggressiveAI::ProcessLogic(), ClassCache< Typ, Key >::purgeCache(), fg_util::PurgeZeroShips(), Resizable< GFXColorVertex >::push_backN(), pushMesh(), Order::queryAny(), GameUnit< UnitType >::queryFrustum(), Unit::querySphere(), GameUnit< UnitType >::querySphereClickList(), Unit::querySphereNoRecurse(), Order::queryType(), Audio::OpenALRenderableStreamingSource::queueALBuffers(), CockpitKeys::QuitNow(), CommunicatingAI::RandomInitiateCommunication(), Unit::rayCollide(), readCommandLineOptions(), readf(), readi(), ReadIntSpace(), GameMenu::readJoinGameControls(), VSFileSystem::VSFile::ReadLine(), readnames(), readplanetentity(), quadsquare::RecomputeErrorAndLighting(), UnitUtil::RecomputeUnitUpgrades(), AccountServer::recvMsg(), GFXVertexList::RefreshDisplayList(), SaveGame::ReloadPickledData(), Unit::RemoveFromSystem(), removelightfromnewpick(), NavPath::removeOldPath(), PathManager::removePath(), EventManager::removeResponder(), StarSystem::Statistics::RemoveUnit(), StarSystem::RemoveUnit(), UnitUtil::removeWeapon(), Briefing::Ship::Render(), Briefing::Render(), quadsquare::Render(), Terrain::RenderAll(), GFXVertexList::RenormalizeNormals(), XMLSupport::replace_space(), RestoreFirstPassState(), RestoreKB(), StarSystemGent::Vector::Roll(), Rread(), s_testBigEndian(), UniverseUtil::SafeStarSystemEntrancePoint(), saveDataList(), PickerCells::saveOpenCategories(), saveStringList(), ScoreKill(), Picker::scrollToCell(), BaseComputer::scrollToItem(), sdl_softvolume_effect_S16LSB(), sdl_softvolume_effect_S16MSB(), sdl_softvolume_effect_S8(), sdl_softvolume_effect_U16LSB(), sdl_softvolume_effect_U16MSB(), sdl_softvolume_effect_U8(), select_from_space_list(), SelectDockPort(), Picker::selectedItem(), BaseComputer::BuyUpgradeOperation::selectMount(), BaseComputer::SellUpgradeOperation::selectMount(), sellShip(), NetServer::sendCommunication(), EventManager::sendInputEvent(), Universe::SetActiveCockpit(), Mesh::SetBlendMode(), NavigationSystem::setCurrentSystem(), Mesh::setEnvMap(), Mesh::setLighting(), BaseUtil::SetLinkArea(), BaseUtil::SetLinkEventMask(), BaseUtil::SetLinkPython(), BaseUtil::SetLinkRoom(), BaseUtil::SetLinkText(), Mesh::SetMaterial(), NavigationSystem::SetMouseFlipStatus(), Orders::FormUpToOwner::SetParent(), PaintText::setText(), BaseUtil::SetTextBoxText(), BaseUtil::SetTexture(), Mesh::setTextureCumulativeTime(), BaseUtil::SetTexturePos(), BaseUtil::SetTextureSize(), ContinuousTerrain::SetTransformation(), NavigationSystem::Setup(), GameUniverse::SetupCockpits(), Universe::SetupCockpits(), SetupGLLightGlobals(), SetupSpecMapFirstPass(), GalaxyXML::SGalaxy::setVariable(), BaseUtil::SetVideoCallback(), Music::SetVolume(), ShiftPalette(), shouldreflect(), ChooseTargetClass< numTuple >::ShouldTargetUnit(), PathManager::showAll(), showListQuestion(), PathManager::showNone(), BaseComputer::showPlayerInfo(), BaseComputer::showShipStats(), ShowText(), showUnitStats(), SortStarSystems(), GameUnit< UnitType >::Split(), SpriteStarVlist::SpriteStarVlist(), SqrDistance(), StarSystemGent::starin(), Universe::StarSystemIndex(), AccountServer::start(), NetServer::start(), GameUniverse::StartDraw(), FSM::StopAllSounds(), FSM::Node::StopSound(), UniverseUtil::StopTargettingEachOther(), BaseUtil::StopVideo(), Font::stringWidth(), Stupodmain(), SuperDock(), SwapInNewShipName(), SwitchUnits(), SwitchVDUTo(), NetClient::synchronizeTime(), NavigationSystem::CachedSystemIterator::SystemInfo::SystemInfo(), UniverseUtil::systemInMemory(), t_rng16::t_rng16(), Tab(), StarSystemGent::Tab(), TabString(), BaseInterface::Room::Talk::Talk(), UniverseUtil::TargetEachOther(), TargMission(), TentativeJumpTo(), terrainTransform(), Opcode::Triangle::TestAgainstPlane(), Audio::Test::testComplexScene(), Audio::Test::testMultiStreaming(), Audio::Test::testMultiStreaming2(), Audio::Test::testSimpleScene(), Audio::Test::testSimpleSceneWTemplates(), Audio::Test::testStreaming(), TexMap(), texTransform(), trackPrice(), GameUnit< UnitType >::TransferUnitToSystem(), truncateByPipe(), UnDockNow(), NetClient::unfireRequest(), Cockpit::UnpackUnitInfo(), UnpickleAllMissions(), unpicklights(), Briefing::Update(), StarSystem::Update(), Universe::Update(), Cockpit::Update(), Terrain::UpdateAll(), CommunicatingAI::UpdateContrabandSearch(), PathManager::updateDependants(), Mesh::UpdateFX(), Audio::SceneManager::updateListenerImpl(), UpdateMasterPartList(), PathManager::updatePaths(), GameNebula::UpdatePhysics2(), Missile::UpdatePhysics2(), GameUnit< UnitType >::UpdatePhysics2(), UpdateTimeCompressionSounds(), UpgradeAllowed(), upgradeNotAddedToCargo(), vdu_lookup(), StarSystemGent::Vector::Vector(), PaintText::visibleLineCountStartingWith(), Cockpit::visitSystem(), VSRandom::VSRandom(), vsstrcmp(), VSSwapHostFloatToLittle(), SocketSet::wait(), StarSystemGent::whichGradColor(), Universe::whichPlayerStarship(), whichside(), XMLnode::Write(), XMLSerializer::Write(), writeCSV(), WriteHudDamage(), WriteHudDamageFunc(), GameUniverse::WriteSaveGame(), XMLnode::WriteString(), XMLSerializer::WriteString(), Unit::WriteUnitString(), Wwrite(), XMLDOM::XMLElement::XMLElement(), StarSystemGent::Vector::Yaw(), Animation::~Animation(), BaseComputer::~BaseComputer(), BaseInterface::~BaseInterface(), bolt_draw::~bolt_draw(), Briefing::~Briefing(), ContinuousTerrain::~ContinuousTerrain(), ForceFeedback::~ForceFeedback(), GroupControl::~GroupControl(), HaloSystem::~HaloSystem(), Mesh::~Mesh(), NavComputer::~NavComputer(), NavPath::~NavPath(), PathManager::~PathManager(), PythonMissionBaseClass::~PythonMissionBaseClass(), BaseInterface::Room::~Room(), SpriteStarVlist::~SpriteStarVlist(), and Terrain::~Terrain().

#define i   (trans.r[8])
#define M (   A,
 
)    (t.r[B*3+A])
#define M (   A,
 
)    (t.r[B*3+A])
#define M (   a,
  b 
)    (tmp.r[b*3+a])

Function Documentation

void Identity ( Matrix matrix)
inline

Computes a 4x4 identity matrix

Definition at line 160 of file matrix.h.

References Matrix::p, and Matrix::r.

Referenced by Animation::Animation(), bootstrap_draw(), ContinuousTerrain::ContinuousTerrain(), createObjects(), GameStarSystem::Draw(), evaluateViews(), GameCockpit::GameCockpit(), ContinuousTerrain::GetGroundPosIdentTrans(), GFXGetMatrix(), GFXLoadIdentity(), Unit::Init(), QuadTree::QuadTree(), GamePlanet::reactToCollision(), Briefing::Ship::Render(), Matrix4x4::RotX(), Matrix4x4::RotY(), Matrix4x4::RotZ(), and Camera::UpdatePlanetGFX().

161 {
162  matrix.r[0] = 1;
163  matrix.r[1] = 0;
164  matrix.r[2] = 0;
165  matrix.r[3] = 0;
166  matrix.r[4] = 1;
167  matrix.r[5] = 0;
168  matrix.r[6] = 0;
169  matrix.r[7] = 0;
170  matrix.r[8] = 1;
171  matrix.p.Set( 0, 0, 0 );
172 }
const Matrix identity_matrix ( ,
,
,
,
,
,
,
,
,
QVector(0, 0, 0)   
)
int invert ( float  b[],
float  a[] 
)

Referenced by ConfigAllows().

void InvertMatrix ( Matrix o,
const Matrix trans 
)
inline

Definition at line 351 of file matrix.h.

References a, b, c, d, e, f, g, h, i, Matrix::p, QVector, Matrix::r, and TransformNormal().

Referenced by GamePlanet::reactToCollision().

352 {
353 #define a (trans.r[0])
354 #define b (trans.r[3])
355 #define c (trans.r[6])
356 #define d (trans.r[1])
357 #define e (trans.r[4])
358 #define f (trans.r[7])
359 #define g (trans.r[2])
360 #define h (trans.r[5])
361 #define i (trans.r[8])
362  float factor = 1.0F/(-c*e*g+b*f*g+c*d*h-a*f*h-b*d*i+a*e*i);
363  o.r[0] = factor*(e*i-f*h);
364  o.r[3] = factor*(c*h-b*i);
365  o.r[6] = factor*(b*f-c*e);
366  o.r[1] = factor*(f*g-d*i);
367  o.r[4] = factor*(a*i-c*g);
368  o.r[7] = factor*(c*d-a*f);
369  o.r[2] = factor*(d*h-e*g);
370  o.r[5] = factor*(b*g-a*h);
371  o.r[8] = factor*(a*e-b*d);
372 #undef a
373 #undef b
374 #undef c
375 #undef d
376 #undef e
377 #undef f
378 #undef g
379 #undef h
380 #undef i
381  o.p = TransformNormal( o, QVector( -trans.p ) );
382 }
QVector InvScaleTransform ( const Matrix trans,
QVector  pos 
)
inline

Definition at line 324 of file matrix.h.

References a, b, c, d, e, f, g, h, i, Matrix::p, and QVector.

Referenced by ContinuousTerrain::AdjustTerrain(), ContinuousTerrain::Collide(), QuadTree::GetGroundPos(), QuadTree::GetHeight(), QuadTree::Render(), and QuadTree::Update().

325 {
326  pos = pos-trans.p;
327 #define a (trans.r[0])
328 #define b (trans.r[3])
329 #define c (trans.r[6])
330 #define d (trans.r[1])
331 #define e (trans.r[4])
332 #define f (trans.r[7])
333 #define g (trans.r[2])
334 #define h (trans.r[5])
335 #define i (trans.r[8])
336  double factor = 1.0F/(-c*e*g+b*f*g+c*d*h-a*f*h-b*d*i+a*e*i);
337  return QVector( pos.Dot( QVector( e*i-f*h, c*h-b*i,
338  b*f-c*e ) ),
339  pos.Dot( QVector( f*g-d*i, a*i-c*g, c*d-a*f ) ), pos.Dot( QVector( d*h-e*g, b*g-a*h, a*e-b*d ) ) )*factor;
340 
341 #undef a
342 #undef b
343 #undef c
344 #undef d
345 #undef e
346 #undef f
347 #undef g
348 #undef h
349 #undef i
350 }
QVector InvTransform ( const Matrix t,
const QVector v 
)
inline

Definition at line 292 of file matrix.h.

References InvTransformNormal(), Matrix::p, and QVector.

Referenced by Unit::ApplyDamage(), Unit::CanDockWithMe(), dockingdistance(), Unit::rayCollide(), and Unit::UpdatePhysics().

293 {
294  return InvTransformNormal( t, QVector( v.i-t.p.i, v.j-t.p.j, v.k-t.p.k ) );
295 }
Vector InvTransform ( const Matrix t,
const Vector v 
)
inline

Definition at line 296 of file matrix.h.

References InvTransformNormal(), Matrix::p, and QVector.

297 {
298  return InvTransformNormal( t, QVector( v.i-t.p.i, v.j-t.p.j, v.k-t.p.k ) ).Cast();
299 }
Vector InvTransformNormal ( const Matrix t,
const Vector v 
)
inline

Definition at line 273 of file matrix.h.

References M, and Vector.

Referenced by Unit::GetNetAcceleration(), InvTransform(), Unit::ResolveForces(), Atmosphere::Update(), and WackyMultFloatMatrix().

274 {
275 #define M( A, B ) (t.r[B*3+A])
276  return Vector( v.i*M( 0, 0 )+v.j*M( 1, 0 )+v.k*M( 2, 0 ),
277  v.i*M( 0, 1 )+v.j*M( 1, 1 )+v.k*M( 2, 1 ),
278  v.i*M( 0, 2 )+v.j*M( 1, 2 )+v.k*M( 2, 2 ) );
279 
280 #undef M
281 }
QVector InvTransformNormal ( const Matrix t,
const QVector v 
)
inline

Definition at line 282 of file matrix.h.

References M, and QVector.

283 {
284 #define M( A, B ) (t.r[B*3+A])
285  return QVector( v.i*M( 0, 0 )+v.j*M( 1, 0 )+v.k*M( 2, 0 ),
286  v.i*M( 0, 1 )+v.j*M( 1, 1 )+v.k*M( 2, 1 ),
287  v.i*M( 0, 2 )+v.j*M( 1, 2 )+v.k*M( 2, 2 ) );
288 
289 #undef M
290 }
void MatrixToVectors ( const Matrix m,
Vector p,
Vector q,
Vector r,
QVector c 
)
inline

Definition at line 316 of file matrix.h.

References Matrix::p, and Matrix::r.

Referenced by GamePlanet::Draw(), Transformation::from_matrix(), and GameUnit< UnitType >::UpdatePhysics2().

317 {
318  p.Set( m.r[0], m.r[1], m.r[2] );
319  q.Set( m.r[3], m.r[4], m.r[5] );
320  r.Set( m.r[6], m.r[7], m.r[8] );
321  c = m.p;
322 }
void MultMatrix ( Matrix dest,
const Matrix m1,
const Matrix m2 
)
inline

Multiplies m1 and m2 and pops the result into dest; dest != m1, dest !=m2

Definition at line 214 of file matrix.h.

References Matrix::p, and Matrix::r.

Referenced by LocationSelect::Draw(), Atmosphere::Draw(), BaseInterface::Room::BaseShip::Draw(), GameUnit< UnitType >::DrawNow(), GFXBoxInFrustumModel(), GFXGetMatrix(), GFXLoadMatrix(), GFXMultMatrix(), GFXMultMatrixModel(), GFXTranslate(), LookAtHelper(), Matrix::operator*(), GamePlanet::reactToCollision(), and Briefing::Ship::Render().

215 {
216  dest.r[0] = m1.r[0]*m2.r[0]+m1.r[3]*m2.r[1]+m1.r[6]*m2.r[2];
217  dest.r[1] = m1.r[1]*m2.r[0]+m1.r[4]*m2.r[1]+m1.r[7]*m2.r[2];
218  dest.r[2] = m1.r[2]*m2.r[0]+m1.r[5]*m2.r[1]+m1.r[8]*m2.r[2];
219 
220  dest.r[3] = m1.r[0]*m2.r[3]+m1.r[3]*m2.r[4]+m1.r[6]*m2.r[5];
221  dest.r[4] = m1.r[1]*m2.r[3]+m1.r[4]*m2.r[4]+m1.r[7]*m2.r[5];
222  dest.r[5] = m1.r[2]*m2.r[3]+m1.r[5]*m2.r[4]+m1.r[8]*m2.r[5];
223 
224  dest.r[6] = m1.r[0]*m2.r[6]+m1.r[3]*m2.r[7]+m1.r[6]*m2.r[8];
225  dest.r[7] = m1.r[1]*m2.r[6]+m1.r[4]*m2.r[7]+m1.r[7]*m2.r[8];
226  dest.r[8] = m1.r[2]*m2.r[6]+m1.r[5]*m2.r[7]+m1.r[8]*m2.r[8];
227 
228  dest.p.i = m1.r[0]*m2.p.i+m1.r[3]*m2.p.j+m1.r[6]*m2.p.k+m1.p.i;
229  dest.p.j = m1.r[1]*m2.p.i+m1.r[4]*m2.p.j+m1.r[7]*m2.p.k+m1.p.j;
230  dest.p.k = m1.r[2]*m2.p.i+m1.r[5]*m2.p.j+m1.r[8]*m2.p.k+m1.p.k;
231 }
void Rotate ( Matrix tmp,
const Vector axis,
float  angle 
)
inline

Definition at line 384 of file matrix.h.

References c, UniverseUtil::cos(), M, Matrix::p, and UniverseUtil::sin().

Referenced by Unit::AutoPilotToErrorMessage(), Unit::UnDock(), Atmosphere::Update(), and Unit::UpdatePhysics2().

385 {
386  double c = cos( angle );
387  double s = sin( angle );
388 //Row, COl
389 #define M( a, b ) (tmp.r[b*3+a])
390  M( 0, 0 ) = axis.i*axis.i*(1-c)+c;
391  M( 0, 1 ) = axis.i*axis.j*(1-c)-axis.k*s;
392  M( 0, 2 ) = axis.i*axis.k*(1-c)+axis.j*s;
393  //M(0,3)=0;
394  M( 1, 0 ) = axis.j*axis.i*(1-c)+axis.k*s;
395  M( 1, 1 ) = axis.j*axis.j*(1-c)+c;
396  M( 1, 2 ) = axis.j*axis.k*(1-c)-axis.i*s;
397  //M(1,3)=0;
398  M( 2, 0 ) = axis.i*axis.k*(1-c)-axis.j*s;
399  M( 2, 1 ) = axis.j*axis.k*(1-c)+axis.i*s;
400  M( 2, 2 ) = axis.k*axis.k*(1-c)+c;
401  //M(2,3)=0;
402 #undef M
403  tmp.p.Set( 0, 0, 0 );
404 }
void RotateAxisAngle ( Matrix tmp,
const Vector axis,
const float  angle 
)
inline

Computes a Translation matrix based on x,y,z translation

Definition at line 176 of file matrix.h.

References c, M, and Matrix::p.

Referenced by PointStarVlist::BeginDrawState(), and GameCockpit::SetupViewPort().

177 {
178  float c = cosf( angle );
179  float s = sinf( angle );
180 #define M( a, b ) (tmp.r[b*3+a])
181  M( 0, 0 ) = axis.i*axis.i*(1-c)+c;
182  M( 0, 1 ) = axis.i*axis.j*(1-c)-axis.k*s;
183  M( 0, 2 ) = axis.i*axis.k*(1-c)+axis.j*s;
184  //M(0,3)=0;
185  M( 1, 0 ) = axis.j*axis.i*(1-c)+axis.k*s;
186  M( 1, 1 ) = axis.j*axis.j*(1-c)+c;
187  M( 1, 2 ) = axis.j*axis.k*(1-c)-axis.i*s;
188  //M(1,3)=0;
189  M( 2, 0 ) = axis.i*axis.k*(1-c)-axis.j*s;
190  M( 2, 1 ) = axis.j*axis.k*(1-c)+axis.i*s;
191  M( 2, 2 ) = axis.k*axis.k*(1-c)+c;
192  //M(2,3)=0;
193 #undef M
194  tmp.p.Set( 0, 0, 0 );
195 }
void ScaleMatrix ( Matrix matrix,
const Vector scale 
)
inline

moves a vector struct to a matrix

Definition at line 108 of file matrix.h.

References Matrix::r.

Referenced by Bolt::Bolt(), bootstrap_draw(), ContinuousTerrain::Collide(), createObjects(), Bolt::Draw(), HaloSystem::Draw(), AtmosphereHalo::Draw(), GameUnit< UnitType >::Draw(), GameUnit< UnitType >::DrawNow(), ContinuousTerrain::SetTransformation(), and GameUnit< UnitType >::WarpMatrix().

109 {
110  matrix.r[0] *= scale.i;
111  matrix.r[1] *= scale.i;
112  matrix.r[2] *= scale.i;
113  matrix.r[3] *= scale.j;
114  matrix.r[4] *= scale.j;
115  matrix.r[5] *= scale.j;
116  matrix.r[6] *= scale.k;
117  matrix.r[7] *= scale.k;
118  matrix.r[8] *= scale.k;
119 }
Vector Transform ( const Matrix t,
const Vector v 
)
inline

Definition at line 256 of file matrix.h.

References Matrix::p, Matrix::r, and Vector.

257 {
258  return Vector( t.p.i+v.i*t.r[0]+v.j*t.r[3]+v.k*t.r[6],
259  t.p.j+v.i*t.r[1]+v.j*t.r[4]+v.k*t.r[7],
260  t.p.k+v.i*t.r[2]+v.j*t.r[5]+v.k*t.r[8] );
261 }
QVector TransformNormal ( const Matrix t,
const QVector v 
)
inline

Definition at line 307 of file matrix.h.

References QVector, and Matrix::r.

308 {
309  return QVector( v.i*t.r[0]+v.j*t.r[3]+v.k*t.r[6],
310  v.i*t.r[1]+v.j*t.r[4]+v.k*t.r[7],
311  v.i*t.r[2]+v.j*t.r[5]+v.k*t.r[8] );
312 }
void Translate ( Matrix matrix,
const QVector v 
)
inline

Definition at line 197 of file matrix.h.

References Matrix::p, Matrix::r, and v.

198 {
199  matrix.r[0] = 1;
200  matrix.r[1] = 0;
201  matrix.r[2] = 0;
202  matrix.r[3] = 0;
203  matrix.r[4] = 1;
204  matrix.r[5] = 0;
205  matrix.r[6] = 0;
206  matrix.r[7] = 0;
207  matrix.r[8] = 1;
208  matrix.p = v;
209 }
void VectorAndPositionToMatrix ( Matrix matrix,
const Vector v1,
const Vector v2,
const Vector v3,
const QVector pos 
)
inline

Definition at line 121 of file matrix.h.

References Matrix::p, and Matrix::r.

Referenced by AdjustMatrix(), Animation::CalculateOrientation(), Bolt::Draw(), GameUnit< UnitType >::Draw(), GameCockpit::Draw(), GameUnit< UnitType >::DrawNow(), Matrix::Matrix(), GamePlanet::reactToCollision(), SetDirection(), and Animation::SetOrientation().

122 {
123  matrix.r[0] = v1.i;
124  matrix.r[1] = v1.j;
125  matrix.r[2] = v1.k;
126 
127  matrix.r[3] = v2.i;
128  matrix.r[4] = v2.j;
129  matrix.r[5] = v2.k;
130 
131  matrix.r[6] = v3.i;
132  matrix.r[7] = v3.j;
133  matrix.r[8] = v3.k;
134  matrix.p = pos;
135 }
void Zero ( Matrix matrix)
inline

zeros out a 4x4 matrix quickly

Definition at line 143 of file matrix.h.

References Matrix::p, and Matrix::r.

Referenced by Matrix3x3::Identity(), and Matrix4x4::Identity().

144 {
145  matrix.r[0] = 0;
146  matrix.r[1] = 0;
147  matrix.r[2] = 0;
148  matrix.r[3] = 0;
149 
150  matrix.r[4] = 0;
151  matrix.r[5] = 0;
152  matrix.r[6] = 0;
153  matrix.r[7] = 0;
154 
155  matrix.r[8] = 0;
156  matrix.p.Set( 0, 0, 0 );
157 }