36 char str[ROUND_UP(N + 1, 4)];
51 ulong GetTypeID()
const {
53 return reinterpret_cast<ulong
>(mName);
56 const char* GetTypeName()
const {
60 bool operator==(
const TypeObj& rOther)
const {
61 return GetTypeID() == rOther.GetTypeID();
65 const ResNameDataPT* mName;
69 G3DPROC_NONE = 0x00000,
71 G3DPROC_CALC_WORLD = 0x00001,
72 G3DPROC_CALC_MAT = 0x00002,
73 G3DPROC_CALC_VTX = 0x00003,
74 G3DPROC_CALC_VIEW = 0x00004,
75 G3DPROC_GATHER_SCNOBJ = 0x00005,
76 G3DPROC_DRAW_OPA = 0x00006,
77 G3DPROC_DRAW_XLU = 0x00007,
78 G3DPROC_UPDATEFRAME = 0x00008,
81 __G3DPROC_OPTIONAL_END,
83 G3DPROC_CHILD_DETACHED = 0x10001,
84 G3DPROC_ATTACH_PARENT = 0x10002,
85 G3DPROC_DETACH_PARENT = 0x10003,
86 G3DPROC_ZSORT = 0x10004
90 virtual bool IsDerivedFrom(
TypeObj other)
const {
91 return other == GetTypeObjStatic();
94 virtual void G3dProc(ulong task, ulong param,
void* pInfo) = 0;
97 virtual const TypeObj GetTypeObj()
const {
100 static const G3dObj::TypeObj GetTypeObjStatic() {
103 virtual const char* GetTypeName()
const {
104 return GetTypeObj().GetTypeName();
107 G3dObj(MEMAllocator* pAllocator, G3dObj* pParent)
108 : mpHeap(pAllocator), mpParent(pParent) {}
110 G3dObj* GetParent()
const {
113 void SetParent(G3dObj* pParent) {
116 void DetachFromParent();
120 static void* Alloc(MEMAllocator* pAllocator, ulong size) {
121 return detail::AllocFromAllocator(pAllocator, size);
123 static void Dealloc(MEMAllocator* pAllocator,
void* pBlock) {
124 detail::FreeToAllocator(pAllocator, pBlock);
127 static inline void*
operator new(
size_t ,
void* pBlock) {
130 static inline void operator delete(
void* ) {}
132 template <
typename TTo>
static TTo* DynamicCast(G3dObj* pObj) {
133 if (pObj != NULL && pObj->IsDerivedFrom(TTo::GetTypeObjStatic())) {
134 return static_cast<TTo*
>(pObj);
141 MEMAllocator* mpHeap;
143 __NW4R_G3D_TYPEOBJ_DECL(G3dObj);