diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-05-04 23:35:54 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-05-04 23:35:54 +0300 |
commit | 6364e2fff696090253c902bec02d68f036ad509c (patch) | |
tree | 8f9f6a8834cf392552c7be07086d9cb0cff61631 /indra/llmath | |
parent | d3b10072f4c52b01c8d77ad1990d69dd89fc1310 (diff) | |
parent | 4a7fd0117a43dca9e30c58c6417ebdf6862561f6 (diff) |
Merge branch 'master' into DRTVWR-460
Diffstat (limited to 'indra/llmath')
-rw-r--r-- | indra/llmath/llvolume.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 2ac1eb99ce..7da53bf8c8 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2399,9 +2399,9 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) { //face has no geometry, continue face.resizeIndices(3); face.resizeVertices(1); - memset(face.mPositions, 0, sizeof(LLVector4a)); - memset(face.mNormals, 0, sizeof(LLVector4a)); - memset(face.mTexCoords, 0, sizeof(LLVector2)); + face.mPositions->clear(); + face.mNormals->clear(); + face.mTexCoords->setZero(); memset(face.mIndices, 0, sizeof(U16)*3); continue; } @@ -2489,7 +2489,11 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) } else { - memset(norm_out, 0, sizeof(LLVector4a)*num_verts); + for (U32 j = 0; j < num_verts; ++j) + { + norm_out->clear(); + norm_out++; // or just norm_out[j].clear(); + } } } @@ -2519,7 +2523,11 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) } else { - memset(tc_out, 0, sizeof(LLVector2)*num_verts); + for (U32 j = 0; j < num_verts; j += 2) + { + tc_out->clear(); + tc_out++; + } } } @@ -5288,7 +5296,7 @@ bool LLVolumeFace::cacheOptimize() triangle_data.resize(mNumIndices / 3); vertex_data.resize(mNumVertices); } - catch (std::bad_alloc) + catch (std::bad_alloc&) { LL_WARNS("LLVOLUME") << "Resize failed" << LL_ENDL; return false; @@ -5442,7 +5450,7 @@ bool LLVolumeFace::cacheOptimize() { new_idx.resize(mNumVertices, -1); } - catch (std::bad_alloc) + catch (std::bad_alloc&) { ll_aligned_free<64>(pos); ll_aligned_free_16(wght); @@ -6968,11 +6976,16 @@ void CalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVe { //LLVector4a *tan1 = new LLVector4a[vertexCount * 2]; LLVector4a* tan1 = (LLVector4a*) ll_aligned_malloc_16(vertexCount*2*sizeof(LLVector4a)); + // new(tan1) LLVector4a; LLVector4a* tan2 = tan1 + vertexCount; - memset(tan1, 0, vertexCount*2*sizeof(LLVector4a)); - + U32 count = vertexCount * 2; + for (U32 i = 0; i < count; i++) + { + tan1[i].clear(); + } + for (U32 a = 0; a < triangleCount; a++) { U32 i1 = *index_array++; |