diff options
Diffstat (limited to 'indra/llprimitive')
-rw-r--r-- | indra/llprimitive/lldaeloader.cpp | 10 | ||||
-rw-r--r-- | indra/llprimitive/llgltfmaterial.cpp | 109 | ||||
-rw-r--r-- | indra/llprimitive/llgltfmaterial.h | 67 | ||||
-rw-r--r-- | indra/llprimitive/llmaterial.cpp | 2 | ||||
-rw-r--r-- | indra/llprimitive/llmaterial.h | 2 | ||||
-rw-r--r-- | indra/llprimitive/llmaterialtable.cpp | 48 | ||||
-rw-r--r-- | indra/llprimitive/llmaterialtable.h | 18 | ||||
-rw-r--r-- | indra/llprimitive/llmodel.cpp | 12 | ||||
-rw-r--r-- | indra/llprimitive/llmodel.h | 12 | ||||
-rw-r--r-- | indra/llprimitive/llmodelloader.cpp | 12 | ||||
-rw-r--r-- | indra/llprimitive/llmodelloader.h | 6 | ||||
-rw-r--r-- | indra/llprimitive/llprimitive.cpp | 123 | ||||
-rw-r--r-- | indra/llprimitive/llprimitive.h | 93 | ||||
-rw-r--r-- | indra/llprimitive/lltextureanim.cpp | 18 | ||||
-rw-r--r-- | indra/llprimitive/lltextureanim.h | 2 | ||||
-rw-r--r-- | indra/llprimitive/lltextureentry.cpp | 1 | ||||
-rw-r--r-- | indra/llprimitive/lltextureentry.h | 2 | ||||
-rw-r--r-- | indra/llprimitive/tests/llprimitive_test.cpp | 14 |
18 files changed, 334 insertions, 217 deletions
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp index 2c357e1ac5..b3ae249951 100644 --- a/indra/llprimitive/lldaeloader.cpp +++ b/indra/llprimitive/lldaeloader.cpp @@ -241,7 +241,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())); @@ -496,7 +496,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()); @@ -508,7 +508,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) { @@ -2264,7 +2264,7 @@ std::map<std::string, LLImportMaterial> 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) @@ -2349,7 +2349,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/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index 237636bd0b..12af568b7e 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()) { @@ -767,7 +828,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()) @@ -793,27 +854,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) { @@ -834,6 +904,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 f62cab1a61..90f1ecfa8f 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,18 @@ public: static const char* const GLTF_FILE_EXTENSION_TRANSFORM_ROTATION; static const LLUUID GLTF_OVERRIDE_NULL_UUID; - std::array<LLUUID, GLTF_TEXTURE_INFO_COUNT> mTextureId; - std::array<TextureTransform, GLTF_TEXTURE_INFO_COUNT> 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; - - AlphaMode mAlphaMode = ALPHA_MODE_OPAQUE; - + // *TODO: If/when we implement additional GLTF extensions, they may not be + // compatible with our GLTF terrain implementation. We may want to disallow + // materials with some features from being set on terrain, if their + // implementation on terrain is not compliant with the spec: + // - KHR_materials_transmission: Probably OK? + // - KHR_materials_ior: Probably OK? + // - KHR_materials_volume: Likely incompatible, as our terrain + // heightmaps cannot currently be described as finite enclosed + // volumes. + // See also LLPanelRegionTerrainInfo::validateMaterials bool mDoubleSided = false; - // override specific flags for state that can't use off-by-epsilon or UUID hack - bool mOverrideDoubleSided = false; - bool mOverrideAlphaMode = false; // These fields are local to viewer and are a part of local bitmap support typedef std::map<LLUUID, LLUUID> local_tex_map_t; @@ -235,7 +228,6 @@ public: bool hasLocalTextures() { return !mTrackingIdToLocalTexture.empty(); } virtual bool replaceLocalTexture(const LLUUID& tracking_id, const LLUUID &old_id, const LLUUID& new_id); virtual void updateTextureTracking(); - protected: static LLVector2 vec2FromJson(const std::map<std::string, tinygltf::Value>& object, const char* key, const LLVector2& default_value); static F32 floatFromJson(const std::map<std::string, tinygltf::Value>& object, const char* key, const F32 default_value); @@ -252,4 +244,41 @@ protected: void writeToTexture(tinygltf::Model& model, T& texture_info, TextureInfo texture_info_id, bool force_write = false) const; template<typename T> 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<LLUUID, LLUUID> 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<LLUUID, GLTF_TEXTURE_INFO_COUNT> mTextureId; + std::array<TextureTransform, GLTF_TEXTURE_INFO_COUNT> 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 = false; + + // Override specific flags for state that can't use off-by-epsilon or UUID + // hack + bool mOverrideDoubleSided = false; + bool mOverrideAlphaMode = false; }; 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<std::string, std::string> 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 7b0d2632aa..905292a44f 100644 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -663,11 +663,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; @@ -948,7 +948,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 040257e00e..1242646a8a 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -165,17 +165,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*> 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::vector<std:: //called in the main thread void LLModelLoader::loadTextures() { - BOOL is_paused = isPaused() ; + bool is_paused = isPaused() ; pause() ; //pause the loader for(scene::iterator iter = mScene.begin(); iter != mScene.end(); ++iter) diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h index fbc74554a0..e00dd9668f 100644 --- a/indra/llprimitive/llmodelloader.h +++ b/indra/llprimitive/llmodelloader.h @@ -104,7 +104,7 @@ public: S32 mLod; LLMatrix4 mTransform; - BOOL mFirstTransform; + bool mFirstTransform; LLVector3 mExtents[2]; bool mTrySLM; @@ -215,7 +215,7 @@ protected: static bool isAlive(LLModelLoader* loader) ; }; class LLMatrix4a; -void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, BOOL& first_transform); -void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& max, BOOL& first_transform); +void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, bool& first_transform); +void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& max, bool& first_transform); #endif // LL_LLMODELLOADER_H diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 904747af2d..a4f9132ddd 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -115,8 +115,8 @@ const F32 FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY = 10.0f; const F32 FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE = 0.99f; const F32 FLEXIBLE_OBJECT_DEFAULT_LENGTH = 1.0f; -const BOOL FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE = FALSE; -const BOOL FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE = FALSE; +const bool FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE = false; +const bool FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE = false; const char *SCULPT_DEFAULT_TEXTURE = "be293869-d0d9-0a69-5989-ad27f1946fd4"; // old inverted texture: "7595d345-a24c-e7ef-f0bd-78793792133e"; @@ -172,7 +172,7 @@ void LLPrimitive::setVolumeManager( LLVolumeMgr* volume_manager ) // static bool LLPrimitive::cleanupVolumeManager() { - BOOL res = FALSE; + bool res = false; if (sVolumeManager) { res = sVolumeManager->cleanup(); @@ -770,16 +770,16 @@ S32 face_index_from_id(LLFaceID face_ID, const std::vector<LLProfile::Face>& 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 @@ -1934,6 +1934,19 @@ void LLReflectionProbeParams::setIsDynamic(bool is_dynamic) } } + +void LLReflectionProbeParams::setIsMirror(bool is_mirror) +{ + if (is_mirror) + { + mFlags |= FLAG_MIRROR; + } + else + { + mFlags &= ~FLAG_MIRROR; + } +} + //============================================================================ LLFlexibleObjectData::LLFlexibleObjectData() { @@ -1949,7 +1962,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 +1972,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 +1994,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 +2090,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 +2106,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 +2190,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 +2266,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 +2329,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 +2340,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 +2354,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..c4fe4fdf62 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. @@ -186,6 +186,7 @@ public: { FLAG_BOX_VOLUME = 0x01, // use a box influence volume FLAG_DYNAMIC = 0x02, // render dynamic objects (avatars) into this Reflection Probe + FLAG_MIRROR = 0x04, // This probe is used for reflections on realtime mirrors. }; protected: @@ -195,8 +196,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. @@ -209,11 +210,13 @@ public: void setClipDistance(F32 distance) { mClipDistance = llclamp(distance, REFLECTION_PROBE_MIN_CLIP_DISTANCE, REFLECTION_PROBE_MAX_CLIP_DISTANCE); } void setIsBox(bool is_box); void setIsDynamic(bool is_dynamic); + void setIsMirror(bool is_mirror); F32 getAmbiance() const { return mAmbiance; } F32 getClipDistance() const { return mClipDistance; } bool getIsBox() const { return (mFlags & FLAG_BOX_VOLUME) != 0; } bool getIsDynamic() const { return (mFlags & FLAG_DYNAMIC) != 0; } + bool getIsMirror() const { return (mFlags & FLAG_MIRROR) != 0; } }; //------------------------------------------------- @@ -255,8 +258,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 +271,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 +291,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 +310,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 +331,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 +356,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 +381,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 +395,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 +457,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 +489,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 +557,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 +572,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 +601,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 +789,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); diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index 71caff1686..ee2a4c769a 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -685,6 +685,7 @@ S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams) mMaterialUpdatePending = true; } mMaterial = pMaterialParams; + return TEM_CHANGE_TEXTURE; } diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h index f5f2c0172d..0935147688 100644 --- a/indra/llprimitive/lltextureentry.h +++ b/indra/llprimitive/lltextureentry.h @@ -134,7 +134,7 @@ public: S32 setGlow(F32 glow); S32 setMaterialID(const LLMaterialID& pMaterialID); S32 setMaterialParams(const LLMaterialPtr pMaterialParams); - + virtual const LLUUID &getID() const { return mID; } const LLColor4 &getColor() const { return mColor; } const F32 getAlpha() const { return mColor.mV[VALPHA]; } 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()); |