本文整理汇总了C++中LLSpatialGroup::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ LLSpatialGroup::isVisible方法的具体用法?C++ LLSpatialGroup::isVisible怎么用?C++ LLSpatialGroup::isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLSpatialGroup
的用法示例。
在下文中一共展示了LLSpatialGroup::isVisible方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isVisible
BOOL LLDrawable::isVisible() const
{
if (mVisible == sCurVisible)
{
return TRUE;
}
#if 0
//disabling this code fixes DEV-20105. Leaving in place in case some other bug pops up as a a result.
//should be safe to just always ask the spatial group for visibility.
if (isActive())
{
if (isRoot())
{
LLSpatialGroup* group = mSpatialBridge.notNull() ? mSpatialBridge->getSpatialGroup() :
getSpatialGroup();
if (group && group->isVisible())
{
mVisible = sCurVisible;
return TRUE;
}
}
else
{
if (getParent()->isVisible())
{
mVisible = sCurVisible;
return TRUE;
}
}
}
else
#endif
{
LLSpatialGroup* group = getSpatialGroup();
if (group && group->isVisible())
{
mVisible = sCurVisible;
return TRUE;
}
}
return FALSE;
}
示例2: updateGeometry
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));
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;
tot_area = llmax(tot_area, area);
//.........这里部分代码省略.........
示例3: updateSimulation
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(LLFastTimer::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())
{
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;
}
}
if ((LLDrawable::getCurrentFrame()+mViewerPartGroups[i]->mID)%visirate == 0)
{
if (vobj)
{
gPipeline.markRebuild(vobj->mDrawable, LLDrawable::REBUILD_ALL, TRUE);
}
mViewerPartGroups[i]->updateParticles(dt * visirate);
//.........这里部分代码省略.........
示例4: updateGeometry
BOOL LLVOClouds::updateGeometry(LLDrawable *drawable)
{
LLFastTimer ftm(FTM_UPDATE_CLOUDS);
dirtySpatialGroup();
S32 num_parts = mCloudGroupp->getNumPuffs();
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));
return TRUE;
}
if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLASSIC_CLOUDS)))
{
return TRUE;
}
if (num_parts > drawable->getNumFaces())
{
drawable->setNumFacesFast(num_parts+num_parts/4, NULL, getTEImage(0));
}
mDepth = (getPositionAgent()-LLViewerCamera::getInstance()->getOrigin())*LLViewerCamera::getInstance()->getAtAxis();
S32 face_indx = 0;
for ( ; face_indx < num_parts; face_indx++)
{
facep = drawable->getFace(face_indx);
if (!facep)
{
llwarns << "No facep for index " << face_indx << llendl;
continue;
}
facep->setTEOffset(face_indx);
facep->setSize(4, 6);
facep->setViewerObject(this);
const LLCloudPuff &puff = mCloudGroupp->getPuff(face_indx);
const LLVector3 puff_pos_agent = gAgent.getPosAgentFromGlobal(puff.getPositionGlobal());
facep->mCenterLocal = puff_pos_agent;
/// Update cloud color based on sun color.
LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
facep->setFaceColor(float_color);
facep->setTexture(getTEImage(0));
}
for ( ; face_indx < drawable->getNumFaces(); face_indx++)
{
facep = drawable->getFace(face_indx);
if (!facep)
{
llwarns << "No facep for index " << face_indx << llendl;
continue;
}
facep->setTEOffset(face_indx);
facep->setSize(0,0);
}
mDrawable->movePartition();
return TRUE;
}
示例5: updateGeometry
BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable)
{
LLFastTimer ftm(LLFastTimer::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();
for (i = 0 ; i < (S32)mViewerPartGroupp->mParticles.size(); i++)
{
const LLViewerPart *part = mViewerPartGroupp->mParticles[i];
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;
F32 area = part->mScale.mV[0] * part->mScale.mV[1] * inv_camera_dist_squared;
tot_area = llmax(tot_area, area);
if (tot_area > max_area)
{
break;
}
count++;
facep = drawable->getFace(i);
if (!facep)
{
llwarns << "No face found for index " << i << "!" << llendl;
continue;
}
facep->setTEOffset(i);
const F32 NEAR_PART_DIST_SQ = 5.f*5.f; // Only discard particles > 5 m from the camera
const F32 MIN_PART_AREA = .005f*.005f; // only less than 5 mm x 5 mm at 1 m from camera
if (camera_dist_squared > NEAR_PART_DIST_SQ && area < MIN_PART_AREA)
{
facep->setSize(0, 0);
continue;
}
facep->setSize(4, 6);
facep->setViewerObject(this);
if (part->mFlags & LLPartData::LL_PART_EMISSIVE_MASK)
{
facep->setState(LLFace::FULLBRIGHT);
//.........这里部分代码省略.........