// ================================================================
// Filename: CD3DObject.h
// Description: Header file for CD3DObject class - Presents a base
// class for all scene objects, providing central
// management, scene handling and resource management.
//
// This source corresponds to 32Bits.co.uk DirectX
// Basics tutorial 3 part 5 DX9 Edition.
// ================================================================
#ifndef _CD3DOBJECT_H
#define _CD3DOBJECT_H
// We added: the CUBE enum member for D3D Basics 3 Tutorial 5 cube class.
// the MESH enum member for D3D Techniques 1 Tutorial 4 mesh class.
enum D3DRTTI {UNKNOWN, SPRITE, RASTERFONT, CUBE, MESH};
class CD3DObject
{
private:
D3DRTTI m_nObjectType; // Holds the class type (run time type info)
CD3DObject* m_llpNextObject; // pointer to the next object in the linked list
CD3DObject* m_llpPrevObject; // pointer to the previous object in the linked list
public:
char* m_pszClassDesc; // Holds the readable class description
CD3DObject();
virtual ~CD3DObject();
// Pure virtual methods. These have no use in the base class
virtual HRESULT Render(LPDIRECT3DDEVICE8& pDevice, LPDIRECT3DSURFACE8& pRenderSurface)=0;
virtual HRESULT Render(LPDIRECT3DDEVICE8& pDevice)=0;
virtual HRESULT RestoreVolatile()=0;
virtual HRESULT ReleaseVolatile()=0;
// Helper methods, generic across all derived classes
virtual void SetClassDesc(char* szDesc);
virtual void SetRTTI(D3DRTTI RTTIType);
virtual D3DRTTI GetRTTI(D3DRTTI* RTTIType);
virtual HRESULT Error(HRESULT hrCode, int nLine, char* szFile, char* szExtraInfo=NULL);
// Linked list methods, generic across all derived classes
virtual HRESULT SetNextObject(CD3DObject* pD3DObject);
virtual CD3DObject* GetNextObject(CD3DObject** pD3DObject=NULL);
virtual HRESULT SetPrevObject(CD3DObject* pD3DObject);
virtual CD3DObject* GetPrevObject(CD3DObject** pD3DObject=NULL);
};
#endif // _CD3DOBJECT_H