diff options
Diffstat (limited to 'indra/newview')
28 files changed, 258 insertions, 138 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 72d51540ef..5fae5b893f 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1210,7 +1210,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s else { // Guess at a reasonable stop distance. - mAutoPilotStopDistance = fsqrtf( distance ); + mAutoPilotStopDistance = (F32) sqrt( distance ); if (mAutoPilotStopDistance < 0.5f) { mAutoPilotStopDistance = 0.5f; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 8d0a06378f..68f52e04bc 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -743,7 +743,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) } else { - pos = LLVector3(getPositionGroup().getF32()); + pos = LLVector3(getPositionGroup().getF32ptr()); } pos -= camera.getOrigin(); @@ -824,7 +824,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) for (S32 i = 0; i < getNumFaces(); i++) { LLFace *facep = getFace(i); - facep->mCenterAgent += LLVector3(shift_vector.getF32()); + facep->mCenterAgent += LLVector3(shift_vector.getF32ptr()); facep->mExtents[0].add(shift_vector); facep->mExtents[1].add(shift_vector); @@ -1153,13 +1153,13 @@ void LLSpatialBridge::updateSpatialExtents() LLVector4a max; max.setAdd(center, delta); - newMin.setMin(min); - newMax.setMax(max); + newMin.setMin(newMin, min); + newMax.setMax(newMax, max); } LLVector4a diagonal; diagonal.setSub(newMax, newMin); - mRadius = diagonal.length3() * 0.5f; + mRadius = diagonal.getLength3().getF32() * 0.5f; mPositionGroup->setAdd(newMin,newMax); mPositionGroup->mul(0.5f); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index af082eea3e..d698624c15 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -37,6 +37,7 @@ #include "llvoavatar.h" #include "m3math.h" +#include "llmatrix4a.h" #include "llagent.h" //for gAgent.needsRenderAvatar() #include "lldrawable.h" @@ -495,7 +496,7 @@ S32 LLDrawPoolAvatar::getNumPasses() } else { - return 3; + return 4; } #else if (LLPipeline::sImpostorRender) @@ -814,26 +815,46 @@ void LLDrawPoolAvatar::endSkinned() #if LL_MESH_ENABLED void LLDrawPoolAvatar::beginRiggedSimple() { - if (LLPipeline::sUnderWaterRender) + if (sShaderLevel > 0) { - sVertexProgram = &gSkinnedObjectSimpleWaterProgram; + if (LLPipeline::sUnderWaterRender) + { + sVertexProgram = &gSkinnedObjectSimpleWaterProgram; + } + else + { + sVertexProgram = &gSkinnedObjectSimpleProgram; + } } else { - sVertexProgram = &gSkinnedObjectSimpleProgram; + if (LLPipeline::sUnderWaterRender) + { + sVertexProgram = &gObjectSimpleWaterProgram; + } + else + { + sVertexProgram = &gObjectSimpleProgram; + } } - sDiffuseChannel = 0; - sVertexProgram->bind(); - LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); + if (sShaderLevel > 0 || gPipeline.canUseVertexShaders()) + { + sDiffuseChannel = 0; + sVertexProgram->bind(); + LLVertexBuffer::sWeight4Loc = sVertexProgram->getAttribLocation(LLViewerShaderMgr::OBJECT_WEIGHT); + } } void LLDrawPoolAvatar::endRiggedSimple() { LLVertexBuffer::unbind(); - sVertexProgram->unbind(); - sVertexProgram = NULL; - LLVertexBuffer::sWeight4Loc = -1; + if (sShaderLevel > 0 || gPipeline.canUseVertexShaders()) + { + sVertexProgram->unbind(); + sVertexProgram = NULL; + LLVertexBuffer::sWeight4Loc = -1; + } } void LLDrawPoolAvatar::beginRiggedAlpha() @@ -1281,8 +1302,10 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) } #if LL_MESH_ENABLED -void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLFace* face, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face) +void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* face, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face) { + LLVertexBuffer* buffer = face->mVertexBuffer; + U32 data_mask = 0; for (U32 i = 0; i < face->mRiggedIndex.size(); ++i) { @@ -1292,17 +1315,23 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLFace* face, const LLMeshSk } } - LLVertexBuffer* buff = face->mVertexBuffer; - - if (!buff || - buff->getTypeMask() != data_mask || - buff->getRequestedVerts() != vol_face.mNumVertices) + if (!buffer || + buffer->getTypeMask() != data_mask || + buffer->getRequestedVerts() != vol_face.mNumVertices) { face->setGeomIndex(0); face->setIndicesIndex(0); face->setSize(vol_face.mNumVertices, vol_face.mNumIndices, true); - face->mVertexBuffer = new LLVertexBuffer(data_mask, 0); + if (sShaderLevel > 0) + { + face->mVertexBuffer = new LLVertexBuffer(data_mask, GL_DYNAMIC_DRAW_ARB); + } + else + { + face->mVertexBuffer = new LLVertexBuffer(data_mask, GL_STREAM_DRAW_ARB); + } + face->mVertexBuffer->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), true); U16 offset = 0; @@ -1319,7 +1348,83 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLFace* face, const LLMeshSk LLMatrix3 mat_normal(mat3); face->getGeometryVolume(*volume, face->getTEOffset(), mat_vert, mat_normal, offset, true); - buff = face->mVertexBuffer; + buffer = face->mVertexBuffer; + } + + if (sShaderLevel <= 0 && face->mLastSkinTime < avatar->getLastSkinTime()) + { //perform software vertex skinning for this face + LLStrider<LLVector3> position; + LLStrider<LLVector3> normal; + + buffer->getVertexStrider(position); + buffer->getNormalStrider(normal); + + LLVector4a* pos = (LLVector4a*) position.get(); + LLVector4a* norm = (LLVector4a*) normal.get(); + + //build matrix palette + LLMatrix4a mp[64]; + LLMatrix4* mat = (LLMatrix4*) mp; + + for (U32 j = 0; j < skin->mJointNames.size(); ++j) + { + LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); + if (joint) + { + mat[j] = skin->mInvBindMatrix[j]; + mat[j] *= joint->getWorldMatrix(); + } + } + + LLVector4a* weight = vol_face.mWeights; + + LLMatrix4a bind_shape_matrix; + bind_shape_matrix.loadu(skin->mBindShapeMatrix); + + for (U32 j = 0; j < buffer->getRequestedVerts(); ++j) + { + LLMatrix4a final_mat; + final_mat.clear(); + + S32 idx[4]; + + LLVector4 wght; + + F32 scale = 0.f; + for (U32 k = 0; k < 4; k++) + { + F32 w = weight[j][k]; + + idx[k] = (S32) floorf(w); + wght[k] = w - floorf(w); + scale += wght[k]; + } + + wght *= 1.f/scale; + + for (U32 k = 0; k < 4; k++) + { + F32 w = wght[k]; + + LLMatrix4a src; + src.setMul(mp[idx[k]], w); + + final_mat.add(src); + } + + + LLVector4a& v = vol_face.mPositions[j]; + LLVector4a t; + LLVector4a dst; + bind_shape_matrix.affineTransform(v, t); + final_mat.affineTransform(t, dst); + pos[j] = dst; + + LLVector4a& n = vol_face.mNormals[j]; + bind_shape_matrix.rotate(n, t); + final_mat.rotate(t, dst); + norm[j] = dst; + } } } @@ -1371,7 +1476,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) stop_glerror(); const LLVolumeFace& vol_face = volume->getVolumeFace(te); - updateRiggedFaceVertexBuffer(face, skin, volume, vol_face); + updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face); stop_glerror(); @@ -1381,30 +1486,37 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (buff) { - LLMatrix4 mat[64]; + if (sShaderLevel > 0) + { //upload matrix palette to shader + LLMatrix4 mat[64]; - for (U32 i = 0; i < skin->mJointNames.size(); ++i) - { - LLJoint* joint = avatar->getJoint(skin->mJointNames[i]); - if (joint) + for (U32 i = 0; i < skin->mJointNames.size(); ++i) { - mat[i] = skin->mInvBindMatrix[i]; - mat[i] *= joint->getWorldMatrix(); + LLJoint* joint = avatar->getJoint(skin->mJointNames[i]); + if (joint) + { + mat[i] = skin->mInvBindMatrix[i]; + mat[i] *= joint->getWorldMatrix(); + } } + + stop_glerror(); + + LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette", + skin->mJointNames.size(), + FALSE, + (GLfloat*) mat[0].mMatrix); + LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette[0]", + skin->mJointNames.size(), + FALSE, + (GLfloat*) mat[0].mMatrix); + + stop_glerror(); + } + else + { + data_mask &= ~LLVertexBuffer::MAP_WEIGHT4; } - - stop_glerror(); - - LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette", - skin->mJointNames.size(), - FALSE, - (GLfloat*) mat[0].mMatrix); - LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette[0]", - skin->mJointNames.size(), - FALSE, - (GLfloat*) mat[0].mMatrix); - - stop_glerror(); buff->setBuffer(data_mask); diff --git a/indra/newview/lldrawpoolavatar.h b/indra/newview/lldrawpoolavatar.h index b01394534b..d08ae04516 100644 --- a/indra/newview/lldrawpoolavatar.h +++ b/indra/newview/lldrawpoolavatar.h @@ -138,7 +138,8 @@ public: void endDeferredRiggedSimple(); void endDeferredRiggedBump(); - void updateRiggedFaceVertexBuffer(LLFace* facep, + void updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, + LLFace* facep, const LLMeshSkinInfo* skin, LLVolume* volume, const LLVolumeFace& vol_face); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 8533f9710c..5d7d3387a4 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -106,8 +106,8 @@ void planarProjection(LLVector2 &tc, const LLVector4a& normal, LLVector4a tangent; tangent.setCross3(binormal,normal); - tc.mV[1] = -((tangent.dot3(vec))*2 - 0.5f); - tc.mV[0] = 1.0f+((binormal.dot3(vec))*2 - 0.5f); + tc.mV[1] = -((tangent.dot3(vec).getF32())*2 - 0.5f); + tc.mV[0] = 1.0f+((binormal.dot3(vec).getF32())*2 - 0.5f); } void sphericalProjection(LLVector2 &tc, const LLVector4a& normal, @@ -156,6 +156,7 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) mLastUpdateTime = gFrameTimeSeconds; mLastMoveTime = 0.f; + mLastSkinTime = gFrameTimeSeconds; mVSize = 0.f; mPixelArea = 16.f; mState = GLOBAL; @@ -828,8 +829,8 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, LLVector4a max; max.setAdd(center, delta); - newMin.setMin(min); - newMax.setMax(max); + newMin.setMin(newMin,min); + newMax.setMax(newMax,max); } if (!mDrawablep->isActive()) @@ -844,11 +845,11 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, t.mul(0.5f); //VECTORIZE THIS - mCenterLocal.set(t.getF32()); + mCenterLocal.set(t.getF32ptr()); t.setSub(newMax,newMin); t.mul(0.5f); - mBoundingSphereRadius = t.length3(); + mBoundingSphereRadius = t.getLength3().getF32(); updateCenterAgent(); } @@ -1313,7 +1314,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (!do_xform) { - LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2); + LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32)); } else { @@ -1529,13 +1530,13 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (mDrawablep->isActive()) { LLVector3 t; - t.set(binormal.getF32()); + t.set(binormal.getF32ptr()); t *= bump_quat; binormal.load3(t.mV); } binormal.normalize3fast(); - tc += LLVector2( bump_s_primary_light_ray.dot3(tangent), bump_t_primary_light_ray.dot3(binormal) ); + tc += LLVector2( bump_s_primary_light_ray.dot3(tangent).getF32(), bump_t_primary_light_ray.dot3(binormal).getF32() ); *tex_coords2++ = tc; } @@ -1583,7 +1584,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_weights && vf.mWeights) { - LLVector4a::memcpyNonAliased16((F32*) weights, (F32*) vf.mWeights, num_vertices*4); + LLVector4a::memcpyNonAliased16((F32*) weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); } if (rebuild_color) @@ -1705,21 +1706,21 @@ BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) LLViewerCamera* camera = LLViewerCamera::getInstance(); - F32 size_squared = size.dot3(size); + F32 size_squared = size.dot3(size).getF32(); LLVector4a lookAt; LLVector4a t; t.load3(camera->getOrigin().mV); lookAt.setSub(center, t); - F32 dist = lookAt.length3(); + F32 dist = lookAt.getLength3().getF32(); lookAt.normalize3fast() ; //get area of circle around node - F32 app_angle = atanf(fsqrtf(size_squared) / dist); + F32 app_angle = atanf((F32) sqrt(size_squared) / dist); radius = app_angle*LLDrawable::sCurPixelAngle; mPixelArea = radius*radius * 3.14159f; LLVector4a x_axis; x_axis.load3(camera->getXAxis().mV); - cos_angle_to_view_dir = lookAt.dot3(x_axis); + cos_angle_to_view_dir = lookAt.dot3(x_axis).getF32(); //if has media, check if the face is out of the view frustum. if(hasMedia()) diff --git a/indra/newview/llface.h b/indra/newview/llface.h index b6a67c7fc4..a7d7889350 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -240,6 +240,7 @@ public: LLPointer<LLVertexBuffer> mVertexBuffer; LLPointer<LLVertexBuffer> mLastVertexBuffer; F32 mLastUpdateTime; + F32 mLastSkinTime; F32 mLastMoveTime; LLMatrix4* mTextureMatrix; LLDrawInfo* mDrawInfo; @@ -274,7 +275,7 @@ private: S32 mReferenceIndex; std::vector<S32> mRiggedIndex; - + F32 mVSize; F32 mPixelArea; diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 8be4e34748..62336b03bf 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -100,7 +100,7 @@ void LLVolumeImplFlexible::onParameterChanged(U16 param_type, LLNetworkData *dat void LLVolumeImplFlexible::onShift(const LLVector4a &shift_vector) { //VECTORIZE THIS - LLVector3 shift(shift_vector.getF32()); + LLVector3 shift(shift_vector.getF32ptr()); for (int section = 0; section < (1<<FLEXIBLE_OBJECT_MAX_SECTIONS)+1; ++section) { mSection[section].mPosition += shift; diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp index 63040904df..e5da871d03 100644 --- a/indra/newview/llhudicon.cpp +++ b/indra/newview/llhudicon.cpp @@ -302,7 +302,7 @@ BOOL LLHUDIcon::lineSegmentIntersect(const LLVector3& start, const LLVector3& en { dir.mul(t); starta.add(dir); - *intersection = LLVector3((F32*) &starta.mQ); + *intersection = LLVector3(starta.getF32ptr()); } return TRUE; } diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index 7f4609b83e..adeb401b77 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -362,7 +362,7 @@ void LLPanelNearByMedia::updateListItem(LLScrollListItem* item, LLViewerMediaImp debug_str += llformat("%g/", (float)impl->getInterest()); // proximity distance is actually distance squared -- display it as straight distance. - debug_str += llformat("%g/", fsqrtf(impl->getProximityDistance())); + debug_str += llformat("%g/", (F32) sqrt(impl->getProximityDistance())); // s += llformat("%g/", (float)impl->getCPUUsage()); // s += llformat("%g/", (float)impl->getApproximateTextureInterest()); diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 98fbebbc5d..d84ac2e4c8 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -576,8 +576,8 @@ void LLPanelPrimMediaControls::updateShape() const LLVolumeFace& vf = volume->getVolumeFace(mTargetObjectFace); LLVector3 ext[2]; - ext[0].set(vf.mExtents[0].getF32()); - ext[1].set(vf.mExtents[1].getF32()); + 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; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 42f09f7396..92903a6aa9 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -1124,13 +1124,13 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 & size.setSub(max_extents, min_extents); size.mul(0.5f); - mGridOrigin.set(center.getF32()); + mGridOrigin.set(center.getF32ptr()); LLDrawable* drawable = first_grid_object->mDrawable; if (drawable && drawable->isActive()) { mGridOrigin = mGridOrigin * first_grid_object->getRenderMatrix(); } - mGridScale.set(size.getF32()); + mGridScale.set(size.getF32ptr()); } } else // GRID_MODE_WORLD or just plain default @@ -3543,7 +3543,7 @@ void LLSelectMgr::deselectAllIfTooFar() { if (mDebugSelectMgr) { - llinfos << "Selection manager: auto-deselecting, select_dist = " << fsqrtf(select_dist_sq) << llendl; + llinfos << "Selection manager: auto-deselecting, select_dist = " << (F32) sqrt(select_dist_sq) << llendl; llinfos << "agent pos global = " << gAgent.getPositionGlobal() << llendl; llinfos << "selection pos global = " << selectionCenter << llendl; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 2335c7bb8e..e55ec03356 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -231,7 +231,7 @@ U8* get_box_fan_indices(LLCamera* camera, const LLVector4a& center) LLVector4a origin; origin.load3(camera->getOrigin().mV); - S32 cypher = center.greaterThan4(origin).getComparisonMask() & 0x7; + S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7; return sOcclusionIndices+cypher*8; } @@ -253,7 +253,7 @@ void LLSpatialGroup::buildOcclusion() r2.splat(0.25f); r2.add(mBounds[1]); - r.setMin(r2); + r.setMin(r, r2); LLVector4a* v = mOcclusionVerts; const LLVector4a& c = mBounds[0]; @@ -775,8 +775,8 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma } else { - minOut.setMin(newMin); - maxOut.setMax(newMax); + minOut.setMin(minOut, newMin); + maxOut.setMax(maxOut, newMax); } return TRUE; @@ -1220,8 +1220,8 @@ void LLSpatialGroup::updateDistance(LLCamera &camera) #endif if (!getData().empty()) { - mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].length3() : - (F32) mOctreeNode->getSize().length3(); + mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() : + (F32) mOctreeNode->getSize().getLength3().getF32(); mDistance = mSpatialPartition->calcDistance(this, camera); mPixelArea = mSpatialPartition->calcPixelArea(this, camera); } @@ -1241,7 +1241,7 @@ F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera) { LLVector4a v = eye; - dist = eye.length3(); + dist = eye.getLength3().getF32(); eye.normalize3fast(); if (!group->isState(LLSpatialGroup::ALPHA_DIRTY)) @@ -1253,7 +1253,7 @@ F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera) LLVector4a diff; diff.setSub(view_angle, *group->mLastUpdateViewAngle); - if (diff.length3() > 0.64f) + if (diff.getLength3().getF32() > 0.64f) { *group->mViewAngle = view_angle; *group->mLastUpdateViewAngle = view_angle; @@ -1279,11 +1279,11 @@ F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera) t.mul(group->mObjectBounds[1]); v.sub(t); - group->mDepth = v.dot3(ata); + group->mDepth = v.dot3(ata).getF32(); } else { - dist = eye.length3(); + dist = eye.getLength3().getF32(); } if (dist < 16.f) @@ -1497,8 +1497,8 @@ BOOL LLSpatialGroup::rebound() const LLVector4a& max = group->mExtents[1]; const LLVector4a& min = group->mExtents[0]; - newMax.setMax(max); - newMin.setMin(min); + newMax.setMax(newMax, max); + newMin.setMin(newMin, min); } boundObjects(FALSE, newMin, newMax); @@ -2196,8 +2196,8 @@ BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLOctreeCullVisExtents vis(&camera, visMina, visMaxa); vis.traverse(mOctree); - visMin.set(visMina.getF32()); - visMax.set(visMaxa.getF32()); + visMin.set(visMina.getF32ptr()); + visMax.set(visMaxa.getF32ptr()); return vis.mEmpty; } @@ -2280,13 +2280,13 @@ BOOL earlyFail(LLCamera* camera, LLSpatialGroup* group) LLVector4a max; max.setAdd(c,r); - S32 lt = e.lessThan4(min).getComparisonMask() & 0x7; + S32 lt = e.lessThan(min).getGatheredBits() & 0x7; if (lt) { return FALSE; } - S32 gt = e.greaterThan4(max).getComparisonMask() & 0x7; + S32 gt = e.greaterThan(max).getGatheredBits() & 0x7; if (gt) { return FALSE; @@ -2745,8 +2745,8 @@ void renderNormals(LLDrawable* drawablep) p.setAdd(face.mPositions[j], n); gGL.color4f(1,1,1,1); - gGL.vertex3fv(face.mPositions[j].getF32()); - gGL.vertex3fv(p.getF32()); + gGL.vertex3fv(face.mPositions[j].getF32ptr()); + gGL.vertex3fv(p.getF32ptr()); if (face.mBinormals) { @@ -2754,8 +2754,8 @@ void renderNormals(LLDrawable* drawablep) p.setAdd(face.mPositions[j], n); gGL.color4f(0,1,1,1); - gGL.vertex3fv(face.mPositions[j].getF32()); - gGL.vertex3fv(p.getF32()); + gGL.vertex3fv(face.mPositions[j].getF32ptr()); + gGL.vertex3fv(p.getF32ptr()); } } @@ -3024,8 +3024,8 @@ public: LLVolumeOctreeListener* vl = (LLVolumeOctreeListener*) branch->getListener(0); LLVector3 center, size; - center.set(vl->mBounds[0].getF32()); - size.set(vl->mBounds[1].getF32()); + center.set(vl->mBounds[0].getF32ptr()); + size.set(vl->mBounds[1].getF32ptr()); drawBoxOutline(center, size); } diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index cef7c4abbb..917185ed04 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -810,7 +810,7 @@ BOOL LLViewerCamera::areVertsVisible(LLViewerObject* volumep, BOOL all_verts) render_mata.affineTransform(t, vec); } - BOOL in_frustum = pointInFrustum(LLVector3(vec.getF32())) > 0; + BOOL in_frustum = pointInFrustum(LLVector3(vec.getF32ptr())) > 0; if (( !in_frustum && all_verts) || (in_frustum && !all_verts)) diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 9e35b5cc51..0a181e09bb 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -726,8 +726,8 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w U32 words = num_verts*4; - LLVector4a::memcpyNonAliased16(v, (F32*) mMesh->getCoords(), words); - LLVector4a::memcpyNonAliased16(n, (F32*) mMesh->getNormals(), words); + LLVector4a::memcpyNonAliased16(v, (F32*) mMesh->getCoords(), words*sizeof(F32)); + LLVector4a::memcpyNonAliased16(n, (F32*) mMesh->getNormals(), words*sizeof(F32)); if (!terse_update) @@ -740,9 +740,9 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w F32* vw = (F32*) vertex_weightsp.get(); F32* cw = (F32*) clothing_weightsp.get(); - LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), num_verts*2); - LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), num_verts); - LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4); + LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), num_verts*2*sizeof(F32)); + LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), num_verts*sizeof(F32)); + LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4*sizeof(F32)); } const U32 idx_count = mMesh->getNumFaces()*3; diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 79d8fc7df9..16a6022b86 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -764,7 +764,7 @@ void LLViewerJoystick::moveAvatar(bool reset) sDelta[RX_I] += (cur_delta[RX_I] - sDelta[RX_I]) * time * feather; sDelta[RY_I] += (cur_delta[RY_I] - sDelta[RY_I]) * time * feather; - handleRun(fsqrtf(sDelta[Z_I]*sDelta[Z_I] + sDelta[X_I]*sDelta[X_I])); + handleRun((F32) sqrt(sDelta[Z_I]*sDelta[Z_I] + sDelta[X_I]*sDelta[X_I])); // Allow forward/backward movement some priority if (dom_axis == Z_I) diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 178d928f57..303f339f7d 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -865,7 +865,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) // Set the low priority size for downsampling to approximately the size the texture is displayed at. { - F32 approximate_interest_dimension = fsqrtf(pimpl->getInterest()); + F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest()); pimpl->setLowPrioritySizeLimit(llround(approximate_interest_dimension)); } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 2b89deaa53..9587fbafb1 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -2973,7 +2973,7 @@ F32 LLViewerObject::getBinRadius() const LLVector4a* ext = mDrawable->getSpatialExtents(); LLVector4a diff; diff.setSub(ext[1], ext[0]); - return diff.length3(); + return diff.getLength3().getF32(); } return getScale().magVec(); diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index 41848e8b7a..4759454ee7 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -161,8 +161,8 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo if (group != NULL) { - LLVector3 center(group->mOctreeNode->getCenter().getF32()); - LLVector3 size(group->mOctreeNode->getSize().getF32()); + LLVector3 center(group->mOctreeNode->getCenter().getF32ptr()); + LLVector3 size(group->mOctreeNode->getSize().getF32ptr()); size += LLVector3(0.01f, 0.01f, 0.01f); mMinObjPos = center - size; mMaxObjPos = center + size; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 719c5b0da5..d50efe89dd 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1580,7 +1580,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() S32 cur_discard = getCurrentDiscardLevelForFetching(); bool have_all_data = (cur_discard >= 0 && (cur_discard <= mDesiredDiscardLevel)); - F32 pixel_priority = fsqrtf(mMaxVirtualSize); + F32 pixel_priority = (F32) sqrt(mMaxVirtualSize); F32 priority = 0.f; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index abf22b5e5a..e50d0fce49 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -675,6 +675,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mTexHairColor( NULL ), mTexEyeColor( NULL ), mNeedsSkin(FALSE), + mLastSkinTime(0.f), mUpdatePeriod(1), mFullyLoaded(FALSE), mPreviousFullyLoaded(FALSE), @@ -1356,7 +1357,7 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) if (isImpostor() && !needsImpostorUpdate()) { LLVector3 delta = getRenderPosition() - - ((LLVector3(mDrawable->getPositionGroup().getF32())-mImpostorOffset)); + ((LLVector3(mDrawable->getPositionGroup().getF32ptr())-mImpostorOffset)); newMin.load3( (mLastAnimExtents[0] + delta).mV); newMax.load3( (mLastAnimExtents[1] + delta).mV); @@ -1364,12 +1365,12 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) else { getSpatialExtents(newMin,newMax); - mLastAnimExtents[0].set(newMin.getF32()); - mLastAnimExtents[1].set(newMax.getF32()); + mLastAnimExtents[0].set(newMin.getF32ptr()); + mLastAnimExtents[1].set(newMax.getF32ptr()); LLVector4a pos_group; pos_group.setAdd(newMin,newMax); pos_group.mul(0.5f); - mImpostorOffset = LLVector3(pos_group.getF32())-getRenderPosition(); + mImpostorOffset = LLVector3(pos_group.getF32ptr())-getRenderPosition(); mDrawable->setPositionGroup(pos_group); } } @@ -1435,7 +1436,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) distance.setSub(ext[1], ext[0]); LLVector4a max_span(max_attachment_span); - S32 lt = distance.lessThan4(max_span).getComparisonMask() & 0x7; + S32 lt = distance.lessThan(max_span).getGatheredBits() & 0x7; // Only add the prim to spatial extents calculations if it isn't a megaprim. // max_attachment_span calculated at the start of the function @@ -2533,14 +2534,14 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) getSpatialExtents(ext[0], ext[1]); LLVector4a diff; diff.setSub(ext[1], mImpostorExtents[1]); - if (diff.length3() > 0.05f) + if (diff.getLength3().getF32() > 0.05f) { mNeedsImpostorUpdate = TRUE; } else { diff.setSub(ext[0], mImpostorExtents[0]); - if (diff.length3() > 0.05f) + if (diff.getLength3().getF32() > 0.05f) { mNeedsImpostorUpdate = TRUE; } @@ -3887,7 +3888,8 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) mMeshLOD[MESH_ID_HAIR]->updateJointGeometry(); } mNeedsSkin = FALSE; - + mLastSkinTime = gFrameTimeSeconds; + LLVertexBuffer* vb = mDrawable->getFace(0)->mVertexBuffer; if (vb) { @@ -4231,7 +4233,7 @@ void LLVOAvatar::updateTextures() if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) { - setDebugText(llformat("%4.0f:%4.0f", fsqrtf(mMinPixelArea),fsqrtf(mMaxPixelArea))); + setDebugText(llformat("%4.0f:%4.0f", (F32) sqrt(mMinPixelArea),(F32) sqrt(mMaxPixelArea))); } } @@ -5443,7 +5445,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) } else { - F32 radius = size.length3(); + F32 radius = size.getLength3().getF32(); mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG; } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 95b0665f7d..94b564fc8f 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -345,6 +345,7 @@ public: U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255), S32 diffuse_channel = 0); U32 renderRigid(); U32 renderSkinned(EAvatarRenderPass pass); + F32 getLastSkinTime() { return mLastSkinTime; } U32 renderSkinnedAttachments(); U32 renderTransparent(BOOL first_pass); void renderCollisionVolumes(); @@ -357,6 +358,8 @@ private: bool shouldAlphaMask(); BOOL mNeedsSkin; // avatar has been animated and verts have not been updated + F32 mLastSkinTime; //value of gFrameTimeSeconds at last skin update + S32 mUpdatePeriod; S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer. diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index fe1e36cbe8..65829b213e 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -328,7 +328,7 @@ void LLVOGrass::updateTextures() { if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) { - setDebugText(llformat("%4.0f", fsqrtf(mPixelArea))); + setDebugText(llformat("%4.0f", (F32) sqrt(mPixelArea))); } getTEImage(0)->addTextureStats(mPixelArea); } diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 63f662c5a1..c047758a59 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -999,8 +999,8 @@ BOOL LLVOSurfacePatch::lineSegmentIntersect(const LLVector3& start, const LLVect const LLVector4a* exta = mDrawable->getSpatialExtents(); LLVector3 ext[2]; - ext[0].set(exta[0].getF32()); - ext[1].set(exta[1].getF32()); + ext[0].set(exta[0].getF32ptr()); + ext[1].set(exta[1].getF32ptr()); F32 rad = (delta*tdelta).magVecSquared(); diff --git a/indra/newview/llvotextbubble.cpp b/indra/newview/llvotextbubble.cpp index 339da3c0bf..e790373d02 100644 --- a/indra/newview/llvotextbubble.cpp +++ b/indra/newview/llvotextbubble.cpp @@ -254,8 +254,8 @@ void LLVOTextBubble::getGeometry(S32 idx, LLVector2* dst_tc = (LLVector2*) texcoordsp.get(); LLVector2* src_tc = (LLVector2*) face.mTexCoords; - LLVector4a::memcpyNonAliased16((F32*) dst_norm, (F32*) src_norm, face.mNumVertices*4); - LLVector4a::memcpyNonAliased16((F32*) dst_tc, (F32*) src_tc, face.mNumVertices*2); + LLVector4a::memcpyNonAliased16((F32*) dst_norm, (F32*) src_norm, face.mNumVertices*4*sizeof(F32)); + LLVector4a::memcpyNonAliased16((F32*) dst_tc, (F32*) src_tc, face.mNumVertices*2*sizeof(F32)); for (U32 i = 0; i < face.mNumVertices; i++) diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index eb790b04cc..e3b4efb9dd 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -472,7 +472,7 @@ void LLVOTree::updateTextures() { if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) { - setDebugText(llformat("%4.0f", fsqrtf(mPixelArea))); + setDebugText(llformat("%4.0f", (F32) sqrt(mPixelArea))); } mTreeImagep->addTextureStats(mPixelArea); } @@ -1278,8 +1278,8 @@ BOOL LLVOTree::lineSegmentIntersect(const LLVector3& start, const LLVector3& end //VECTORIZE THIS LLVector3 ext[2]; - ext[0].set(exta[0].getF32()); - ext[1].set(exta[1].getF32()); + ext[0].set(exta[0].getF32ptr()); + ext[1].set(exta[1].getF32ptr()); LLVector3 center = (ext[1]+ext[0])*0.5f; LLVector3 size = (ext[1]-ext[0]); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 1397b64623..128fd15142 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -696,7 +696,7 @@ void LLVOVolume::updateTextureVirtualSize() const LLTextureEntry *te = face->getTextureEntry(); LLViewerTexture *imagep = face->getTexture(); if (!imagep || !te || - face->mExtents[0].equal3(face->mExtents[1])) + face->mExtents[0].equals3(face->mExtents[1])) { continue; } @@ -820,15 +820,15 @@ void LLVOVolume::updateTextureVirtualSize() if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_AREA)) { - setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize))); + setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize))); } else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)) { - setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize))); + setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize))); } else if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_FACE_AREA)) { - setDebugText(llformat("%.0f:%.0f", fsqrtf(min_vsize),fsqrtf(max_vsize))); + setDebugText(llformat("%.0f:%.0f", (F32) sqrt(min_vsize),(F32) sqrt(max_vsize))); } if (mPixelArea == 0) @@ -1355,8 +1355,8 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global) } else { - min.setMin(face->mExtents[0]); - max.setMax(face->mExtents[1]); + min.setMin(min, face->mExtents[0]); + max.setMax(max, face->mExtents[1]); } } } @@ -1864,7 +1864,7 @@ LLVector3 LLVOVolume::getApproximateFaceNormal(U8 face_id) result.add(face.mNormals[i]); } - LLVector3 ret((F32*) &result.mQ); + LLVector3 ret(result.getF32ptr()); ret = volumeDirectionToAgent(ret); ret.normVec(); } @@ -3075,7 +3075,7 @@ F32 LLVOVolume::getBinRadius() LLVector4a rad; rad.setSub(ext[1], ext[0]); - radius = rad.length3()*0.5f; + radius = rad.getLength3().getF32()*0.5f; } else if (mDrawable->isStatic()) { diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index a1e4df8a66..53eca0d08e 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -591,7 +591,7 @@ void LLWorld::updateVisibilities() region_list_t::iterator curiter = iter++; LLViewerRegion* regionp = *curiter; F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ(); - F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared); + F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared); if (!regionp->getLand().hasZData() || LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius)) { @@ -612,7 +612,7 @@ void LLWorld::updateVisibilities() } F32 height = regionp->getLand().getMaxZ() - regionp->getLand().getMinZ(); - F32 radius = 0.5f*fsqrtf(height * height + diagonal_squared); + F32 radius = 0.5f*(F32) sqrt(height * height + diagonal_squared); if (LLViewerCamera::getInstance()->sphereInFrustum(regionp->getCenterAgent(), radius)) { regionp->calculateCameraDistance(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fec7da1dd0..b0a7b1ce83 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1522,7 +1522,7 @@ F32 LLPipeline::calcPixelArea(const LLVector4a& center, const LLVector4a& size, LLVector4a lookAt; lookAt.setSub(center, origin); - F32 dist = lookAt.length3(); + F32 dist = lookAt.getLength3().getF32(); //ramp down distance for nearby objects //shrink dist by dist/16. @@ -1534,7 +1534,7 @@ F32 LLPipeline::calcPixelArea(const LLVector4a& center, const LLVector4a& size, } //get area of circle around node - F32 app_angle = atanf(size.length3()/dist); + F32 app_angle = atanf(size.getLength3().getF32()/dist); F32 radius = app_angle*LLDrawable::sCurPixelAngle; return radius*radius * F_PI; } @@ -4671,7 +4671,7 @@ static F32 calc_light_dist(LLVOVolume* light, const LLVector3& cam_pos, F32 max_ { return max_dist; } - F32 dist = fsqrtf(dist2); + F32 dist = (F32) sqrt(dist2); dist *= 1.f / inten; dist -= radius; if (selected) @@ -6980,7 +6980,7 @@ void LLPipeline::renderDeferredLighting() LLVector4a center; center.load3(drawablep->getPositionAgent().mV); - const F32* c = center.getF32(); + const F32* c = center.getF32ptr(); F32 s = volume->getLightRadius()*1.5f; LLColor3 col = volume->getLightColor(); @@ -7078,7 +7078,7 @@ void LLPipeline::renderDeferredLighting() LLVector4a center; center.load3(drawablep->getPositionAgent().mV); - const F32* c = center.getF32(); + const F32* c = center.getF32ptr(); F32 s = volume->getLightRadius()*1.5f; sVisibleLightCount++; @@ -9184,8 +9184,8 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) up.mul(up); up.normalize3fast(); - tdim.mV[0] = fabsf(half_height.dot3(left)); - tdim.mV[1] = fabsf(half_height.dot3(up)); + tdim.mV[0] = fabsf(half_height.dot3(left).getF32()); + tdim.mV[1] = fabsf(half_height.dot3(up).getF32()); glMatrixMode(GL_PROJECTION); glPushMatrix(); |