summaryrefslogtreecommitdiffstats
path: root/src/entities/Entity.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2021-05-23 17:45:07 +0200
committerSergeanur <s.anureev@yandex.ua>2021-06-24 20:32:43 +0200
commit50058371efaf4c5713b7a608db0c7990ec3d78a6 (patch)
tree314722ae778432755c8ea0563a317df52fe130ee /src/entities/Entity.cpp
parentUndef PS2_AUDIO_CHANNELS for SQUEEZE_PERFORMANCE and VANILLA_DEFINES (diff)
downloadre3-50058371efaf4c5713b7a608db0c7990ec3d78a6.tar
re3-50058371efaf4c5713b7a608db0c7990ec3d78a6.tar.gz
re3-50058371efaf4c5713b7a608db0c7990ec3d78a6.tar.bz2
re3-50058371efaf4c5713b7a608db0c7990ec3d78a6.tar.lz
re3-50058371efaf4c5713b7a608db0c7990ec3d78a6.tar.xz
re3-50058371efaf4c5713b7a608db0c7990ec3d78a6.tar.zst
re3-50058371efaf4c5713b7a608db0c7990ec3d78a6.zip
Diffstat (limited to 'src/entities/Entity.cpp')
-rw-r--r--src/entities/Entity.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 208e6deb..9d5bf73c 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -191,7 +191,7 @@ CEntity::GetBoundRect(void)
{
CRect rect;
CVector v;
- CColModel *col = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel();
+ CColModel *col = CModelInfo::GetColModel(m_modelIndex);
rect.ContainPoint(GetMatrix() * col->boundingBox.min);
rect.ContainPoint(GetMatrix() * col->boundingBox.max);
@@ -210,21 +210,27 @@ CEntity::GetBoundRect(void)
CVector
CEntity::GetBoundCentre(void)
{
- CVector v;
- GetBoundCentre(v);
- return v;
+ return GetMatrix() * CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center;
}
+#ifdef GTA_PS2
+void
+CEntity::GetBoundCentre(CVuVector &out)
+{
+ TransformPoint(out, GetMatrix(), CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center);
+}
+#else
void
CEntity::GetBoundCentre(CVector &out)
{
- out = GetMatrix() * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center;
+ out = GetMatrix() * CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center;
}
+#endif
float
CEntity::GetBoundRadius(void)
{
- return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.radius;
+ return CModelInfo::GetColModel(m_modelIndex)->boundingSphere.radius;
}
void
@@ -379,10 +385,13 @@ CEntity::Render(void)
}
}
+
bool
-CEntity::GetIsTouching(CVector const &center, float radius)
+CEntity::GetIsTouching(CVUVECTOR const &center, float radius)
{
- return sq(GetBoundRadius()+radius) > (GetBoundCentre()-center).MagnitudeSqr();
+ CVUVECTOR boundCenter;
+ GetBoundCentre(boundCenter);
+ return sq(GetBoundRadius()+radius) > (boundCenter-center).MagnitudeSqr();
}
bool
@@ -400,8 +409,7 @@ CEntity::IsVisibleComplex(void)
bool
CEntity::GetIsOnScreen(void)
{
- return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius(),
- &TheCamera.GetCameraMatrix());
+ return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius());
}
bool
@@ -417,7 +425,7 @@ CEntity::GetIsOnScreenComplex(void)
return true;
CRect rect = GetBoundRect();
- CColModel *colmodel = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel();
+ CColModel *colmodel = CModelInfo::GetColModel(m_modelIndex);
float z = GetPosition().z;
float minz = z + colmodel->boundingBox.min.z;
float maxz = z + colmodel->boundingBox.max.z;
@@ -572,7 +580,7 @@ CEntity::Remove(void)
float
CEntity::GetDistanceFromCentreOfMassToBaseOfModel(void)
{
- return -CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingBox.min.z;
+ return -CModelInfo::GetColModel(m_modelIndex)->boundingBox.min.z;
}
void