r5sdk/r5dev/public/datacache/imdlcache.h
Kawe Mazidjatari abe68def03 CMDLCache code improvements
Slightly mapped out the CMDLCache class, to the point the pointers to its members are no longer needed. Also fixed a bug were the studiodata pointer was dereferenced before checking if its not null, this check did exist, but was performed too late. Fully implemented the CUtlDict class for m_MDLDict. Slightly optimized the initialization of the error model handles.
2023-06-19 13:53:56 +02:00

54 lines
1.3 KiB
C

#ifndef IMDLCACHE_H
#define IMDLCACHE_H
#define ERROR_MODEL "mdl/error.rmdl"
#define EMPTY_MODEL "mdl/dev/empty_model.rmdl"
#define IDSTUDIOHEADER (('T'<<24)+('S'<<16)+('D'<<8)+'I')
//-----------------------------------------------------------------------------
// Reference to a loaded studiomdl
//-----------------------------------------------------------------------------
typedef unsigned short MDLHandle_t;
inline MDLHandle_t VoidPtrToMDLHandle(void* ptr)
{
return (MDLHandle_t)(int)(intptr_t)ptr;
}
inline void* MDLHandleToVirtual(MDLHandle_t hndl)
{
return (void*)(uintptr_t)hndl;
}
enum
{
MDLHANDLE_INVALID = (MDLHandle_t)~0
};
//-----------------------------------------------------------------------------
// Cache data types
//-----------------------------------------------------------------------------
enum MDLCacheDataType_t
{
MDLCACHE_NONE = -1,
// Callbacks to get called when data is loaded or unloaded for these:
MDLCACHE_STUDIOHDR = 0,
MDLCACHE_STUDIOHWDATA,
MDLCACHE_VCOLLIDE,
// Callbacks NOT called when data is loaded or unloaded for these:
MDLCACHE_ANIMBLOCK,
MDLCACHE_VIRTUALMODEL,
MDLCACHE_VERTEXES,
MDLCACHE_DECODEDANIMBLOCK
};
abstract_class IMDLCache : public IAppSystem
{
// !TODO: map this out.
};
#endif // !IMDLCACHE_H