本文整理汇总了C++中LLSpatialGroup类的典型用法代码示例。如果您正苦于以下问题:C++ LLSpatialGroup类的具体用法?C++ LLSpatialGroup怎么用?C++ LLSpatialGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLSpatialGroup类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mt
void LLViewerPartSim::updateSimulation()
{
LLMemType mt(LLMemType::MTYPE_PARTICLES);
static LLFrameTimer update_timer;
const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f);
if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
{
return;
}
LLFastTimer ftm(FTM_SIMULATE_PARTICLES);
// Start at a random particle system so the same
// particle system doesn't always get first pick at the
// particles. Theoretically we'd want to do this in distance
// order or something, but sorting particle sources will be a big
// pain.
S32 i;
S32 count = (S32) mViewerPartSources.size();
S32 start = (S32)ll_frand((F32)count);
S32 dir = 1;
S32 deldir = 0;
if (ll_frand() > 0.5f)
{
dir = -1;
deldir = -1;
}
S32 num_updates = 0;
for (i = start; num_updates < count;)
{
if (i >= count)
{
i = 0;
}
if (i < 0)
{
i = count - 1;
}
if (!mViewerPartSources[i]->isDead())
{
BOOL upd = TRUE;
//if (!LLPipeline::sRenderAttachedParticles)
{
LLViewerObject* vobj = mViewerPartSources[i]->mSourceObjectp;
if (vobj && (vobj->getPCode() == LL_PCODE_VOLUME))
{
LLVOVolume* vvo = (LLVOVolume *)vobj;
if (vvo && vvo->isAttachment())
{
if (!LLPipeline::sRenderAttachedParticles)
upd = FALSE;
else
{
LLVOAvatar *avatar = vvo->getAvatar();
if(avatar && avatar->isVisuallyMuted())
upd = FALSE;
}
}
}
}
if (upd)
{
mViewerPartSources[i]->update(dt);
}
}
if (mViewerPartSources[i]->isDead())
{
mViewerPartSources.erase(mViewerPartSources.begin() + i);
count--;
i+=deldir;
}
else
{
i += dir;
}
num_updates++;
}
count = (S32) mViewerPartGroups.size();
for (i = 0; i < count; i++)
{
LLViewerObject* vobj = mViewerPartGroups[i]->mVOPartGroupp;
S32 visirate = 1;
if (vobj)
{
LLSpatialGroup* group = vobj->mDrawable->getSpatialGroup();
if (group && !group->isVisible()) // && !group->isState(LLSpatialGroup::OBJECT_DIRTY))
{
visirate = 8;
}
}
//.........这里部分代码省略.........
示例2: draw_orphans
void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results, BOOL for_select)
{
if (!gPipeline.hasRenderType(mDrawableType))
{
return;
}
//HACK don't draw attachments for avatars that haven't been visible in more than a frame
LLViewerObject *vobj = mDrawable->getVObj();
if (vobj && vobj->isAttachment() && !vobj->isHUDAttachment())
{
LLDrawable* av;
LLDrawable* parent = mDrawable->getParent();
if (parent)
{
LLViewerObject* objparent = parent->getVObj();
av = objparent->mDrawable;
LLSpatialGroup* group = av->getSpatialGroup();
BOOL impostor = FALSE;
BOOL loaded = FALSE;
if (objparent->isAvatar())
{
LLVOAvatar* avatarp = (LLVOAvatar*) objparent;
if (avatarp->isVisible())
{
impostor = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isImpostor();
loaded = objparent->isAvatar() && ((LLVOAvatar*) objparent)->isFullyLoaded();
}
else
{
return;
}
}
if (!group ||
LLDrawable::getCurrentFrame() - av->mVisible > 1 ||
impostor ||
!loaded)
{
return;
}
}
else
{
static const LLCachedControl<bool> draw_orphans("ShyotlDrawOrphanAttachments",false);
if(!draw_orphans)
return;
}
}
LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0);
group->rebound();
LLVector4a center;
center.setAdd(mExtents[0], mExtents[1]);
center.mul(0.5f);
LLVector4a size;
size.setSub(mExtents[1], mExtents[0]);
size.mul(0.5f);
if ((LLPipeline::sShadowRender && camera_in.AABBInFrustum(center, size)) ||
LLPipeline::sImpostorRender ||
(camera_in.AABBInFrustumNoFarClip(center, size) &&
AABBSphereIntersect(mExtents[0], mExtents[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist)))
{
if (!LLPipeline::sImpostorRender &&
!LLPipeline::sShadowRender &&
LLPipeline::calcPixelArea(center, size, camera_in) < FORCE_INVISIBLE_AREA)
{
return;
}
LLDrawable::setVisible(camera_in);
if (for_select)
{
results->push_back(mDrawable);
if (mDrawable->getVObj())
{
LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
iter != child_list.end(); iter++)
{
LLViewerObject* child = *iter;
LLDrawable* drawable = child->mDrawable;
results->push_back(drawable);
}
}
}
else
{
LLCamera trans_camera = transformCamera(camera_in);
LLOctreeMarkNotCulled culler(&trans_camera);
culler.traverse(mOctree);
}
}
//.........这里部分代码省略.........
示例3: updateSpatialExtents
void LLSpatialBridge::updateSpatialExtents()
{
LLSpatialGroup* root = (LLSpatialGroup*) mOctree->getListener(0);
{
LLFastTimer ftm(FTM_CULL_REBOUND);
root->rebound();
}
LLVector4a offset;
LLVector4a size = root->mBounds[1];
//VECTORIZE THIS
LLMatrix4a mat;
mat.loadu(mDrawable->getXform()->getWorldMatrix());
LLVector4a t;
t.splat(0.f);
LLVector4a center;
mat.affineTransform(t, center);
mat.rotate(root->mBounds[0], offset);
center.add(offset);
LLVector4a v[4];
//get 4 corners of bounding box
mat.rotate(size,v[0]);
LLVector4a scale;
scale.set(-1.f, -1.f, 1.f);
scale.mul(size);
mat.rotate(scale, v[1]);
scale.set(1.f, -1.f, -1.f);
scale.mul(size);
mat.rotate(scale, v[2]);
scale.set(-1.f, 1.f, -1.f);
scale.mul(size);
mat.rotate(scale, v[3]);
LLVector4a& newMin = mExtents[0];
LLVector4a& newMax = mExtents[1];
newMin = newMax = center;
for (U32 i = 0; i < 4; i++)
{
LLVector4a delta;
delta.setAbs(v[i]);
LLVector4a min;
min.setSub(center, delta);
LLVector4a max;
max.setAdd(center, delta);
newMin.setMin(newMin, min);
newMax.setMax(newMax, max);
}
LLVector4a diagonal;
diagonal.setSub(newMax, newMin);
mRadius = diagonal.getLength3().getF32() * 0.5f;
mPositionGroup.setAdd(newMin,newMax);
mPositionGroup.mul(0.5f);
updateBinRadius();
}
示例4: traverse
virtual void traverse(const LLOctreeNode<LLDrawable>* node)
{
LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
group->setVisible();
LLOctreeTraveler<LLDrawable>::traverse(node);
}
示例5: ftm
BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable)
{
LLFastTimer ftm(FTM_UPDATE_PARTICLES);
dirtySpatialGroup();
S32 num_parts = mViewerPartGroupp->getCount();
LLFace *facep;
LLSpatialGroup* group = drawable->getSpatialGroup();
if (!group && num_parts)
{
drawable->movePartition();
group = drawable->getSpatialGroup();
}
if (group && group->isVisible())
{
dirtySpatialGroup(TRUE);
}
if (!num_parts)
{
if (group && drawable->getNumFaces())
{
group->setState(LLSpatialGroup::GEOM_DIRTY);
}
drawable->setNumFaces(0, NULL, getTEImage(0));
LLPipeline::sCompiles++;
return TRUE;
}
if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
{
return TRUE;
}
if (num_parts > drawable->getNumFaces())
{
drawable->setNumFacesFast(num_parts+num_parts/4, NULL, getTEImage(0));
}
F32 tot_area = 0;
F32 max_area = LLViewerPartSim::getMaxPartCount() * MAX_PARTICLE_AREA_SCALE;
F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
pixel_meter_ratio *= pixel_meter_ratio;
LLViewerPartSim::checkParticleCount(mViewerPartGroupp->mParticles.size()) ;
S32 count=0;
mDepth = 0.f;
S32 i = 0 ;
LLVector3 camera_agent = getCameraPosition();
F32 max_scale = 0.f;
for (i = 0 ; i < (S32)mViewerPartGroupp->mParticles.size(); i++)
{
const LLViewerPart *part = mViewerPartGroupp->mParticles[i];
//remember the largest particle
max_scale = llmax(max_scale, part->mScale.mV[0], part->mScale.mV[1]);
if (part->mFlags & LLPartData::LL_PART_RIBBON_MASK)
{ //include ribbon segment length in scale
const LLVector3* pos_agent = NULL;
if (part->mParent)
{
pos_agent = &(part->mParent->mPosAgent);
}
else if (part->mPartSourcep.notNull())
{
pos_agent = &(part->mPartSourcep->mPosAgent);
}
if (pos_agent)
{
F32 dist = (*pos_agent-part->mPosAgent).length();
max_scale = llmax(max_scale, dist);
}
}
LLVector3 part_pos_agent(part->mPosAgent);
LLVector3 at(part_pos_agent - camera_agent);
F32 camera_dist_squared = at.lengthSquared();
F32 inv_camera_dist_squared;
if (camera_dist_squared > 1.f)
inv_camera_dist_squared = 1.f / camera_dist_squared;
else
inv_camera_dist_squared = 1.f;
llassert(llfinite(inv_camera_dist_squared));
llassert(!llisnan(inv_camera_dist_squared));
F32 area = part->mScale.mV[0] * part->mScale.mV[1] * inv_camera_dist_squared;
//.........这里部分代码省略.........