本文整理汇总了C++中ogre::AxisAlignedBox::intersects方法的典型用法代码示例。如果您正苦于以下问题:C++ AxisAlignedBox::intersects方法的具体用法?C++ AxisAlignedBox::intersects怎么用?C++ AxisAlignedBox::intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::AxisAlignedBox
的用法示例。
在下文中一共展示了AxisAlignedBox::intersects方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
///////////////////////////////////////////////////////////////
// collides with any other bounding boxes?
bool
Agent::intersects(Ogre::Entity* e)
{
if (e == NULL) { return false; }
Ogre::AxisAlignedBox mBox = mBodyEntity->getWorldBoundingBox();
Ogre::AxisAlignedBox eBox = e->getWorldBoundingBox();
return mBox.intersects(eBox);
}
示例2:
bool
Agent::intersectsSphere(Ogre::Entity* e)
{
if (e == NULL) { return false; }
Ogre::AxisAlignedBox mBox = mBodyEntity->getWorldBoundingBox();
//Ogre::Real radius= e->getBoundingRadius();
Ogre::AxisAlignedBox eBox = e->getBoundingBox();
//e->getWorldBoundingSphere
e->getBoundingBox();
return mBox.intersects(eBox);
}
示例3: _convertOgreEntities
void InputGeometry::_convertOgreEntities(const Ogre::AxisAlignedBox& tileBounds)
{
std::vector<Ogre::Entity*> selectedEntities;
Ogre::AxisAlignedBox boundingBox;
Ogre::Matrix4 transform;
for(auto itr = _sourceMeshes.begin(); itr != _sourceMeshes.end(); ++itr)
{
transform = _referenceNode->_getFullTransform().inverse() * (*itr)->getParentSceneNode()->_getFullTransform();
boundingBox = (*itr)->getBoundingBox();
boundingBox.transform(transform);
if(boundingBox.intersects(tileBounds))
{
selectedEntities.push_back(*itr);
}
}
_sourceMeshes.clear();
_sourceMeshes = selectedEntities;
_convertOgreEntities();
}
示例4: isInLightRange
//-----------------------------------------------------------------------
bool Light::isInLightRange(const Ogre::AxisAlignedBox& container) const
{
bool isIntersect = true;
//Check the 2 simple / obvious situations. Light is directional or light source is inside the container
if ((mLightType != LT_DIRECTIONAL) && (container.intersects(mDerivedPosition) == false))
{
//Check that the container is within the sphere of the light
isIntersect = Math::intersects(Sphere(mDerivedPosition, mRange),container);
//If this is a spotlight, do a more specific check
if ((isIntersect) && (mLightType == LT_SPOTLIGHT) && (mSpotOuter.valueRadians() <= Math::PI))
{
//Create a rough bounding box around the light and check if
Quaternion localToWorld = Vector3::NEGATIVE_UNIT_Z.getRotationTo(mDerivedDirection);
Real boxOffset = Math::Sin(mSpotOuter * 0.5) * mRange;
AxisAlignedBox lightBoxBound;
lightBoxBound.merge(Vector3::ZERO);
lightBoxBound.merge(localToWorld * Vector3(boxOffset, boxOffset, -mRange));
lightBoxBound.merge(localToWorld * Vector3(-boxOffset, boxOffset, -mRange));
lightBoxBound.merge(localToWorld * Vector3(-boxOffset, -boxOffset, -mRange));
lightBoxBound.merge(localToWorld * Vector3(boxOffset, -boxOffset, -mRange));
lightBoxBound.setMaximum(lightBoxBound.getMaximum() + mDerivedPosition);
lightBoxBound.setMinimum(lightBoxBound.getMinimum() + mDerivedPosition);
isIntersect = lightBoxBound.intersects(container);
//If the bounding box check succeeded do one more test
if (isIntersect)
{
//Check intersection again with the bounding sphere of the container
//Helpful for when the light is at an angle near one of the vertexes of the bounding box
isIntersect = isInLightRange(Sphere(container.getCenter(),
container.getHalfSize().length()));
}
}
}
return isIntersect;
}