本文整理汇总了C++中LLVector3::magVecSquared方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVector3::magVecSquared方法的具体用法?C++ LLVector3::magVecSquared怎么用?C++ LLVector3::magVecSquared使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVector3
的用法示例。
在下文中一共展示了LLVector3::magVecSquared方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shiftObjects
void LLViewerObjectList::shiftObjects(const LLVector3 &offset)
{
// This is called when we shift our origin when we cross region boundaries...
// We need to update many object caches, I'll document this more as I dig through the code
// cleaning things out...
if (gNoRender || 0 == offset.magVecSquared())
{
return;
}
LLViewerObject *objectp;
S32 i;
for (i = 0; i < mObjects.count(); i++)
{
objectp = getObject(i);
// There could be dead objects on the object list, so don't update stuff if the object is dead.
if (objectp)
{
objectp->updatePositionCaches();
if (objectp->mDrawable.notNull() && !objectp->mDrawable->isDead())
{
gPipeline.markShift(objectp->mDrawable);
}
}
}
gPipeline.shiftObjects(offset);
gWorldPointer->mPartSim.shift(offset);
}
示例2: shiftObjects
void LLViewerObjectList::shiftObjects(const LLVector3 &offset)
{
// This is called when we shift our origin when we cross region boundaries...
// We need to update many object caches, I'll document this more as I dig through the code
// cleaning things out...
if (gNoRender || 0 == offset.magVecSquared())
{
return;
}
LLViewerObject *objectp;
for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)
{
objectp = *iter;
// There could be dead objects on the object list, so don't update stuff if the object is dead.
if (objectp && !objectp->isDead())
{
objectp->updatePositionCaches();
if (objectp->mDrawable.notNull() && !objectp->mDrawable->isDead())
{
gPipeline.markShift(objectp->mDrawable);
}
}
}
gPipeline.shiftObjects(offset);
LLWorld::getInstance()->shiftRegions(offset);
}
示例3: sqrt
// Saves space by using the fact that our quaternions are normalized
void LLQuaternion::unpackFromVector3( const LLVector3& vec )
{
mQ[VX] = vec.mV[VX];
mQ[VY] = vec.mV[VY];
mQ[VZ] = vec.mV[VZ];
F32 t = 1.f - vec.magVecSquared();
if( t > 0 )
{
mQ[VW] = sqrt( t );
}
else
{
// Need this to avoid trying to find the square root of a negative number due
// to floating point error.
mQ[VW] = 0;
}
}
示例4: if
//.........这里部分代码省略.........
if ( are_parallel(poleVec, agVec, 0.001f) )
{
// the solutions is also singular
return;
}
else
{
abcNorm = poleVec % agVec;
}
}
else
{
abcNorm = poleVec % abVec;
}
}
else
{
abcNorm = abVec % bcVec;
}
}
else
{
abcNorm = mBAxis * mJointB->getWorldRotation();
}
//-------------------------------------------------------------------------
// compute rotation of B
//-------------------------------------------------------------------------
// angle between A->B and B->C
F32 abbcAng = angle_between(abVec, bcVec);
// vector orthogonal to A->B and B->C
LLVector3 abbcOrthoVec = abVec % bcVec;
if (abbcOrthoVec.magVecSquared() < 0.001f)
{
abbcOrthoVec = poleVec % abVec;
abacCompOrthoVec = poleVec;
}
abbcOrthoVec.normVec();
F32 agLenSq = agLen * agLen;
// angle arm for extension
F32 cosTheta = (agLenSq - abLen*abLen - bcLen*bcLen) / (2.0f * abLen * bcLen);
if (cosTheta > 1.0f)
cosTheta = 1.0f;
else if (cosTheta < -1.0f)
cosTheta = -1.0f;
F32 theta = acos(cosTheta);
LLQuaternion bRot(theta - abbcAng, abbcOrthoVec);
// llinfos << "abbcAng : " << abbcAng << llendl;
// llinfos << "abbcOrthoVec : " << abbcOrthoVec << llendl;
// llinfos << "agLenSq : " << agLenSq << llendl;
// llinfos << "cosTheta : " << cosTheta << llendl;
// llinfos << "theta : " << theta << llendl;
// llinfos << "bRot : " << bRot << llendl;
// llinfos << "theta abbcAng theta-abbcAng: " << theta*180.0/F_PI << " " << abbcAng*180.0f/F_PI << " " << (theta - abbcAng)*180.0f/F_PI << llendl;
//-------------------------------------------------------------------------
// compute rotation that rotates new A->C to A->G
//-------------------------------------------------------------------------
// rotate B->C by bRot
bcVec = bcVec * bRot;
示例5: updateGeometry
BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable)
{
LLFastTimer ftm(LLFastTimer::FTM_UPDATE_PARTICLES);
LLVector3 at;
LLVector3 position_agent;
LLVector3 camera_agent = gCamera->getOrigin();
S32 num_parts = mViewerPartGroupp->getCount();
LLFace *facep;
LLSpatialGroup* group = drawable->getSpatialGroup();
if (!group && num_parts)
{
drawable->movePartition();
group = drawable->getSpatialGroup();
}
if (!num_parts)
{
if (group && drawable->getNumFaces())
{
group->dirtyGeom();
}
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 = gCamera->getPixelMeterRatio();
pixel_meter_ratio *= pixel_meter_ratio;
S32 count=0;
S32 i;
mDepth = 0.f;
for (i = 0; i < num_parts; i++)
{
const LLViewerPart &part = *((LLViewerPart*) mViewerPartGroupp->mParticles[i]);
LLVector3 part_pos_agent(part.mPosAgent);
at = part_pos_agent - camera_agent;
F32 camera_dist_squared = at.magVecSquared();
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 += 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);
}
else
{
facep->clearState(LLFace::FULLBRIGHT);
}
//.........这里部分代码省略.........