This commit is contained in:
Siana Gearz
2011-08-02 01:25:46 +02:00
4 changed files with 29 additions and 18 deletions

View File

@@ -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;i<elem_count;i++)
{
memcpy(mBytep,buff,sizeof(Object));
mBytep+=mSkip;
buff+=elem_size;
}
}
}
};
#endif // LL_LLSTRIDER_H

View File

@@ -753,11 +753,11 @@ void LLPreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
*(normal_strider++) = normal;
}
//build vertices
vertex_strider.assignArray((U8*)vf.mPositions,sizeof(vf.mPositions[0]),num_indices);
// build indices
for (U16 i = 0; i < num_indices; i++)
{
*(index_strider++) = vf.mIndices[i];
}
index_strider.assignArray((U8*)vf.mIndices,sizeof(vf.mIndices[0]),num_indices);
}

View File

@@ -1403,9 +1403,9 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
buffer->getNormalStrider(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());
}
}
}

View File

@@ -1371,16 +1371,15 @@ 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);
*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