summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-01-20 17:59:33 +0100
committerGitHub <noreply@github.com>2021-01-20 17:59:33 +0100
commit9b193a47a22d99ac89a4bec584d40ae41f971286 (patch)
treebadff7d74ddadf1de18aeb7473cdfc05a175da72 /src/core
parentMerge branch 'master' of github.com:GTAmodding/re3 (diff)
parentGet rid of VuVector (diff)
downloadre3-9b193a47a22d99ac89a4bec584d40ae41f971286.tar
re3-9b193a47a22d99ac89a4bec584d40ae41f971286.tar.gz
re3-9b193a47a22d99ac89a4bec584d40ae41f971286.tar.bz2
re3-9b193a47a22d99ac89a4bec584d40ae41f971286.tar.lz
re3-9b193a47a22d99ac89a4bec584d40ae41f971286.tar.xz
re3-9b193a47a22d99ac89a4bec584d40ae41f971286.tar.zst
re3-9b193a47a22d99ac89a4bec584d40ae41f971286.zip
Diffstat (limited to '')
-rw-r--r--src/core/Camera.cpp45
-rw-r--r--src/core/Camera.h6
2 files changed, 42 insertions, 9 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 7a831068..9d169716 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -3629,9 +3629,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;
@@ -3644,9 +3652,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;
@@ -3664,11 +3680,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]++;
diff --git a/src/core/Camera.h b/src/core/Camera.h
index ca1bd135..d7293e20 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -641,7 +641,11 @@ public:
bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius);
- bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
+#ifdef GTA_PS2
+ bool IsBoxVisible(CVuVector *box, const CMatrix *mat);
+#else
+ bool IsBoxVisible(CVector *box, const CMatrix *mat);
+#endif
};
VALIDATE_SIZE(CCamera, 0xE9D8);