diff options
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/CMakeLists.txt | 17 | ||||
-rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 131 | ||||
-rw-r--r-- | indra/llprimitive/lldaeloader.h | 2 | ||||
-rw-r--r-- | indra/llprimitive/llgltfloader.cpp | 1 | ||||
-rw-r--r-- | indra/llprimitive/llmodel.cpp | 11 | ||||
-rw-r--r-- | indra/llprimitive/llmodel.h | 9 | ||||
-rw-r--r-- | indra/llprimitive/llmodelloader.cpp | 1 | ||||
-rw-r--r-- | indra/llprimitive/llmodelloader.h | 4 | ||||
-rw-r--r-- | indra/llprimitive/object_flags.h | 12 |
9 files changed, 101 insertions, 87 deletions
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index b98edc67de..00d821c470 100644 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -8,21 +8,22 @@ include(LLCommon) include(LLCoreHttp) include(LLPhysicsExtensions) include(LLPrimitive) -include(GLH) include(GLM) include(TinyGLTF) if(LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD ) + set_property(DIRECTORY APPEND + PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/../patches/collada-dom-v2.3-r8.patch) prepare_thirdparty( - "https://github.com/secondlife/3p-colladadom/archive/refs/tags/v2.3-r7.tar.gz" - "colladadom-v2.3-r7.tar.gz" - "3p-colladadom-2.3-r7" - "collada-dom-v2.3-r7.patch" - "0d7a13531eb0de8c617b48af90c3b5b22c2a0b566069d1a0c36f9602dbfeb9ebab1516556e6dda34645d63354c3c6539375d7e5b8c0b36baba11312d18a3c705" + "https://github.com/secondlife/3p-colladadom/archive/refs/tags/v2.3-r8.tar.gz" + "colladadom-v2.3-r8.tar.gz" + "3p-colladadom-2.3-r8" + "collada-dom-v2.3-r8.patch" + "b36dce3b7be4b49f3c8e4d6c9dbf3529f7ed1f28e64ee45be0e77805f06376b95079798616529302d771ab2b76bf06d2f894ca11e6f7f3097c3f7a05a78c474f" ) set(OPT_COLLADA14 TRUE) add_subdirectory( - "${CMAKE_SOURCE_DIR}/../../3p-colladadom-2.3-r7" "colladadom") + "${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8" "colladadom") target_include_directories( ll::colladadom INTERFACE ${colladadom_SOURCE_DIR}/include @@ -90,7 +91,7 @@ target_link_libraries(llprimitive llrender llphysicsextensions_impl ll::colladadom - ll::glh_linear + ll::glm ) include(LibraryInstall) diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 34af3ffece..0759447902 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -51,7 +51,8 @@ #include "llsdserialize.h" #include "lljoint.h" -#include "glh/glh_linear.h" +#include "glm/mat4x4.hpp" +#include "glm/gtc/type_ptr.hpp" #include "llmatrix4a.h" #include <boost/regex.hpp> @@ -1216,9 +1217,9 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do mesh_scale *= normalized_transformation; normalized_transformation = mesh_scale; - glh::matrix4f inv_mat((F32*) normalized_transformation.mMatrix); - inv_mat = inv_mat.inverse(); - LLMatrix4 inverse_normalized_transformation(inv_mat.m); + glm::mat4 inv_mat = glm::make_mat4((F32*)normalized_transformation.mMatrix); + inv_mat = glm::inverse(inv_mat); + LLMatrix4 inverse_normalized_transformation(glm::value_ptr(inv_mat)); domSkin::domBind_shape_matrix* bind_mat = skin->getBind_shape_matrix(); @@ -2079,79 +2080,83 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da { if (domMesh* mesh = daeSafeCast<domMesh>(geo->getDescendant(daeElement::matchType(domMesh::ID())))) { - for (LLModel* model : mModelsMap.find(mesh)->second) + dae_model_map::iterator it = mModelsMap.find(mesh); + if (it != mModelsMap.end()) { - LLMatrix4 transformation = mTransform; + for (LLModel* model : it->second) + { + LLMatrix4 transformation = mTransform; - if (mTransform.determinant() < 0) - { //negative scales are not supported - LL_INFOS() << "Negative scale detected, unsupported transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; - LLSD args; - args["Message"] = "NegativeScaleTrans"; - args["LABEL"] = getElementLabel(instance_geo); - mWarningsArray.append(args); + if (mTransform.determinant() < 0) + { //negative scales are not supported + LL_INFOS() << "Negative scale detected, unsupported transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; + LLSD args; + args["Message"] = "NegativeScaleTrans"; + args["LABEL"] = getElementLabel(instance_geo); + mWarningsArray.append(args); - badElement = true; - } + badElement = true; + } - LLModelLoader::material_map materials = getMaterials(model, instance_geo, dae); - - // adjust the transformation to compensate for mesh normalization - LLVector3 mesh_scale_vector; - LLVector3 mesh_translation_vector; - model->getNormalizedScaleTranslation(mesh_scale_vector, mesh_translation_vector); - - LLMatrix4 mesh_translation; - mesh_translation.setTranslation(mesh_translation_vector); - mesh_translation *= transformation; - transformation = mesh_translation; - - LLMatrix4 mesh_scale; - mesh_scale.initScale(mesh_scale_vector); - mesh_scale *= transformation; - transformation = mesh_scale; - - if (transformation.determinant() < 0) - { //negative scales are not supported - LL_INFOS() << "Negative scale detected, unsupported post-normalization transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; - LLSD args; - args["Message"] = "NegativeScaleNormTrans"; - args["LABEL"] = getElementLabel(instance_geo); - mWarningsArray.append(args); - badElement = true; - } + LLModelLoader::material_map materials = getMaterials(model, instance_geo, dae); + + // adjust the transformation to compensate for mesh normalization + LLVector3 mesh_scale_vector; + LLVector3 mesh_translation_vector; + model->getNormalizedScaleTranslation(mesh_scale_vector, mesh_translation_vector); + + LLMatrix4 mesh_translation; + mesh_translation.setTranslation(mesh_translation_vector); + mesh_translation *= transformation; + transformation = mesh_translation; + + LLMatrix4 mesh_scale; + mesh_scale.initScale(mesh_scale_vector); + mesh_scale *= transformation; + transformation = mesh_scale; + + if (transformation.determinant() < 0) + { //negative scales are not supported + LL_INFOS() << "Negative scale detected, unsupported post-normalization transform. domInstance_geometry: " << getElementLabel(instance_geo) << LL_ENDL; + LLSD args; + args["Message"] = "NegativeScaleNormTrans"; + args["LABEL"] = getElementLabel(instance_geo); + mWarningsArray.append(args); + badElement = true; + } - std::string label; + std::string label; - if (model->mLabel.empty()) - { - label = getLodlessLabel(instance_geo); + if (model->mLabel.empty()) + { + label = getLodlessLabel(instance_geo); - llassert(!label.empty()); + llassert(!label.empty()); - if (model->mSubmodelID) - { - label += (char)((int)'a' + model->mSubmodelID); - } + if (model->mSubmodelID) + { + label += (char)((int)'a' + model->mSubmodelID); + } - model->mLabel = label + lod_suffix[mLod]; - } - else - { - // Don't change model's name if possible, it will play havoc with scenes that already use said model. - size_t ext_pos = getSuffixPosition(model->mLabel); - if (ext_pos != -1) - { - label = model->mLabel.substr(0, ext_pos); + model->mLabel = label + lod_suffix[mLod]; } else { - label = model->mLabel; + // Don't change model's name if possible, it will play havoc with scenes that already use said model. + size_t ext_pos = getSuffixPosition(model->mLabel); + if (ext_pos != -1) + { + label = model->mLabel.substr(0, ext_pos); + } + else + { + label = model->mLabel; + } } - } - mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials)); - stretch_extents(model, transformation); + mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials)); + stretch_extents(model, transformation); + } } } } diff --git a/indra/llprimitive/lldaeloader.h b/indra/llprimitive/lldaeloader.h index c6e5ea42fc..92152fb8b8 100644 --- a/indra/llprimitive/lldaeloader.h +++ b/indra/llprimitive/lldaeloader.h @@ -29,7 +29,7 @@ #include "llmodelloader.h" -#ifndef LL_USESYSTEMLIBS +#if 0 class DAE; class daeElement; class domProfile_COMMON; diff --git a/indra/llprimitive/llgltfloader.cpp b/indra/llprimitive/llgltfloader.cpp index 776f81cc01..480012699a 100644 --- a/indra/llprimitive/llgltfloader.cpp +++ b/indra/llprimitive/llgltfloader.cpp @@ -51,7 +51,6 @@ #include "llsdserialize.h" #include "lljoint.h" -#include "glh/glh_linear.h" #include "llmatrix4a.h" #include <boost/regex.hpp> diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index bcd1ee57db..6b4bb3a8b0 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -33,7 +33,7 @@ #include "llvector4a.h" #include "hbxxh.h" -#ifdef LL_USESYSTEMLIBS +#if 1 # include <zlib.h> #else # include "zlib-ng/zlib.h" @@ -97,7 +97,7 @@ void LLModel::offsetMesh(const LLVector3& pivotPoint) for (LLVolumeFace& face : mVolumeFaces) { - for (U32 i = 0; i < face.mNumVertices; ++i) + for (S32 i = 0; i < face.mNumVertices; ++i) { face.mPositions[i].add(pivot); } @@ -1543,6 +1543,13 @@ void LLMeshSkinInfo::fromLLSD(LLSD& skin) mLockScaleIfJointPosition = false; } + // combine mBindShapeMatrix and mInvBindMatrix into mBindPoseMatrix + mBindPoseMatrix.resize(mInvBindMatrix.size()); + for (U32 i = 0; i < mInvBindMatrix.size(); ++i) + { + matMul(mBindShapeMatrix, mInvBindMatrix[i], mBindPoseMatrix[i]); + } + updateHash(); } diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index b9c6c9aa24..4b5d079b48 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -35,7 +35,7 @@ #include <boost/align/aligned_allocator.hpp> -#ifndef LL_USESYSTEMLIBS +#if 0 class daeElement; class domMesh; #endif @@ -58,12 +58,15 @@ public: LLUUID mMeshID; std::vector<std::string> mJointNames; mutable std::vector<S32> mJointNums; - typedef std::vector<LLMatrix4a, boost::alignment::aligned_allocator<LLMatrix4a, 16>> matrix_list_t; + typedef std::vector<LLMatrix4a> matrix_list_t; matrix_list_t mInvBindMatrix; // bones/joints position overrides matrix_list_t mAlternateBindMatrix; + // cached multiply of mBindShapeMatrix and mInvBindMatrix + matrix_list_t mBindPoseMatrix; + LL_ALIGN_16(LLMatrix4a mBindShapeMatrix); float mPelvisOffset; @@ -204,7 +207,7 @@ public: void trimVolumeFacesToSize(U32 new_count = LL_SCULPT_MESH_MAX_FACES, LLVolume::face_list_t* remainder = NULL); void remapVolumeFaces(); void optimizeVolumeFaces(); - void offsetMesh(const LLVector3& pivotPoint); + void offsetMesh( const LLVector3& pivotPoint ); void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out) const; LLVector3 getTransformedCenter(const LLMatrix4& mat); diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index 1a64e6227f..84adec4da5 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -31,7 +31,6 @@ #include "lljoint.h" #include "llcallbacklist.h" -#include "glh/glh_linear.h" #include "llmatrix4a.h" #include <boost/bind.hpp> diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h index 637dabe08a..530e61e2b8 100644 --- a/indra/llprimitive/llmodelloader.h +++ b/indra/llprimitive/llmodelloader.h @@ -156,12 +156,12 @@ public: bool loadFromSLM(const std::string& filename); void loadModelCallback(); - void loadTextures(); // called in the main thread. + void loadTextures() ; // called in the main thread. void setLoadState(U32 state); void stretch_extents(const LLModel* model, const LLMatrix4& mat); - S32 mNumOfFetchingTextures; // updated in the main thread + S32 mNumOfFetchingTextures ; // updated in the main thread bool areTexturesReady() { return !mNumOfFetchingTextures; } // called in the main thread. bool verifyCount( int expected, int result ); diff --git a/indra/llprimitive/object_flags.h b/indra/llprimitive/object_flags.h index e2cdba072a..06e216ba49 100644 --- a/indra/llprimitive/object_flags.h +++ b/indra/llprimitive/object_flags.h @@ -57,16 +57,16 @@ const U32 FLAGS_CAMERA_SOURCE = (1U << 22); //const U32 FLAGS_UNUSED_001 = (1U << 23); // was FLAGS_CAST_SHADOWS -//const U32 FLAGS_UNUSED_002 = (1U << 24); -//const U32 FLAGS_UNUSED_003 = (1U << 25); -//const U32 FLAGS_UNUSED_004 = (1U << 26); -//const U32 FLAGS_UNUSED_005 = (1U << 27); +const U32 FLAGS_SERVER_AUTOPILOT = (1U << 24); // Update was for an agent AND that agent is being autopiloted from the server +//const U32 FLAGS_UNUSED_002 = (1U << 25); +//const U32 FLAGS_UNUSED_003 = (1U << 26); +//const U32 FLAGS_UNUSED_004 = (1U << 27); const U32 FLAGS_OBJECT_OWNER_MODIFY = (1U << 28); const U32 FLAGS_TEMPORARY_ON_REZ = (1U << 29); -//const U32 FLAGS_UNUSED_006 = (1U << 30); // was FLAGS_TEMPORARY -//const U32 FLAGS_UNUSED_007 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED +//const U32 FLAGS_UNUSED_005 = (1U << 30); // was FLAGS_TEMPORARY +//const U32 FLAGS_UNUSED_006 = (1U << 31); // was FLAGS_ZLIB_COMPRESSED const U32 FLAGS_LOCAL = FLAGS_ANIM_SOURCE | FLAGS_CAMERA_SOURCE; const U32 FLAGS_WORLD = FLAGS_USE_PHYSICS | FLAGS_PHANTOM | FLAGS_TEMPORARY_ON_REZ; |