VisibilityPlugins callbacks and fixes
This commit is contained in:
parent
4af82584e2
commit
d9fb2cc56f
@ -7,6 +7,7 @@
|
|||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "VisibilityPlugins.h"
|
#include "VisibilityPlugins.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
#define FADE_DISTANCE 20.0f
|
#define FADE_DISTANCE 20.0f
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ CVisibilityPlugins::Initialise(void)
|
|||||||
m_alphaList.Init(20);
|
m_alphaList.Init(20);
|
||||||
m_alphaList.head.item.sort = 0.0f;
|
m_alphaList.head.item.sort = 0.0f;
|
||||||
m_alphaList.tail.item.sort = 100000000.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.head.item.sort = 0.0f;
|
||||||
m_alphaEntityList.tail.item.sort = 100000000.0f;
|
m_alphaEntityList.tail.item.sort = 100000000.0f;
|
||||||
}
|
}
|
||||||
@ -498,14 +499,11 @@ CVisibilityPlugins::RenderTrainHiDetailAlphaCB(RpAtomic *atomic)
|
|||||||
return atomic;
|
return atomic;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this is part of a struct
|
|
||||||
static RwTexture *&playerskin = *(RwTexture**)0x941428;
|
|
||||||
|
|
||||||
RpAtomic*
|
RpAtomic*
|
||||||
CVisibilityPlugins::RenderPlayerCB(RpAtomic *atomic)
|
CVisibilityPlugins::RenderPlayerCB(RpAtomic *atomic)
|
||||||
{
|
{
|
||||||
if(playerskin)
|
if(CWorld::Players[0].m_pSkinTexture)
|
||||||
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, playerskin);
|
RpGeometryForAllMaterials(RpAtomicGetGeometry(atomic), SetTextureCB, CWorld::Players[0].m_pSkinTexture);
|
||||||
AtomicDefaultRenderCallBack(atomic);
|
AtomicDefaultRenderCallBack(atomic);
|
||||||
return atomic;
|
return atomic;
|
||||||
}
|
}
|
||||||
@ -607,22 +605,30 @@ CVisibilityPlugins::DefaultVisibilityCB(RpClump *clump)
|
|||||||
bool
|
bool
|
||||||
CVisibilityPlugins::FrustumSphereCB(RpClump *clump)
|
CVisibilityPlugins::FrustumSphereCB(RpClump *clump)
|
||||||
{
|
{
|
||||||
// TODO, but unused
|
RwSphere sphere;
|
||||||
return true;
|
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
|
bool
|
||||||
CVisibilityPlugins::VehicleVisibilityCB(RpClump *clump)
|
CVisibilityPlugins::VehicleVisibilityCB(RpClump *clump)
|
||||||
{
|
{
|
||||||
// TODO, but unused
|
if (GetDistanceSquaredFromCamera(RpClumpGetFrame(clump)) <= ms_vehicleLod1Dist)
|
||||||
return true;
|
return FrustumSphereCB(clump);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CVisibilityPlugins::VehicleVisibilityCB_BigVehicle(RpClump *clump)
|
CVisibilityPlugins::VehicleVisibilityCB_BigVehicle(RpClump *clump)
|
||||||
{
|
{
|
||||||
// TODO, but unused
|
return FrustumSphereCB(clump);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user