本文整理汇总了C++中LLVector3::set方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVector3::set方法的具体用法?C++ LLVector3::set怎么用?C++ LLVector3::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVector3
的用法示例。
在下文中一共展示了LLVector3::set方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateSpatialExtents
void LLVOTree::updateSpatialExtents(LLVector3& newMin, LLVector3& newMax)
{
F32 radius = getScale().length()*0.05f;
LLVector3 center = getRenderPosition();
F32 sz = mBillboardScale*mBillboardRatio*radius*0.5f;
LLVector3 size(sz,sz,sz);
center += LLVector3(0, 0, size.mV[2]) * getRotation();
newMin.set(center-size);
newMax.set(center+size);
mDrawable->setPositionGroup(center);
}
示例2: updateDistance
void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
{
if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
{
llwarns << "Attempted to update distance for non-world camera." << llendl;
return;
}
//switch LOD with the spatial group to avoid artifacts
//LLSpatialGroup* sg = getSpatialGroup();
LLVector3 pos;
//if (!sg || sg->changeLOD())
{
LLVOVolume* volume = getVOVolume();
if (volume)
{
if (getSpatialGroup())
{
pos.set(getPositionGroup().getF32ptr());
}
else
{
pos = getPositionAgent();
}
if (isState(LLDrawable::HAS_ALPHA))
{
for (S32 i = 0; i < getNumFaces(); i++)
{
LLFace* facep = getFace(i);
if (force_update || facep->getPoolType() == LLDrawPool::POOL_ALPHA)
{
LLVector4a box;
box.setSub(facep->mExtents[1], facep->mExtents[0]);
box.mul(0.25f);
LLVector3 v = (facep->mCenterLocal-camera.getOrigin());
const LLVector3& at = camera.getAtAxis();
for (U32 j = 0; j < 3; j++)
{
v.mV[j] -= box[j] * at.mV[j];
}
facep->mDistance = v * camera.getAtAxis();
}
}
}
}
else
{
pos = LLVector3(getPositionGroup().getF32ptr());
}
pos -= camera.getOrigin();
mDistanceWRTCamera = llround(pos.magVec(), 0.01f);
mVObjp->updateLOD();
}
}
示例3: updateGeometry
BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
{
LLFastTimer ftm(LLFastTimer::FTM_UPDATE_TREE);
if (mReferenceBuffer.isNull() || mDrawable->getFace(0)->mVertexBuffer.isNull())
{
const F32 SRR3 = 0.577350269f; // sqrt(1/3)
const F32 SRR2 = 0.707106781f; // sqrt(1/2)
U32 i, j;
U32 slices = MAX_SLICES;
S32 max_indices = LEAF_INDICES;
S32 max_vertices = LEAF_VERTICES;
S32 lod;
LLFace *face = drawable->getFace(0);
face->mCenterAgent = getPositionAgent();
face->mCenterLocal = face->mCenterAgent;
for (lod = 0; lod < 4; lod++)
{
slices = sLODSlices[lod];
sLODVertexOffset[lod] = max_vertices;
sLODVertexCount[lod] = slices*slices;
sLODIndexOffset[lod] = max_indices;
sLODIndexCount[lod] = (slices-1)*(slices-1)*6;
max_indices += sLODIndexCount[lod];
max_vertices += sLODVertexCount[lod];
}
mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, gSavedSettings.getBOOL("RenderAnimateTrees") ? GL_STATIC_DRAW_ARB : 0);
mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE);
LLStrider<LLVector3> vertices;
LLStrider<LLVector3> normals;
LLStrider<LLVector2> tex_coords;
LLStrider<U16> indicesp;
mReferenceBuffer->getVertexStrider(vertices);
mReferenceBuffer->getNormalStrider(normals);
mReferenceBuffer->getTexCoord0Strider(tex_coords);
mReferenceBuffer->getIndexStrider(indicesp);
S32 vertex_count = 0;
S32 index_count = 0;
// First leaf
*(normals++) = LLVector3(-SRR2, -SRR2, 0.f);
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
*(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
vertex_count++;
*(normals++) = LLVector3(SRR3, -SRR3, SRR3);
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
*(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
vertex_count++;
*(normals++) = LLVector3(-SRR3, -SRR3, SRR3);
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
*(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
vertex_count++;
*(normals++) = LLVector3(SRR2, -SRR2, 0.f);
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_BOTTOM);
*(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 0.f);
vertex_count++;
*(indicesp++) = 0;
index_count++;
*(indicesp++) = 1;
index_count++;
*(indicesp++) = 2;
index_count++;
*(indicesp++) = 0;
index_count++;
*(indicesp++) = 3;
index_count++;
*(indicesp++) = 1;
index_count++;
// Same leaf, inverse winding/normals
*(normals++) = LLVector3(-SRR2, SRR2, 0.f);
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_BOTTOM);
*(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 0.f);
vertex_count++;
*(normals++) = LLVector3(SRR3, SRR3, SRR3);
*(tex_coords++) = LLVector2(LEAF_RIGHT, LEAF_TOP);
*(vertices++) = LLVector3(0.5f*LEAF_WIDTH, 0.f, 1.f);
vertex_count++;
*(normals++) = LLVector3(-SRR3, SRR3, SRR3);
*(tex_coords++) = LLVector2(LEAF_LEFT, LEAF_TOP);
*(vertices++) = LLVector3(-0.5f*LEAF_WIDTH, 0.f, 1.f);
vertex_count++;
//.........这里部分代码省略.........
示例4: if
//-----------------------------------------------------------------------------
// solve()
//-----------------------------------------------------------------------------
void LLJointSolverRP3::solve()
{
// llinfos << llendl;
// llinfos << "LLJointSolverRP3::solve()" << llendl;
//-------------------------------------------------------------------------
// setup joints in their base rotations
//-------------------------------------------------------------------------
mJointA->setRotation( mJointABaseRotation );
mJointB->setRotation( mJointBBaseRotation );
//-------------------------------------------------------------------------
// get joint positions in world space
//-------------------------------------------------------------------------
LLVector3 aPos = mJointA->getWorldPosition();
LLVector3 bPos = mJointB->getWorldPosition();
LLVector3 cPos = mJointC->getWorldPosition();
LLVector3 gPos = mJointGoal->getWorldPosition();
// llinfos << "bPosLocal = " << mJointB->getPosition() << llendl;
// llinfos << "cPosLocal = " << mJointC->getPosition() << llendl;
// llinfos << "bRotLocal = " << mJointB->getRotation() << llendl;
// llinfos << "cRotLocal = " << mJointC->getRotation() << llendl;
// llinfos << "aPos : " << aPos << llendl;
// llinfos << "bPos : " << bPos << llendl;
// llinfos << "cPos : " << cPos << llendl;
// llinfos << "gPos : " << gPos << llendl;
//-------------------------------------------------------------------------
// get the poleVector in world space
//-------------------------------------------------------------------------
LLVector3 poleVec = mPoleVector;
if ( mJointA->getParent() )
{
LLVector4a pole_veca;
pole_veca.load3(mPoleVector.mV);
mJointA->getParent()->getWorldMatrix().rotate(pole_veca,pole_veca);
poleVec.set(pole_veca.getF32ptr());
}
//-------------------------------------------------------------------------
// compute the following:
// vector from A to B
// vector from B to C
// vector from A to C
// vector from A to G (goal)
//-------------------------------------------------------------------------
LLVector3 abVec = bPos - aPos;
LLVector3 bcVec = cPos - bPos;
LLVector3 acVec = cPos - aPos;
LLVector3 agVec = gPos - aPos;
// llinfos << "abVec : " << abVec << llendl;
// llinfos << "bcVec : " << bcVec << llendl;
// llinfos << "acVec : " << acVec << llendl;
// llinfos << "agVec : " << agVec << llendl;
//-------------------------------------------------------------------------
// compute needed lengths of those vectors
//-------------------------------------------------------------------------
F32 abLen = abVec.magVec();
F32 bcLen = bcVec.magVec();
F32 agLen = agVec.magVec();
// llinfos << "abLen : " << abLen << llendl;
// llinfos << "bcLen : " << bcLen << llendl;
// llinfos << "agLen : " << agLen << llendl;
//-------------------------------------------------------------------------
// compute component vector of (A->B) orthogonal to (A->C)
//-------------------------------------------------------------------------
LLVector3 abacCompOrthoVec = abVec - acVec * ((abVec * acVec)/(acVec * acVec));
// llinfos << "abacCompOrthoVec : " << abacCompOrthoVec << llendl;
//-------------------------------------------------------------------------
// compute the normal of the original ABC plane (and store for later)
//-------------------------------------------------------------------------
LLVector3 abcNorm;
if (!mbUseBAxis)
{
if( are_parallel(abVec, bcVec, 0.001f) )
{
// the current solution is maxed out, so we use the axis that is
// orthogonal to both poleVec and A->B
if ( are_parallel(poleVec, abVec, 0.001f) )
{
// ACK! the problem is singular
if ( are_parallel(poleVec, agVec, 0.001f) )
{
// the solutions is also singular
return;
}
else
{
abcNorm = poleVec % agVec;
//.........这里部分代码省略.........
示例5: setLocalPos
// <FS:Ansariel> Extended TP history
void LLTeleportHistoryFlatItem::setLocalPos(const LLVector3& local_pos)
{
mLocalPos.set(local_pos);
}
示例6: getGeometryVolume
BOOL LLFace::getGeometryVolume(const LLVolume& volume,
const S32 &f,
const LLMatrix4& mat_vert_in, const LLMatrix3& mat_norm_in,
const U16 &index_offset,
bool force_rebuild)
{
llassert(verify());
const LLVolumeFace &vf = volume.getVolumeFace(f);
S32 num_vertices = (S32)vf.mNumVertices;
S32 num_indices = (S32) vf.mNumIndices;
if (mVertexBuffer.notNull())
{
if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())
{
llwarns << "Index buffer overflow!" << llendl;
llwarns << "Indices Count: " << mIndicesCount
<< " VF Num Indices: " << num_indices
<< " Indices Index: " << mIndicesIndex
<< " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl;
llwarns << "Last Indices Count: " << mLastIndicesCount
<< " Last Indices Index: " << mLastIndicesIndex
<< " Face Index: " << f
<< " Pool Type: " << mPoolType << llendl;
return FALSE;
}
if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts())
{
llwarns << "Vertex buffer overflow!" << llendl;
return FALSE;
}
}
LLStrider<LLVector3> vertices;
LLStrider<LLVector2> tex_coords;
LLStrider<LLVector2> tex_coords2;
LLStrider<LLVector3> normals;
LLStrider<LLColor4U> colors;
LLStrider<LLVector3> binormals;
LLStrider<U16> indicesp;
#if MESH_ENABLED
LLStrider<LLVector4> weights;
#endif //MESH_ENABLED
BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME);
BOOL global_volume = mDrawablep->getVOVolume()->isVolumeGlobal();
LLVector3 scale;
if (global_volume)
{
scale.setVec(1,1,1);
}
else
{
scale = mVObjp->getScale();
}
bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION);
bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR);
bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD);
bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
bool rebuild_binormal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_BINORMAL);
#if MESH_ENABLED
bool rebuild_weights = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_WEIGHT4);
#endif //MESH_ENABLED
const LLTextureEntry *tep = mVObjp->getTE(f);
if (!tep) rebuild_color = FALSE; // can't get color when tep is NULL
U8 bump_code = tep ? tep->getBumpmap() : 0;
BOOL is_static = mDrawablep->isStatic();
BOOL is_global = is_static;
LLVector3 center_sum(0.f, 0.f, 0.f);
if (is_global)
{
setState(GLOBAL);
}
else
{
clearState(GLOBAL);
}
LLColor4U color = (tep ? LLColor4U(tep->getColor()) : LLColor4U::white);
if (rebuild_color) // FALSE if tep == NULL
{
if (tep)
{
GLfloat alpha[4] =
{
0.00f,
0.25f,
0.5f,
0.75f
};
//.........这里部分代码省略.........