summaryrefslogtreecommitdiffstats
path: root/src/render/VisibilityPlugins.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-05-15 16:52:37 +0200
committeraap <aap@papnet.eu>2019-05-15 16:52:37 +0200
commit600bf0351476a5a21aabb5429132ddf7f52ac0b9 (patch)
treed8e48b3a581679e33830fb7c98ed69e1e242e2c2 /src/render/VisibilityPlugins.h
downloadre3-600bf0351476a5a21aabb5429132ddf7f52ac0b9.tar
re3-600bf0351476a5a21aabb5429132ddf7f52ac0b9.tar.gz
re3-600bf0351476a5a21aabb5429132ddf7f52ac0b9.tar.bz2
re3-600bf0351476a5a21aabb5429132ddf7f52ac0b9.tar.lz
re3-600bf0351476a5a21aabb5429132ddf7f52ac0b9.tar.xz
re3-600bf0351476a5a21aabb5429132ddf7f52ac0b9.tar.zst
re3-600bf0351476a5a21aabb5429132ddf7f52ac0b9.zip
Diffstat (limited to 'src/render/VisibilityPlugins.h')
-rw-r--r--src/render/VisibilityPlugins.h129
1 files changed, 129 insertions, 0 deletions
diff --git a/src/render/VisibilityPlugins.h b/src/render/VisibilityPlugins.h
new file mode 100644
index 00000000..f041b24e
--- /dev/null
+++ b/src/render/VisibilityPlugins.h
@@ -0,0 +1,129 @@
+#pragma once
+
+#include "templates.h"
+
+class CEntity;
+class CSimpleModelInfo;
+class CClumpModelInfo;
+
+typedef bool (*ClumpVisibilityCB)(RpClump*);
+
+class CVisibilityPlugins
+{
+public:
+ struct AlphaObjectInfo
+ {
+ union {
+ CEntity *entity;
+ RpAtomic *atomic;
+ };
+ float sort;
+ };
+
+ static CLinkList<AlphaObjectInfo> &m_alphaList;
+ static CLinkList<AlphaObjectInfo> &m_alphaEntityList;
+ static RwV3d *&ms_pCameraPosn;
+ static float &ms_cullCompsDist;
+ static float &ms_vehicleLod0Dist;
+ static float &ms_vehicleLod1Dist;
+ static float &ms_vehicleFadeDist;
+ static float &ms_bigVehicleLod0Dist;
+ static float &ms_bigVehicleLod1Dist;
+ static float &ms_pedLod0Dist;
+ static float &ms_pedLod1Dist;
+ static float &ms_pedFadeDist;
+
+ static void Initialise(void);
+ static void InitAlphaEntityList(void);
+ static bool InsertEntityIntoSortedList(CEntity *e, float dist);
+ static void InitAlphaAtomicList(void);
+ static bool InsertAtomicIntoSortedList(RpAtomic *a, float dist);
+
+ static RpAtomic *RenderWheelAtomicCB(RpAtomic *atomic);
+ static RpAtomic *RenderObjNormalAtomic(RpAtomic *atomic);
+ static RpAtomic *RenderAlphaAtomic(RpAtomic *atomic, int alpha);
+ static RpAtomic *RenderFadingAtomic(RpAtomic *atm, float dist);
+
+ static RpAtomic *RenderVehicleHiDetailCB(RpAtomic *atomic);
+ static RpAtomic *RenderVehicleHiDetailAlphaCB(RpAtomic *atomic);
+ static RpAtomic *RenderVehicleHiDetailCB_BigVehicle(RpAtomic *atomic);
+ static RpAtomic *RenderVehicleHiDetailAlphaCB_BigVehicle(RpAtomic *atomic);
+ static RpAtomic *RenderVehicleHiDetailCB_Boat(RpAtomic *atomic);
+ static RpAtomic *RenderVehicleLowDetailCB_BigVehicle(RpAtomic *atomic);
+ static RpAtomic *RenderVehicleLowDetailAlphaCB_BigVehicle(RpAtomic *atomic);
+ static RpAtomic *RenderVehicleReallyLowDetailCB(RpAtomic *atomic);
+ static RpAtomic *RenderVehicleReallyLowDetailCB_BigVehicle(RpAtomic *atomic);
+ static RpAtomic *RenderTrainHiDetailCB(RpAtomic *atomic);
+ static RpAtomic *RenderTrainHiDetailAlphaCB(RpAtomic *atomic);
+
+ static RpAtomic *RenderPlayerCB(RpAtomic *atomic);
+ static RpAtomic *RenderPedLowDetailCB(RpAtomic *atomic);
+ static RpAtomic *RenderPedHiDetailCB(RpAtomic *atomic);
+
+ static void RenderAlphaAtomics(void);
+ static void RenderFadingEntities(void);
+
+ // All actually unused
+ static bool DefaultVisibilityCB(RpClump *clump);
+ static bool FrustumSphereCB(RpClump *clump);
+// static bool MloVisibilityCB(RpClump *clump);
+ static bool VehicleVisibilityCB(RpClump *clump);
+ static bool VehicleVisibilityCB_BigVehicle(RpClump *clump);
+
+ static float GetDistanceSquaredFromCamera(RwFrame *frame);
+ static float GetDotProductWithCameraVector(RwMatrix *atomicMat, RwMatrix *clumpMat, uint32 flags);
+
+ //
+ // RW Plugins
+ //
+
+ union AtomicExt
+ {
+ CSimpleModelInfo *modelInfo; // used by SimpleModelInfo
+ int flags; // used by ClumpModelInfo
+ };
+ static void SetAtomicModelInfo(RpAtomic*, CSimpleModelInfo*);
+ static CSimpleModelInfo *GetAtomicModelInfo(RpAtomic *atomic);
+ static void SetAtomicFlag(RpAtomic*, int);
+ static void ClearAtomicFlag(RpAtomic*, int);
+ static int GetAtomicId(RpAtomic *atomic);
+ static void SetAtomicRenderCallback(RpAtomic*, RpAtomicCallBackRender);
+
+ static void *AtomicConstructor(void *object, int32 offset, int32 len);
+ static void *AtomicDestructor(void *object, int32 offset, int32 len);
+ static void *AtomicCopyConstructor(void *dst, const void *src,
+ int32 offset, int32 len);
+ static int32 &ms_atomicPluginOffset;
+
+ struct FrameExt
+ {
+ // BUG: this is abused to hold a pointer by SetClumpModelInfo
+ int32 id;
+ };
+ static void SetFrameHierarchyId(RwFrame *frame, int32 id);
+ static int32 GetFrameHierarchyId(RwFrame *frame);
+
+ static void *FrameConstructor(void *object, int32 offset, int32 len);
+ static void *FrameDestructor(void *object, int32 offset, int32 len);
+ static void *FrameCopyConstructor(void *dst, const void *src,
+ int32 offset, int32 len);
+ static int32 &ms_framePluginOffset;
+
+ // Not actually used
+ struct ClumpExt
+ {
+ ClumpVisibilityCB visibilityCB;
+ int alpha;
+ };
+ static void SetClumpModelInfo(RpClump*, CClumpModelInfo*);
+ static void SetClumpAlpha(RpClump*, int);
+ static int GetClumpAlpha(RpClump*);
+
+ static void *ClumpConstructor(void *object, int32 offset, int32 len);
+ static void *ClumpDestructor(void *object, int32 offset, int32 len);
+ static void *ClumpCopyConstructor(void *dst, const void *src,
+ int32 offset, int32 len);
+ static int32 &ms_clumpPluginOffset;
+
+ static bool PluginAttach(void);
+};