Wow的室内环境,奥格瑞玛/血色修道院等,是由wmo文件代表的sector组成的,从解析出来的sector三维景象来看,是很明显的portal sector,比如甬道被格成单独的wmo,每个wmo sector有明显的portal开口.
Portal引擎和BSP是可以一起使用的,不相互排斥,对每个sector的处理将采用BSP算法,这个概念很关键.Portal的另一个重要作用是将室外环境和室内环境在算法逻辑上联系起来.
可以确定,Wow的室内碰撞检测是使用BSP来完成的,其BSP为Leafy BSP. Leafy BSP使用的切分平面可以不与场景中的多边形共面,切分平面目前只看到X,Y,Z三轴,定义等同Quake3源码中的定义.
在碰撞检测中,BSP数据最神奇的地方就在于,它能够快速地给出人物附近的三角面集合,即需要进行碰撞检测的三角形集合.
若将Leaf上的数据全设0,则进入游戏后,室内场景就没有碰撞了.
此BSP除了碰撞检测,还对室内的渲染有影响.
Most engines do not use the BSP-tree to speed up the drawing, such as portal engines, but still almost all of them have built a BSP-tree out of the geometry. This is because of the great advantage when calculating the collision detection, namely that it is very cheap to position the user in the BSP-tree. When that is done, the only polygons needed to be checked; are the polygons in the leaves the object passed through that frame.
References:
http://www.flipcode.com/articles/portals_issue01.shtml
Core Techniques and Algorithms in Game Programming
http://www.devmaster.net/articles/bsp-trees/
http://www.karkza.org/ftp/programming/misc/bsp.htm
http://www.devmaster.net/articles/bsp-trees-physics/