From 9cb31845bafe9188d9f90dc1330355c73fb96851 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 4 May 2011 20:45:14 -0500 Subject: SH-1497 Update mesh asset parser to use new format restrictions. --- indra/newview/llmeshrepository.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index dd2ffdf7f1..013fc43f99 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -772,8 +772,8 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) if (header_size > 0) { - S32 offset = header_size + mMeshHeader[mesh_id]["decomposition"]["offset"].asInteger(); - S32 size = mMeshHeader[mesh_id]["decomposition"]["size"].asInteger(); + S32 offset = header_size + mMeshHeader[mesh_id]["physics_convex"]["offset"].asInteger(); + S32 size = mMeshHeader[mesh_id]["physics_convex"]["size"].asInteger(); mHeaderMutex->unlock(); @@ -844,8 +844,8 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) if (header_size > 0) { - S32 offset = header_size + mMeshHeader[mesh_id]["physics_shape"]["offset"].asInteger(); - S32 size = mMeshHeader[mesh_id]["physics_shape"]["size"].asInteger(); + S32 offset = header_size + mMeshHeader[mesh_id]["physics_mesh"]["offset"].asInteger(); + S32 size = mMeshHeader[mesh_id]["physics_mesh"]["size"].asInteger(); mHeaderMutex->unlock(); @@ -1927,7 +1927,7 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason, //just in case skin info or decomposition is at the end of the file (which it shouldn't be) lod_bytes = llmax(lod_bytes, header["skin"]["offset"].asInteger() + header["skin"]["size"].asInteger()); - lod_bytes = llmax(lod_bytes, header["decomposition"]["offset"].asInteger() + header["decomposition"]["size"].asInteger()); + lod_bytes = llmax(lod_bytes, header["physics_convex"]["offset"].asInteger() + header["physics_convex"]["size"].asInteger()); S32 header_bytes = (S32) gMeshRepo.mThread->mMeshHeaderSize[mesh_id]; S32 bytes = lod_bytes + header_bytes; @@ -2543,7 +2543,7 @@ void LLMeshRepository::buildHull(const LLVolumeParams& params, S32 detail) bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id) { LLSD mesh = mThread->getMeshHeader(mesh_id); - return mesh.has("physics_shape") && mesh["physics_shape"].has("size") && (mesh["physics_shape"]["size"].asInteger() > 0); + return mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0); } LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id) -- cgit v1.2.3 From d79468057c954a05acdb9dd69d398dd004425ec0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 25 May 2011 16:08:21 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 155 +++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 74 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index b79f120eda..79541e49d3 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1437,9 +1437,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { LLMeshUploadData data; data.mBaseModel = iter->first; - LLModelInstance& instance = *(iter->second.begin()); - LLModel* model = instance.mModel; - if (mesh_index.find(model) == mesh_index.end()) + if (mesh_index.find(data.mBaseModel) == mesh_index.end()) { // Have not seen this model before - create a new mesh_list entry for it. std::string model_name = data.mBaseModel->getName(); @@ -1472,97 +1470,106 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) std::string str = ostr.str(); res["mesh_list"][mesh_num] = LLSD::Binary(str.begin(),str.end()); - mesh_index[model] = mesh_num; + mesh_index[data.mBaseModel] = mesh_num; mesh_num++; } + + // For all instances that use this model + for (instance_list::iterator instance_iter = iter->second.begin(); + instance_iter != iter->second.end(); + ++instance_iter) + { + + LLModelInstance& instance = *instance_iter; - LLSD instance_entry; + LLSD instance_entry; - for (S32 i = 0; i < 5; i++) - { - data.mModel[i] = instance.mLOD[i]; - } + for (S32 i = 0; i < 5; i++) + { + data.mModel[i] = instance.mLOD[i]; + } - LLVector3 pos, scale; - LLQuaternion rot; - LLMatrix4 transformation = instance.mTransform; - decomposeMeshMatrix(transformation,pos,rot,scale); - instance_entry["position"] = ll_sd_from_vector3(pos); - instance_entry["rotation"] = ll_sd_from_quaternion(rot); - instance_entry["scale"] = ll_sd_from_vector3(scale); + LLVector3 pos, scale; + LLQuaternion rot; + LLMatrix4 transformation = instance.mTransform; + decomposeMeshMatrix(transformation,pos,rot,scale); + instance_entry["position"] = ll_sd_from_vector3(pos); + instance_entry["rotation"] = ll_sd_from_quaternion(rot); + instance_entry["scale"] = ll_sd_from_vector3(scale); - instance_entry["material"] = LL_MCODE_WOOD; - LLPermissions perm; - perm.setOwnerAndGroup(gAgent.getID(), gAgent.getID(), LLUUID::null, false); - perm.setCreator(gAgent.getID()); + instance_entry["material"] = LL_MCODE_WOOD; + LLPermissions perm; + perm.setOwnerAndGroup(gAgent.getID(), gAgent.getID(), LLUUID::null, false); + perm.setCreator(gAgent.getID()); - perm.initMasks(PERM_ITEM_UNRESTRICTED | PERM_MOVE, //base - PERM_ITEM_UNRESTRICTED | PERM_MOVE, //owner - LLFloaterPerms::getEveryonePerms(), - LLFloaterPerms::getGroupPerms(), - LLFloaterPerms::getNextOwnerPerms()); - instance_entry["permissions"] = ll_create_sd_from_permissions(perm); - instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); - instance_entry["mesh"] = mesh_index[model]; - - if (mUploadTextures) - { - instance_entry["face_list"] = LLSD::emptyArray(); - - for (S32 face_num = 0; face_num < model->getNumVolumeFaces(); face_num++) + perm.initMasks(PERM_ITEM_UNRESTRICTED | PERM_MOVE, //base + PERM_ITEM_UNRESTRICTED | PERM_MOVE, //owner + LLFloaterPerms::getEveryonePerms(), + LLFloaterPerms::getGroupPerms(), + LLFloaterPerms::getNextOwnerPerms()); + instance_entry["permissions"] = ll_create_sd_from_permissions(perm); + instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); + instance_entry["mesh"] = mesh_index[data.mBaseModel]; + + if (mUploadTextures) { - LLImportMaterial& material = instance.mMaterial[face_num]; - LLSD face_entry = LLSD::emptyMap(); - LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); - - if (texture != NULL) - { - if (textures.find(texture) == textures.end()) - { - textures.insert(texture); - } + instance_entry["face_list"] = LLSD::emptyArray(); - std::stringstream ostr; - if (include_textures) // otherwise data is blank. + for (S32 face_num = 0; face_num < data.mBaseModel->getNumVolumeFaces(); face_num++) + { + LLImportMaterial& material = instance.mMaterial[face_num]; + LLSD face_entry = LLSD::emptyMap(); + LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); + + if (texture != NULL) { - LLTextureUploadData data(texture, material.mDiffuseMapLabel); - if (!data.mTexture->isRawImageValid()) + if (textures.find(texture) == textures.end()) { - data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); + textures.insert(texture); } + + std::stringstream ostr; + if (include_textures) // otherwise data is blank. + { + LLTextureUploadData data(texture, material.mDiffuseMapLabel); + if (!data.mTexture->isRawImageValid()) + { + data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); + } - LLPointer upload_file = - LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); - ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); + LLPointer upload_file = + LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); + ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); + } + + if (texture_index.find(texture) == texture_index.end()) + { + texture_index[texture] = texture_num; + std::string str = ostr.str(); + res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); + texture_num++; + } } - if (texture_index.find(texture) == texture_index.end()) + // Subset of TextureEntry fields. + if (texture) { - texture_index[texture] = texture_num; - std::string str = ostr.str(); - res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); - texture_num++; + face_entry["image"] = texture_index[texture]; } + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; + face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); + face_entry["fullbright"] = material.mFullbright; + instance_entry["face_list"][face_num] = face_entry; } + } - // Subset of TextureEntry fields. - if (texture) - { - face_entry["image"] = texture_index[texture]; - } - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; - face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); - face_entry["fullbright"] = material.mFullbright; - instance_entry["face_list"][face_num] = face_entry; - } + res["instance_list"][instance_num] = instance_entry; + instance_num++; } - - res["instance_list"][instance_num] = instance_entry; - instance_num++; } result["asset_resources"] = res; -- cgit v1.2.3 From 081ba71f9632153efa86df07b33c28471b31e2cb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 25 May 2011 18:36:01 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 79541e49d3..d4be311be8 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -62,6 +62,8 @@ #include "llinventorymodel.h" #include "llfoldertype.h" +#include "boost/lexical_cast.hpp" + #ifndef LL_WINDOWS #include "netdb.h" #endif @@ -85,6 +87,12 @@ U32 LLMeshRepository::sPeakKbps = 0; const U32 MAX_TEXTURE_UPLOAD_RETRIES = 5; +static S32 dump_num = 0; +std::string make_dump_name(std::string prefix, S32 num) +{ + return prefix + boost::lexical_cast(num) + std::string(".xml"); + +} void dumpLLSDToFile(const LLSD& content, std::string filename); std::string header_lod[] = @@ -498,7 +506,7 @@ public: //assert_main_thread(); llinfos << "completed" << llendl; mThread->mPendingUploads--; - dumpLLSDToFile(content,"whole_model_fee_response.xml"); + dumpLLSDToFile(content,make_dump_name("whole_model_fee_response_",dump_num)); if (isGoodStatus(status)) { mThread->mWholeModelUploadURL = content["uploader"].asString(); @@ -530,7 +538,7 @@ public: //assert_main_thread(); llinfos << "upload completed" << llendl; mThread->mPendingUploads--; - dumpLLSDToFile(content,"whole_model_upload_response.xml"); + dumpLLSDToFile(content,make_dump_name("whole_model_upload_response_",dump_num)); // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. mPostData["asset_type"] = "object"; @@ -1437,6 +1445,12 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) { LLMeshUploadData data; data.mBaseModel = iter->first; + LLModelInstance& first_instance = *(iter->second.begin()); + for (S32 i = 0; i < 5; i++) + { + data.mModel[i] = first_instance.mLOD[i]; + } + if (mesh_index.find(data.mBaseModel) == mesh_index.end()) { // Have not seen this model before - create a new mesh_list entry for it. @@ -1573,13 +1587,15 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) } result["asset_resources"] = res; - dumpLLSDToFile(result,"whole_model.xml"); + dumpLLSDToFile(result,make_dump_name("whole_model_",dump_num)); dest = result; } void LLMeshUploadThread::doWholeModelUpload() { + dump_num++; + mCurlRequest = new LLCurlRequest(); // Queue up models for hull generation (viewer-side) @@ -1627,7 +1643,7 @@ void LLMeshUploadThread::doWholeModelUpload() LLSD model_data; wholeModelToLLSD(model_data,false); - dumpLLSDToFile(model_data,"whole_model_fee_request.xml"); + dumpLLSDToFile(model_data,make_dump_name("whole_model_fee_request_",dump_num)); mPendingUploads++; LLCurlRequest::headers_t headers; @@ -1649,7 +1665,7 @@ void LLMeshUploadThread::doWholeModelUpload() LLSD full_model_data; wholeModelToLLSD(full_model_data, true); LLSD body = full_model_data["asset_resources"]; - dumpLLSDToFile(body,"whole_model_body.xml"); + dumpLLSDToFile(body,make_dump_name("whole_model_body_",dump_num)); mCurlRequest->post(mWholeModelUploadURL, headers, body, new LLWholeModelUploadResponder(this, model_data)); do @@ -3317,8 +3333,8 @@ bool LLImportMaterial::operator<(const LLImportMaterial &rhs) const void LLMeshRepository::updateInventory(inventory_data data) { LLMutexLock lock(mMeshMutex); - dumpLLSDToFile(data.mPostData,"update_inventory_post_data.xml"); - dumpLLSDToFile(data.mResponse,"update_inventory_response.xml"); + dumpLLSDToFile(data.mPostData,make_dump_name("update_inventory_post_data_",dump_num)); + dumpLLSDToFile(data.mResponse,make_dump_name("update_inventory_response_",dump_num)); mInventoryQ.push(data); } -- cgit v1.2.3 From 8b552a25c4fb1e9babdd52c5a5acee3540f353ac Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 26 May 2011 13:56:12 -0400 Subject: SH-1492 WIP - include face info even if textures not being uploaded --- indra/newview/llmeshrepository.cpp | 88 ++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 46 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index d4be311be8..7c75599a15 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1525,60 +1525,56 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) instance_entry["physics_shape_type"] = (U8)(LLViewerObject::PHYSICS_SHAPE_CONVEX_HULL); instance_entry["mesh"] = mesh_index[data.mBaseModel]; - if (mUploadTextures) + instance_entry["face_list"] = LLSD::emptyArray(); + + for (S32 face_num = 0; face_num < data.mBaseModel->getNumVolumeFaces(); face_num++) { - instance_entry["face_list"] = LLSD::emptyArray(); + LLImportMaterial& material = instance.mMaterial[face_num]; + LLSD face_entry = LLSD::emptyMap(); + LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); + + if ((texture != NULL) && + (textures.find(texture) == textures.end())) + { + textures.insert(texture); + } - for (S32 face_num = 0; face_num < data.mBaseModel->getNumVolumeFaces(); face_num++) + std::stringstream texture_str; + if (texture != NULL && include_textures && mUploadTextures) { - LLImportMaterial& material = instance.mMaterial[face_num]; - LLSD face_entry = LLSD::emptyMap(); - LLViewerFetchedTexture *texture = material.mDiffuseMap.get(); - - if (texture != NULL) + // Get binary rep of texture, if needed. + LLTextureUploadData data(texture, material.mDiffuseMapLabel); + if (!data.mTexture->isRawImageValid()) { - if (textures.find(texture) == textures.end()) - { - textures.insert(texture); - } - - std::stringstream ostr; - if (include_textures) // otherwise data is blank. - { - LLTextureUploadData data(texture, material.mDiffuseMapLabel); - if (!data.mTexture->isRawImageValid()) - { - data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); - } + data.mTexture->reloadRawImage(data.mTexture->getDiscardLevel()); + } - LLPointer upload_file = - LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); - ostr.write((const char*) upload_file->getData(), upload_file->getDataSize()); - } + LLPointer upload_file = + LLViewerTextureList::convertToUploadFile(data.mTexture->getRawImage()); + texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); + } - if (texture_index.find(texture) == texture_index.end()) - { - texture_index[texture] = texture_num; - std::string str = ostr.str(); - res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); - texture_num++; - } - } + if (texture_index.find(texture) == texture_index.end()) + { + texture_index[texture] = texture_num; + std::string str = texture_str.str(); + res["texture_list"][texture_num] = LLSD::Binary(str.begin(),str.end()); + texture_num++; + } - // Subset of TextureEntry fields. - if (texture) - { - face_entry["image"] = texture_index[texture]; - } - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; - face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); - face_entry["fullbright"] = material.mFullbright; - instance_entry["face_list"][face_num] = face_entry; + // Subset of TextureEntry fields. + if (texture) + { + face_entry["image"] = texture_index[texture]; } + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; + face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); + face_entry["fullbright"] = material.mFullbright; + instance_entry["face_list"][face_num] = face_entry; } res["instance_list"][instance_num] = instance_entry; -- cgit v1.2.3 From 01c5e12853b60d6f9ddc4f32b1450548beb09736 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 26 May 2011 18:22:14 -0400 Subject: SH-1492 WIP --- indra/newview/llmeshrepository.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 7c75599a15..5074caccb6 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1554,7 +1554,9 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) texture_str.write((const char*) upload_file->getData(), upload_file->getDataSize()); } - if (texture_index.find(texture) == texture_index.end()) + if (texture != NULL && + mUploadTextures && + texture_index.find(texture) == texture_index.end()) { texture_index[texture] = texture_num; std::string str = texture_str.str(); @@ -1563,15 +1565,15 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) } // Subset of TextureEntry fields. - if (texture) + if (texture != NULL && mUploadTextures) { face_entry["image"] = texture_index[texture]; + face_entry["scales"] = 1.0; + face_entry["scalet"] = 1.0; + face_entry["offsets"] = 0.0; + face_entry["offsett"] = 0.0; + face_entry["imagerot"] = 0.0; } - face_entry["scales"] = 1.0; - face_entry["scalet"] = 1.0; - face_entry["offsets"] = 0.0; - face_entry["offsett"] = 0.0; - face_entry["imagerot"] = 0.0; face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); face_entry["fullbright"] = material.mFullbright; instance_entry["face_list"][face_num] = face_entry; -- cgit v1.2.3 From 31e850d04885bed2ac779c66bb6b7923a0a51d96 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 27 May 2011 11:50:39 -0700 Subject: transplant fix for SH-1467 viewer now uses simulatorfeatures to check whether to show UI elements for mesh or not --- indra/newview/llmeshrepository.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4464d299ed..4e75219c3e 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -61,6 +61,7 @@ #include "pipeline.h" #include "llinventorymodel.h" #include "llfoldertype.h" +#include "llviewerparcelmgr.h" #include "boost/lexical_cast.hpp" @@ -3957,3 +3958,33 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp) } } } + +bool LLMeshRepository::meshUploadEnabled() +{ + LLViewerRegion *region = gAgent.getRegion(); + if(gSavedSettings.getBOOL("MeshEnabled") && + LLViewerParcelMgr::getInstance()->allowAgentBuild() && + region) + { + LLSD sim_features; + region->getSimulatorFeatures(sim_features); + return (sim_features.has("MeshUploadEnabled") && + sim_features["MeshUploadEnabled"].asBoolean()); + } + return false; +} + +bool LLMeshRepository::meshRezEnabled() +{ + LLViewerRegion *region = gAgent.getRegion(); + if(gSavedSettings.getBOOL("MeshEnabled") && + region) + { + LLSD sim_features; + region->getSimulatorFeatures(sim_features); + return (sim_features.has("MeshRezEnabled") && + sim_features["MeshRezEnabled"].asBoolean()); + } + return false; +} + -- cgit v1.2.3 From b0a04b08f7b3cf4040b9708125a548e646b990f7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 3 Jun 2011 00:13:50 -0500 Subject: SH-1744 Add havok's degenerate triangle check to importer. Highlight degenerate triangles in physics mesh and block upload when degenerate triangles are present. --- indra/newview/llmeshrepository.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4464d299ed..4a8c644dbc 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1399,14 +1399,14 @@ BOOL LLMeshUploadThread::isDiscarded() void LLMeshUploadThread::run() { - if (gSavedSettings.getBOOL("MeshUseWholeModelUpload")) + //if (gSavedSettings.getBOOL("MeshUseWholeModelUpload")) { doWholeModelUpload(); } - else + /*else { doIterativeUpload(); - } + }*/ } void dumpLLSDToFile(const LLSD& content, std::string filename) -- cgit v1.2.3 From 325c2b216907b84b02b425103b011a556222b474 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 6 Jun 2011 21:27:29 +0000 Subject: Removed the old mesh asset upload pipeline. Fixed a problem with spamming MissingString MacLocale warnings. Reviewed by Dave --- indra/newview/llmeshrepository.cpp | 265 +------------------------------------ 1 file changed, 2 insertions(+), 263 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index d8024b362e..a4dcd3cd52 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -507,6 +507,7 @@ public: llinfos << "completed" << llendl; mThread->mPendingUploads--; dumpLLSDToFile(content,make_dump_name("whole_model_fee_response_",dump_num)); + llinfos << "LLWholeModelFeeResponder content: " << content << llendl; if (isGoodStatus(status)) { mThread->mWholeModelUploadURL = content["uploader"].asString(); @@ -1302,8 +1303,6 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mOrigin = gAgent.getPositionAgent(); mHost = gAgent.getRegionHost(); - mUploadObjectAssetCapability = gAgent.getRegion()->getCapability("UploadObjectAsset"); - mNewInventoryCapability = gAgent.getRegion()->getCapability("NewFileAgentInventoryVariablePrice"); mWholeModelFeeCapability = gAgent.getRegion()->getCapability("NewFileAgentInventory"); mOrigin += gAgent.getAtAxis() * scale.magVec(); @@ -1393,14 +1392,7 @@ BOOL LLMeshUploadThread::isDiscarded() void LLMeshUploadThread::run() { - //if (gSavedSettings.getBOOL("MeshUseWholeModelUpload")) - { - doWholeModelUpload(); - } - /*else - { - doIterativeUpload(); - }*/ + doWholeModelUpload(); } void dumpLLSDToFile(const LLSD& content, std::string filename) @@ -1670,163 +1662,6 @@ void LLMeshUploadThread::doWholeModelUpload() mFinished = true; } -void LLMeshUploadThread::doIterativeUpload() -{ - if(isDiscarded()) - { - mFinished = true; - return ; - } - - mCurlRequest = new LLCurlRequest(); - - std::set textures; - - //populate upload queue with relevant models - for (instance_map::iterator iter = mInstance.begin(); iter != mInstance.end(); ++iter) - { - LLMeshUploadData data; - data.mBaseModel = iter->first; - - LLModelInstance& instance = *(iter->second.begin()); - - for (S32 i = 0; i < 5; i++) - { - data.mModel[i] = instance.mLOD[i]; - } - - uploadModel(data); - - if (mUploadTextures) - { - for (std::vector::iterator material_iter = instance.mMaterial.begin(); - material_iter != instance.mMaterial.end(); ++material_iter) - { - - if (textures.find(material_iter->mDiffuseMap.get()) == textures.end()) - { - textures.insert(material_iter->mDiffuseMap.get()); - - LLTextureUploadData data(material_iter->mDiffuseMap.get(), material_iter->mDiffuseMapLabel); - uploadTexture(data); - } - } - } - - //queue up models for hull generation - LLModel* physics = data.mModel[LLModel::LOD_PHYSICS]; - if (physics == NULL) - { //no physics model available, use high lod - physics = data.mModel[LLModel::LOD_HIGH]; - } - - DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this); - gMeshRepo.mDecompThread->submitRequest(request); - } - - while (!mPhysicsComplete) - { - apr_sleep(100); - } - - //upload textures - bool done = false; - do - { - if (!mTextureQ.empty()) - { - sendCostRequest(mTextureQ.front()); - mTextureQ.pop(); - } - - if (!mConfirmedTextureQ.empty()) - { - doUploadTexture(mConfirmedTextureQ.front()); - mConfirmedTextureQ.pop(); - } - - mCurlRequest->process(); - - done = mTextureQ.empty() && mConfirmedTextureQ.empty(); - } - while (!done || mCurlRequest->getQueued() > 0); - - LLSD object_asset; - object_asset["objects"] = LLSD::emptyArray(); - - done = false; - do - { - static S32 count = 0; - static F32 last_hundred = gFrameTimeSeconds; - if (gFrameTimeSeconds - last_hundred > 1.f) - { - last_hundred = gFrameTimeSeconds; - count = 0; - } - - //how many requests to push before calling process - const S32 PUSH_PER_PROCESS = 32; - - S32 tcount = llmin(count+PUSH_PER_PROCESS, 100); - - while (!mUploadQ.empty() && count < tcount) - { //send any pending upload requests - mMutex->lock(); - LLMeshUploadData data = mUploadQ.front(); - mUploadQ.pop(); - mMutex->unlock(); - sendCostRequest(data); - count++; - } - - tcount = llmin(count+PUSH_PER_PROCESS, 100); - - while (!mConfirmedQ.empty() && count < tcount) - { //process any meshes that have been confirmed for upload - LLMeshUploadData& data = mConfirmedQ.front(); - doUploadModel(data); - mConfirmedQ.pop(); - count++; - } - - tcount = llmin(count+PUSH_PER_PROCESS, 100); - - while (!mInstanceQ.empty() && count < tcount && !isDiscarded()) - { //create any objects waiting for upload - count++; - object_asset["objects"].append(createObject(mInstanceQ.front())); - mInstanceQ.pop(); - } - - mCurlRequest->process(); - - done = isDiscarded() || (mInstanceQ.empty() && mConfirmedQ.empty() && mUploadQ.empty()); - } - while (!done || mCurlRequest->getQueued() > 0); - - delete mCurlRequest; - mCurlRequest = NULL; - - // now upload the object asset - std::string url = mUploadObjectAssetCapability; - - if (object_asset["objects"][0].has("permissions")) - { //copy permissions from first available object to be used for coalesced object - object_asset["permissions"] = object_asset["objects"][0]["permissions"]; - } - - if(!isDiscarded()) - { - mPendingUploads++; - LLHTTPClient::post(url, object_asset, new LLModelObjectUploadResponder(this,object_asset)); - } - else - { - mFinished = true; - } -} - void LLMeshUploadThread::uploadModel(LLMeshUploadData& data) { //called from arbitrary thread { @@ -2937,102 +2772,6 @@ S32 LLMeshRepository::getMeshSize(const LLUUID& mesh_id, S32 lod) } -void LLMeshUploadThread::sendCostRequest(LLMeshUploadData& data) -{ - if(isDiscarded()) - { - return ; - } - - //write model file to memory buffer - std::stringstream ostr; - - LLModel::Decomposition& decomp = - data.mModel[LLModel::LOD_PHYSICS].notNull() ? - data.mModel[LLModel::LOD_PHYSICS]->mPhysics : - data.mBaseModel->mPhysics; - - LLSD header = LLModel::writeModel( - ostr, - data.mModel[LLModel::LOD_PHYSICS], - data.mModel[LLModel::LOD_HIGH], - data.mModel[LLModel::LOD_MEDIUM], - data.mModel[LLModel::LOD_LOW], - data.mModel[LLModel::LOD_IMPOSTOR], - decomp, - mUploadSkin, - mUploadJoints, - true); - - std::string desc = data.mBaseModel->mLabel; - - // Grab the total vertex count of the model - // along with other information for the "asset_resources" map - // to send to the server. - LLSD asset_resources = LLSD::emptyMap(); - - - std::string url = mNewInventoryCapability; - - if (!url.empty()) - { - LLSD body = generate_new_resource_upload_capability_body( - LLAssetType::AT_MESH, - desc, - desc, - LLFolderType::FT_MESH, - LLInventoryType::IT_MESH, - LLFloaterPerms::getNextOwnerPerms(), - LLFloaterPerms::getGroupPerms(), - LLFloaterPerms::getEveryonePerms()); - - body["asset_resources"] = asset_resources; - - mPendingConfirmations++; - LLCurlRequest::headers_t headers; - - data.mPostData = body; - - mCurlRequest->post(url, headers, body, new LLMeshCostResponder(data, this)); - } -} - -void LLMeshUploadThread::sendCostRequest(LLTextureUploadData& data) -{ - if(isDiscarded()) - { - return ; - } - - if (data.mTexture && data.mTexture->getDiscardLevel() >= 0) - { - LLSD asset_resources = LLSD::emptyMap(); - - std::string url = mNewInventoryCapability; - - if (!url.empty()) - { - LLSD body = generate_new_resource_upload_capability_body( - LLAssetType::AT_TEXTURE, - data.mLabel, - data.mLabel, - LLFolderType::FT_TEXTURE, - LLInventoryType::IT_TEXTURE, - LLFloaterPerms::getNextOwnerPerms(), - LLFloaterPerms::getGroupPerms(), - LLFloaterPerms::getEveryonePerms()); - - body["asset_resources"] = asset_resources; - - mPendingConfirmations++; - LLCurlRequest::headers_t headers; - - data.mPostData = body; - mCurlRequest->post(url, headers, body, new LLTextureCostResponder(data, this)); - } - } -} - void LLMeshUploadThread::doUploadModel(LLMeshUploadData& data) { -- cgit v1.2.3 From b3fbb12f155ae1acc6b4d258d1c383d5d8e47964 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 6 Jun 2011 19:12:52 -0500 Subject: SH-1589 Fix for some meshes showing up in non mesh enabled regions. --- indra/newview/llmeshrepository.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index ff9f0e1663..bfaddf9cde 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2379,7 +2379,6 @@ void LLMeshRepository::notifyLoadedMeshes() if (gAgent.getRegion()->getName() != region_name && gAgent.getRegion()->capabilitiesReceived()) { region_name = gAgent.getRegion()->getName(); - mGetMeshCapability = gAgent.getRegion()->getCapability("GetMesh"); } } @@ -3725,10 +3724,7 @@ bool LLMeshRepository::meshUploadEnabled() LLViewerParcelMgr::getInstance()->allowAgentBuild() && region) { - LLSD sim_features; - region->getSimulatorFeatures(sim_features); - return (sim_features.has("MeshUploadEnabled") && - sim_features["MeshUploadEnabled"].asBoolean()); + return region->meshUploadEnabled(); } return false; } @@ -3739,10 +3735,7 @@ bool LLMeshRepository::meshRezEnabled() if(gSavedSettings.getBOOL("MeshEnabled") && region) { - LLSD sim_features; - region->getSimulatorFeatures(sim_features); - return (sim_features.has("MeshRezEnabled") && - sim_features["MeshRezEnabled"].asBoolean()); + return region->meshRezEnabled(); } return false; } -- cgit v1.2.3 From d9dfa9b8707b3bf68d7c5cd03a6ca738be7f891f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 8 Jun 2011 14:31:22 -0500 Subject: SH-1777 Fix for "Prim" physics shape type not showing up on meshes with convex decompositions. --- indra/newview/llmeshrepository.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 29904c579c..3545b5128a 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2716,7 +2716,18 @@ void LLMeshRepository::buildHull(const LLVolumeParams& params, S32 detail) bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id) { LLSD mesh = mThread->getMeshHeader(mesh_id); - return mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0); + if (mesh.has("physics_mesh") && mesh["physics_mesh"].has("size") && (mesh["physics_mesh"]["size"].asInteger() > 0)) + { + return true; + } + + LLModel::Decomposition* decomp = getDecomposition(mesh_id); + if (decomp && !decomp->mHull.empty()) + { + return true; + } + + return false; } LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id) -- cgit v1.2.3 From 776353b4a6ced013a9406a6177d4cbc18177ccef Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 8 Jun 2011 15:25:59 -0600 Subject: fix for SH-1651 and SH-1652: Viewer Crash in Display:RenderUI when uploading skpfile.dae model with High LOD selected as Physics shape --- indra/newview/llmeshrepository.cpp | 86 +++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 29 deletions(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 29904c579c..0b10024663 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1323,35 +1323,7 @@ LLMeshUploadThread::DecompRequest::DecompRequest(LLModel* mdl, LLModel* base_mod mThread = thread; //copy out positions and indices - if (mdl) - { - U16 index_offset = 0; - - mPositions.clear(); - mIndices.clear(); - - //queue up vertex positions and indices - for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) - { - const LLVolumeFace& face = mdl->getVolumeFace(i); - if (mPositions.size() + face.mNumVertices > 65535) - { - continue; - } - - for (U32 j = 0; j < face.mNumVertices; ++j) - { - mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); - } - - for (U32 j = 0; j < face.mNumIndices; ++j) - { - mIndices.push_back(face.mIndices[j]+index_offset); - } - - index_offset += face.mNumVertices; - } - } + assignData(mdl) ; mThread->mFinalDecomp = this; mThread->mPhysicsComplete = false; @@ -3599,6 +3571,62 @@ void LLPhysicsDecomp::run() mDone = true; } +void LLPhysicsDecomp::Request::assignData(LLModel* mdl) +{ + if (!mdl) + { + return ; + } + + U16 index_offset = 0; + U16 tri[3] ; + + mPositions.clear(); + mIndices.clear(); + mBBox[1] = LLVector3(F32_MIN, F32_MIN, F32_MIN) ; + mBBox[0] = LLVector3(F32_MAX, F32_MAX, F32_MAX) ; + + //queue up vertex positions and indices + for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i) + { + const LLVolumeFace& face = mdl->getVolumeFace(i); + if (mPositions.size() + face.mNumVertices > 65535) + { + continue; + } + + for (U32 j = 0; j < face.mNumVertices; ++j) + { + mPositions.push_back(LLVector3(face.mPositions[j].getF32ptr())); + for(U32 k = 0 ; k < 3 ; k++) + { + mBBox[0].mV[k] = llmin(mBBox[0].mV[k], mPositions[j].mV[k]) ; + mBBox[1].mV[k] = llmax(mBBox[1].mV[k], mPositions[j].mV[k]) ; + } + } + + updateTriangleAreaThreshold() ; + + for (U32 j = 0; j+2 < face.mNumIndices; j += 3) + { + tri[0] = face.mIndices[j] + index_offset ; + tri[1] = face.mIndices[j + 1] + index_offset ; + tri[2] = face.mIndices[j + 2] + index_offset ; + + if(isValidTriangle(tri[0], tri[1], tri[2])) + { + mIndices.push_back(tri[0]); + mIndices.push_back(tri[1]); + mIndices.push_back(tri[2]); + } + } + + index_offset += face.mNumVertices; + } + + return ; +} + void LLPhysicsDecomp::Request::updateTriangleAreaThreshold() { F32 range = mBBox[1].mV[0] - mBBox[0].mV[0] ; -- cgit v1.2.3 From 73d807bd894e64c653efc6093c408d046e510a5b Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 8 Jun 2011 16:46:29 -0700 Subject: change the color specifier to 'diffuse_color' in the mesh upload blobs --- indra/newview/llmeshrepository.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llmeshrepository.cpp') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 6b8b0f5a00..d4198041ec 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1533,7 +1533,7 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures) face_entry["offsett"] = 0.0; face_entry["imagerot"] = 0.0; } - face_entry["colors"] = ll_sd_from_color4(material.mDiffuseColor); + face_entry["diffuse_color"] = ll_sd_from_color4(material.mDiffuseColor); face_entry["fullbright"] = material.mFullbright; instance_entry["face_list"][face_num] = face_entry; } -- cgit v1.2.3