本文整理汇总了C++中LLVector4a::getF32ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVector4a::getF32ptr方法的具体用法?C++ LLVector4a::getF32ptr怎么用?C++ LLVector4a::getF32ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVector4a
的用法示例。
在下文中一共展示了LLVector4a::getF32ptr方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getWorldPosition
const LLVector3 LLDrawable::getPositionAgent() const
{
if (getVOVolume())
{
if (isActive())
{
if (!isRoot())
{
LLVector4a pos;
pos.load3(mVObjp->getPosition().mV);
getRenderMatrix().affineTransform(pos,pos);
return LLVector3(pos.getF32ptr());
}
else
{
return LLVector3(getRenderMatrix().getRow<3>().getF32ptr());
}
}
else
{
return mVObjp->getPositionAgent();
}
}
else
{
return getWorldPosition();
}
}
示例2: shiftPos
void LLDrawable::shiftPos(const LLVector4a &shift_vector)
{
if (isDead())
{
llwarns << "Shifting dead drawable" << llendl;
return;
}
if (mParent)
{
mXform.setPosition(mVObjp->getPosition());
}
else
{
mXform.setPosition(mVObjp->getPositionAgent());
}
mXform.setRotation(mVObjp->getRotation());
mXform.setScale(1,1,1);
mXform.updateMatrix();
if (isStatic())
{
LLVOVolume* volume = getVOVolume();
if (!volume)
{
gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE);
}
for (S32 i = 0; i < getNumFaces(); i++)
{
LLFace *facep = getFace(i);
facep->mCenterAgent += LLVector3(shift_vector.getF32ptr());
facep->mExtents[0].add(shift_vector);
facep->mExtents[1].add(shift_vector);
if (!volume && facep->hasGeometry())
{
facep->clearVertexBuffer();
}
}
mExtents[0].add(shift_vector);
mExtents[1].add(shift_vector);
mPositionGroup.add(shift_vector);
}
else if (mSpatialBridge)
{
mSpatialBridge->shiftPos(shift_vector);
}
else if (isAvatar())
{
mExtents[0].add(shift_vector);
mExtents[1].add(shift_vector);
mPositionGroup.add(shift_vector);
}
mVObjp->onShift(shift_vector);
}
示例3: onShift
void LLVolumeImplFlexible::onShift(const LLVector4a &shift_vector)
{
//VECTORIZE THIS
LLVector3 shift(shift_vector.getF32ptr());
for (int section = 0; section < (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1; ++section)
{
mSection[section].mPosition += shift;
}
}
示例4: areVertsVisible
BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts)
{
S32 i, num_faces;
LLDrawable* drawablep = volumep->mDrawable;
if (!drawablep)
{
return FALSE;
}
LLVolume* volume = volumep->getVolume();
if (!volume)
{
return FALSE;
}
LLVOVolume* vo_volume = (LLVOVolume*) volumep;
vo_volume->updateRelativeXform();
LLMatrix4 mat = vo_volume->getRelativeXform();
LLMatrix4 render_mat(vo_volume->getRenderRotation(), LLVector4(vo_volume->getRenderPosition()));
LLMatrix4a render_mata;
render_mata.loadu(render_mat);
LLMatrix4a mata;
mata.loadu(mat);
num_faces = volume->getNumVolumeFaces();
for (i = 0; i < num_faces; i++)
{
const LLVolumeFace& face = volume->getVolumeFace(i);
for (U32 v = 0; v < face.mNumVertices; v++)
{
const LLVector4a& src_vec = face.mPositions[v];
LLVector4a vec;
mata.affineTransform(src_vec, vec);
if (drawablep->isActive())
{
LLVector4a t = vec;
render_mata.affineTransform(t, vec);
}
BOOL in_frustum = pointInFrustum(LLVector3(vec.getF32ptr())) > 0;
if (( !in_frustum && all_verts) ||
(in_frustum && !all_verts))
{
return !all_verts;
}
}
}
return all_verts;
}
示例5: transformCamera
LLCamera LLSpatialBridge::transformCamera(LLCamera& camera)
{
LLCamera ret = camera;
LLXformMatrix* mat = mDrawable->getXform();
const LLVector4a& center = mat->getWorldMatrix().getRow<3>();
LLQuaternion2 invRot;
invRot.setConjugate( LLQuaternion2(mat->getRotation()) );
LLVector4a delta;
delta.load3(ret.getOrigin().mV);
delta.sub(center);
LLVector4a lookAt;
lookAt.load3(ret.getAtAxis().mV);
LLVector4a up_axis;
up_axis.load3(ret.getUpAxis().mV);
LLVector4a left_axis;
left_axis.load3(ret.getLeftAxis().mV);
delta.setRotated(invRot, delta);
lookAt.setRotated(invRot, lookAt);
up_axis.setRotated(invRot, up_axis);
left_axis.setRotated(invRot, left_axis);
if (!delta.isFinite3())
{
delta.clear();
}
ret.setOrigin(LLVector3(delta.getF32ptr()));
ret.setAxes(LLVector3(lookAt.getF32ptr()), LLVector3(left_axis.getF32ptr()), LLVector3(up_axis.getF32ptr()));
return ret;
}
示例6: lineSegmentIntersect
BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, S32 *face_hitp,
LLVector4a* intersection,LLVector2* tex_coord, LLVector4a* normal, LLVector4a* tangent)
{
if (!lineSegmentBoundingBox(start, end))
{
return FALSE;
}
LLVector4a da;
da.setSub(end, start);
LLVector3 delta(da.getF32ptr());
LLVector3 pdelta = delta;
pdelta.mV[2] = 0;
F32 plength = pdelta.length();
F32 tdelta = 1.f/plength;
LLVector3 v_start(start.getF32ptr());
LLVector3 origin = v_start - mRegionp->getOriginAgent();
if (mRegionp->getLandHeightRegion(origin) > origin.mV[2])
{
//origin is under ground, treat as no intersection
return FALSE;
}
//step one meter at a time until intersection point found
//VECTORIZE THIS
const LLVector4a* exta = mDrawable->getSpatialExtents();
LLVector3 ext[2];
ext[0].set(exta[0].getF32ptr());
ext[1].set(exta[1].getF32ptr());
F32 rad = (delta*tdelta).magVecSquared();
F32 t = 0.f;
while ( t <= 1.f)
{
LLVector3 sample = origin + delta*t;
if (AABBSphereIntersectR2(ext[0], ext[1], sample+mRegionp->getOriginAgent(), rad))
{
F32 height = mRegionp->getLandHeightRegion(sample);
if (height > sample.mV[2])
{ //ray went below ground, positive intersection
//quick and dirty binary search to get impact point
tdelta = -tdelta*0.5f;
F32 err_dist = 0.001f;
F32 dist = fabsf(sample.mV[2] - height);
while (dist > err_dist && tdelta*tdelta > 0.0f)
{
t += tdelta;
sample = origin+delta*t;
height = mRegionp->getLandHeightRegion(sample);
if ((tdelta < 0 && height < sample.mV[2]) ||
(height > sample.mV[2] && tdelta > 0))
{ //jumped over intersection point, go back
tdelta = -tdelta;
}
tdelta *= 0.5f;
dist = fabsf(sample.mV[2] - height);
}
if (intersection)
{
F32 height = mRegionp->getLandHeightRegion(sample);
if (fabsf(sample.mV[2]-height) < delta.length()*tdelta)
{
sample.mV[2] = mRegionp->getLandHeightRegion(sample);
}
intersection->load3((sample + mRegionp->getOriginAgent()).mV);
}
if (normal)
{
normal->load3((mRegionp->getLand().resolveNormalGlobal(mRegionp->getPosGlobalFromRegion(sample))).mV);
}
return TRUE;
}
}
t += tdelta;
if (t > 1 && t < 1.f+tdelta*0.99f)
{ //make sure end point is checked (saves vertical lines coming up negative)
t = 1.f;
}
}
return FALSE;
}
示例7: updateShape
//.........这里部分代码省略.........
case SCROLL_DOWN:
media_impl->scrollWheel(0, 1, MASK_NONE);
break;
case SCROLL_LEFT:
media_impl->scrollWheel(1, 0, MASK_NONE);
// media_impl->handleKeyHere(KEY_LEFT, MASK_NONE);
break;
case SCROLL_RIGHT:
media_impl->scrollWheel(-1, 0, MASK_NONE);
// media_impl->handleKeyHere(KEY_RIGHT, MASK_NONE);
break;
case SCROLL_NONE:
default:
break;
}
}
setVisible(enabled);
//
// Calculate position and shape of the controls
//
std::vector<LLVector3>::iterator vert_it;
std::vector<LLVector3>::iterator vert_end;
std::vector<LLVector3> vect_face;
LLVolume* volume = objectp->getVolume();
if (volume)
{
const LLVolumeFace& vf = volume->getVolumeFace(mTargetObjectFace);
LLVector3 ext[2];
ext[0].set(vf.mExtents[0].getF32ptr());
ext[1].set(vf.mExtents[1].getF32ptr());
LLVector3 center = (ext[0]+ext[1])*0.5f;
LLVector3 size = (ext[1]-ext[0])*0.5f;
LLVector3 vert[] =
{
center + size.scaledVec(LLVector3(1,1,1)),
center + size.scaledVec(LLVector3(-1,1,1)),
center + size.scaledVec(LLVector3(1,-1,1)),
center + size.scaledVec(LLVector3(-1,-1,1)),
center + size.scaledVec(LLVector3(1,1,-1)),
center + size.scaledVec(LLVector3(-1,1,-1)),
center + size.scaledVec(LLVector3(1,-1,-1)),
center + size.scaledVec(LLVector3(-1,-1,-1)),
};
LLVOVolume* vo = (LLVOVolume*) objectp;
for (U32 i = 0; i < 8; i++)
{
vect_face.push_back(vo->volumePositionToAgent(vert[i]));
}
}
vert_it = vect_face.begin();
vert_end = vect_face.end();
LLMatrix4a mat;
if (!is_hud)
{
mat.setMul(glh_get_current_projection(),glh_get_current_modelview());
}
else {
示例8: shiftPos
void LLDrawable::shiftPos(const LLVector4a &shift_vector)
{
if (isDead())
{
LL_WARNS() << "Shifting dead drawable" << LL_ENDL;
return;
}
if (mParent)
{
mXform.setPosition(mVObjp->getPosition());
}
else
{
mXform.setPosition(mVObjp->getPositionAgent());
}
mXform.updateMatrix();
if (isStatic())
{
LLVOVolume* volume = getVOVolume();
bool rebuild = (!volume &&
getRenderType() != LLPipeline::RENDER_TYPE_TREE &&
getRenderType() != LLPipeline::RENDER_TYPE_TERRAIN &&
getRenderType() != LLPipeline::RENDER_TYPE_SKY &&
getRenderType() != LLPipeline::RENDER_TYPE_GROUND);
if (rebuild)
{
gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE);
}
for (S32 i = 0; i < getNumFaces(); i++)
{
LLFace *facep = getFace(i);
if (facep)
{
facep->mCenterAgent += LLVector3(shift_vector.getF32ptr());
facep->mExtents[0].add(shift_vector);
facep->mExtents[1].add(shift_vector);
if (rebuild && facep->hasGeometry())
{
facep->clearVertexBuffer();
}
}
}
mExtents[0].add(shift_vector);
mExtents[1].add(shift_vector);
mPositionGroup.add(shift_vector);
}
else if (mSpatialBridge)
{
mSpatialBridge->shiftPos(shift_vector);
}
else if (isAvatar())
{
mExtents[0].add(shift_vector);
mExtents[1].add(shift_vector);
mPositionGroup.add(shift_vector);
}
mVObjp->onShift(shift_vector);
}
示例9: normalizeVolumeFaces
//.........这里部分代码省略.........
min_tc = face.mTexCoords[0];
max_tc = face.mTexCoords[0];
for (U32 j = 1; j < (U32)face.mNumVertices; ++j)
{
update_min_max(min_tc, max_tc, face.mTexCoords[j]);
}
}
else
{
face.mTexCoordExtents[0].set(0,0);
face.mTexCoordExtents[1].set(1,1);
}
}
// Now that we have the extents of the model
// we can compute the offset needed to center
// the model at the origin.
// Compute center of the model
// and make it negative to get translation
// needed to center at origin.
LLVector4a trans;
trans.setAdd(min, max);
trans.mul(-0.5f);
// Compute the total size along all
// axes of the model.
LLVector4a size;
size.setSub(max, min);
// Prevent division by zero.
F32 x = size[0];
F32 y = size[1];
F32 z = size[2];
F32 w = size[3];
if (fabs(x)<F_APPROXIMATELY_ZERO)
{
x = 1.0;
}
if (fabs(y)<F_APPROXIMATELY_ZERO)
{
y = 1.0;
}
if (fabs(z)<F_APPROXIMATELY_ZERO)
{
z = 1.0;
}
size.set(x,y,z,w);
// Compute scale as reciprocal of size
LLVector4a scale;
scale.splat(1.f);
scale.div(size);
LLVector4a inv_scale(1.f);
inv_scale.div(scale);
for (U32 i = 0; i < mVolumeFaces.size(); ++i)
{
LLVolumeFace& face = mVolumeFaces[i];
// We shrink the extents so
// that they fall within
// the unit cube.
face.mExtents[0].add(trans);
face.mExtents[0].mul(scale);
face.mExtents[1].add(trans);
face.mExtents[1].mul(scale);
// For all the positions, we scale
// the positions to fit within the unit cube.
LLVector4a* pos = (LLVector4a*) face.mPositions;
LLVector4a* norm = (LLVector4a*) face.mNormals;
for (U32 j = 0; j < (U32)face.mNumVertices; ++j)
{
pos[j].add(trans);
pos[j].mul(scale);
if (norm && !norm[j].equals3(LLVector4a::getZero()))
{
norm[j].mul(inv_scale);
norm[j].normalize3();
}
}
}
// mNormalizedScale is the scale at which
// we would need to multiply the model
// by to get the original size of the
// model instead of the normalized size.
LLVector4a normalized_scale;
normalized_scale.splat(1.f);
normalized_scale.div(scale);
mNormalizedScale.set(normalized_scale.getF32ptr());
mNormalizedTranslation.set(trans.getF32ptr());
mNormalizedTranslation *= -1.f;
}
}
示例10: doOcclusion
void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* shift)
{
LLGLDisable stencil(GL_STENCIL_TEST);
if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1)
{
//move mBounds to the agent space if necessary
LLVector4a bounds[2];
bounds[0] = mBounds[0];
bounds[1] = mBounds[1];
if(shift != NULL)
{
bounds[0].add(*shift);
}
// Don't cull hole/edge water, unless we have the GL_ARB_depth_clamp extension
if (earlyFail(camera, bounds))
{
LLFastTimer t(FTM_OCCLUSION_EARLY_FAIL);
setOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY);
assert_states_valid(this);
clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF);
assert_states_valid(this);
}
else
{
if (!isOcclusionState(QUERY_PENDING) || isOcclusionState(DISCARD_QUERY))
{
{ //no query pending, or previous query to be discarded
LLFastTimer t(FTM_RENDER_OCCLUSION);
if (!mOcclusionQuery[LLViewerCamera::sCurCameraID])
{
LLFastTimer t(FTM_OCCLUSION_ALLOCATE);
mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName();
}
// Depth clamp all water to avoid it being culled as a result of being
// behind the far clip plane, and in the case of edge water to avoid
// it being culled while still visible.
bool const use_depth_clamp = gGLManager.mHasDepthClamp &&
(mSpatialPartition->mDrawableType == LLDrawPool::POOL_WATER ||
mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER);
LLGLEnable clamp(use_depth_clamp ? GL_DEPTH_CLAMP : 0);
#if !LL_DARWIN
U32 mode = gGLManager.mHasOcclusionQuery2 ? GL_ANY_SAMPLES_PASSED : GL_SAMPLES_PASSED_ARB;
#else
U32 mode = GL_SAMPLES_PASSED_ARB;
#endif
#if LL_TRACK_PENDING_OCCLUSION_QUERIES
sPendingQueries.insert(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
#endif
{
LLFastTimer t(FTM_PUSH_OCCLUSION_VERTS);
//store which frame this query was issued on
mOcclusionIssued[LLViewerCamera::sCurCameraID] = gFrameCount;
{
LLFastTimer t(FTM_OCCLUSION_BEGIN_QUERY);
glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);
}
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
llassert(shader);
shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, bounds[0].getF32ptr());
//static LLVector4a fudge(SG_OCCLUSION_FUDGE);
static LLCachedControl<F32> vel("SHOcclusionFudge",SG_OCCLUSION_FUDGE);
LLVector4a fudge(SG_OCCLUSION_FUDGE);
static LLVector4a fudged_bounds;
fudged_bounds.setAdd(fudge, bounds[1]);
shader->uniform3fv(LLShaderMgr::BOX_SIZE, 1, fudged_bounds.getF32ptr());
if (!use_depth_clamp && mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER)
{
LLFastTimer t(FTM_OCCLUSION_DRAW_WATER);
LLGLSquashToFarClip squash(glh_get_current_projection(), 1);
if (camera->getOrigin().isExactlyZero())
{ //origin is invalid, draw entire box
gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0);
gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8);
}
else
{
gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0]));
}
}
else
{
LLFastTimer t(FTM_OCCLUSION_DRAW);
if (camera->getOrigin().isExactlyZero())
{ //origin is invalid, draw entire box
gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0);
gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8);
}
//.........这里部分代码省略.........
示例11: genVolumeBBoxes
//.........这里部分代码省略.........
llassert(less_than_max_mag(max));
//min, max are in volume space, convert to drawable render space
LLVector4a center;
LLVector4a t;
t.setAdd(min, max);
t.mul(0.5f);
mat_vert.affineTransform(t, center);
LLVector4a size;
size.setSub(max, min);
size.mul(0.5f);
llassert(less_than_max_mag(min));
llassert(less_than_max_mag(max));
if (!global_volume)
{
//VECTORIZE THIS
LLVector4a scale;
scale.load3(mDrawablep->getVObj()->getScale().mV);
size.mul(scale);
}
mat_normal.mMatrix[0].normalize3fast();
mat_normal.mMatrix[1].normalize3fast();
mat_normal.mMatrix[2].normalize3fast();
LLVector4a v[4];
//get 4 corners of bounding box
mat_normal.rotate(size,v[0]);
//VECTORIZE THIS
LLVector4a scale;
scale.set(-1.f, -1.f, 1.f);
scale.mul(size);
mat_normal.rotate(scale, v[1]);
scale.set(1.f, -1.f, -1.f);
scale.mul(size);
mat_normal.rotate(scale, v[2]);
scale.set(-1.f, 1.f, -1.f);
scale.mul(size);
mat_normal.rotate(scale, v[3]);
LLVector4a& newMin = mExtents[0];
LLVector4a& newMax = mExtents[1];
newMin = newMax = center;
llassert(less_than_max_mag(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);
llassert(less_than_max_mag(newMin));
llassert(less_than_max_mag(newMax));
}
if (!mDrawablep->isActive())
{
LLVector4a offset;
offset.load3(mDrawablep->getRegion()->getOriginAgent().mV);
newMin.add(offset);
newMax.add(offset);
llassert(less_than_max_mag(newMin));
llassert(less_than_max_mag(newMax));
}
t.setAdd(newMin, newMax);
t.mul(0.5f);
llassert(less_than_max_mag(t));
//VECTORIZE THIS
mCenterLocal.set(t.getF32ptr());
llassert(less_than_max_mag(newMin));
llassert(less_than_max_mag(newMax));
t.setSub(newMax,newMin);
mBoundingSphereRadius = t.getLength3().getF32()*0.5f;
updateCenterAgent();
}
return TRUE;
}
示例12: getGeometryVolume
//.........这里部分代码省略.........
}
*tex_coords++ = tc;
if (do_bump)
{
bump_tc.push_back(tc);
}
}
//mVertexBuffer->setBuffer(0);
if (do_bump)
{
mVertexBuffer->getTexCoord1Strider(tex_coords2, mGeomIndex);
for (S32 i = 0; i < num_vertices; i++)
{
LLVector4a tangent;
tangent.setCross3(vf.mBinormals[i], vf.mNormals[i]);
LLMatrix4a tangent_to_object;
tangent_to_object.setRows(tangent, vf.mBinormals[i], vf.mNormals[i]);
LLVector4a t;
tangent_to_object.rotate(binormal_dir, t);
LLVector4a binormal;
mat_normal.rotate(t, binormal);
//VECTORIZE THIS
if (mDrawablep->isActive())
{
LLVector3 t;
t.set(binormal.getF32ptr());
t *= bump_quat;
binormal.load3(t.mV);
}
binormal.normalize3fast();
LLVector2 tc = bump_tc[i];
tc += LLVector2( bump_s_primary_light_ray.dot3(tangent).getF32(), bump_t_primary_light_ray.dot3(binormal).getF32() );
*tex_coords2++ = tc;
}
//mVertexBuffer->setBuffer(0);
}
}
}
if (rebuild_pos)
{
llassert(num_vertices > 0);
mVertexBuffer->getVertexStrider(vertices, mGeomIndex);
LLMatrix4a mat_vert;
mat_vert.loadu(mat_vert_in);
LLVector4a* src = vf.mPositions;
LLVector4a position;
for (S32 i = 0; i < num_vertices; i++)
{
mat_vert.affineTransform(src[i], position);
vertices[i].set(position.getF32ptr());
}