summaryrefslogtreecommitdiffstats
path: root/src/render/VisibilityPlugins.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2019-10-26 13:12:24 +0200
committerSergeanur <s.anureev@yandex.ua>2019-10-26 13:12:24 +0200
commitd9fb2cc56f942ca1738f26e0a5a8fec80fbcf374 (patch)
treed15df6f8014583de4bf76c2fa43ee7baa0d2ff49 /src/render/VisibilityPlugins.cpp
parentFixed markers rotation speed (diff)
downloadre3-d9fb2cc56f942ca1738f26e0a5a8fec80fbcf374.tar
re3-d9fb2cc56f942ca1738f26e0a5a8fec80fbcf374.tar.gz
re3-d9fb2cc56f942ca1738f26e0a5a8fec80fbcf374.tar.bz2
re3-d9fb2cc56f942ca1738f26e0a5a8fec80fbcf374.tar.lz
re3-d9fb2cc56f942ca1738f26e0a5a8fec80fbcf374.tar.xz
re3-d9fb2cc56f942ca1738f26e0a5a8fec80fbcf374.tar.zst
re3-d9fb2cc56f942ca1738f26e0a5a8fec80fbcf374.zip
Diffstat (limited to 'src/render/VisibilityPlugins.cpp')
-rw-r--r--src/render/VisibilityPlugins.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/render/VisibilityPlugins.cpp b/src/render/VisibilityPlugins.cpp
index 2107813b..6a2f77a1 100644
--- a/src/render/VisibilityPlugins.cpp
+++ b/src/render/VisibilityPlugins.cpp
@@ -7,6 +7,7 @@
#include "Renderer.h"
#include "Camera.h"
#include "VisibilityPlugins.h"
+#include "World.h"
#define FADE_DISTANCE 20.0f
@@ -43,7 +44,7 @@ CVisibilityPlugins::Initialise(void)
m_alphaList.Init(20);
m_alphaList.head.item.sort = 0.0f;
m_alphaList.tail.item.sort = 100000000.0f;
- m_alphaEntityList.Init(350); // TODO: set back to 150 when things are fixed
+ m_alphaEntityList.Init(150);
m_alphaEntityList.head.item.sort = 0.0f;
m_alphaEntityList.tail.item.sort = 100000000.0f;
}
@@ -498,14 +499,11 @@ CVisibilityPlugins::RenderTrainHiDetailAlphaCB(RpAtomic *atomic)
return atomic;
}
-// TODO: this is part of a struct
-static RwTexture *&playerskin = *(RwTexture**)0x941428;
-
RpAtomic*
CVisibilityPlugins::RenderPlayerCB(RpAtomic *atomic)
{
- if(playerskin)
- RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, playerskin);
+ if(CWorld::Players[0].m_pSkinTexture)
+ RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, CWorld::Players[0].m_pSkinTexture);
AtomicDefaultRenderCallBack(atomic);
return atomic;
}
@@ -607,22 +605,30 @@ CVisibilityPlugins::DefaultVisibilityCB(RpClump *clump)
bool
CVisibilityPlugins::FrustumSphereCB(RpClump *clump)
{
- // TODO, but unused
- return true;
+ RwSphere sphere;
+ RwFrame *frame = RpClumpGetFrame(clump);
+
+ CClumpModelInfo *modelInfo = (CClumpModelInfo*)GetFrameHierarchyId(frame);
+ sphere.radius = modelInfo->GetColModel()->boundingSphere.radius;
+ sphere.center.x = modelInfo->GetColModel()->boundingSphere.center.x;
+ sphere.center.y = modelInfo->GetColModel()->boundingSphere.center.y;
+ sphere.center.z = modelInfo->GetColModel()->boundingSphere.center.z;
+ RwV3dTransformPoints(&sphere.center, &sphere.center, 1, RwFrameGetLTM(frame));
+ return RwCameraFrustumTestSphere(ms_pCamera, &sphere) != rwSPHEREOUTSIDE;
}
bool
CVisibilityPlugins::VehicleVisibilityCB(RpClump *clump)
{
- // TODO, but unused
- return true;
+ if (GetDistanceSquaredFromCamera(RpClumpGetFrame(clump)) <= ms_vehicleLod1Dist)
+ return FrustumSphereCB(clump);
+ return false;
}
bool
CVisibilityPlugins::VehicleVisibilityCB_BigVehicle(RpClump *clump)
{
- // TODO, but unused
- return true;
+ return FrustumSphereCB(clump);
}