游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1783|回复: 1

使用enableCustomNearClipPlane的问题.

[复制链接]

4

主题

7

帖子

9

积分

新手上路

Rank: 1

积分
9
发表于 2008-12-12 15:01:00 | 显示全部楼层 |阅读模式
正常情况下, 会把场景中所有的东西剪切,但是我有一个不想被剪切的物体,请问这个怎样实现?

void ReflactionRenderQueueListener::renderQueueStarted( Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& skipThisInvocation)
{
        if ( queueGroupId == Ogre::RENDER_QUEUE_WORLD_GEOMETRY_1 )
        {
                g_xDemoSceneMgr.GetCamera()->disableCustomNearClipPlane();
                Ogre::Root::getSingleton().getRenderSystem()->_setProjectionMatrix( g_xDemoSceneMgr.GetCamera()->getProjectionMatrixRS() );
        }
}

void ReflactionRenderQueueListener::renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation)
{
        if ( queueGroupId == Ogre::RENDER_QUEUE_WORLD_GEOMETRY_1 )
        {
           Ogre::Vector3 pos = m_pTexture->m_pTexture->m_pWaterObject->getWorldPosition();
                Ogre:lane plane( Ogre::Vector3::NEGATIVE_UNIT_Y, -pos.y );                                                                                                               
                g_xDemoSceneMgr.GetCamera()->enableCustomNearClipPlane( plane );
                Ogre::Root::getSingleton().getRenderSystem()->_setProjectionMatrix( g_xDemoSceneMgr.GetCamera()->getProjectionMatrixRS() );
        }
}

使用上面的代码可以实现,但是存在一个问题:
好像那个没被剪切的物体没有被正常的写入深度缓存.
现在有一些被那个没剪切的物体所遮挡的物体也被绘制出来的了, 请问这个怎样解决??
sf_2008121215034.png

1367

主题

1993

帖子

2118

积分

金牌会员

Rank: 6Rank: 6

积分
2118
发表于 2008-12-12 15:07:00 | 显示全部楼层

Re:使用enableCustomNearClipPlane的问题.

up
up
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-20 17:08

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表