Ogre bsp场景管理笔记

1.用到的知识点

  如何判断点在平面哪一边? 以及判断aabb盒子在面的哪一边?

   Real Plane::getDistance (const Vector3& rkPoint) const
    {
        return normal.dotProduct(rkPoint) + d;
    }
    //-----------------------------------------------------------------------
    Plane::Side Plane::getSide (const Vector3& rkPoint) const
    {
        Real fDistance = getDistance(rkPoint);

        if ( fDistance < 0.0 )
            return Plane::NEGATIVE_SIDE;

        if ( fDistance > 0.0 )
            return Plane::POSITIVE_SIDE;

        return Plane::NO_SIDE;
    }

  Plane::Side Plane::getSide (const Vector3& centre, const Vector3& halfSize) const
  {
    // Calculate the distance between box centre and the plane
    Real dist = getDistance(centre);

 
  

    // Calculate the maximise allows absolute distance for
    // the distance between box centre and plane
    Real maxAbsDist = normal.absDotProduct(halfSize);

 
  

    if (dist < -maxAbsDist)
      return Plane::NEGATIVE_SIDE;

 
  

    if (dist > +maxAbsDist)
      return Plane::POSITIVE_SIDE;

 
  

    return Plane::BOTH_SIDE;
  }



2. 如何获取可见节点

  1.获取相机所在的叶子节点

  BspNode* cameraNode = mLevel->findLeaf(camera->getDerivedPosition());

  查找体现出了bsp的特性,根据节点的分割面,定位相机所在的节点

  2.找到相机所在的节点后,根据PVS (潜在可视集合Potentially Visible Set)。获取从该节点处可看到节点的。

    portal技术,由于笔者也不会,不做介绍。

3. 总结

  Ogre 的bsp scenemanager 主要是基于quake的bsp。 是基于室内的场景管理, 一个节点相当于一个房间,通过Cluster

  可查到在该房间内可以看到的其它房间。 而通过bsp可以快速查找相机所在的房间。

  以上纯属笔者自己见解,如有错误,欢迎谈讨 :)

  

 

转载于:https://www.cnblogs.com/duzib/p/4457457.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值