[转]Ogre中也可以直接使用D3D底层接口

http://hi.baidu.com/janxhuilk/blog/item/6b041b66d534b53eaa184c52.html

Ogre真的很强大,它为使用者提供了类似:

mWindow->getCustomAttribute("D3DDEVICE", &m_pD3dDevice);
  assert( m_pD3dDevice );

的方法让开发人员方便直接调用D3D的接口!

渲染时可以让你的类继承Ogre::RenderQueueListener,

virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation,   bool& skipThisInvocation)
        { (void)queueGroupId; (void)invocation; (void)skipThisInvocation; }

virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation,   bool& repeatThisInvocation)
        { (void)queueGroupId; (void)invocation; (void)repeatThisInvocation; }

两个成员方法是在IDirect3DDevice9::BeginScene()和IDirect3DDevice9::EndScene()中被调用的,

因此你的D3D绘制操作可以写在这两个成员函数之间。

记着初始化时将Ogre::RenderQueueListener对象添加到Ogre场景管理器的渲染队列监听器列表中。

mSceneMgr->addRenderQueueListener( this );

到此你就可以使用D3D接口实现任意效果!包括使用shader。或effect。本人非常喜欢使用DX提供的Effect框架!

原文地址:https://www.cnblogs.com/pulas/p/2349473.html