summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llprimitive/lldaeloader.cpp16
-rw-r--r--indra/llprimitive/llmodel.cpp3
-rw-r--r--indra/llprimitive/llmodel.h5
-rw-r--r--indra/newview/llmodelpreview.cpp73
4 files changed, 26 insertions, 71 deletions
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<LLVolumeFace>& face_list,
std::vector<std::string>& 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<LLVolumeFace>& face_list,
std::vector<std::string>& 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<LLModel*>& 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;
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 8b8fde0ea0..702a1b5238 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -55,8 +55,7 @@ LLModel::LLModel(LLVolumeParams& params, F32 detail)
mNormalizedTranslation(0,0,0),
mPelvisOffset( 0.0f ),
mStatus(NO_ERRORS),
- mSubmodelID(0),
- mHasGeneratedFaces(false)
+ mSubmodelID(0)
{
mDecompID = -1;
mLocalID = -1;
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index 87a47dcb36..96368d64e5 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -284,11 +284,6 @@ public:
// A model/object can only have 8 faces, spillover faces will
// be moved to new model/object and assigned a submodel id.
int mSubmodelID;
- // A .dae face can have more than 65K vertices, but viewer
- // is limited to U16 for indices, in such case spilower will
- // be moved into new face and this will be set to true.
- // Also true in case faces were generated from polygons
- bool mHasGeneratedFaces;
};
typedef std::vector<LLPointer<LLModel> > model_list;
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index d629358355..f6edbf6bc6 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -1775,68 +1775,41 @@ void LLModelPreview::genMeshOptimizerLODs(S32 which_lod, S32 meshopt_mode, U32 d
if (model_meshopt_mode == MESH_OPTIMIZER_AUTO)
{
F32 allowed_ratio_drift = 2.f;
- F32 res_ratio = 0;
- if (base->mHasGeneratedFaces)
- {
- res_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, false);
+ F32 res_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, false);
- if (res_ratio < 0)
+ if (res_ratio < 0)
+ {
+ // U16 vertices overflow, shouldn't happen, but just in case
+ for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx)
{
- // U16 vertices overflow, shouldn't happen, but just in case
- for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx)
- {
- genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, false);
- }
- LL_INFOS() << "Model " << target_model->getName()
- << " lod " << which_lod
- << " per model method overflow, defaulting to per face." << LL_ENDL;
+ genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, false);
}
- else if (res_ratio * allowed_ratio_drift < indices_decimator)
- {
- // Try sloppy variant if normal one failed to simplify model enough.
- res_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, true);
- LL_INFOS() << "Model " << target_model->getName()
- << " lod " << which_lod
- << " sloppily simplified using per model method." << LL_ENDL;
+ LL_INFOS() << "Model " << target_model->getName()
+ << " lod " << which_lod
+ << " per model method overflow, defaulting to per face." << LL_ENDL;
+ }
+ else if (res_ratio * allowed_ratio_drift < indices_decimator)
+ {
+ // Try sloppy variant if normal one failed to simplify model enough.
+ res_ratio = genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, true);
+ LL_INFOS() << "Model " << target_model->getName()
+ << " lod " << which_lod
+ << " sloppily simplified using per model method." << LL_ENDL;
- if (res_ratio < 0)
- {
- // Sloppy variant failed to generate triangles.
- // Can happen with models that are too simple as is.
- // Fallback to normal method.
- genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, false);
- }
- }
- else
+ if (res_ratio < 0)
{
- LL_INFOS() << "Model " << target_model->getName()
- << " lod " << which_lod
- << " simplified using per model method." << LL_ENDL;
+ // Sloppy variant failed to generate triangles.
+ // Can happen with models that are too simple as is.
+ // Fallback to normal method.
+ genMeshOptimizerPerModel(base, target_model, indices_decimator, lod_error_threshold, false);
}
}
else
{
- for (U32 face_idx = 0; face_idx < base->getNumVolumeFaces(); ++face_idx)
- {
- res_ratio = genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, false);
-
- if (res_ratio * allowed_ratio_drift < indices_decimator)
- {
- // normal method failed to sufficiently simplify, try sloppy
- res_ratio = genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, true);
- if (res_ratio < 0)
- {
- // Sloppy failed to generate triangles.
- // Can happen with models that are too simple as is.
- // Fallback to normal method.
- genMeshOptimizerPerFace(base, target_model, face_idx, indices_decimator, lod_error_threshold, false);
- }
- }
- }
LL_INFOS() << "Model " << target_model->getName()
<< " lod " << which_lod
- << " simplified using per face methods." << LL_ENDL;
+ << " simplified using per model method." << LL_ENDL;
}
}