summaryrefslogtreecommitdiffstats
path: root/src/core/Camera.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-01-20 19:14:12 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2021-01-20 19:14:12 +0100
commit23831e38e632073c9d1fc5ff073b1568c02e33b8 (patch)
treee2386110918e4424e26d33a8a9c9d0e9ea46fa2c /src/core/Camera.cpp
parentMerge branch 'lcs-dev' into lcs (diff)
parentMerge branch 'miami' into lcs (diff)
downloadre3-23831e38e632073c9d1fc5ff073b1568c02e33b8.tar
re3-23831e38e632073c9d1fc5ff073b1568c02e33b8.tar.gz
re3-23831e38e632073c9d1fc5ff073b1568c02e33b8.tar.bz2
re3-23831e38e632073c9d1fc5ff073b1568c02e33b8.tar.lz
re3-23831e38e632073c9d1fc5ff073b1568c02e33b8.tar.xz
re3-23831e38e632073c9d1fc5ff073b1568c02e33b8.tar.zst
re3-23831e38e632073c9d1fc5ff073b1568c02e33b8.zip
Diffstat (limited to 'src/core/Camera.cpp')
-rw-r--r--src/core/Camera.cpp45
1 files changed, 37 insertions, 8 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index f3b9e163..4bb782f2 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -4057,9 +4057,17 @@ CCamera::CalculateDerivedValues(void)
bool
CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
{
- RwV3d c;
- c = center;
- RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
+#ifdef GTA_PS2
+ CVuVector c;
+ TransformPoint(c, *mat, center);
+#else
+ CVector c = center;
+ #ifdef FIX_BUGS
+ c = *mat * center;
+ #else
+ RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
+ #endif
+#endif
if(c.y < CDraw::GetNearClipZ()) return false;
if(c.y > CDraw::GetFarClipZ()) return false;
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > 0.0f) return false;
@@ -4072,9 +4080,17 @@ CCamera::IsPointVisible(const CVector &center, const CMatrix *mat)
bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)
{
- RwV3d c;
- c = center;
- RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
+#ifdef GTA_PS2
+ CVuVector c;
+ TransformPoint(c, *mat, center);
+#else
+ CVector c = center;
+ #ifdef FIX_BUGS
+ c = *mat * center;
+ #else
+ RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
+ #endif
+#endif
if(c.y + radius < CDraw::GetNearClipZ()) return false;
if(c.y - radius > CDraw::GetFarClipZ()) return false;
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > radius) return false;
@@ -4092,11 +4108,24 @@ CCamera::IsSphereVisible(const CVector &center, float radius)
}
bool
-CCamera::IsBoxVisible(RwV3d *box, const CMatrix *mat)
+#ifdef GTA_PS2
+CCamera::IsBoxVisible(CVuVector *box, const CMatrix *mat)
+#else
+CCamera::IsBoxVisible(CVector *box, const CMatrix *mat)
+#endif
{
int i;
int frustumTests[6] = { 0 };
- RwV3dTransformPoints(box, box, 8, &mat->m_matrix);
+#ifdef GTA_PS2
+ TransformPoints(box, 8, *mat, box);
+#else
+ #ifdef FIX_BUGS
+ for (i = 0; i < 8; i++)
+ box[i] = *mat * box[i];
+ #else
+ RwV3dTransformPoints(box, box, 8, (RwMatrix*)mat);
+ #endif
+#endif
for(i = 0; i < 8; i++){
if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++;