CryEngineBase类的设计

来源:互联网 发布:财务对账软件 编辑:程序博客网 时间:2024/05/20 14:16

CryEngineBase类,包含了基本的系统指针对象,其对象都是静态对象,则所有派生类均可共享。

struct Cry3DEngineBase{    static ISystem*   m_pSystem;    static IRenderer* m_pRenderer;    static ITimer*m_pTimer;    static ILog*  m_pLog;    static IPhysicalWorld*m_pPhysicalWorld;    static IConsole*  m_pConsole;    static C3DEngine* m_p3DEngine;    static CVars* m_pCVars;    static ICryPak*   m_pCryPak;    static CObjManager*   m_pObjManager;    static CTerrain*  m_pTerrain;    static IParticleManager*  m_pPartManager;    static std::shared_ptr<pfx2::IParticleSystem> m_pParticleSystem;    static IOpticsManager*m_pOpticsManager;    static CDecalManager* m_pDecalManager;    static CCloudsManager*m_pCloudsManager;    static CVisAreaManager*   m_pVisAreaManager;    static CClipVolumeManager*m_pClipVolumeManager;    static CMatMan*   m_pMatMan;    static CSkyLightManager*  m_pSkyLightManager;    static CWaterWaveManager* m_pWaterWaveManager;    static CRenderMeshMerger* m_pRenderMeshMerger;    static CMergedMeshesManager*  m_pMergedMeshesManager;    static CBreezeGenerator*  m_pBreezeGenerator;    static IStreamedObjectListener*   m_pStreamListener;    static CGeomCacheManager* m_pGeomCacheManager;}

这样设计也很精妙,所有子类都可以方便访问系统全局的对象。

class CObjManager : public Cry3DEngineBase;class C3DEngine : public I3DEngine, public Cry3DEngineBase;class CObjManager : public Cry3DEngineBase
原创粉丝点击