1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-10 18:09:16 +00:00
re3/src/rw/VisibilityPlugins.h

149 lines
5.3 KiB
C
Raw Normal View History

2019-05-15 14:52:37 +00:00
#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;
};
2020-04-16 08:50:45 +00:00
static CLinkList<AlphaObjectInfo> m_alphaList;
2020-05-11 20:21:18 +00:00
static CLinkList<AlphaObjectInfo> m_alphaBoatAtomicList;
2020-04-16 08:50:45 +00:00
static CLinkList<AlphaObjectInfo> m_alphaEntityList;
2020-05-11 20:21:18 +00:00
static CLinkList<AlphaObjectInfo> m_alphaUnderwaterEntityList;
2020-11-03 19:33:07 +00:00
#ifdef NEW_RENDERER
static CLinkList<AlphaObjectInfo> m_alphaBuildingList;
#endif
2020-04-16 08:50:45 +00:00
static RwCamera *ms_pCamera;
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_pedLod1Dist;
static float ms_pedFadeDist;
2019-05-15 14:52:37 +00:00
static void Initialise(void);
2019-06-13 10:25:55 +00:00
static void Shutdown(void);
2019-05-15 14:52:37 +00:00
static void InitAlphaEntityList(void);
static bool InsertEntityIntoSortedList(CEntity *e, float dist);
static void InitAlphaAtomicList(void);
static bool InsertAtomicIntoSortedList(RpAtomic *a, float dist);
2020-05-11 20:21:18 +00:00
static bool InsertAtomicIntoBoatSortedList(RpAtomic *a, float dist);
2019-05-15 14:52:37 +00:00
2019-05-31 09:44:43 +00:00
static void SetRenderWareCamera(RwCamera *camera);
2020-05-11 15:03:32 +00:00
static void SetupVehicleVariables(RpClump *vehicle);
2019-05-31 09:44:43 +00:00
2019-05-15 14:52:37 +00:00
static RpAtomic *RenderWheelAtomicCB(RpAtomic *atomic);
static RpAtomic *RenderObjNormalAtomic(RpAtomic *atomic);
static RpAtomic *RenderAlphaAtomic(RpAtomic *atomic, int alpha);
2020-05-10 08:04:20 +00:00
static RpAtomic *RenderWeaponCB(RpAtomic *atomic);
2019-05-15 14:52:37 +00:00
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);
2020-05-11 20:21:18 +00:00
static RpAtomic *RenderVehicleHiDetailAlphaCB_Boat(RpAtomic *atomic);
2019-05-15 14:52:37 +00:00
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);
2020-05-10 15:09:14 +00:00
static RpAtomic *RenderVehicleRotorAlphaCB(RpAtomic *atomic);
static RpAtomic *RenderVehicleTailRotorAlphaCB(RpAtomic *atomic);
2019-05-15 14:52:37 +00:00
static RpAtomic *RenderPlayerCB(RpAtomic *atomic);
static RpAtomic *RenderPedCB(RpAtomic *atomic); // for skinned models with only one clump
2019-05-15 14:52:37 +00:00
2020-05-11 20:21:18 +00:00
static void RenderAtomicList(CLinkList<AlphaObjectInfo> &list);
2019-05-15 14:52:37 +00:00
static void RenderAlphaAtomics(void);
2020-05-11 20:21:18 +00:00
static void RenderBoatAlphaAtomics(void);
static void RenderFadingEntities(CLinkList<AlphaObjectInfo> &list);
2019-05-15 14:52:37 +00:00
static void RenderFadingEntities(void);
2020-05-11 15:03:32 +00:00
static void RenderFadingUnderwaterEntities(void);
2019-05-15 14:52:37 +00:00
// All actually unused
static bool DefaultVisibilityCB(RpClump *clump);
static bool FrustumSphereCB(RpClump *clump);
static bool VehicleVisibilityCB(RpClump *clump);
static bool VehicleVisibilityCB_BigVehicle(RpClump *clump);
2020-07-01 16:03:39 +00:00
static float GetDistanceSquaredFromCamera(RwV3d *pos);
2019-05-15 14:52:37 +00:00
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);
2020-04-16 08:50:45 +00:00
static int32 ms_atomicPluginOffset;
2019-05-15 14:52:37 +00:00
struct FrameExt
{
// BUG: this is abused to hold a pointer by SetClumpModelInfo
intptr id;
2019-05-15 14:52:37 +00:00
};
static void SetFrameHierarchyId(RwFrame *frame, intptr id);
static intptr GetFrameHierarchyId(RwFrame *frame);
2019-05-15 14:52:37 +00:00
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);
2020-04-16 08:50:45 +00:00
static int32 ms_framePluginOffset;
2019-05-15 14:52:37 +00:00
// 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);
2020-04-16 08:50:45 +00:00
static int32 ms_clumpPluginOffset;
2019-05-15 14:52:37 +00:00
static bool PluginAttach(void);
};
RpMaterial *SetAlphaCB(RpMaterial *material, void *data);