本文整理汇总了C++中LLViewerRegion::calculateCameraDistance方法的典型用法代码示例。如果您正苦于以下问题:C++ LLViewerRegion::calculateCameraDistance方法的具体用法?C++ LLViewerRegion::calculateCameraDistance怎么用?C++ LLViewerRegion::calculateCameraDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLViewerRegion
的用法示例。
在下文中一共展示了LLViewerRegion::calculateCameraDistance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateVisibilities
void LLWorld::updateVisibilities()
{
F32 cur_far_clip = LLViewerCamera::getInstance()->getFar();
// Go through the culled list and check for visible regions (region is visible if land is visible)
for (region_list_t::iterator iter = mCulledRegionList.begin();
iter != mCulledRegionList.end(); )
{
region_list_t::iterator curiter = iter++;
LLViewerRegion* regionp = *curiter;
LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
if (part)
{
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
{
mCulledRegionList.erase(curiter);
mVisibleRegionList.push_back(regionp);
}
}
}
// Update all of the visible regions
for (region_list_t::iterator iter = mVisibleRegionList.begin();
iter != mVisibleRegionList.end(); )
{
region_list_t::iterator curiter = iter++;
LLViewerRegion* regionp = *curiter;
if (!regionp->getLand().hasZData())
{
continue;
}
LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
if (part)
{
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
{
regionp->calculateCameraDistance();
if (!gNoRender)
{
regionp->getLand().updatePatchVisibilities(gAgent);
}
}
else
{
mVisibleRegionList.erase(curiter);
mCulledRegionList.push_back(regionp);
}
}
}
// Sort visible regions
mVisibleRegionList.sort(LLViewerRegion::CompareDistance());
LLViewerCamera::getInstance()->setFar(cur_far_clip);
}
示例2: updateVisibilities
void LLWorld::updateVisibilities()
{
F32 cur_far_clip = LLViewerCamera::getInstance()->getFar();
LLViewerCamera::getInstance()->setFar(mLandFarClip);
F32 diagonal_squared = F_SQRT2 * F_SQRT2 * mWidth * mWidth;
// Go through the culled list and check for visible regions
for (region_list_t::iterator iter = mCulledRegionList.begin();
iter != mCulledRegionList.end(); )
{
region_list_t::iterator curiter = iter++;
LLViewerRegion* regionp = *curiter;
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared);
if (!regionp->getLand().hasZData()
|| LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
{
mCulledRegionList.erase(curiter);
mVisibleRegionList.push_back(regionp);
}
}
// Update all of the visible regions
for (region_list_t::iterator iter = mVisibleRegionList.begin();
iter != mVisibleRegionList.end(); )
{
region_list_t::iterator curiter = iter++;
LLViewerRegion* regionp = *curiter;
if (!regionp->getLand().hasZData())
{
continue;
}
F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared);
if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
{
regionp->calculateCameraDistance();
if (!gNoRender)
{
regionp->getLand().updatePatchVisibilities(gAgent);
}
}
else
{
mVisibleRegionList.erase(curiter);
mCulledRegionList.push_back(regionp);
}
}
// Sort visible regions
mVisibleRegionList.sort(LLViewerRegion::CompareDistance());
LLViewerCamera::getInstance()->setFar(cur_far_clip);
}
示例3: updateVisibilities
void LLWorld::updateVisibilities()
{
F32 cur_far_clip = LLViewerCamera::getInstance()->getFar();
//-------------------------voodoo--------------------------
//LLViewerCamera::getInstance()->setFar(mLandFarClip);
//F32 diagonal_squared = F_SQRT2 * F_SQRT2 * mWidth * mWidth;
//-------------------------------------------------------------
// Go through the culled list and check for visible regions
for (region_list_t::iterator iter = mCulledRegionList.begin();
iter != mCulledRegionList.end(); )
{
region_list_t::iterator curiter = iter++;
LLViewerRegion* regionp = *curiter;
LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
if (part)
//-------------------------Voodoo-------------------------------------
//F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ();
//F32 radius = 0.5f * (F32) sqrt(height * height + diagonal_squared);
//if (!regionp->getLand().hasZData()
// || LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius))
//---------------------------------------------------------------------
{
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
{
mCulledRegionList.erase(curiter);
mVisibleRegionList.push_back(regionp);
}
}
}
// Update all of the visible regions
for (region_list_t::iterator iter = mVisibleRegionList.begin();
iter != mVisibleRegionList.end(); )
{
region_list_t::iterator curiter = iter++;
LLViewerRegion* regionp = *curiter;
if (!regionp->getLand().hasZData())
{
continue;
}
LLSpatialPartition* part = regionp->getSpatialPartition(LLViewerRegion::PARTITION_TERRAIN);
if (part)
{
LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0);
if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1]))
{
regionp->calculateCameraDistance();
if (!gNoRender)
{
regionp->getLand().updatePatchVisibilities(gAgent);
}
}
else
{
mVisibleRegionList.erase(curiter);
mCulledRegionList.push_back(regionp);
}
}
}
// Sort visible regions
mVisibleRegionList.sort(LLViewerRegion::CompareDistance());
LLViewerCamera::getInstance()->setFar(cur_far_clip);
}