diff options
author | aap <aap@papnet.eu> | 2021-07-29 19:43:35 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2021-07-29 19:43:47 +0200 |
commit | 3c5bae164f54ef3eb21d1f62aabbbb58939f14ab (patch) | |
tree | 15282e0f336a51b9cbc6640ce83613cbb45f95a1 /src/rw/VisibilityPlugins.cpp | |
parent | Reverse unused audio functions from mobile (diff) | |
download | re3-3c5bae164f54ef3eb21d1f62aabbbb58939f14ab.tar re3-3c5bae164f54ef3eb21d1f62aabbbb58939f14ab.tar.gz re3-3c5bae164f54ef3eb21d1f62aabbbb58939f14ab.tar.bz2 re3-3c5bae164f54ef3eb21d1f62aabbbb58939f14ab.tar.lz re3-3c5bae164f54ef3eb21d1f62aabbbb58939f14ab.tar.xz re3-3c5bae164f54ef3eb21d1f62aabbbb58939f14ab.tar.zst re3-3c5bae164f54ef3eb21d1f62aabbbb58939f14ab.zip |
Diffstat (limited to 'src/rw/VisibilityPlugins.cpp')
-rw-r--r-- | src/rw/VisibilityPlugins.cpp | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp index 7ff5c243..e6d4641d 100644 --- a/src/rw/VisibilityPlugins.cpp +++ b/src/rw/VisibilityPlugins.cpp @@ -155,7 +155,7 @@ CVisibilityPlugins::Initialise(void) m_alphaList.head.item.sort = 0.0f; m_alphaList.tail.item.sort = 100000000.0f; #ifdef ASPECT_RATIO_SCALE - // default 150 if not enough for bigger FOVs + // default 150 is not enough for bigger FOVs m_alphaEntityList.Init(NUMALPHAENTITYLIST * 3); #else m_alphaEntityList.Init(NUMALPHAENTITYLIST); @@ -658,8 +658,7 @@ CVisibilityPlugins::RenderTrainHiDetailAlphaCB(RpAtomic *atomic) return atomic; if(flags & ATOMIC_FLAG_DRAWLAST){ - // sort before clump - if(!InsertAtomicIntoSortedList(atomic, distsq - 0.0001f)) + if(!InsertAtomicIntoSortedList(atomic, distsq)) RENDERCALLBACK(atomic); }else{ if(!InsertAtomicIntoSortedList(atomic, distsq + dot)) @@ -792,16 +791,6 @@ CVisibilityPlugins::DefaultVisibilityCB(RpClump *clump) } bool -CVisibilityPlugins::MloVisibilityCB(RpClump *clump) -{ - RwFrame *frame = RpClumpGetFrame(clump); - CMloModelInfo *modelInfo = (CMloModelInfo*)GetFrameHierarchyId(frame); - if (sq(modelInfo->field_34) < GetDistanceSquaredFromCamera(frame)) - return false; - return CVisibilityPlugins::FrustumSphereCB(clump); -} - -bool CVisibilityPlugins::FrustumSphereCB(RpClump *clump) { RwSphere sphere; @@ -817,11 +806,22 @@ CVisibilityPlugins::FrustumSphereCB(RpClump *clump) } bool +CVisibilityPlugins::MloVisibilityCB(RpClump *clump) +{ + RwFrame *frame = RpClumpGetFrame(clump); + CMloModelInfo *modelInfo = (CMloModelInfo*)GetFrameHierarchyId(frame); + if (SQR(modelInfo->drawDist) < GetDistanceSquaredFromCamera(frame)) + return false; + return CVisibilityPlugins::FrustumSphereCB(clump); +} + +bool CVisibilityPlugins::VehicleVisibilityCB(RpClump *clump) { - if (GetDistanceSquaredFromCamera(RpClumpGetFrame(clump)) <= ms_vehicleLod1Dist) - return FrustumSphereCB(clump); - return false; + RwFrame *frame = RpClumpGetFrame(clump); + if (ms_vehicleLod1Dist < GetDistanceSquaredFromCamera(frame)) + return false; + return FrustumSphereCB(clump); } bool @@ -927,6 +927,12 @@ CVisibilityPlugins::ClearAtomicFlag(RpAtomic *atomic, int f) ATOMICEXT(atomic)->flags &= ~f; } +void +CVisibilityPlugins::SetAtomicId(RpAtomic *atomic, int id) +{ + ATOMICEXT(atomic)->flags = id; +} + int CVisibilityPlugins::GetAtomicId(RpAtomic *atomic) { @@ -1012,7 +1018,9 @@ CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo // Unused switch (modelInfo->GetModelType()) { - // ignore MLO + case MITYPE_MLO: + CLUMPEXT(clump)->visibilityCB = MloVisibilityCB; + break; case MITYPE_VEHICLE: vmi = (CVehicleModelInfo*)modelInfo; if(vmi->m_vehicleType == VEHICLE_TYPE_TRAIN || @@ -1026,6 +1034,12 @@ CVisibilityPlugins::SetClumpModelInfo(RpClump *clump, CClumpModelInfo *modelInfo } } +CClumpModelInfo* +CVisibilityPlugins::GetClumpModelInfo(RpClump *clump) +{ + return (CClumpModelInfo*)GetFrameHierarchyId(RpClumpGetFrame(clump)); +} + void CVisibilityPlugins::SetClumpAlpha(RpClump *clump, int alpha) { @@ -1037,3 +1051,9 @@ CVisibilityPlugins::GetClumpAlpha(RpClump *clump) { return CLUMPEXT(clump)->alpha; } + +bool +CVisibilityPlugins::IsClumpVisible(RpClump *clump) +{ + return CLUMPEXT(clump)->visibilityCB(clump); +} |