本文整理汇总了C++中ogre::Camera::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::isVisible方法的具体用法?C++ Camera::isVisible怎么用?C++ Camera::isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Camera
的用法示例。
在下文中一共展示了Camera::isVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateVisible
//------------------------------------------------------------------------
void TerrainBatch::updateVisible( AxisAlignedBox& visibleAAbb )
{
//Ogre::Camera* cam = mScene->getOgreSceneManager()->getCurrentViewport()->getCamera();
Ogre::Camera* cam = mScene->getActiveCamera()->getOgreCamera();
if ( isValidRenderableDistance(cam) )
{
if ( cam->isVisible(mBoundingBox) )
{
mIsVisible = true;
visibleAAbb.merge( mNodeBoundingBox );
return;
}
}
mIsVisible = false;
}
示例2: Axis_Trans
//.........这里部分代码省略.........
{
KLThrow("(AX_GAME->AX_SCREEN) Not support yet!");
}
}
break;
//-----------------------------------------------
case AX_PLAN:
{
if(!pTerrainData) return FALSE;
FLOAT fGfxX = pTerrainData->mPosition.x + (FLOAT)fvSource.x * pTerrainData->mScale.x;
FLOAT fGfxZ = pTerrainData->mPosition.z + (FLOAT)fvSource.z * pTerrainData->mScale.z;
if(AX_GAME==typeTar)
{
//取得相地形高度作为Y坐标(游戏坐标)
fvTarget.y = (pTerrainData->getHeightAtGrid(fvSource.x, fvSource.z)-pTerrainData->mPosition.y)/ pTerrainData->mScale.y;
return TRUE;
}
else if(AX_GFX == typeTar)
{
//取得相地形高度作为Y坐标
fvTarget.x = fGfxX;
fvTarget.z = fGfxZ;
fvTarget.y = pTerrainData->getHeightAtGrid(fvSource.x, fvSource.z);
return TRUE;
}
else if(AX_SCREEN==typeTar)
{
KLThrow("(AX_PLAN->AX_SCREEN) Not support yet!");
}
}
break;
//-----------------------------------------------
case AX_GFX:
{
if(AX_GAME==typeTar || AX_PLAN==typeTar)
{
if(pTerrainData)
{
fvTarget.x = (fvSource.x-pTerrainData->mPosition.x)/pTerrainData->mScale.x;
fvTarget.y = (fvSource.y-pTerrainData->mPosition.y)/pTerrainData->mScale.y;
fvTarget.z = (fvSource.z-pTerrainData->mPosition.z)/pTerrainData->mScale.z;
}
else
{
fvTarget.x = (fvSource.x)/fvScale.x;
fvTarget.y = (fvSource.y)/fvScale.y;
fvTarget.z = (fvSource.z)/fvScale.z;
}
return TRUE;
}
else if(AX_SCREEN==typeTar)
{
//KLThrow("(AX_GFX->AX_SCREEN) Not support yet!");
if(!pTerrainData) return FALSE;
//得到Ogre相机
Ogre::Camera* pOgreCamera = m_pCamera_Current->GetOgreCamera();
if(!pOgreCamera) return FALSE;
if(!(pOgreCamera->isVisible(Ogre::Vector3(fvSource.x, fvSource.y, fvSource.z)))) return FALSE;
// x:[-1w, 1w] z:[-1h, 1h]
Ogre::Vector3 vRet = pOgreCamera->getProjectionMatrix()* pOgreCamera->getViewMatrix() * Ogre::Vector3(fvSource.x, fvSource.y, fvSource.z);
int nWidth = m_pFairySystem->getViewport()->getActualWidth();
int nHeight = m_pFairySystem->getViewport()->getActualHeight();
fvTarget.x = (( vRet.x + 1.0f)*nWidth/2.0f);
fvTarget.y = ((-vRet.y + 1.0f)*nHeight/2.0f);
return TRUE;
}
}
break;
//-----------------------------------------------
case AX_SCREEN:
{
if(!pTerrainData) return FALSE;
Ogre::Vector3 vRenderPos;
BOOL bRet = m_pFairySystem->getTerrainIntersects(Fairy::Point((INT)fvSource.x, fvSource.y), vRenderPos);
if(!bRet) return FALSE;
if(AX_GAME==typeTar || AX_PLAN==typeTar)
{
return Axis_Trans(AX_GFX, fVector3(vRenderPos.x, vRenderPos.y, vRenderPos.z), AX_GAME, fvTarget);
}
else if(AX_GFX==typeTar)
{
fvTarget = fVector3(vRenderPos.x, vRenderPos.y, vRenderPos.z);
return TRUE;
}
}
break;
}
return FALSE;
}