您的位置:首页 > 其它

CryEngineBase类的设计

2017-06-26 13:42 369 查看

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  CryEngine5