From 2d2ed85c56c0aa47e6909becaf60b71f1daaf46f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 28 Jul 2021 21:30:49 +0300 Subject: DRTVWR-542 Fix malfunctioning warning --- indra/llprimitive/lldaeloader.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llprimitive/lldaeloader.cpp') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index dfa29fb539..d3acd44f06 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -787,7 +787,12 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac for (U32 i = 0; i < verts.size(); ++i) { indices[i] = vert_idx[verts[i]]; - llassert(!i || (indices[i-1] != indices[i])); + if (i % 3 != 0) // assumes GL_TRIANGLES, compare 0-1, 1-2, 3-4, 4-5 but not 2-3 or 5-6 + { + // A faulty degenerate triangle detection (triangle with 0 area), + // probably should be a warning and not an assert + llassert(!i || (indices[i-1] != indices[i])); + } } // DEBUG just build an expanded triangle list -- cgit v1.2.3 From 7235d333ea24388fc13a6d01dbafc707b658a0d4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 4 Aug 2021 00:15:49 +0300 Subject: DRTVWR-542 Fix incorect dropbox state --- indra/llprimitive/lldaeloader.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llprimitive/lldaeloader.cpp') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index d3acd44f06..17e9e05edd 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -289,6 +289,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa material = std::string(tri->getMaterial()); } + // Todo: mark model in some way as having generated(split) faces materials.push_back(material); face_list.push_back(face); face_list.rbegin()->fillFromLegacyData(verts, indices); -- cgit v1.2.3 From 1a1793244002effe46cedf63180de60f4bc69a9a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 4 Aug 2021 21:14:00 +0300 Subject: DRTVWR-542 Automated method selection Normally simplification methods apply for whole upload, but this one selects methods per model or per face. --- indra/llprimitive/lldaeloader.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'indra/llprimitive/lldaeloader.cpp') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 17e9e05edd..dcf3b5fa0e 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -149,7 +149,11 @@ bool get_dom_sources(const domInputLocalOffset_Array& inputs, S32& pos_offset, S return true; } -LLModel::EModelStatus load_face_from_dom_triangles(std::vector& face_list, std::vector& materials, domTrianglesRef& tri) +LLModel::EModelStatus load_face_from_dom_triangles( + std::vector& face_list, + std::vector& materials, + domTrianglesRef& tri, + bool &generated_additional_faces) { LLVolumeFace face; std::vector verts; @@ -282,6 +286,8 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa if (indices.size()%3 == 0 && verts.size() >= 65532) { + generated_additional_faces = true; + std::string material; if (tri->getMaterial()) @@ -289,7 +295,6 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa material = std::string(tri->getMaterial()); } - // Todo: mark model in some way as having generated(split) faces materials.push_back(material); face_list.push_back(face); face_list.rbegin()->fillFromLegacyData(verts, indices); @@ -344,7 +349,12 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector& fa return LLModel::NO_ERRORS ; } -LLModel::EModelStatus load_face_from_dom_polylist(std::vector& face_list, std::vector& materials, domPolylistRef& poly, LLSD& log_msg) +LLModel::EModelStatus load_face_from_dom_polylist( + std::vector& face_list, + std::vector& materials, + domPolylistRef& poly, + bool& generated_additional_faces, + LLSD& log_msg) { domPRef p = poly->getP(); domListOfUInts& idx = p->getValue(); @@ -546,6 +556,8 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector& fac if (indices.size()%3 == 0 && indices.size() >= 65532) { + generated_additional_faces = true; + std::string material; if (poly->getMaterial()) @@ -771,6 +783,9 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector& fac } } + // Viewer can only fit U16 vertices, shouldn't we do some checks here and return overflow if result has more? + llassert(vert_idx.size() < U16_MAX); + //build vertex array from map std::vector new_verts; new_verts.resize(vert_idx.size()); @@ -2390,11 +2405,13 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& LLModel::EModelStatus status = LLModel::NO_ERRORS; domTriangles_Array& tris = mesh->getTriangles_array(); + pModel->mHasGeneratedFaces = false; + for (U32 i = 0; i < tris.getCount(); ++i) { domTrianglesRef& tri = tris.get(i); - status = load_face_from_dom_triangles(pModel->getVolumeFaces(), pModel->getMaterialList(), tri); + status = load_face_from_dom_triangles(pModel->getVolumeFaces(), pModel->getMaterialList(), tri, pModel->mHasGeneratedFaces); pModel->mStatus = status; if(status != LLModel::NO_ERRORS) { @@ -2407,7 +2424,7 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& for (U32 i = 0; i < polys.getCount(); ++i) { domPolylistRef& poly = polys.get(i); - status = load_face_from_dom_polylist(pModel->getVolumeFaces(), pModel->getMaterialList(), poly, log_msg); + status = load_face_from_dom_polylist(pModel->getVolumeFaces(), pModel->getMaterialList(), poly, pModel->mHasGeneratedFaces, log_msg); if(status != LLModel::NO_ERRORS) { @@ -2421,6 +2438,10 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& for (U32 i = 0; i < polygons.getCount(); ++i) { domPolygonsRef& poly = polygons.get(i); + + // Due to how poligons work, assume that face was 'generated' by default + pModel->mHasGeneratedFaces = true; + status = load_face_from_dom_polygons(pModel->getVolumeFaces(), pModel->getMaterialList(), poly); if(status != LLModel::NO_ERRORS) @@ -2520,6 +2541,7 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector& mo { LLModel* next = new LLModel(volume_params, 0.f); next->mSubmodelID = ++submodelID; + next->mHasGeneratedFaces = ret->mHasGeneratedFaces; next->mLabel = model_name + (char)((int)'a' + next->mSubmodelID) + lod_suffix[mLod]; next->getVolumeFaces() = remainder; next->mNormalizedScale = ret->mNormalizedScale; -- cgit v1.2.3 From ca629c362c5ed248547f9df057703079c95331e7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 Sep 2021 20:59:21 +0300 Subject: SL-15965 Support wider range of parsing errors --- indra/llprimitive/lldaeloader.cpp | 56 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'indra/llprimitive/lldaeloader.cpp') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index dcf3b5fa0e..73a0b3d673 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -153,7 +153,8 @@ LLModel::EModelStatus load_face_from_dom_triangles( std::vector& face_list, std::vector& materials, domTrianglesRef& tri, - bool &generated_additional_faces) + bool &generated_additional_faces, + LLSD& log_msg) { LLVolumeFace face; std::vector verts; @@ -173,12 +174,18 @@ LLModel::EModelStatus load_face_from_dom_triangles( if ( !get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source)) { + LLSD args; + args["Message"] = "ParsingErrorBadElement"; + log_msg.append(args); return LLModel::BAD_ELEMENT; } if (!pos_source || !pos_source->getFloat_array()) { LL_WARNS() << "Unable to process mesh without position data; invalid model; invalid model." << LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorPositionInvalidModel"; + log_msg.append(args); return LLModel::BAD_ELEMENT; } @@ -381,6 +388,10 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (!get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source)) { + LL_WARNS() << "Bad element." << LL_ENDL; + LLSD args; + args["Message"] = "ParsingErrorBadElement"; + log_msg.append(args); return LLModel::BAD_ELEMENT; } @@ -432,6 +443,9 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (!cv.getPosition().isFinite3()) { LL_WARNS() << "Found NaN while loading position data from DAE-Model, invalid model." << LL_ENDL; + LLSD args; + args["Message"] = "PositionNaN"; + log_msg.append(args); return LLModel::BAD_ELEMENT; } } @@ -464,6 +478,10 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (!cv.getNormal().isFinite3()) { LL_WARNS() << "Found NaN while loading normals from DAE-Model, invalid model." << LL_ENDL; + LLSD args; + args["Message"] = "NormalsNaN"; + log_msg.append(args); + return LLModel::BAD_ELEMENT; } } @@ -928,6 +946,9 @@ bool LLDAELoader::OpenFile(const std::string& filename) if (!dom) { LL_INFOS() <<" Error with dae - traditionally indicates a corrupt file."<getVolumeFaces(), pModel->getMaterialList(), tri, pModel->mHasGeneratedFaces); + status = load_face_from_dom_triangles(pModel->getVolumeFaces(), pModel->getMaterialList(), tri, pModel->mHasGeneratedFaces, log_msg); pModel->mStatus = status; if(status != LLModel::NO_ERRORS) { -- cgit v1.2.3 From f79890669dcf8e44b5ec3ce1abbd1d1fdd34eb3b Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 20 Sep 2021 18:58:09 +0000 Subject: SL-16006 and SL-16009 Rigged mesh rendering optimization pass --- indra/llprimitive/lldaeloader.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/llprimitive/lldaeloader.cpp') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index dfa29fb539..8343de0cbc 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -1173,17 +1173,19 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do LLMeshSkinInfo& skin_info = model->mSkinInfo; + LLMatrix4 mat; for (int i = 0; i < 4; i++) { for(int j = 0; j < 4; j++) { - skin_info.mBindShapeMatrix.mMatrix[i][j] = dom_value[i + j*4]; + mat.mMatrix[i][j] = dom_value[i + j*4]; } } - LLMatrix4 trans = normalized_transformation; - trans *= skin_info.mBindShapeMatrix; - skin_info.mBindShapeMatrix = trans; + skin_info.mBindShapeMatrix.loadu(mat); + + LLMatrix4a trans(normalized_transformation); + matMul(trans, skin_info.mBindShapeMatrix, skin_info.mBindShapeMatrix); } @@ -1401,7 +1403,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do mat.mMatrix[i][j] = transform[k*16 + i + j*4]; } } - model->mSkinInfo.mInvBindMatrix.push_back(mat); + model->mSkinInfo.mInvBindMatrix.push_back(LLMatrix4a(mat)); } } } @@ -1475,9 +1477,9 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do if (mJointMap.find(lookingForJoint) != mJointMap.end() && model->mSkinInfo.mInvBindMatrix.size() > i) { - LLMatrix4 newInverse = model->mSkinInfo.mInvBindMatrix[i]; + LLMatrix4 newInverse = LLMatrix4(model->mSkinInfo.mInvBindMatrix[i].getF32ptr()); newInverse.setTranslation( mJointList[lookingForJoint].getTranslation() ); - model->mSkinInfo.mAlternateBindMatrix.push_back( newInverse ); + model->mSkinInfo.mAlternateBindMatrix.push_back( LLMatrix4a(newInverse) ); } else { -- cgit v1.2.3 From 3641541c6cc7f33f0e0dc2e1eb2cfdfcec23322b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 15 Nov 2021 23:23:09 +0200 Subject: SL-15756 Removed mHasGeneratedFaces mHasGeneratedFaces is always true for some types of models and glod was treating faces as one mesh by default, so meshoptimizer should do the same regardles of mHasGeneratedFaces --- indra/llprimitive/lldaeloader.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'indra/llprimitive/lldaeloader.cpp') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 73a0b3d673..93d492b42d 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -153,7 +153,6 @@ LLModel::EModelStatus load_face_from_dom_triangles( std::vector& face_list, std::vector& materials, domTrianglesRef& tri, - bool &generated_additional_faces, LLSD& log_msg) { LLVolumeFace face; @@ -293,8 +292,6 @@ LLModel::EModelStatus load_face_from_dom_triangles( if (indices.size()%3 == 0 && verts.size() >= 65532) { - generated_additional_faces = true; - std::string material; if (tri->getMaterial()) @@ -360,7 +357,6 @@ LLModel::EModelStatus load_face_from_dom_polylist( std::vector& face_list, std::vector& materials, domPolylistRef& poly, - bool& generated_additional_faces, LLSD& log_msg) { domPRef p = poly->getP(); @@ -574,8 +570,6 @@ LLModel::EModelStatus load_face_from_dom_polylist( if (indices.size()%3 == 0 && indices.size() >= 65532) { - generated_additional_faces = true; - std::string material; if (poly->getMaterial()) @@ -2453,13 +2447,11 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& LLModel::EModelStatus status = LLModel::NO_ERRORS; domTriangles_Array& tris = mesh->getTriangles_array(); - pModel->mHasGeneratedFaces = false; - for (U32 i = 0; i < tris.getCount(); ++i) { domTrianglesRef& tri = tris.get(i); - status = load_face_from_dom_triangles(pModel->getVolumeFaces(), pModel->getMaterialList(), tri, pModel->mHasGeneratedFaces, log_msg); + status = load_face_from_dom_triangles(pModel->getVolumeFaces(), pModel->getMaterialList(), tri, log_msg); pModel->mStatus = status; if(status != LLModel::NO_ERRORS) { @@ -2472,7 +2464,7 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& for (U32 i = 0; i < polys.getCount(); ++i) { domPolylistRef& poly = polys.get(i); - status = load_face_from_dom_polylist(pModel->getVolumeFaces(), pModel->getMaterialList(), poly, pModel->mHasGeneratedFaces, log_msg); + status = load_face_from_dom_polylist(pModel->getVolumeFaces(), pModel->getMaterialList(), poly, log_msg); if(status != LLModel::NO_ERRORS) { @@ -2487,9 +2479,6 @@ bool LLDAELoader::addVolumeFacesFromDomMesh(LLModel* pModel,domMesh* mesh, LLSD& { domPolygonsRef& poly = polygons.get(i); - // Due to how poligons work, assume that face was 'generated' by default - pModel->mHasGeneratedFaces = true; - status = load_face_from_dom_polygons(pModel->getVolumeFaces(), pModel->getMaterialList(), poly); if(status != LLModel::NO_ERRORS) @@ -2589,7 +2578,6 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector& mo { LLModel* next = new LLModel(volume_params, 0.f); next->mSubmodelID = ++submodelID; - next->mHasGeneratedFaces = ret->mHasGeneratedFaces; next->mLabel = model_name + (char)((int)'a' + next->mSubmodelID) + lod_suffix[mLod]; next->getVolumeFaces() = remainder; next->mNormalizedScale = ret->mNormalizedScale; -- cgit v1.2.3