当前位置: 首页>>代码示例>>C++>>正文


C++ AxisAlignedBox::intersects方法代码示例

本文整理汇总了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);
}
开发者ID:bshea5,项目名称:CS425_Physics_Repo,代码行数:12,代码来源:Agent.cpp

示例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);
}
开发者ID:Segobiano,项目名称:425_Final_Project,代码行数:12,代码来源:Agent.cpp

示例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();
}
开发者ID:Dar13,项目名称:WastelandArchive,代码行数:21,代码来源:RecastInputGeometry.cpp

示例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;
    }
开发者ID:bsmr-c-cpp,项目名称:ogre,代码行数:38,代码来源:OgreLight.cpp


注:本文中的ogre::AxisAlignedBox::intersects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。