Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/maths/BoundingBoxOriented.cpp
/* Copyright (C) 2011 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 17 Lines | |||||
CBoundingBoxOriented::CBoundingBoxOriented(const CBoundingBoxAligned& bound) | CBoundingBoxOriented::CBoundingBoxOriented(const CBoundingBoxAligned& bound) | ||||
{ | { | ||||
if (bound.IsEmpty()) | if (bound.IsEmpty()) | ||||
{ | { | ||||
SetEmpty(); | SetEmpty(); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
bound.GetCentre(m_Center); | bound.GetCenter(m_Center); | ||||
// the axes of an AABB are the world-space axes | // the axes of an AABB are the world-space axes | ||||
m_Basis[0].X = 1.f; m_Basis[0].Y = 0.f; m_Basis[0].Z = 0.f; | m_Basis[0].X = 1.f; m_Basis[0].Y = 0.f; m_Basis[0].Z = 0.f; | ||||
m_Basis[1].X = 0.f; m_Basis[1].Y = 1.f; m_Basis[1].Z = 0.f; | m_Basis[1].X = 0.f; m_Basis[1].Y = 1.f; m_Basis[1].Z = 0.f; | ||||
m_Basis[2].X = 0.f; m_Basis[2].Y = 0.f; m_Basis[2].Z = 1.f; | m_Basis[2].X = 0.f; m_Basis[2].Y = 0.f; m_Basis[2].Z = 1.f; | ||||
// element-wise division by two to get half sizes (remember, [1] and [0] are the max and min coord points) | // element-wise division by two to get half sizes (remember, [1] and [0] are the max and min coord points) | ||||
m_HalfSizes = (bound[1] - bound[0]) * 0.5f; | m_HalfSizes = (bound[1] - bound[0]) * 0.5f; | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator