diff --git a/indra/llcommon/llstrider.h b/indra/llcommon/llstrider.h index 44ea80a36..444820c67 100644 --- a/indra/llcommon/llstrider.h +++ b/indra/llcommon/llstrider.h @@ -58,6 +58,21 @@ public: Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; } Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; } Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); } + void assignArray(U8* buff, size_t elem_size, size_t elem_count) + { + llassert_always(sizeof(Object) <= elem_size); + if(sizeof(Object) == mSkip && sizeof(Object) == elem_size) //No stride. No difference in element size. + LLVector4a::memcpyNonAliased16((F32*) mBytep, (F32*) buff, elem_size * elem_count); + else + { + for(U32 i=0;igetNormalStrider(normal); } - LLVector4a* pos = (LLVector4a*) position.get(); + //LLVector4a* pos = (LLVector4a*) position.get(); - LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL; + //LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL; //build matrix palette LLMatrix4a mp[64]; @@ -1461,14 +1461,14 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace* LLVector4a dst; bind_shape_matrix.affineTransform(v, t); final_mat.affineTransform(t, dst); - pos[j] = dst; + position[j].set(dst.getF32ptr()); - if (norm) + if (has_normal && normal.get()) { LLVector4a& n = vol_face.mNormals[j]; bind_shape_matrix.rotate(n, t); final_mat.rotate(t, dst); - norm[j] = dst; + normal[j].set(dst.getF32ptr()); } } } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 39eaed4b2..afef985d7 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1371,17 +1371,16 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (!do_tex_mat) { - /*if (!do_xform) + if (!do_xform) { - LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32)); + tex_coords.assignArray((U8*) vf.mTexCoords, sizeof(vf.mTexCoords[0]), num_vertices); } - else*/ + else { for (S32 i = 0; i < num_vertices; i++) { LLVector2 tc(vf.mTexCoords[i]); - if(do_xform) - xform(tc, cos_ang, sin_ang, os, ot, ms, mt); + xform(tc, cos_ang, sin_ang, os, ot, ms, mt); *tex_coords++ = tc; } } @@ -1589,10 +1588,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_weights && vf.mWeights) { mVertexBuffer->getWeight4Strider(weights, mGeomIndex); - for (S32 i = 0; i < num_vertices; i++) - { - weights[i].set(vf.mWeights[i].getF32ptr()); - } + weights.assignArray((U8*) vf.mWeights, sizeof(vf.mWeights[0]), num_vertices); //mVertexBuffer->setBuffer(0); } #endif //MESH_ENABLED