64 lines
1.1 KiB
C++
64 lines
1.1 KiB
C++
#ifndef FUNNY_MATERIALS_H
|
|
#define FUNNY_MATERIALS_H
|
|
#include "datamap.h"
|
|
#include "stdint.h"
|
|
|
|
#define TEXTURE_INVALID 0
|
|
#define TEXTURE_NO_TEXTURE -1
|
|
|
|
namespace FMat
|
|
{
|
|
typedef int32_t XMTexture;
|
|
struct XMFLOAT2
|
|
{
|
|
float x;
|
|
float y;
|
|
};
|
|
struct XMFLOAT3
|
|
{
|
|
float x;
|
|
float y;
|
|
float z;
|
|
};
|
|
struct XMFLOAT4
|
|
{
|
|
float x;
|
|
float y;
|
|
float z;
|
|
float w;
|
|
};
|
|
struct XMFLOAT4x4
|
|
{
|
|
XMFLOAT4 row1;
|
|
XMFLOAT4 row2;
|
|
XMFLOAT4 row3;
|
|
XMFLOAT4 row4;
|
|
};
|
|
}
|
|
|
|
class CBaseMaterial
|
|
{
|
|
public:
|
|
DECLARE_CLASS_NOBASE(CBaseMaterial)
|
|
DECLARE_DATADESC_NOBASE()
|
|
};
|
|
|
|
typedef CBaseMaterial *( *InstantiateMaterialFn )( void );
|
|
class CFunnyMaterialRegistry
|
|
{
|
|
public:
|
|
CFunnyMaterialRegistry( InstantiateMaterialFn fn, const char *szName );
|
|
|
|
InstantiateMaterialFn m_CreateFn;
|
|
const char *m_szName;
|
|
|
|
CFunnyMaterialRegistry *m_pNext;
|
|
};
|
|
CBaseMaterial *CreateMaterial( const char *szName );
|
|
|
|
#define DEFINE_MATERIAL( className, name ) \
|
|
static CBaseMaterial *__Create##className##_material() { return ( CBaseMaterial* )( new className ); }; \
|
|
static CFunnyMaterialRegistry __CreateMaterail##className##_registry( __Create##className##_material, name );
|
|
|
|
#endif
|