Ogre Scene Renderer - 如何将一个可渲染对象加进渲染队列

  1. 判断对象是否半透明实体  
  1.   //-----------------------------------------------------------------------  
  2.   bool Pass::isTransparent(voidconst  
  3.   {  
  4. // Transparent if any of the destination colour is taken into account  
  5. if (mDestBlendFactor == SBF_ZERO &&  
  6.     mSourceBlendFactor != SBF_DEST_COLOUR &&  
  7.     mSourceBlendFactor != SBF_ONE_MINUS_DEST_COLOUR &&  
  8.     mSourceBlendFactor != SBF_DEST_ALPHA &&  
  9.     mSourceBlendFactor != SBF_ONE_MINUS_DEST_ALPHA)  
  10. {  
  11.     return false;  
  12. }  
  13.    else  
  14. {  
  15.     return true;  
  16. }  
  17.   }  


 

  1. //-----------------------------------------------------------------------  
  2. void RenderPriorityGroup::addRenderable(Renderable* rend, Technique* pTech)  
  3. {  
  4.     // Transparent and depth/colour settings mean depth sorting is required?  
  5.     // Note: colour write disabled with depth check/write enabled means  
  6.     //       setup depth buffer for other passes use.  
  1.      // <strong>这个很长的if决定对象是否半透明实体</strong>  
  2.      if (pTech->isTransparentSortingForced() ||   
  3. (pTech->isTransparent() &&   
  4.          (!pTech->isDepthWriteEnabled() ||  
  5.           !pTech->isDepthCheckEnabled() ||  
  6.           pTech->hasColourWriteDisabled())))  
  7.      {  
  8. if (pTech->isTransparentSortingEnabled())  
  9.     addTransparentRenderable(pTech, rend);  
  10. else  
  11.     addUnsortedTransparentRenderable(pTech, rend);  
  12.      }  
  13.      else  
  14.      {  
  15.          if (mSplitNoShadowPasses &&  
  16.              mParent->getShadowsEnabled() &&  
  17.     (!pTech->getParent()->getReceiveShadows() ||  
  18.     rend->getCastsShadows() && mShadowCastersNotReceivers))  
  19.          {  
  20.              // Add solid renderable and add passes to no-shadow group  
  21.              addSolidRenderable(pTech, rend, true);  
  22.          }  
  23.          else  
  24.          {  
  25.              if (mSplitPassesByLightingType && mParent->getShadowsEnabled())  
  26.              {  
  27.                  addSolidRenderableSplitByLightType(pTech, rend);  
  28.              }  
  29.              else  
  30.              {  
  31.                  addSolidRenderable(pTech, rend, false);  
  32.              }  
  33.          }  
  34.      }  
  35.   
  36.  }  

 

 

 

每一个RenderPriorityGroup由6个队列组成
+  mSolidsBasic {msRadixSorter1={...} msRadixSorter2={...} mOrganisationMode='' ...} Ogre::QueuedRenderableCollection
+  mSolidsDiffuseSpecular {msRadixSorter1={...} msRadixSorter2={...} mOrganisationMode='' ...} Ogre::QueuedRenderableCollection
+  mSolidsDecal {msRadixSorter1={...} msRadixSorter2={...} mOrganisationMode='' ...} Ogre::QueuedRenderableCollection
+  mSolidsNoShadowReceive {msRadixSorter1={...} msRadixSorter2={...} mOrganisationMode='' ...} Ogre::QueuedRenderableCollection
+  mTransparentsUnsorted {msRadixSorter1={...} msRadixSorter2={...} mOrganisationMode='' ...} Ogre::QueuedRenderableCollection
+  mTransparents {msRadixSorter1={...} msRadixSorter2={...} mOrganisationMode='' ...} Ogre::QueuedRenderableCollection


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值