From 8eb2d17c7715dbe72d4719d7ed3dd05f8cb4b65e Mon Sep 17 00:00:00 2001 From: Henri Beauchamp Date: Thu, 30 Nov 2023 13:23:57 +0100 Subject: Fix LLGLTFMaterial hashing This PR fixes the non-working material hashing for LLGLTFMaterial instances. There are several issues in the current code, stemming to the fact that the hashing is performed on the block of the member variables: 1.- There are padding bytes between member variables, even after rearranging them to avoid most of the padding; in particular, the std::array's size is not a multiple of 4 bytes (64 bits), and most compilers will pad them to the next 4-byte aligment as a result. Note that C++ standards do not impose the zeroing of padding bytes on construction of a class instance, with only a couple exceptions (such as explicit zero-initialization). Those bytes MUST therefore be zeroed by us on construction. 2.- The TextureTransform strutcure getPacked() method did not touch some of the packed bytes, and as a result could *potentially* cause an issue for hashing when applied to a transform of another material instance. 3.- With the recent addition of the local textures tracking map, the said map cannot be hashed as a block of memory (map pairs will typically be allocated on the heap or on the stack, not in the memory block used by member variables). This PR solves all these issues and offers proper hashing of LLGLTFMaterial instances. --- indra/llprimitive/llgltfmaterial.cpp | 109 +++++++++++++++++++++++++++++------ indra/llprimitive/llgltfmaterial.h | 62 ++++++++++++-------- 2 files changed, 128 insertions(+), 43 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index ae165f7fa4..e9d3350ee9 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -47,16 +47,49 @@ const char* const LLGLTFMaterial::GLTF_FILE_EXTENSION_TRANSFORM_ROTATION = "rota // special UUID that indicates a null UUID in override data const LLUUID LLGLTFMaterial::GLTF_OVERRIDE_NULL_UUID = LLUUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); +LLGLTFMaterial::LLGLTFMaterial() +{ + // IMPORTANT: since we use the hash of the member variables memory block of + // this class to detect changes, we must ensure that all its padding bytes + // have been zeroed out. But of course, we must leave the LLRefCount member + // variable untouched (and skip it when hashing), and we cannot either + // touch the local texture overrides map (else we destroy pointers, and + // sundry private data, which would lead to a crash when using that map). + // The variable members have therefore been arranged so that anything, + // starting at mLocalTexDataDigest and up to the end of the members, can be + // safely zeroed. HB + const size_t offset = intptr_t(&mLocalTexDataDigest) - intptr_t(this); + memset((void*)((const char*)this + offset), 0, sizeof(*this) - offset); + + // Now that we zeroed out our member variables, we can set the ones that + // should not be zero to their default value. HB + mBaseColor.set(1.f, 1.f, 1.f, 1.f); + mMetallicFactor = mRoughnessFactor = 1.f; + mAlphaCutoff = 0.5f; + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + { + mTextureTransform[i].mScale.set(1.f, 1.f); +#if 0 + mTextureTransform[i].mOffset.clear(); + mTextureTransform[i].mRotation = 0.f; +#endif + } +#if 0 + mLocalTexDataDigest = 0; + mAlphaMode = ALPHA_MODE_OPAQUE; // This is 0 + mOverrideDoubleSided = mOverrideAlphaMode = false; +#endif +} + void LLGLTFMaterial::TextureTransform::getPacked(F32 (&packed)[8]) const { packed[0] = mScale.mV[VX]; packed[1] = mScale.mV[VY]; packed[2] = mRotation; - // packed[3] = unused packed[4] = mOffset.mV[VX]; packed[5] = mOffset.mV[VY]; - // packed[6] = unused - // packed[7] = unused + // Not used but nonetheless zeroed for proper hashing. HB + packed[3] = packed[6] = packed[7] = 0.f; } bool LLGLTFMaterial::TextureTransform::operator==(const TextureTransform& other) const @@ -89,13 +122,37 @@ LLGLTFMaterial& LLGLTFMaterial::operator=(const LLGLTFMaterial& rhs) mOverrideDoubleSided = rhs.mOverrideDoubleSided; mOverrideAlphaMode = rhs.mOverrideAlphaMode; - mTrackingIdToLocalTexture = rhs.mTrackingIdToLocalTexture; - - updateTextureTracking(); + if (rhs.mTrackingIdToLocalTexture.empty()) + { + mTrackingIdToLocalTexture.clear(); + mLocalTexDataDigest = 0; + } + else + { + mTrackingIdToLocalTexture = rhs.mTrackingIdToLocalTexture; + updateLocalTexDataDigest(); + updateTextureTracking(); + } return *this; } +void LLGLTFMaterial::updateLocalTexDataDigest() +{ + mLocalTexDataDigest = 0; + if (!mTrackingIdToLocalTexture.empty()) + { + for (local_tex_map_t::const_iterator + it = mTrackingIdToLocalTexture.begin(), + end = mTrackingIdToLocalTexture.end(); + it != end; ++it) + { + mLocalTexDataDigest ^= it->first.getDigest64() ^ + it->second.getDigest64(); + } + } +} + bool LLGLTFMaterial::operator==(const LLGLTFMaterial& rhs) const { return mTextureId == rhs.mTextureId && @@ -547,7 +604,7 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) { LL_PROFILE_ZONE_SCOPED; - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { LLUUID& texture_id = mTextureId[i]; const LLUUID& override_texture_id = override_mat.mTextureId[i]; @@ -588,7 +645,7 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) mDoubleSided = override_mat.mDoubleSided; } - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { if (override_mat.mTextureTransform[i].mOffset != getDefaultTextureOffset()) { @@ -606,9 +663,13 @@ void LLGLTFMaterial::applyOverride(const LLGLTFMaterial& override_mat) } } - mTrackingIdToLocalTexture.insert(override_mat.mTrackingIdToLocalTexture.begin(), override_mat.mTrackingIdToLocalTexture.begin()); - - updateTextureTracking(); + if (!override_mat.mTrackingIdToLocalTexture.empty()) + { + auto it = override_mat.mTrackingIdToLocalTexture.begin(); + mTrackingIdToLocalTexture.insert(it, it); + updateLocalTexDataDigest(); + updateTextureTracking(); + } } void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& data) @@ -618,7 +679,7 @@ void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& d // make every effort to shave bytes here - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { LLUUID& texture_id = mTextureId[i]; const LLUUID& override_texture_id = override_mat.mTextureId[i]; @@ -663,7 +724,7 @@ void LLGLTFMaterial::getOverrideLLSD(const LLGLTFMaterial& override_mat, LLSD& d data["ds"] = override_mat.mDoubleSided; } - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { if (override_mat.mTextureTransform[i].mOffset != getDefaultTextureOffset()) { @@ -742,7 +803,7 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data) const LLSD& ti = data["ti"]; if (ti.isArray()) { - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { const LLSD& o = ti[i]["o"]; if (o.isDefined()) @@ -768,27 +829,36 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data) LLUUID LLGLTFMaterial::getHash() const { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; - // HACK - hash the bytes of this object but don't include the ref count - LLUUID hash; - HBXXH128::digest(hash, (unsigned char*)this + sizeof(LLRefCount), sizeof(*this) - sizeof(LLRefCount)); - return hash; + // *HACK: hash the bytes of this object but do not include the ref count + // neither the local texture overrides (which is a map, with pointers to + // key/value pairs that would change from one LLGLTFMaterial instance to + // the other, even though the key/value pairs could be the same, and stored + // elsewhere in the memory heap or on the stack). + // Note: this does work properly to compare two LLGLTFMaterial instances + // only because the padding bytes between their member variables have been + // dutifully zeroed in the constructor. HB + const size_t offset = intptr_t(&mLocalTexDataDigest) - intptr_t(this); + return HBXXH128::digest((const void*)((const char*)this + offset), + sizeof(*this) - offset); } void LLGLTFMaterial::addLocalTextureTracking(const LLUUID& tracking_id, const LLUUID& tex_id) { mTrackingIdToLocalTexture[tracking_id] = tex_id; + updateLocalTexDataDigest(); } void LLGLTFMaterial::removeLocalTextureTracking(const LLUUID& tracking_id) { mTrackingIdToLocalTexture.erase(tracking_id); + updateLocalTexDataDigest(); } bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& tracking_id, const LLUUID& old_id, const LLUUID& new_id) { bool res = false; - for (int i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) + for (U32 i = 0; i < GLTF_TEXTURE_INFO_COUNT; ++i) { if (mTextureId[i] == old_id) { @@ -809,6 +879,7 @@ bool LLGLTFMaterial::replaceLocalTexture(const LLUUID& tracking_id, const LLUUID { mTrackingIdToLocalTexture.erase(tracking_id); } + updateLocalTexDataDigest(); return res; } diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 02f62fb08c..9f817d6a19 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -81,7 +81,7 @@ public: ALPHA_MODE_MASK }; - LLGLTFMaterial() {} + LLGLTFMaterial(); LLGLTFMaterial(const LLGLTFMaterial& rhs); LLGLTFMaterial& operator=(const LLGLTFMaterial& rhs); @@ -110,25 +110,6 @@ public: static const char* const GLTF_FILE_EXTENSION_TRANSFORM_ROTATION; static const LLUUID GLTF_OVERRIDE_NULL_UUID; - std::array mTextureId; - std::array mTextureTransform; - - // NOTE: initialize values to defaults according to the GLTF spec - // NOTE: these values should be in linear color space - LLColor4 mBaseColor = LLColor4(1, 1, 1, 1); - LLColor3 mEmissiveColor = LLColor3(0, 0, 0); - - F32 mMetallicFactor = 1.f; - F32 mRoughnessFactor = 1.f; - F32 mAlphaCutoff = 0.5f; - - bool mDoubleSided = false; - AlphaMode mAlphaMode = ALPHA_MODE_OPAQUE; - - // override specific flags for state that can't use off-by-epsilon or UUID hack - bool mOverrideDoubleSided = false; - bool mOverrideAlphaMode = false; - // get a UUID based on a hash of this LLGLTFMaterial LLUUID getHash() const; @@ -229,10 +210,6 @@ public: virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID &old_id, const LLUUID& new_id); virtual void updateTextureTracking(); - // These fields are local to viewer and are a part of local bitmap support - typedef std::map local_tex_map_t; - local_tex_map_t mTrackingIdToLocalTexture; - protected: static LLVector2 vec2FromJson(const std::map& object, const char* key, const LLVector2& default_value); static F32 floatFromJson(const std::map& object, const char* key, const F32 default_value); @@ -249,4 +226,41 @@ protected: void writeToTexture(tinygltf::Model& model, T& texture_info, TextureInfo texture_info_id, bool force_write = false) const; template static void writeToTexture(tinygltf::Model& model, T& texture_info, const LLUUID& texture_id, const TextureTransform& transform, bool force_write = false); + + // Used to update the digest of the mTrackingIdToLocalTexture map each time + // it is changed; this way, that digest can be used by the fast getHash() + // method intsead of having to hash all individual keys and values. HB + void updateLocalTexDataDigest(); + +public: + // These fields are local to viewer and are a part of local bitmap support + // IMPORTANT: do not move this member down (and do not move + // mLocalTexDataDigest either): the getHash() method does rely on the + // current ordering. HB + typedef std::map local_tex_map_t; + local_tex_map_t mTrackingIdToLocalTexture; + + // Used to store a digest of mTrackingIdToLocalTexture when the latter is + // not empty, or zero otherwise. HB + U64 mLocalTexDataDigest; + + std::array mTextureId; + std::array mTextureTransform; + + // NOTE: initialize values to defaults according to the GLTF spec + // NOTE: these values should be in linear color space + LLColor4 mBaseColor; + LLColor3 mEmissiveColor; + + F32 mMetallicFactor; + F32 mRoughnessFactor; + F32 mAlphaCutoff; + + AlphaMode mAlphaMode; + bool mDoubleSided; + + // Override specific flags for state that can't use off-by-epsilon or UUID + // hack + bool mOverrideDoubleSided; + bool mOverrideAlphaMode; }; -- cgit v1.2.3 From c3e6f7b1643076df35a6960f735024078ddbb353 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 19 Feb 2024 21:33:38 +0100 Subject: Convert remaining cases of BOOL to bool in llmath and llprimitive Changed the return values for LLPrimitive::packTEMessage methods from FALSE to true - these seemed to be strange and wrong, especially considering the following statement in LLVOAvatarSelf: bool success = packTEMessage(mesgsys); --- indra/llprimitive/lldaeloader.cpp | 10 ++-- indra/llprimitive/llmaterial.cpp | 2 +- indra/llprimitive/llmaterial.h | 2 +- indra/llprimitive/llmaterialtable.cpp | 48 +++++++-------- indra/llprimitive/llmaterialtable.h | 18 +++--- indra/llprimitive/llmodel.cpp | 12 ++-- indra/llprimitive/llmodel.h | 12 ++-- indra/llprimitive/llmodelloader.cpp | 12 ++-- indra/llprimitive/llmodelloader.h | 6 +- indra/llprimitive/llprimitive.cpp | 110 +++++++++++++++++----------------- indra/llprimitive/llprimitive.h | 90 ++++++++++++++-------------- indra/llprimitive/lltextureanim.cpp | 18 +++--- indra/llprimitive/lltextureanim.h | 2 +- 13 files changed, 171 insertions(+), 171 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 2e4b013b77..cf7b40dc73 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -243,7 +243,7 @@ LLModel::EModelStatus load_face_from_dom_triangles( n[idx[i+norm_offset]*3+2])); } - BOOL found = FALSE; + bool found = false; LLVolumeFace::VertexMapData::PointMap::iterator point_iter; point_iter = point_map.find(LLVector3(cv.getPosition().getF32ptr())); @@ -498,7 +498,7 @@ LLModel::EModelStatus load_face_from_dom_polylist( cur_idx += idx_stride; - BOOL found = FALSE; + bool found = false; LLVolumeFace::VertexMapData::PointMap::iterator point_iter; LLVector3 pos3(cv.getPosition().getF32ptr()); @@ -510,7 +510,7 @@ LLModel::EModelStatus load_face_from_dom_polylist( { if ((point_iter->second)[k] == cv) { - found = TRUE; + found = true; U32 index = (point_iter->second)[k].mIndex; if (j == 0) { @@ -2266,7 +2266,7 @@ std::map LLDAELoader::getMaterials(LLModel* model LLImportMaterial LLDAELoader::profileToMaterial(domProfile_COMMON* material, DAE* dae) { LLImportMaterial mat; - mat.mFullbright = FALSE; + mat.mFullbright = false; daeElement* diffuse = material->getDescendant("diffuse"); if (diffuse) @@ -2351,7 +2351,7 @@ LLImportMaterial LLDAELoader::profileToMaterial(domProfile_COMMON* material, DAE LLColor4 emission_color = getDaeColor(emission); if (((emission_color[0] + emission_color[1] + emission_color[2]) / 3.0) > 0.25) { - mat.mFullbright = TRUE; + mat.mFullbright = true; } } diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index 0d146de949..e316df1d04 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -427,7 +427,7 @@ bool LLMaterial::operator != (const LLMaterial& rhs) const } -U32 LLMaterial::getShaderMask(U32 alpha_mode, BOOL is_alpha) +U32 LLMaterial::getShaderMask(U32 alpha_mode, bool is_alpha) { //NEVER incorporate this value into the message system -- this function will vary depending on viewer implementation //two least significant bits are "diffuse alpha mode" diff --git a/indra/llprimitive/llmaterial.h b/indra/llprimitive/llmaterial.h index 81f41ddc51..2bed37cbde 100644 --- a/indra/llprimitive/llmaterial.h +++ b/indra/llprimitive/llmaterial.h @@ -122,7 +122,7 @@ public: bool operator == (const LLMaterial& rhs) const; bool operator != (const LLMaterial& rhs) const; - U32 getShaderMask(U32 alpha_mode, BOOL is_alpha); + U32 getShaderMask(U32 alpha_mode, bool is_alpha); LLUUID getHash() const; protected: diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp index 58b2d00d44..32fc19efb3 100644 --- a/indra/llprimitive/llmaterialtable.cpp +++ b/indra/llprimitive/llmaterialtable.cpp @@ -341,21 +341,21 @@ void LLMaterialTable::initBasicTable() } } -BOOL LLMaterialTable::add(U8 mcode, const std::string& name, const LLUUID &uuid) +bool LLMaterialTable::add(U8 mcode, const std::string& name, const LLUUID &uuid) { LLMaterialInfo *infop; infop = new LLMaterialInfo(mcode,name,uuid); - if (!infop) return FALSE; + if (!infop) return false; // Add at the end so the order in menus matches the order in this // file. JNC 11.30.01 mMaterialInfoList.push_back(infop); - return TRUE; + return true; } -BOOL LLMaterialTable::addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid) +bool LLMaterialTable::addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid) { if (mCollisionSoundMatrix && (mcode < LL_MCODE_END) && (mcode2 < LL_MCODE_END)) { @@ -365,10 +365,10 @@ BOOL LLMaterialTable::addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid) mCollisionSoundMatrix[mcode2 * LL_MCODE_END + mcode] = uuid; } } - return TRUE; + return true; } -BOOL LLMaterialTable::addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) +bool LLMaterialTable::addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) { if (mSlidingSoundMatrix && (mcode < LL_MCODE_END) && (mcode2 < LL_MCODE_END)) { @@ -378,10 +378,10 @@ BOOL LLMaterialTable::addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) mSlidingSoundMatrix[mcode2 * LL_MCODE_END + mcode] = uuid; } } - return TRUE; + return true; } -BOOL LLMaterialTable::addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) +bool LLMaterialTable::addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) { if (mRollingSoundMatrix && (mcode < LL_MCODE_END) && (mcode2 < LL_MCODE_END)) { @@ -391,10 +391,10 @@ BOOL LLMaterialTable::addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid) mRollingSoundMatrix[mcode2 * LL_MCODE_END + mcode] = uuid; } } - return TRUE; + return true; } -BOOL LLMaterialTable::addShatterSound(U8 mcode, const LLUUID &uuid) +bool LLMaterialTable::addShatterSound(U8 mcode, const LLUUID &uuid) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -403,14 +403,14 @@ BOOL LLMaterialTable::addShatterSound(U8 mcode, const LLUUID &uuid) if (mcode == infop->mMCode) { infop->mShatterSoundID = uuid; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMaterialTable::addDensity(U8 mcode, const F32 &density) +bool LLMaterialTable::addDensity(U8 mcode, const F32 &density) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -419,14 +419,14 @@ BOOL LLMaterialTable::addDensity(U8 mcode, const F32 &density) if (mcode == infop->mMCode) { infop->mDensity = density; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMaterialTable::addRestitution(U8 mcode, const F32 &restitution) +bool LLMaterialTable::addRestitution(U8 mcode, const F32 &restitution) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -435,14 +435,14 @@ BOOL LLMaterialTable::addRestitution(U8 mcode, const F32 &restitution) if (mcode == infop->mMCode) { infop->mRestitution = restitution; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMaterialTable::addFriction(U8 mcode, const F32 &friction) +bool LLMaterialTable::addFriction(U8 mcode, const F32 &friction) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -451,14 +451,14 @@ BOOL LLMaterialTable::addFriction(U8 mcode, const F32 &friction) if (mcode == infop->mMCode) { infop->mFriction = friction; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL LLMaterialTable::addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod) +bool LLMaterialTable::addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod) { for (info_list_t::iterator iter = mMaterialInfoList.begin(); iter != mMaterialInfoList.end(); ++iter) @@ -469,11 +469,11 @@ BOOL LLMaterialTable::addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 infop->mHPModifier = hp_mod; infop->mDamageModifier = damage_mod; infop->mEPModifier = ep_mod; - return TRUE; + return true; } } - return FALSE; + return false; } LLUUID LLMaterialTable::getDefaultTextureID(const std::string& name) diff --git a/indra/llprimitive/llmaterialtable.h b/indra/llprimitive/llmaterialtable.h index 0cf5e626ef..61a4cf2470 100644 --- a/indra/llprimitive/llmaterialtable.h +++ b/indra/llprimitive/llmaterialtable.h @@ -106,15 +106,15 @@ public: void initTableTransNames(std::map namemap); - BOOL add(U8 mcode, const std::string& name, const LLUUID &uuid); - BOOL addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid); - BOOL addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); - BOOL addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); - BOOL addShatterSound(U8 mcode, const LLUUID &uuid); - BOOL addDensity(U8 mcode, const F32 &density); - BOOL addFriction(U8 mcode, const F32 &friction); - BOOL addRestitution(U8 mcode, const F32 &restitution); - BOOL addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod); + bool add(U8 mcode, const std::string& name, const LLUUID &uuid); + bool addCollisionSound(U8 mcode, U8 mcode2, const LLUUID &uuid); + bool addSlidingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); + bool addRollingSound(U8 mcode, U8 mcode2, const LLUUID &uuid); + bool addShatterSound(U8 mcode, const LLUUID &uuid); + bool addDensity(U8 mcode, const F32 &density); + bool addFriction(U8 mcode, const F32 &friction); + bool addRestitution(U8 mcode, const F32 &restitution); + bool addDamageAndEnergy(U8 mcode, const F32 &hp_mod, const F32 &damage_mod, const F32 &ep_mod); LLUUID getDefaultTextureID(const std::string& name); // LLUUID::null if not found LLUUID getDefaultTextureID(U8 mcode); // LLUUID::null if not found diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index 99a5697a84..ee6387608e 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -662,11 +662,11 @@ LLSD LLModel::writeModel( LLModel* low, LLModel* impostor, const LLModel::Decomposition& decomp, - BOOL upload_skin, - BOOL upload_joints, - BOOL lock_scale_if_joint_position, - BOOL nowrite, - BOOL as_slm, + bool upload_skin, + bool upload_joints, + bool lock_scale_if_joint_position, + bool nowrite, + bool as_slm, int submodel_id) { LLSD mdl; @@ -947,7 +947,7 @@ LLSD LLModel::writeModel( return writeModelToStream(ostr, mdl, nowrite, as_slm); } -LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite, BOOL as_slm) +LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, bool nowrite, bool as_slm) { std::string::size_type cur_offset = 0; diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 4505d6b3b9..f6c0061b3e 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -162,17 +162,17 @@ public: LLModel* low, LLModel* imposotr, const LLModel::Decomposition& decomp, - BOOL upload_skin, - BOOL upload_joints, - BOOL lock_scale_if_joint_position, - BOOL nowrite = FALSE, - BOOL as_slm = FALSE, + bool upload_skin, + bool upload_joints, + bool lock_scale_if_joint_position, + bool nowrite = false, + bool as_slm = false, int submodel_id = 0); static LLSD writeModelToStream( std::ostream& ostr, LLSD& mdl, - BOOL nowrite = FALSE, BOOL as_slm = FALSE); + bool nowrite = false, bool as_slm = false); void ClearFacesAndMaterials() { mVolumeFaces.clear(); mMaterialList.clear(); } diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp index fc826727e1..f1bd53cdc8 100644 --- a/indra/llprimitive/llmodelloader.cpp +++ b/indra/llprimitive/llmodelloader.cpp @@ -37,7 +37,7 @@ std::list LLModelLoader::sActiveLoaderList; -void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, BOOL& first_transform) +void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, bool& first_transform) { LLVector4a box[] = { @@ -74,7 +74,7 @@ void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4 if (first_transform) { - first_transform = FALSE; + first_transform = false; min = max = v; } else @@ -85,7 +85,7 @@ void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4 } } -void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& max, BOOL& first_transform) +void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& max, bool& first_transform) { LLVector4a mina, maxa; LLMatrix4a mata; @@ -121,7 +121,7 @@ LLModelLoader::LLModelLoader( , mFilename(filename) , mLod(lod) , mTrySLM(false) -, mFirstTransform(TRUE) +, mFirstTransform(true) , mNumOfFetchingTextures(0) , mLoadCallback(load_cb) , mJointLookupFunc(joint_lookup_func) @@ -337,7 +337,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename) //convert instance_list to mScene - mFirstTransform = TRUE; + mFirstTransform = true; for (U32 i = 0; i < instance_list.size(); ++i) { LLModelInstance& cur_instance = instance_list[i]; @@ -478,7 +478,7 @@ bool LLModelLoader::isRigSuitableForJointPositionUpload( const std::vectorcleanup(); @@ -770,16 +770,16 @@ S32 face_index_from_id(LLFaceID face_ID, const std::vector& fac return -1; } -BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume) +bool LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume) { if (NO_LOD == detail) { // build the new object setChanged(GEOMETRY); sVolumeManager->unrefVolume(mVolumep); - mVolumep = new LLVolume(volume_params, 1, TRUE, TRUE); + mVolumep = new LLVolume(volume_params, 1, true, true); setNumTEs(mVolumep->getNumFaces()); - return FALSE; + return false; } LLVolume *volumep; @@ -788,9 +788,9 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail); if (mVolumep.notNull() && volume_params == mVolumep->getParams() && (volume_detail == mVolumep->getDetail())) { - return FALSE; + return false; } - volumep = new LLVolume(volume_params, volume_detail, FALSE, TRUE); + volumep = new LLVolume(volume_params, volume_detail, false, true); } else { @@ -799,7 +799,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail); if (volume_params == mVolumep->getParams() && (volume_detail == mVolumep->getDetail())) { - return FALSE; + return false; } } @@ -807,7 +807,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai if (volumep == mVolumep) { sVolumeManager->unrefVolume( volumep ); // LLVolumeMgr::refVolume() creates a reference, but we don't need a second one. - return TRUE; + return true; } } @@ -819,7 +819,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai mVolumep = volumep; //mFaceMask = mVolumep->generateFaceMask(); setNumTEs(mVolumep->getNumFaces()); - return TRUE; + return true; } #if 0 @@ -871,14 +871,14 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai if (old_face_mask == new_face_mask) { // nothing to do - return TRUE; + return true; } if (mVolumep->getNumFaces() == 0 && new_face_mask != 0) { LL_WARNS() << "Object with 0 faces found...INCORRECT!" << LL_ENDL; setNumTEs(mVolumep->getNumFaces()); - return TRUE; + return true; } // initialize face_mapping @@ -1030,19 +1030,19 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai setNumTEs(mVolumep->getNumFaces()); #endif - return TRUE; + return true; } -BOOL LLPrimitive::setMaterial(U8 material) +bool LLPrimitive::setMaterial(U8 material) { if (material != mMaterial) { mMaterial = material; - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -1058,12 +1058,12 @@ S32 LLPrimitive::packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_fa for (face_index = last_face_index-1; face_index >= 0; face_index--) { - BOOL already_sent = FALSE; + bool already_sent = false; for (i = face_index+1; i <= last_face_index; i++) { if (!memcmp(data_ptr+(data_size *face_index), data_ptr+(data_size *i), data_size)) { - already_sent = TRUE; + already_sent = true; break; } } @@ -1201,7 +1201,7 @@ namespace // Pack information about all texture entries into container: // { TextureEntry Variable 2 } // Includes information about image ID, color, scale S,T, offset S,T and rotation -BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const +bool LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const { const U32 MAX_TES = 45; @@ -1282,11 +1282,11 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const } mesgsys->addBinaryDataFast(_PREHASH_TextureEntry, packed_buffer, (S32)(cur_ptr - packed_buffer)); - return FALSE; + return true; } -BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const +bool LLPrimitive::packTEMessage(LLDataPacker &dp) const { const U32 MAX_TES = 45; @@ -1367,7 +1367,7 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const } dp.packBinaryData(packed_buffer, (S32)(cur_ptr - packed_buffer), "TextureEntry"); - return FALSE; + return true; } S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec) @@ -1484,12 +1484,12 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) { // use a negative block_num to indicate a single-block read (a non-variable block) S32 retval = 0; - const U32 MAX_TES = 45; + constexpr U32 MAX_TES = 45; // Avoid construction of 32 UUIDs per call static LLMaterialID material_ids[MAX_TES]; - const U32 MAX_TE_BUFFER = 4096; + constexpr U32 MAX_TE_BUFFER = 4096; U8 packed_buffer[MAX_TE_BUFFER]; memset((void*)packed_buffer, 0, MAX_TE_BUFFER); @@ -1685,7 +1685,7 @@ bool LLPrimitive::getTESTAxes(const U8 face, U32* s_axis, U32* t_axis) //============================================================================ //static -BOOL LLNetworkData::isValid(U16 param_type, U32 size) +bool LLNetworkData::isValid(U16 param_type, U32 size) { // ew - better mechanism needed @@ -1707,7 +1707,7 @@ BOOL LLNetworkData::isValid(U16 param_type, U32 size) return (size == 9); } - return FALSE; + return false; } //============================================================================ @@ -1722,17 +1722,17 @@ LLLightParams::LLLightParams() mType = PARAMS_LIGHT; } -BOOL LLLightParams::pack(LLDataPacker &dp) const +bool LLLightParams::pack(LLDataPacker &dp) const { LLColor4U color4u(mColor); dp.packColor4U(color4u, "color"); dp.packF32(mRadius, "radius"); dp.packF32(mCutoff, "cutoff"); dp.packF32(mFalloff, "falloff"); - return TRUE; + return true; } -BOOL LLLightParams::unpack(LLDataPacker &dp) +bool LLLightParams::unpack(LLDataPacker &dp) { LLColor4U color; dp.unpackColor4U(color, "color"); @@ -1750,7 +1750,7 @@ BOOL LLLightParams::unpack(LLDataPacker &dp) dp.unpackF32(falloff, "falloff"); setFalloff(falloff); - return TRUE; + return true; } bool LLLightParams::operator==(const LLNetworkData& data) const @@ -1830,15 +1830,15 @@ LLReflectionProbeParams::LLReflectionProbeParams() mType = PARAMS_REFLECTION_PROBE; } -BOOL LLReflectionProbeParams::pack(LLDataPacker &dp) const +bool LLReflectionProbeParams::pack(LLDataPacker &dp) const { dp.packF32(mAmbiance, "ambiance"); dp.packF32(mClipDistance, "clip_distance"); dp.packU8(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLReflectionProbeParams::unpack(LLDataPacker &dp) +bool LLReflectionProbeParams::unpack(LLDataPacker &dp) { F32 ambiance; F32 clip_distance; @@ -1851,7 +1851,7 @@ BOOL LLReflectionProbeParams::unpack(LLDataPacker &dp) dp.unpackU8(mFlags, "flags"); - return TRUE; + return true; } bool LLReflectionProbeParams::operator==(const LLNetworkData& data) const @@ -1949,7 +1949,7 @@ LLFlexibleObjectData::LLFlexibleObjectData() mType = PARAMS_FLEXIBLE; } -BOOL LLFlexibleObjectData::pack(LLDataPacker &dp) const +bool LLFlexibleObjectData::pack(LLDataPacker &dp) const { // Custom, uber-svelte pack "softness" in upper bits of tension & drag U8 bit1 = (mSimulateLOD & 2) << 6; @@ -1959,10 +1959,10 @@ BOOL LLFlexibleObjectData::pack(LLDataPacker &dp) const dp.packU8((U8)((mGravity+10.f)*10.01f), "gravity"); dp.packU8((U8)(mWindSensitivity*10.01f), "wind"); dp.packVector3(mUserForce, "userforce"); - return TRUE; + return true; } -BOOL LLFlexibleObjectData::unpack(LLDataPacker &dp) +bool LLFlexibleObjectData::unpack(LLDataPacker &dp) { U8 tension, friction, gravity, wind; U8 bit1, bit2; @@ -1981,7 +1981,7 @@ BOOL LLFlexibleObjectData::unpack(LLDataPacker &dp) { mUserForce.setVec(0.f, 0.f, 0.f); } - return TRUE; + return true; } bool LLFlexibleObjectData::operator==(const LLNetworkData& data) const @@ -2077,15 +2077,15 @@ LLSculptParams::LLSculptParams() mSculptType = LL_SCULPT_TYPE_SPHERE; } -BOOL LLSculptParams::pack(LLDataPacker &dp) const +bool LLSculptParams::pack(LLDataPacker &dp) const { dp.packUUID(mSculptTexture, "texture"); dp.packU8(mSculptType, "type"); - return TRUE; + return true; } -BOOL LLSculptParams::unpack(LLDataPacker &dp) +bool LLSculptParams::unpack(LLDataPacker &dp) { U8 type; LLUUID id; @@ -2093,7 +2093,7 @@ BOOL LLSculptParams::unpack(LLDataPacker &dp) dp.unpackU8(type, "type"); setSculptTexture(id, type); - return TRUE; + return true; } bool LLSculptParams::operator==(const LLNetworkData& data) const @@ -2177,20 +2177,20 @@ LLLightImageParams::LLLightImageParams() mParams.setVec(F_PI*0.5f, 0.f, 0.f); } -BOOL LLLightImageParams::pack(LLDataPacker &dp) const +bool LLLightImageParams::pack(LLDataPacker &dp) const { dp.packUUID(mLightTexture, "texture"); dp.packVector3(mParams, "params"); - return TRUE; + return true; } -BOOL LLLightImageParams::unpack(LLDataPacker &dp) +bool LLLightImageParams::unpack(LLDataPacker &dp) { dp.unpackUUID(mLightTexture, "texture"); dp.unpackVector3(mParams, "params"); - return TRUE; + return true; } bool LLLightImageParams::operator==(const LLNetworkData& data) const @@ -2253,18 +2253,18 @@ LLExtendedMeshParams::LLExtendedMeshParams() mFlags = 0; } -BOOL LLExtendedMeshParams::pack(LLDataPacker &dp) const +bool LLExtendedMeshParams::pack(LLDataPacker &dp) const { dp.packU32(mFlags, "flags"); - return TRUE; + return true; } -BOOL LLExtendedMeshParams::unpack(LLDataPacker &dp) +bool LLExtendedMeshParams::unpack(LLDataPacker &dp) { dp.unpackU32(mFlags, "flags"); - return TRUE; + return true; } bool LLExtendedMeshParams::operator==(const LLNetworkData& data) const @@ -2316,7 +2316,7 @@ LLRenderMaterialParams::LLRenderMaterialParams() mType = PARAMS_RENDER_MATERIAL; } -BOOL LLRenderMaterialParams::pack(LLDataPacker& dp) const +bool LLRenderMaterialParams::pack(LLDataPacker& dp) const { U8 count = (U8)llmin((S32)mEntries.size(), 14); //limited to 255 bytes, no more than 14 material ids @@ -2327,10 +2327,10 @@ BOOL LLRenderMaterialParams::pack(LLDataPacker& dp) const dp.packUUID(entry.id, "id"); } - return TRUE; + return true; } -BOOL LLRenderMaterialParams::unpack(LLDataPacker& dp) +bool LLRenderMaterialParams::unpack(LLDataPacker& dp) { U8 count; dp.unpackU8(count, "count"); @@ -2341,7 +2341,7 @@ BOOL LLRenderMaterialParams::unpack(LLDataPacker& dp) dp.unpackUUID(entry.id, "te_id"); } - return TRUE; + return true; } bool LLRenderMaterialParams::operator==(const LLNetworkData& data) const diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 0b7dbd703a..45307d567c 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -114,11 +114,11 @@ public: public: U16 mType; virtual ~LLNetworkData() {}; - virtual BOOL pack(LLDataPacker &dp) const = 0; - virtual BOOL unpack(LLDataPacker &dp) = 0; + virtual bool pack(LLDataPacker &dp) const = 0; + virtual bool unpack(LLDataPacker &dp) = 0; virtual bool operator==(const LLNetworkData& data) const = 0; virtual void copy(const LLNetworkData& data) = 0; - static BOOL isValid(U16 param_type, U32 size); + static bool isValid(U16 param_type, U32 size); }; extern const F32 LIGHT_MIN_RADIUS; @@ -141,8 +141,8 @@ private: public: LLLightParams(); - /*virtual*/ BOOL pack(LLDataPacker &dp) const; - /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool pack(LLDataPacker &dp) const; + /*virtual*/ bool unpack(LLDataPacker &dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); // LLSD implementations here are provided by Eddy Stryker. @@ -195,8 +195,8 @@ protected: public: LLReflectionProbeParams(); - /*virtual*/ BOOL pack(LLDataPacker& dp) const; - /*virtual*/ BOOL unpack(LLDataPacker& dp); + /*virtual*/ bool pack(LLDataPacker& dp) const; + /*virtual*/ bool unpack(LLDataPacker& dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); // LLSD implementations here are provided by Eddy Stryker. @@ -255,8 +255,8 @@ extern const F32 FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY; extern const F32 FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE; extern const F32 FLEXIBLE_OBJECT_DEFAULT_LENGTH; -extern const BOOL FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE; -extern const BOOL FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE; +extern const bool FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE; +extern const bool FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE; class LLFlexibleObjectData : public LLNetworkData @@ -268,8 +268,8 @@ protected: F32 mWindSensitivity; // interacts with tension, air friction, and gravity F32 mTension; //interacts in complex ways with other parameters LLVector3 mUserForce; // custom user-defined force vector - //BOOL mUsingCollisionSphere; - //BOOL mRenderingCollisionSphere; + //bool mUsingCollisionSphere; + //bool mRenderingCollisionSphere; public: void setSimulateLOD(S32 lod) { mSimulateLOD = llclamp(lod, (S32)FLEXIBLE_OBJECT_MIN_SECTIONS, (S32)FLEXIBLE_OBJECT_MAX_SECTIONS); } @@ -288,8 +288,8 @@ public: //------ the constructor for the structure ------------ LLFlexibleObjectData(); - BOOL pack(LLDataPacker &dp) const; - BOOL unpack(LLDataPacker &dp); + bool pack(LLDataPacker &dp) const; + bool unpack(LLDataPacker &dp); bool operator==(const LLNetworkData& data) const; void copy(const LLNetworkData& data); LLSD asLLSD() const; @@ -307,8 +307,8 @@ protected: public: LLSculptParams(); - /*virtual*/ BOOL pack(LLDataPacker &dp) const; - /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool pack(LLDataPacker &dp) const; + /*virtual*/ bool unpack(LLDataPacker &dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); LLSD asLLSD() const; @@ -328,8 +328,8 @@ protected: public: LLLightImageParams(); - /*virtual*/ BOOL pack(LLDataPacker &dp) const; - /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool pack(LLDataPacker &dp) const; + /*virtual*/ bool unpack(LLDataPacker &dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); LLSD asLLSD() const; @@ -353,8 +353,8 @@ public: static const U32 ANIMATED_MESH_ENABLED_FLAG = 0x1 << 0; LLExtendedMeshParams(); - /*virtual*/ BOOL pack(LLDataPacker &dp) const; - /*virtual*/ BOOL unpack(LLDataPacker &dp); + /*virtual*/ bool pack(LLDataPacker &dp) const; + /*virtual*/ bool unpack(LLDataPacker &dp); /*virtual*/ bool operator==(const LLNetworkData& data) const; /*virtual*/ void copy(const LLNetworkData& data); LLSD asLLSD() const; @@ -378,8 +378,8 @@ private: public: LLRenderMaterialParams(); - BOOL pack(LLDataPacker& dp) const override; - BOOL unpack(LLDataPacker& dp) override; + bool pack(LLDataPacker& dp) const override; + bool unpack(LLDataPacker& dp) override; bool operator==(const LLNetworkData& data) const override; void copy(const LLNetworkData& data) override; @@ -392,7 +392,7 @@ public: // This code is not naming-standards compliant. Leaving it like this for // now to make the connection to code in -// BOOL packTEMessage(LLDataPacker &dp) const; +// bool packTEMessage(LLDataPacker &dp) const; // more obvious. This should be refactored to remove the duplication, at which // point we can fix the names as well. // - Vir @@ -454,10 +454,10 @@ public: void setPCode(const LLPCode pcode); const LLVolume *getVolumeConst() const { return mVolumep; } // HACK for Windoze confusion about ostream operator in LLVolume LLVolume *getVolume() const { return mVolumep; } - virtual BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); + virtual bool setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); // Modify texture entry properties - inline BOOL validTE(const U8 te_num) const; + inline bool validTE(const U8 te_num) const; LLTextureEntry* getTE(const U8 te_num) const; virtual void setNumTEs(const U8 num_tes); @@ -486,17 +486,17 @@ public: virtual S32 setTEGlow(const U8 te, const F32 glow); virtual S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID); virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams); - virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed + virtual bool setMaterial(const U8 material); // returns true if material changed virtual void setTESelected(const U8 te, bool sel); LLMaterialPtr getTEMaterialParams(const U8 index); void copyTEs(const LLPrimitive *primitive); S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const; - BOOL packTEMessage(LLMessageSystem *mesgsys) const; - BOOL packTEMessage(LLDataPacker &dp) const; + bool packTEMessage(LLMessageSystem *mesgsys) const; + bool packTEMessage(LLDataPacker &dp) const; S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num); // Variable num of blocks - BOOL unpackTEMessage(LLDataPacker &dp); + S32 unpackTEMessage(LLDataPacker &dp); S32 parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec); S32 applyParsedTEMessage(LLTEContents& tec); @@ -554,9 +554,9 @@ public: // takes the contents of other_list and clears other_list void takeTextureList(LLPrimTextureList& other_list); - inline BOOL isAvatar() const; - inline BOOL isSittingAvatar() const; - inline BOOL isSittingAvatarOnGround() const; + inline bool isAvatar() const; + inline bool isSittingAvatar() const; + inline bool isSittingAvatarOnGround() const; inline bool hasBumpmap() const { return mNumBumpmapTEs > 0;} void setFlags(U32 flags) { mMiscFlags = flags; } @@ -569,10 +569,10 @@ public: static U8 pCodeToLegacy(const LLPCode pcode); static bool getTESTAxes(const U8 face, U32* s_axis, U32* t_axis); - BOOL hasRenderMaterialParams() const; + bool hasRenderMaterialParams() const; - inline static BOOL isPrimitive(const LLPCode pcode); - inline static BOOL isApp(const LLPCode pcode); + inline static bool isPrimitive(const LLPCode pcode); + inline static bool isApp(const LLPCode pcode); private: void updateNumBumpmap(const U8 index, const U8 bump); @@ -598,39 +598,39 @@ public: }; }; -inline BOOL LLPrimitive::isAvatar() const +inline bool LLPrimitive::isAvatar() const { - return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode ) ? TRUE : FALSE; + return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode ) ? true : false; } -inline BOOL LLPrimitive::isSittingAvatar() const +inline bool LLPrimitive::isSittingAvatar() const { // this is only used server-side return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode - && ((getFlags() & (PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND)) != 0) ) ? TRUE : FALSE; + && ((getFlags() & (PRIM_FLAG_SITTING | PRIM_FLAG_SITTING_ON_GROUND)) != 0) ) ? true : false; } -inline BOOL LLPrimitive::isSittingAvatarOnGround() const +inline bool LLPrimitive::isSittingAvatarOnGround() const { // this is only used server-side return ( LL_PCODE_LEGACY_AVATAR == mPrimitiveCode - && ((getFlags() & PRIM_FLAG_SITTING_ON_GROUND) != 0) ) ? TRUE : FALSE; + && ((getFlags() & PRIM_FLAG_SITTING_ON_GROUND) != 0) ) ? true : false; } // static -inline BOOL LLPrimitive::isPrimitive(const LLPCode pcode) +inline bool LLPrimitive::isPrimitive(const LLPCode pcode) { LLPCode base_type = pcode & LL_PCODE_BASE_MASK; if (base_type && (base_type < LL_PCODE_APP)) { - return TRUE; + return true; } - return FALSE; + return false; } // static -inline BOOL LLPrimitive::isApp(const LLPCode pcode) +inline bool LLPrimitive::isApp(const LLPCode pcode) { LLPCode base_type = pcode & LL_PCODE_BASE_MASK; @@ -786,7 +786,7 @@ void LLPrimitive::setAcceleration(const F32 x, const F32 y, const F32 z) } #endif // CHECK_FOR_FINITE -inline BOOL LLPrimitive::validTE(const U8 te_num) const +inline bool LLPrimitive::validTE(const U8 te_num) const { return (mNumTEs && te_num < mNumTEs); } diff --git a/indra/llprimitive/lltextureanim.cpp b/indra/llprimitive/lltextureanim.cpp index 7c48e57a1a..8933b3287c 100644 --- a/indra/llprimitive/lltextureanim.cpp +++ b/indra/llprimitive/lltextureanim.cpp @@ -54,38 +54,38 @@ void LLTextureAnim::reset() mRate = 1.f; } -BOOL LLTextureAnim::equals(const LLTextureAnim &other) const +bool LLTextureAnim::equals(const LLTextureAnim &other) const { if (mMode != other.mMode) { - return FALSE; + return false; } if (mFace != other.mFace) { - return FALSE; + return false; } if (mSizeX != other.mSizeX) { - return FALSE; + return false; } if (mSizeY != other.mSizeY) { - return FALSE; + return false; } if (mStart != other.mStart) { - return FALSE; + return false; } if (mLength != other.mLength) { - return FALSE; + return false; } if (mRate != other.mRate) { - return FALSE; + return false; } - return TRUE; + return true; } void LLTextureAnim::packTAMessage(LLMessageSystem *mesgsys) const { diff --git a/indra/llprimitive/lltextureanim.h b/indra/llprimitive/lltextureanim.h index f0d9f9df5c..5c388175f1 100644 --- a/indra/llprimitive/lltextureanim.h +++ b/indra/llprimitive/lltextureanim.h @@ -44,7 +44,7 @@ public: void packTAMessage(LLDataPacker &dp) const; void unpackTAMessage(LLMessageSystem *mesgsys, const S32 block_num); void unpackTAMessage(LLDataPacker &dp); - BOOL equals(const LLTextureAnim &other) const; + bool equals(const LLTextureAnim &other) const; LLSD asLLSD() const; operator LLSD() const { return asLLSD(); } bool fromLLSD(LLSD& sd); -- cgit v1.2.3 From e160758b5c32f7b4b9622a5c25c7c53070395c7d Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 1 Mar 2024 13:48:46 +0100 Subject: Convert remaining TRUE/FALSE to true/false --- indra/llprimitive/tests/llprimitive_test.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/llprimitive') diff --git a/indra/llprimitive/tests/llprimitive_test.cpp b/indra/llprimitive/tests/llprimitive_test.cpp index 0ff0795fdc..284edc5901 100644 --- a/indra/llprimitive/tests/llprimitive_test.cpp +++ b/indra/llprimitive/tests/llprimitive_test.cpp @@ -46,7 +46,7 @@ public: if (mVolumeTest.isNull() || volume_params != mCurrParamsTest || detail != mCurrDetailTest) { F32 volume_detail = LLVolumeLODGroup::getVolumeScaleFromDetail(detail); - mVolumeTest = new LLVolume(volume_params, volume_detail, FALSE, FALSE); + mVolumeTest = new LLVolume(volume_params, volume_detail, false, false); mCurrParamsTest = volume_params; mCurrDetailTest = detail; return mVolumeTest; @@ -193,7 +193,7 @@ namespace tut ensure(!primitive.isChanged(LLXform::GEOMETRY)); // Make sure setVolume returns true - ensure(primitive.setVolume(params, 0, true) == TRUE); + ensure(primitive.setVolume(params, 0, true) == true); LLVolume* new_volume = primitive.getVolume(); // make sure new volume was actually created @@ -210,12 +210,12 @@ namespace tut ensure(primitive.isChanged(LLXform::GEOMETRY)); // Run it twice to make sure it doesn't create a different one if params are the same - ensure(primitive.setVolume(params, 0, true) == FALSE); + ensure(primitive.setVolume(params, 0, true) == false); ensure(new_volume == primitive.getVolume()); // Change the param definition and try setting it again. params.setRevolutions(4); - ensure(primitive.setVolume(params, 0, true) == TRUE); + ensure(primitive.setVolume(params, 0, true) == true); // Ensure that we now have a different volume ensure(new_volume != primitive.getVolume()); @@ -238,7 +238,7 @@ namespace tut ensure(!primitive.isChanged(LLXform::GEOMETRY)); // Make sure setVolume returns true - ensure(primitive.setVolume(params, 0, false) == TRUE); + ensure(primitive.setVolume(params, 0, false) == true); LLVolume* new_volume = primitive.getVolume(); @@ -256,12 +256,12 @@ namespace tut ensure(primitive.isChanged(LLXform::GEOMETRY)); // Run it twice to make sure it doesn't create a different one if params are the same - ensure(primitive.setVolume(params, 0, false) == FALSE); + ensure(primitive.setVolume(params, 0, false) == false); ensure(new_volume == primitive.getVolume()); // Change the param definition and try setting it again. params.setRevolutions(4); - ensure(primitive.setVolume(params, 0, false) == TRUE); + ensure(primitive.setVolume(params, 0, false) == true); // Ensure that we now have a different volume ensure(new_volume != primitive.getVolume()); -- cgit v1.2.3