From ae035a0d66604e25b1277c4fa303aea8d798e719 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 22 Apr 2014 08:58:38 -0700 Subject: Modify importer to (optionally) improve debug output, perform name-based LOD association, and handle models with many materials. --- indra/llmath/llvolume.h | 5 +++++ indra/llmath/m4math.cpp | 13 +++++++++++++ indra/llmath/m4math.h | 5 +++++ 3 files changed, 23 insertions(+) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 975227ea58..d2cb052043 100755 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -969,6 +969,7 @@ protected: ~LLVolume(); // use unref public: + typedef std::vector face_list_t; struct FaceParams { @@ -1041,6 +1042,10 @@ public: // conversion if *(LLVolume*) to LLVolume& const LLVolumeFace &getVolumeFace(const S32 f) const {return mVolumeFaces[f];} // DO NOT DELETE VOLUME WHILE USING THIS REFERENCE, OR HOLD A POINTER TO THIS VOLUMEFACE + LLVolumeFace &getVolumeFace(const S32 f) {return mVolumeFaces[f];} // DO NOT DELETE VOLUME WHILE USING THIS REFERENCE, OR HOLD A POINTER TO THIS VOLUMEFACE + + face_list_t& getVolumeFaces() { return mVolumeFaces; } + U32 mFaceMask; // bit array of which faces exist in this volume LLVector3 mLODScaleBias; // vector for biasing LOD based on scale diff --git a/indra/llmath/m4math.cpp b/indra/llmath/m4math.cpp index 6a1b4143cf..d89c482804 100755 --- a/indra/llmath/m4math.cpp +++ b/indra/llmath/m4math.cpp @@ -274,6 +274,19 @@ const LLMatrix4& LLMatrix4::invert(void) return *this; } +// Convenience func for simplifying comparison-heavy code by +// intentionally stomping values in [-FLT_EPS,FLT_EPS] to 0.0f +// +void LLMatrix4::condition(void) +{ + U32 i; + U32 j; + for (i = 0; i < 3;i++) + for (j = 0; j < 3;j++) + mMatrix[i][j] = ((mMatrix[i][j] > -FLT_EPSILON) + && (mMatrix[i][j] < FLT_EPSILON)) ? 0.0f : mMatrix[i][j]; +} + LLVector4 LLMatrix4::getFwdRow4() const { return LLVector4(mMatrix[VX][VX], mMatrix[VX][VY], mMatrix[VX][VZ], mMatrix[VX][VW]); diff --git a/indra/llmath/m4math.h b/indra/llmath/m4math.h index a7dce10397..a77c5bc76d 100755 --- a/indra/llmath/m4math.h +++ b/indra/llmath/m4math.h @@ -180,6 +180,11 @@ public: const LLMatrix4& setTranslation(const LLVector4 &translation); const LLMatrix4& setTranslation(const LLVector3 &translation); + // Convenience func for simplifying comparison-heavy code by + // intentionally stomping values [-FLT_EPS,FLT_EPS] to 0.0 + // + void condition(void); + /////////////////////////// // // Get properties of a matrix -- cgit v1.2.3 From 5cbcff7b4045e5246eee5c86f789394510cb0669 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 22 Apr 2014 22:19:39 -0700 Subject: Appease GCC 4.6.1 syntax problems with uintptr_t in alignment asserts --- indra/llmath/llvolume.h | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index d2cb052043..3d7d4b40d1 100755 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -1083,7 +1083,6 @@ public: BOOL mGenerateSingleFace; - typedef std::vector face_list_t; face_list_t mVolumeFaces; public: -- cgit v1.2.3 From 75ffe90b0cf14559543e1719bf48fd0b397f3905 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Mon, 27 Apr 2015 18:21:39 +0300 Subject: MAINT-5042 FIXED SL Viewer Closes Unexpectedly in specific area with high RenderVolumeLODFactor - fix for review - fix in buffer overrun detector --- indra/llmath/llvolume.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index c2198b91a7..41ee3941ac 100755 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -5584,7 +5584,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) { resizeVertices(num_vertices+1); - if (!partial_build) + //if (!partial_build) { resizeIndices(num_indices+3); } @@ -5592,7 +5592,7 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) else { resizeVertices(num_vertices); - if (!partial_build) + //if (!partial_build) { resizeIndices(num_indices); } @@ -5714,10 +5714,10 @@ BOOL LLVolumeFace::createCap(LLVolume* volume, BOOL partial_build) LL_CHECK_MEMORY - if (partial_build) - { - return TRUE; - } + //if (partial_build) + //{ + // return TRUE; + //} if (mTypeMask & HOLLOW_MASK) { -- cgit v1.2.3 From d43cef4ed5a012593ff31c4ef9c0356edbea5339 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 14 Jul 2015 16:29:36 +0300 Subject: MAINT-5364 FIXED Object with invalid sculpt topology type cannot be seen or selected --- indra/llmath/llvolume.cpp | 29 ++++++++++++++++++++++++++++- indra/llmath/llvolume.h | 13 ++++++++----- 2 files changed, 36 insertions(+), 6 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 41ee3941ac..82081ca853 100755 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -3178,6 +3178,16 @@ BOOL LLVolume::isFlat(S32 face) } +LLVolumeParams::LLVolumeParams( LLProfileParams &profile, + LLPathParams &path, + LLUUID sculpt_id, + U8 sculpt_type) : +mProfileParams(profile), +mPathParams(path) +{ + setSculptID(sculpt_id, sculpt_type); +} + bool LLVolumeParams::isSculpt() const { return mSculptID.notNull(); @@ -3494,7 +3504,24 @@ bool LLVolumeParams::setSkew(const F32 skew_value) bool LLVolumeParams::setSculptID(const LLUUID sculpt_id, U8 sculpt_type) { mSculptID = sculpt_id; - mSculptType = sculpt_type; + // Check sculpt type value, it consist of type and flags + U8 type = sculpt_type & LL_SCULPT_TYPE_MASK; + U8 flags = sculpt_type & LL_SCULPT_FLAG_MASK; + if (sculpt_type != (type | flags) || type > LL_SCULPT_TYPE_MAX) + { + if (sculpt_id != LLUUID::null) + { + mSculptType = LL_SCULPT_TYPE_MESH; + } + else + { + mSculptType = LL_SCULPT_TYPE_SPHERE; + } + } + else + { + mSculptType = sculpt_type; + } return true; } diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index c8476f6897..06688cacc9 100755 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -190,8 +190,12 @@ const U8 LL_SCULPT_TYPE_MESH = 5; const U8 LL_SCULPT_TYPE_MASK = LL_SCULPT_TYPE_SPHERE | LL_SCULPT_TYPE_TORUS | LL_SCULPT_TYPE_PLANE | LL_SCULPT_TYPE_CYLINDER | LL_SCULPT_TYPE_MESH; +// for value checks, assign new value after adding new types +const U8 LL_SCULPT_TYPE_MAX = LL_SCULPT_TYPE_MESH; + const U8 LL_SCULPT_FLAG_INVERT = 64; const U8 LL_SCULPT_FLAG_MIRROR = 128; +const U8 LL_SCULPT_FLAG_MASK = LL_SCULPT_FLAG_INVERT | LL_SCULPT_FLAG_MIRROR; const S32 LL_SCULPT_MESH_MAX_FACES = 8; @@ -556,11 +560,10 @@ public: { } - LLVolumeParams(LLProfileParams &profile, LLPathParams &path, - LLUUID sculpt_id = LLUUID::null, U8 sculpt_type = LL_SCULPT_TYPE_NONE) - : mProfileParams(profile), mPathParams(path), mSculptID(sculpt_id), mSculptType(sculpt_type) - { - } + LLVolumeParams( LLProfileParams &profile, + LLPathParams &path, + LLUUID sculpt_id = LLUUID::null, + U8 sculpt_type = LL_SCULPT_TYPE_NONE); bool operator==(const LLVolumeParams ¶ms) const; bool operator!=(const LLVolumeParams ¶ms) const; -- cgit v1.2.3 From d9341caf45fa888824c93d9c2b24fdb7659f181b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 17 Jul 2015 17:36:33 +0300 Subject: MAINT-5364 FIXED Object with invalid sculpt topology type cannot be seen or selected --- indra/llmath/llvolume.cpp | 29 +---------------------------- indra/llmath/llvolume.h | 9 +++++---- 2 files changed, 6 insertions(+), 32 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 82081ca853..41ee3941ac 100755 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -3178,16 +3178,6 @@ BOOL LLVolume::isFlat(S32 face) } -LLVolumeParams::LLVolumeParams( LLProfileParams &profile, - LLPathParams &path, - LLUUID sculpt_id, - U8 sculpt_type) : -mProfileParams(profile), -mPathParams(path) -{ - setSculptID(sculpt_id, sculpt_type); -} - bool LLVolumeParams::isSculpt() const { return mSculptID.notNull(); @@ -3504,24 +3494,7 @@ bool LLVolumeParams::setSkew(const F32 skew_value) bool LLVolumeParams::setSculptID(const LLUUID sculpt_id, U8 sculpt_type) { mSculptID = sculpt_id; - // Check sculpt type value, it consist of type and flags - U8 type = sculpt_type & LL_SCULPT_TYPE_MASK; - U8 flags = sculpt_type & LL_SCULPT_FLAG_MASK; - if (sculpt_type != (type | flags) || type > LL_SCULPT_TYPE_MAX) - { - if (sculpt_id != LLUUID::null) - { - mSculptType = LL_SCULPT_TYPE_MESH; - } - else - { - mSculptType = LL_SCULPT_TYPE_SPHERE; - } - } - else - { - mSculptType = sculpt_type; - } + mSculptType = sculpt_type; return true; } diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 06688cacc9..e1161682b5 100755 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -560,10 +560,11 @@ public: { } - LLVolumeParams( LLProfileParams &profile, - LLPathParams &path, - LLUUID sculpt_id = LLUUID::null, - U8 sculpt_type = LL_SCULPT_TYPE_NONE); + LLVolumeParams(LLProfileParams &profile, LLPathParams &path, + LLUUID sculpt_id = LLUUID::null, U8 sculpt_type = LL_SCULPT_TYPE_NONE) + : mProfileParams(profile), mPathParams(path), mSculptID(sculpt_id), mSculptType(sculpt_type) + { + } bool operator==(const LLVolumeParams ¶ms) const; bool operator!=(const LLVolumeParams ¶ms) const; -- cgit v1.2.3 From bb7ac16318cb51c7a0863ad349fbd0511f199d21 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 20 Aug 2015 20:25:58 +0300 Subject: MAINT-5532 FIXED upload of duck.dae from MAINT-4483 crashes mac viewer --- indra/llmath/llvolume.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index c2198b91a7..4703e6cf1a 100755 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -6072,7 +6072,7 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con if (new_verts > mNumAllocatedVertices) { - //double buffer size on expansion + // double buffer size on expansion new_verts *= 2; S32 new_tc_size = ((new_verts*8)+0xF) & ~0xF; @@ -6088,18 +6088,21 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con mNormals = mPositions+new_verts; mTexCoords = (LLVector2*) (mNormals+new_verts); - //positions - LLVector4a::memcpyNonAliased16((F32*) mPositions, (F32*) old_buf, old_vsize); - - //normals - LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) (old_buf+mNumVertices), old_vsize); + if (old_buf != NULL) + { + // copy old positions into new buffer + LLVector4a::memcpyNonAliased16((F32*)mPositions, (F32*)old_buf, old_vsize); - //tex coords - LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) (old_buf+mNumVertices*2), old_tc_size); + // normals + LLVector4a::memcpyNonAliased16((F32*)mNormals, (F32*)(old_buf + mNumVertices), old_vsize); - //just clear tangents - ll_aligned_free_16(mTangents); - mTangents = NULL; + // tex coords + LLVector4a::memcpyNonAliased16((F32*)mTexCoords, (F32*)(old_buf + mNumVertices * 2), old_tc_size); + } + + // just clear tangents + ll_aligned_free_16(mTangents); + mTangents = NULL; ll_aligned_free<64>(old_buf); mNumAllocatedVertices = new_verts; -- cgit v1.2.3 From 6b2c1d5f104047af8aa71d01b7d8fbe9a0ad3493 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 14 Sep 2015 11:01:22 -0400 Subject: SL-133 WIP, SL-134 WIP - more extra joint handling --- indra/llmath/llvolume.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index c2198b91a7..cd417c913d 100755 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2536,6 +2536,8 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) U32 cur_influence = 0; LLVector4 wght(0,0,0,0); + U32 joints[4] = {0,0,0,0}; + LLVector4 joints_with_weights(0,0,0,0); while (joint != END_INFLUENCES && idx < weights.size()) { @@ -2543,7 +2545,9 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) influence |= ((U16) weights[idx++] << 8); F32 w = llclamp((F32) influence / 65535.f, 0.f, 0.99999f); - wght.mV[cur_influence++] = (F32) joint + w; + wght.mV[cur_influence] = w; + joints[cur_influence] = joint; + cur_influence++; if (cur_influence >= 4) { @@ -2554,8 +2558,16 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) joint = weights[idx++]; } } - - face.mWeights[cur_vertex].loadua(wght.mV); + F32 wsum = wght.mV[VX] + wght.mV[VY] + wght.mV[VZ] + wght.mV[VW]; + if (wsum <= 0.f) + { + wght = LLVector4(0.99999f,0.f,0.f,0.f); + } + for (U32 k=0; k<4; k++) + { + joints_with_weights[k] = (F32) joints[k] + wght[k]; + } + face.mWeights[cur_vertex].loadua(joints_with_weights.mV); cur_vertex++; } -- cgit v1.2.3