本文整理汇总了C++中ogre::MovableObject::getWorldBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ MovableObject::getWorldBoundingBox方法的具体用法?C++ MovableObject::getWorldBoundingBox怎么用?C++ MovableObject::getWorldBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MovableObject
的用法示例。
在下文中一共展示了MovableObject::getWorldBoundingBox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputTextures
bool MiniMapMaker::outputTextures(void)
{
// 如果需要(纹理大小改变了或第一次输出文件时),就重建render texture
if (mNeedRecreate)
{
destroy();
init();
}
mTempOutputFileNames.clear();
static const String TEMP_GROUP_NAME = "#TEMP#";
// 创建临时的资源组
Ogre::ResourceGroupManager& rgm = Ogre::ResourceGroupManager::getSingleton();
rgm.addResourceLocation(mPath, "FileSystem", TEMP_GROUP_NAME, false);
// 合并所有物体的包围盒
Ogre::AxisAlignedBox aabb;
Ogre::SceneManager::MovableObjectIterator itm =
mManipulator->getSceneManager()->getMovableObjectIterator(Ogre::EntityFactory::FACTORY_TYPE_NAME);
while (itm.hasMoreElements())
{
Ogre::MovableObject* movable = itm.getNext();
aabb.merge(movable->getWorldBoundingBox(true));
}
mCamera->setFarClipDistance(mCamera->getNearClipDistance() + 2 * (aabb.getMaximum().y - aabb.getMinimum().y ));
mCamera->setNearClipDistance(mTileSize/2);
// 设置摄像机的高度
Real yPos = mCamera->getNearClipDistance() + aabb.getMaximum().y;
TerrainData* terrainData = mManipulator->getTerrainData();
assert (terrainData);
float terrainHeight = terrainData->mMaxZ - terrainData->mMinZ;
float terrainWidth = terrainData->mMaxX - terrainData->mMinX;
// 投影的真正面积
Real projectSize = 0.0f;
// 最终切割成小块纹理的块数
int xIndex = 0;
int zIndex = 0;
Ogre::Vector3 originPoint(Ogre::Vector3::ZERO);
if (mUseRealCameraAngle)
{
float outerSquareWidth = 0.0f;
float outerSquareHeight = 0.0f;
Ogre::Radian alphaAngle = Ogre::Math::ATan( Ogre::Math::Abs(mMoveZDir.z / mMoveZDir.x) );
switch (mCameraDirQuadrant)
{
case WestNorth :
{
float leftWidth = Ogre::Math::Sin(alphaAngle) * terrainHeight;
float rightWidth = Ogre::Math::Cos(alphaAngle) * terrainWidth;
outerSquareWidth = leftWidth + rightWidth;
float topHeight = Ogre::Math::Cos(alphaAngle) * terrainHeight;
float bottomHeight = Ogre::Math::Sin(alphaAngle) * terrainWidth;
outerSquareHeight = topHeight + bottomHeight;
originPoint = Ogre::Vector3(terrainData->mMinX,0,terrainData->mMinZ) +
(-mMoveZDir * leftWidth);
float projectOffset = yPos / Ogre::Math::Tan(mCamDirAngle);
originPoint.x += (mInvertCameraDir * projectOffset ).x;
originPoint.z += (mInvertCameraDir * projectOffset ).z;
break;
}
case EastNorth :
{
float leftWidth = Ogre::Math::Cos(alphaAngle) * terrainWidth;
float rightWidth = Ogre::Math::Sin(alphaAngle) * terrainHeight;
outerSquareWidth = leftWidth + rightWidth;
float topHeight = Ogre::Math::Cos(alphaAngle) * terrainHeight;
float bottomHeight = Ogre::Math::Sin(alphaAngle) * terrainWidth;
outerSquareHeight = topHeight + bottomHeight;
originPoint = Ogre::Vector3(terrainData->mMaxX,0,terrainData->mMinZ) +
(-mMoveZDir * leftWidth);
float projectOffset = yPos / Ogre::Math::Tan(mCamDirAngle);
originPoint.x += (mInvertCameraDir * projectOffset ).x;
originPoint.z += (mInvertCameraDir * projectOffset ).z;
break;
}
case EastSouth :
//.........这里部分代码省略.........
示例2: getOgreWorldBoundingBox
BoundingBox<real> getOgreWorldBoundingBox() const {
return mOgreObject ? fromOgre<real>(mOgreObject->getWorldBoundingBox()) : BoundingBox<real>::null();
}