本文整理汇总了C++中LLSpatialPartition类的典型用法代码示例。如果您正苦于以下问题:C++ LLSpatialPartition类的具体用法?C++ LLSpatialPartition怎么用?C++ LLSpatialPartition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLSpatialPartition类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LLSpatialPartition
LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) :
LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB)
{
mBridge = this;
mDrawable = root;
root->setSpatialBridge(this);
mBinIndex = -1;
mRenderType = mDrawable->mRenderType;
mDrawableType = mDrawable->mRenderType;
mPartitionType = LLViewerRegion::PARTITION_VOLUME;
mOctree->balance();
llassert(mDrawable);
llassert(mDrawable->getRegion());
LLSpatialPartition *part = mDrawable->getRegion()->getSpatialPartition(mPartitionType);
llassert(part);
if (part)
{
part->put(this);
}
}
示例2: getSpatialPartition
void LLDrawable::movePartition()
{
LLSpatialPartition* part = getSpatialPartition();
if (part)
{
part->move(this, getSpatialGroup());
}
}
示例3: glPushMatrix
void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask, std::vector<LLSpatialGroup*>& groups)
{
#if !LL_RELEASE_FOR_DOWNLOAD
LLGLState::checkClientArrays(mask);
#endif
LLSpatialBridge* last_bridge = NULL;
LLSpatialPartition* last_part = NULL;
glPushMatrix();
for (std::vector<LLSpatialGroup*>::iterator i = groups.begin(); i != groups.end(); ++i)
{
LLSpatialGroup* group = *i;
if (group->mSpatialPartition->mRenderByGroup &&
!group->isDead())
{
LLSpatialPartition* part = group->mSpatialPartition;
if (part != last_part)
{
LLSpatialBridge* bridge = part->asBridge();
if (bridge != last_bridge)
{
glPopMatrix();
glPushMatrix();
if (bridge)
{
glMultMatrixf((F32*) bridge->mDrawable->getRenderMatrix().mMatrix);
}
last_bridge = bridge;
}
last_part = part;
}
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA];
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
{
LLDrawInfo& params = **k;
if (params.mParticle)
{
continue;
}
params.mVertexBuffer->setBuffer(mask);
U32* indices_pointer = (U32*) params.mVertexBuffer->getIndicesPointer();
glDrawRangeElements(GL_TRIANGLES, params.mStart, params.mEnd, params.mCount,
GL_UNSIGNED_INT, indices_pointer+params.mOffset);
addIndicesDrawn(params.mCount);
}
}
}
glPopMatrix();
}
示例4: llassert_always
BOOL LLSpatialBridge::updateMove()
{
llassert_always(mDrawable);
llassert_always(mDrawable->mVObjp);
llassert_always(mDrawable->getRegion());
LLSpatialPartition* part = mDrawable->getRegion()->getSpatialPartition(mPartitionType);
llassert_always(part);
mOctree->balance();
if (part)
{
part->move(this, getSpatialGroup(), TRUE);
}
return TRUE;
}
示例5: renderObjectsForSelect
U32 LLViewerObjectList::renderObjectsForSelect(LLCamera &camera, BOOL pick_parcel_wall, BOOL keep_pick_list)
{
gRenderForSelect = TRUE;
// LLTimer pick_timer;
if (!keep_pick_list)
{
LLViewerObject *objectp;
S32 i;
// Reset all of the GL names to zero.
for (i = 0; i < mObjects.count(); i++)
{
objectp = mObjects[i];
objectp->mGLName = 0;
}
mSelectPickList.clear();
std::vector<LLDrawable*> pick_drawables;
for (i = 0; i < LLPipeline::NUM_PARTITIONS-1; i++)
{
LLSpatialPartition* part = gPipeline.getSpatialPartition(i);
if (part)
{
part->cull(camera, &pick_drawables, TRUE);
}
}
for (std::vector<LLDrawable*>::iterator iter = pick_drawables.begin();
iter != pick_drawables.end(); iter++)
{
LLDrawable* drawablep = *iter;
if( !drawablep )
continue;
LLViewerObject* last_objectp = NULL;
for (S32 face_num = 0; face_num < drawablep->getNumFaces(); face_num++)
{
LLViewerObject* objectp = drawablep->getFace(face_num)->getViewerObject();
if (objectp && objectp != last_objectp)
{
mSelectPickList.insert(objectp);
last_objectp = objectp;
}
}
}
LLHUDText::addPickable(mSelectPickList);
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
objectp = (LLVOAvatar*) *iter;
if (!objectp->isDead())
{
if (objectp->mDrawable.notNull() && objectp->mDrawable->isVisible())
{
mSelectPickList.insert(objectp);
}
}
}
// add all hud objects to pick list
LLVOAvatar* avatarp = gAgent.getAvatarObject();
if (avatarp)
{
LLViewerJointAttachment* attachmentp;
for (attachmentp = avatarp->mAttachmentPoints.getFirstData();
attachmentp;
attachmentp = avatarp->mAttachmentPoints.getNextData())
{
if (attachmentp->getIsHUDAttachment())
{
LLViewerObject* objectp = attachmentp->getObject();
if (objectp)
{
mSelectPickList.insert(objectp);
for (U32 i = 0; i < objectp->mChildList.size(); i++)
{
LLViewerObject* childp = objectp->mChildList[i];
if (childp)
{
mSelectPickList.insert(childp);
}
}
}
}
}
}
S32 num_pickables = (S32)mSelectPickList.size() + LLHUDIcon::getNumInstances();
if (num_pickables != 0)
{
S32 step = (0x000fffff - GL_NAME_INDEX_OFFSET) / num_pickables;
std::set<LLViewerObject*>::iterator pick_it;
i = 0;
//.........这里部分代码省略.........
示例6: generatePickList
void LLViewerObjectList::generatePickList(LLCamera &camera)
{
LLViewerObject *objectp;
S32 i;
// Reset all of the GL names to zero.
for (i = 0; i < mObjects.count(); i++)
{
objectp = mObjects[i];
objectp->mGLName = 0;
}
mSelectPickList.clear();
std::vector<LLDrawable*> pick_drawables;
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* region = *iter;
for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
LLSpatialPartition* part = region->getSpatialPartition(i);
if (part)
{
part->cull(camera, &pick_drawables, TRUE);
}
}
}
for (std::vector<LLDrawable*>::iterator iter = pick_drawables.begin();
iter != pick_drawables.end(); iter++)
{
LLDrawable* drawablep = *iter;
if( !drawablep )
continue;
LLViewerObject* last_objectp = NULL;
for (S32 face_num = 0; face_num < drawablep->getNumFaces(); face_num++)
{
LLViewerObject* objectp = drawablep->getFace(face_num)->getViewerObject();
if (objectp && objectp != last_objectp)
{
mSelectPickList.insert(objectp);
last_objectp = objectp;
}
}
}
LLHUDText::addPickable(mSelectPickList);
for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
iter != LLCharacter::sInstances.end(); ++iter)
{
objectp = (LLVOAvatar*) *iter;
if (!objectp->isDead())
{
if (objectp->mDrawable.notNull() && objectp->mDrawable->isVisible())
{
mSelectPickList.insert(objectp);
}
}
}
// add all hud objects to pick list
LLVOAvatar* avatarp = gAgent.getAvatarObject();
if (avatarp)
{
for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
iter != avatarp->mAttachmentPoints.end(); )
{
LLVOAvatar::attachment_map_t::iterator curiter = iter++;
LLViewerJointAttachment* attachmentp = curiter->second;
if (attachmentp->getIsHUDAttachment())
{
LLViewerObject* objectp = attachmentp->getObject();
if (objectp)
{
mSelectPickList.insert(objectp);
LLViewerObject::const_child_list_t& child_list = objectp->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* childp = *iter;
if (childp)
{
mSelectPickList.insert(childp);
}
}
}
}
}
}
S32 num_pickables = (S32)mSelectPickList.size() + LLHUDIcon::getNumInstances();
if (num_pickables != 0)
{
S32 step = (0x000fffff - GL_NAME_INDEX_OFFSET) / num_pickables;
//.........这里部分代码省略.........
示例7: display
//.........这里部分代码省略.........
stop_glerror();
//Increment drawable frame counter
LLDrawable::incrementVisible();
/////////////////////////////////////
//
// Render
//
// Actually push all of our triangles to the screen.
//
if (!gDisconnected)
{
if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
{ //don't draw hud objects in this frame
gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD);
}
LLFastTimer t(LLFastTimer::FTM_WORLD_UPDATE);
stop_glerror();
display_update_camera();
stop_glerror();
// *TODO: merge these two methods
gHUDManager->updateEffects();
LLHUDObject::updateAll();
stop_glerror();
gFrameStats.start(LLFrameStats::UPDATE_GEOM);
const F32 max_geom_update_time = 0.005f; // 5 ms update time
gPipeline.updateGeom(max_geom_update_time);
stop_glerror();
LLSpatialPartition* part = gPipeline.getSpatialPartition(LLPipeline::PARTITION_VOLUME);
part->processImagery(gCamera);
display_update_camera();
gFrameStats.start(LLFrameStats::UPDATE_CULL);
gPipeline.updateCull(*gCamera);
stop_glerror();
///////////////////////////////////
//
// StateSort
//
// Responsible for taking visible objects, and adding them to the appropriate draw orders.
// In the case of alpha objects, z-sorts them first.
// Also creates special lists for outlines and selected face rendering.
//
{
LLFastTimer t(LLFastTimer::FTM_REBUILD);
gFrameStats.start(LLFrameStats::STATE_SORT);
gPipeline.stateSort(*gCamera);
stop_glerror();
if (rebuild)
{
//////////////////////////////////////
//
// rebuildPools
//
//
gFrameStats.start(LLFrameStats::REBUILD);
gPipeline.rebuildPools();
示例8: llmin
//.........这里部分代码省略.........
return true;
}
S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
switch (result)
{
case 0:
LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
break;
case 1:
// check vertices
if (!LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
{
LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
}
break;
default:
break;
}
return true;
}
} func;
LLSelectMgr::getInstance()->getHighlightedObjects()->applyToObjects(&func);
}
if (grow_selection)
{
std::vector<LLDrawable*> potentials;
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* region = *iter;
for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
LLSpatialPartition* part = region->getSpatialPartition(i);
if (part)
{
part->cull(*LLViewerCamera::getInstance(), &potentials, TRUE);
}
}
}
for (std::vector<LLDrawable*>::iterator iter = potentials.begin();
iter != potentials.end(); iter++)
{
LLDrawable* drawable = *iter;
LLViewerObject* vobjp = drawable->getVObj();
if (!drawable || !vobjp ||
vobjp->getPCode() != LL_PCODE_VOLUME ||
vobjp->isAttachment() ||
(deselect && !vobjp->isSelected()))
{
continue;
}
if (limit_select_distance && dist_vec_squared(drawable->getWorldPosition(), av_pos) > select_dist_squared)
{
continue;
}
// [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Added: RLVa-1.3.0c
if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canEdit(vobjp)) )
{
continue;
}
// [/RLVa:KB]
S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
if (result)
{
switch (result)
{
case 1:
// check vertices
if (LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
{
LLSelectMgr::getInstance()->highlightObjectOnly(vobjp);
}
break;
case 2:
LLSelectMgr::getInstance()->highlightObjectOnly(vobjp);
break;
default:
break;
}
}
}
}
// restore drawing mode
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
// restore camera
LLViewerCamera::getInstance()->setFar(old_far_plane);
LLViewerCamera::getInstance()->setNear(old_near_plane);
gViewerWindow->setup3DRender();
}
示例9: llmin
//.........这里部分代码省略.........
struct f : public LLSelectedObjectFunctor
{
virtual bool apply(LLViewerObject* vobjp)
{
LLDrawable* drawable = vobjp->mDrawable;
if (!drawable || vobjp->getPCode() != LL_PCODE_VOLUME || vobjp->isAttachment())
{
return true;
}
S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
switch (result)
{
case 0:
LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
break;
case 1:
// check vertices
if (!LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
{
LLSelectMgr::getInstance()->unhighlightObjectOnly(vobjp);
}
break;
default:
break;
}
return true;
}
} func;
LLSelectMgr::getInstance()->getHighlightedObjects()->applyToObjects(&func);
}
if (grow_selection)
{
std::vector<LLDrawable*> potentials;
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
LLViewerRegion* region = *iter;
for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
LLSpatialPartition* part = region->getSpatialPartition(i);
if (part)
{
part->cull(*LLViewerCamera::getInstance(), &potentials, TRUE);
}
}
}
for (std::vector<LLDrawable*>::iterator iter = potentials.begin();
iter != potentials.end(); iter++)
{
LLDrawable* drawable = *iter;
LLViewerObject* vobjp = drawable->getVObj();
if (!drawable || !vobjp ||
vobjp->getPCode() != LL_PCODE_VOLUME ||
vobjp->isAttachment() ||
(deselect && !vobjp->isSelected()))
{
continue;
}
if (limit_select_distance && dist_vec_squared(drawable->getWorldPosition(), av_pos) > select_dist_squared)
{
continue;
}
S32 result = LLViewerCamera::getInstance()->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
if (result)
{
switch (result)
{
case 1:
// check vertices
if (LLViewerCamera::getInstance()->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
{
LLSelectMgr::getInstance()->highlightObjectOnly(vobjp);
}
break;
case 2:
LLSelectMgr::getInstance()->highlightObjectOnly(vobjp);
break;
default:
break;
}
}
}
}
// restore drawing mode
glMatrixMode(GL_PROJECTION);
gGL.popMatrix();
glMatrixMode(GL_MODELVIEW);
// restore camera
LLViewerCamera::getInstance()->setFar(old_far_plane);
LLViewerCamera::getInstance()->setNear(old_near_plane);
gViewerWindow->setup3DRender();
}