OGRE 3D Overlay Element

16.Overlay里可以放3d元素?

如果这样的话,就可以用来做3d的新手引导小精灵了!不用再跟巨人一样用序列帧了!

depth_check on时

clip_image002[4]

depth_check off后

clip_image004[4]

 

代码
material Examples / DepthCheck
{
    technique
    {
        pass
        {
            depth_check off
            
            texture_unit
            {
                texture RustySteel.jpg
            }

            texture_unit
            {
                texture spheremap.png
                colour_op_ex add src_texture src_current
                colour_op_multipass_fallback one one
                env_map spherical
            }
        }
    }
}

 

 

在c++代码里 

 代码

        Overlay *  pOverlay  =  OverlayManager::getSingleton().getByName( " Core/DebugOverlay " );
        
if  (pOverlay)
        {
            SceneManager
*  pSM  =  OGRE_NEW DefaultSceneManager( " Overlay SceneManager " );
            SceneNode
*  pNode  =  OGRE_NEW SceneNode(pSM,  " Overlay Node " );
            pNode
-> setPosition( - 10 , 10 , - 160 );
            Entity
*  pEnt  =  mSceneMgr -> createEntity( " head " " ogrehead.mesh " );
           
//  如果指定material脚本的话,在脚本里关闭depth check
// pEnt->setMaterialName("Examples/DepthCheck");
            pNode -> attachObject(pEnt);
           
//  如果不指定material脚本的话,关闭每个pass的depth check
             for  (unsigned  int  i  =   0 ; i  <  pEnt -> getNumSubEntities();  ++ i)
            {
                SubEntity
*  pSubEnt  =  pEnt -> getSubEntity(i);
                
if  (pSubEnt)
                {
                    Technique
*  pTech  =  pSubEnt -> getMaterial() -> getBestTechnique();
                    
if  (pTech)
                    {
                        
for  (unsigned  int  iPass  =   0 ; iPass  <  pTech -> getNumPasses();  ++ iPass)
                        {
                            Pass
*  pPass  =  pTech -> getPass(iPass);
                            
if  (pPass)
                            {
                                pPass
-> setDepthCheckEnabled( false );
                            }                            
                        }                        
                    }                    
                }                
            }            
            pOverlay
-> add3D(pNode);
        }

 

这样子关闭了pass的depth_check后,如果在场景里也用这个模型并且使用这个pass渲染的时候就没有depth_check了。反正屏幕上用的一般不会在场景里使用,所以也没问题了。

改了下position试了下,发现Overlay坐标系如下

clip_image005[4]

右手坐标系,ViewPort中心是原点.

可以继续YY下,播放角色骨骼动画及声音,以及屏幕上的运动轨迹,就可以用来做新手引导小精灵了!用来做个3D的施法进度条也可以啊!

虽然OGRE的表层元素类和表层容器类被设计为是可供应用程序开发人员扩展的,但是有一些元素是Ogre本身自带的。包括:

· Panel

· BorderPanel

· TextArea

3D的Overlay Element看来也是可以在脚本中配置的,有兴趣了再弄!

 

 

http://www.cnblogs.com/lai3d/archive/2010/01/21/1653635.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值