| 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 |
#if !defined( INCLUDED_IECLASS_H ) |
| 27 |
#define INCLUDED_IECLASS_H |
| 28 |
|
| 29 |
#include "generic/constant.h" |
| 30 |
|
| 31 |
#define MAX_FLAGS 16 |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
#define ECLASS_LIGHT 0x00000001 |
| 36 |
#define ECLASS_ANGLE 0x00000002 |
| 37 |
#define ECLASS_PATH 0x00000004 |
| 38 |
#define ECLASS_MISCMODEL 0x00000008 |
| 39 |
|
| 40 |
class Shader; |
| 41 |
|
| 42 |
class EntityClass; |
| 43 |
class ListAttributeType; |
| 44 |
|
| 45 |
class EntityClassCollector |
| 46 |
{ |
| 47 |
public: |
| 48 |
virtual void insert( EntityClass* eclass ) = 0; |
| 49 |
virtual void insert( const char* name, const ListAttributeType& list ){ |
| 50 |
} |
| 51 |
}; |
| 52 |
|
| 53 |
struct EntityClassScanner |
| 54 |
{ |
| 55 |
INTEGER_CONSTANT( Version, 1 ); |
| 56 |
STRING_CONSTANT( Name, "eclass" ); |
| 57 |
|
| 58 |
void ( *scanFile )( EntityClassCollector& collector, const char* filename ); |
| 59 |
const char* ( *getExtension )( ); |
| 60 |
}; |
| 61 |
|
| 62 |
#include "modulesystem.h" |
| 63 |
|
| 64 |
template<typename Type> |
| 65 |
class ModuleRef; |
| 66 |
typedef ModuleRef<EntityClassScanner> EClassModuleRef; |
| 67 |
|
| 68 |
template<typename Type> |
| 69 |
class Modules; |
| 70 |
typedef Modules<EntityClassScanner> EClassModules; |
| 71 |
|
| 72 |
template<typename Type> |
| 73 |
class ModulesRef; |
| 74 |
typedef ModulesRef<EntityClassScanner> EClassModulesRef; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
class EntityClassVisitor |
| 82 |
{ |
| 83 |
public: |
| 84 |
virtual void visit( EntityClass* eclass ) = 0; |
| 85 |
}; |
| 86 |
|
| 87 |
class ModuleObserver; |
| 88 |
|
| 89 |
|
| 90 |
struct EntityClassManager |
| 91 |
{ |
| 92 |
INTEGER_CONSTANT( Version, 1 ); |
| 93 |
STRING_CONSTANT( Name, "eclassmanager" ); |
| 94 |
|
| 95 |
EntityClass* ( *findOrInsert )( const char* name, bool has_brushes ); |
| 96 |
const ListAttributeType* ( *findListType )(const char* name); |
| 97 |
void ( *forEach )( EntityClassVisitor& visitor ); |
| 98 |
void ( *attach )( ModuleObserver& observer ); |
| 99 |
void ( *detach )( ModuleObserver& observer ); |
| 100 |
void ( *realise )(); |
| 101 |
void ( *unrealise )(); |
| 102 |
}; |
| 103 |
|
| 104 |
template<typename Type> |
| 105 |
class GlobalModule; |
| 106 |
typedef GlobalModule<EntityClassManager> GlobalEntityClassManagerModule; |
| 107 |
|
| 108 |
template<typename Type> |
| 109 |
class GlobalModuleRef; |
| 110 |
typedef GlobalModuleRef<EntityClassManager> GlobalEntityClassManagerModuleRef; |
| 111 |
|
| 112 |
inline EntityClassManager& GlobalEntityClassManager(){ |
| 113 |
return GlobalEntityClassManagerModule::getTable(); |
| 114 |
} |
| 115 |
|
| 116 |
#endif |