-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCBaseModelRender.h
More file actions
54 lines (47 loc) · 2.02 KB
/
CBaseModelRender.h
File metadata and controls
54 lines (47 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include "main.h"
class CBaseModelRender
{
private:
struct tModelStruct {
CBaseModelInfo* pModelInfo;
std::uint32_t nBoneId;
RwV3d vOffset;
RwV3d vRotate;
RwV3d vScale;
RwRGBA tColor;
union {
RwObject* pRwObject;
RpClump* pRwClump;
RpAtomic* pRwAtomic;
};
};
std::unordered_map<std::uint32_t, std::array<tModelStruct, 8>> m_Players;
std::unordered_map<std::uint32_t, CAtomicModelInfo*> m_CustomModels;
CPed* GetPedPointer(std::uint32_t nHandle);
RwMatrix* GetBoneMatrix(CPed* pPed, std::uint32_t nBoneId);
void ApplyMatrixOffset(RwMatrix* pMatrix, const RwV3d& vOffset);
void RotateMatrix(RwMatrix* pMatrix, RwV3d vRotate);
// Private methods for custom models
bool LoadTxd(const std::string& szTxdPath, const std::uint16_t& nModelId, CAtomicModelInfo* pModelInfo);
bool LoadAtomicModel(const std::string& szDffPath, const std::uint16_t& nModelId, CAtomicModelInfo* pModelInfo);
public:
CBaseModelRender();
bool AddModel(CBaseModelInfo* pModel, std::uint32_t nPedHandle, std::uint32_t nBoneId, std::uint8_t nSlot);
void RemoveModel(std::uint32_t nPedHandle, std::uint8_t nSlot);
void RemoveAllModels(std::uint32_t nPedHandle);
void RotateModel(std::uint32_t nPedHandle, std::uint8_t nSlot, const RwV3d& vRotate);
void SetModelOffset(std::uint32_t nPedHandle, std::uint8_t nSlot, const RwV3d& vOffset);
void SetModelScale(std::uint32_t nPedHandle, std::uint8_t nSlot, const RwV3d& vScale);
void RenderModels();
void SetModelColor(std::uint32_t nPedHandle, std::uint8_t nSlot, const RwRGBA& tColor);
void Cleanup();
// Public methods for custom models
std::uint16_t LoadSimpleModel(const std::string& szDffPath, const std::string& szTxdPath);
CAtomicModelInfo* GetCustomModel(std::uint16_t nModelId);
// Static methods for callback's
static RpAtomic* ClumpsForAtomic(RpAtomic* pAtomic, void* pData);
static RpMaterial* GeometryForMaterials(RpMaterial* pMaterial, void* pData);
static RpAtomic* SetRelatedModelInfoCB(RpAtomic* atomic, void* data);
};
extern CBaseModelRender* g_BaseModelRender;