asset manager

This commit is contained in:
2026-02-24 21:38:34 +02:00
parent 003106a4d7
commit e83f7cd448
9 changed files with 205 additions and 42 deletions

View File

@@ -41,6 +41,11 @@ class CBaseMaterial
public:
DECLARE_CLASS_NOBASE(CBaseMaterial)
DECLARE_DATADESC_NOBASE()
virtual const char *GetShaderPath() { return NULL; };
virtual void *GetDataPtr() { return 0; };
virtual size_t GetDataSize() { return 0; };
uint64_t m_uHash;
};
typedef CBaseMaterial *( *InstantiateMaterialFn )( void );
@@ -56,6 +61,11 @@ public:
};
CBaseMaterial *CreateMaterial( const char *szName );
#define DECLARE_SHADER(path) \
virtual const char *GetShaderPath() override { return path; }; \
virtual void *GetDataPtr() override { return (char*)this+_class_offsetof(ThisClass, m_uHash); } \
virtual size_t GetDataSize() override { return sizeof(ThisClass)-_class_offsetof(ThisClass, m_uHash); }
#define DEFINE_MATERIAL( className, name ) \
static CBaseMaterial *__Create##className##_material() { return ( CBaseMaterial* )( new className ); }; \
static CFunnyMaterialRegistry __CreateMaterail##className##_registry( __Create##className##_material, name );