summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2015-03-25 20:07:21 +0200
committerandreykproductengine <akleshchev@productengine.com>2015-03-25 20:07:21 +0200
commit051052b141ef5c2c3a2f08a9d69b7b982386c8c4 (patch)
treefd63b1bb841ae221fc32ad5ae2e25057c0e75903 /indra/llprimitive
parentf930cd149299c520b5147ddf72d50c57985b6d66 (diff)
MAINT-4983 Mesh upload of large model ryoma 3d loads indefinitely
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/lldaeloader.cpp15
-rw-r--r--indra/llprimitive/lldaeloader.h6
2 files changed, 15 insertions, 6 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index d04c7bc23c..2ec627d722 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -779,7 +779,8 @@ LLDAELoader::LLDAELoader(
state_callback_t state_cb,
void* opaque_userdata,
JointTransformMap& jointMap,
- JointSet& jointsFromNodes )
+ JointSet& jointsFromNodes,
+ U32 modelLimit)
: LLModelLoader(
filename,
lod,
@@ -789,7 +790,8 @@ LLDAELoader::LLDAELoader(
state_cb,
opaque_userdata,
jointMap,
- jointsFromNodes)
+ jointsFromNodes),
+mGeneratedModelLimit(modelLimit)
{
}
@@ -911,6 +913,7 @@ bool LLDAELoader::OpenFile(const std::string& filename)
mTransform.condition();
+ U32 submodel_limit = count > 0 ? mGeneratedModelLimit/count : 0;
for (daeInt idx = 0; idx < count; ++idx)
{ //build map of domEntities to LLModel
domMesh* mesh = NULL;
@@ -921,7 +924,7 @@ bool LLDAELoader::OpenFile(const std::string& filename)
std::vector<LLModel*> models;
- loadModelsFromDomMesh(mesh, models);
+ loadModelsFromDomMesh(mesh, models, submodel_limit);
std::vector<LLModel*>::iterator i;
i = models.begin();
@@ -2270,7 +2273,7 @@ LLModel* LLDAELoader::loadModelFromDomMesh(domMesh *mesh)
//static diff version supports creating multiple models when material counts spill
// over the 8 face server-side limit
//
-bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out)
+bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out, U32 submodel_limit)
{
LLVolumeParams volume_params;
@@ -2321,6 +2324,10 @@ bool LLDAELoader::loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& mo
bool normalized = false;
int submodelID = 0;
+
+ // remove all faces that definitely won't fit into one model and submodel limit
+ ret->setNumVolumeFaces((submodel_limit + 1) * LL_SCULPT_MESH_MAX_FACES);
+
LLVolume::face_list_t remainder;
do
{
diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h
index e71c407909..cd07ade282 100644
--- a/indra/llprimitive/lldaeloader.h
+++ b/indra/llprimitive/lldaeloader.h
@@ -55,7 +55,8 @@ public:
LLModelLoader::state_callback_t state_cb,
void* opaque_userdata,
JointTransformMap& jointMap,
- JointSet& jointsFromNodes);
+ JointSet& jointsFromNodes,
+ U32 modelLimit);
virtual ~LLDAELoader() ;
virtual bool OpenFile(const std::string& filename);
@@ -93,11 +94,12 @@ protected:
// Loads a mesh breaking it into one or more models as necessary
// to get around volume face limitations while retaining >8 materials
//
- bool loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out);
+ bool loadModelsFromDomMesh(domMesh* mesh, std::vector<LLModel*>& models_out, U32 submodel_limit);
static std::string getElementLabel(daeElement *element);
private:
+ U32 mGeneratedModelLimit; // Attempt to limit amount of generated submodels
};
#endif // LL_LLDAELLOADER_H