diff options
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r-- | indra/newview/llviewerobject.cpp | 684 |
1 files changed, 280 insertions, 404 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index a53c9c3d23..c791a30d1a 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -110,19 +110,19 @@ //#define DEBUG_UPDATE_TYPE -BOOL LLViewerObject::sVelocityInterpolate = TRUE; -BOOL LLViewerObject::sPingInterpolate = TRUE; +bool LLViewerObject::sVelocityInterpolate = true; +bool LLViewerObject::sPingInterpolate = true; U32 LLViewerObject::sNumZombieObjects = 0; S32 LLViewerObject::sNumObjects = 0; -BOOL LLViewerObject::sMapDebug = TRUE; +bool LLViewerObject::sMapDebug = true; LLColor4 LLViewerObject::sEditSelectColor( 1.0f, 1.f, 0.f, 0.3f); // Edit OK LLColor4 LLViewerObject::sNoEditSelectColor( 1.0f, 0.f, 0.f, 0.3f); // Can't edit S32 LLViewerObject::sAxisArrowLength(50); -BOOL LLViewerObject::sPulseEnabled(FALSE); -BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE +bool LLViewerObject::sPulseEnabled(false); +bool LLViewerObject::sUseSharedDrawables(false); // true // sMaxUpdateInterpolationTime must be greater than sPhaseOutUpdateInterpolationTime F64Seconds LLViewerObject::sMaxUpdateInterpolationTime(3.0); // For motion interpolation: after X seconds with no updates, don't predict object motion @@ -246,7 +246,7 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco return res; } -LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global) +LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, bool is_global) : LLPrimitive(), mChildList(), mID(id), @@ -256,7 +256,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mTEImages(NULL), mTENormalMaps(NULL), mTESpecularMaps(NULL), - mbCanSelect(TRUE), + mbCanSelect(true), mFlags(0), mPhysicsShapeType(0), mPhysicsGravity(0), @@ -264,8 +264,8 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mPhysicsDensity(0), mPhysicsRestitution(0), mDrawable(), - mCreateSelected(FALSE), - mRenderMedia(FALSE), + mCreateSelected(false), + mRenderMedia(false), mBestUpdatePrecision(0), mText(), mHudText(""), @@ -286,14 +286,14 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mExpectedInventorySerialNum(0), mInvRequestState(INVENTORY_REQUEST_STOPPED), mInvRequestXFerId(0), - mInventoryDirty(FALSE), + mInventoryDirty(false), mRegionp(regionp), - mDead(FALSE), - mOrphaned(FALSE), - mUserSelected(FALSE), - mOnActiveList(FALSE), - mOnMap(FALSE), - mStatic(FALSE), + mDead(false), + mOrphaned(false), + mUserSelected(false), + mOnActiveList(false), + mOnMap(false), + mStatic(false), mSeatCount(0), mNumFaces(0), mRotTime(0.f), @@ -310,7 +310,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mPhysicsShapeUnknown(true), mAttachmentItemID(LLUUID::null), mLastUpdateType(OUT_UNKNOWN), - mLastUpdateCached(FALSE), + mLastUpdateCached(false), mCachedMuteListUpdateTime(0), mCachedOwnerInMuteList(false), mRiggedAttachedWarned(false) @@ -447,7 +447,7 @@ void LLViewerObject::markDead() } // Mark itself as dead - mDead = TRUE; + mDead = true; if(mRegionp) { mRegionp->removeFromCreatedList(getLocalID()); @@ -751,7 +751,7 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list) } } -BOOL LLViewerObject::isAnySelected() const +bool LLViewerObject::isAnySelected() const { bool any_selected = isSelected(); for (child_list_t::const_iterator iter = mChildList.begin(); @@ -763,7 +763,7 @@ BOOL LLViewerObject::isAnySelected() const return any_selected; } -void LLViewerObject::setSelected(BOOL sel) +void LLViewerObject::setSelected(bool sel) { mUserSelected = sel; resetRot(); @@ -900,12 +900,12 @@ bool LLViewerObject::crossesParcelBounds() return mRegionp && mRegionp->objectsCrossParcel(boxes); } -BOOL LLViewerObject::setParent(LLViewerObject* parent) +bool LLViewerObject::setParent(LLViewerObject* parent) { if(mParent != parent) { LLViewerObject* old_parent = (LLViewerObject*)mParent ; - BOOL ret = LLPrimitive::setParent(parent); + bool ret = LLPrimitive::setParent(parent); if(ret && old_parent && parent) { old_parent->removeChild(this) ; @@ -913,7 +913,7 @@ BOOL LLViewerObject::setParent(LLViewerObject* parent) return ret ; } - return FALSE ; + return false ; } void LLViewerObject::addChild(LLViewerObject *childp) @@ -981,7 +981,7 @@ void LLViewerObject::removeChild(LLViewerObject *childp) if (childp->isSelected()) { LLSelectMgr::getInstance()->deselectObjectAndFamily(childp); - BOOL add_to_end = TRUE; + bool add_to_end = true; LLSelectMgr::getInstance()->selectObjectAndFamily(childp, add_to_end); } } @@ -1019,35 +1019,35 @@ void LLViewerObject::addThisAndNonJointChildren(std::vector<LLViewerObject*>& ob } } -BOOL LLViewerObject::isChild(LLViewerObject *childp) const +bool LLViewerObject::isChild(LLViewerObject *childp) const { for (child_list_t::const_iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { LLViewerObject* testchild = *iter; if (testchild == childp) - return TRUE; + return true; } - return FALSE; + return false; } -// returns TRUE if at least one avatar is sitting on this object -BOOL LLViewerObject::isSeat() const +// returns true if at least one avatar is sitting on this object +bool LLViewerObject::isSeat() const { return mSeatCount > 0; } -BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp) +bool LLViewerObject::setDrawableParent(LLDrawable* parentp) { if (mDrawable.isNull()) { - return FALSE; + return false; } - BOOL ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL); + bool ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL); if(!ret) { - return FALSE ; + return false ; } LLDrawable* old_parent = mDrawable->mParent; mDrawable->mParent = parentp; @@ -1063,11 +1063,11 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp) || (parentp && parentp->isActive())) { // *TODO we should not be relying on setDrawable parent to call markMoved - gPipeline.markMoved(mDrawable, FALSE); + gPipeline.markMoved(mDrawable, false); } else if (!mDrawable->isAvatar()) { - mDrawable->updateXform(TRUE); + mDrawable->updateXform(true); /*if (!mDrawable->getSpatialGroup()) { mDrawable->movePartition(); @@ -1078,7 +1078,7 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp) } // Show or hide particles, icon and HUD -void LLViewerObject::hideExtraDisplayItems( BOOL hidden ) +void LLViewerObject::hideExtraDisplayItems( bool hidden ) { if( mPartSourcep.notNull() ) { @@ -1108,7 +1108,7 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url) mMedia = new LLViewerObjectMedia; mMedia->mMediaURL = media_url; mMedia->mMediaType = LLViewerObject::MEDIA_SET; - mMedia->mPassedWhitelist = FALSE; + mMedia->mPassedWhitelist = false; } else if (mMedia) { @@ -1130,7 +1130,7 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url) retval |= MEDIA_URL_UPDATED; } mMedia->mMediaURL = media_url; - mMedia->mPassedWhitelist = FALSE; + mMedia->mPassedWhitelist = false; } } return retval; @@ -1166,6 +1166,20 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, LL_DEBUGS("ObjectUpdate") << " mesgsys " << mesgsys << " dp " << dp << " id " << getID() << " update_type " << (S32) update_type << LL_ENDL; dumpStack("ObjectUpdateStack"); + // The new OBJECTDATA_FIELD_SIZE_124, OBJECTDATA_FIELD_SIZE_140, OBJECTDATA_FIELD_SIZE_80 + // and OBJECTDATA_FIELD_SIZE_64 lengths should be supported in the existing cases below. + // Each case should start at the beginning of the buffer and extract all known + // values, and ignore any unknown data at the end of the buffer. + // This allows new data in the future without breaking current viewers. + const S32 OBJECTDATA_FIELD_SIZE_140 = 140; // Full precision avatar update for future extended data + const S32 OBJECTDATA_FIELD_SIZE_124 = 124; // Full precision object update for future extended data + const S32 OBJECTDATA_FIELD_SIZE_76 = 76; // Full precision avatar update + const S32 OBJECTDATA_FIELD_SIZE_60 = 60; // Full precision object update + const S32 OBJECTDATA_FIELD_SIZE_80 = 80; // Terse avatar update, 16 bit precision for future extended data + const S32 OBJECTDATA_FIELD_SIZE_64 = 64; // Terse object update, 16 bit precision for future extended data + const S32 OBJECTDATA_FIELD_SIZE_48 = 48; // Terse avatar update, 16 bit precision + const S32 OBJECTDATA_FIELD_SIZE_32 = 32; // Terse object update, 16 bit precision + U32 retval = 0x0; // If region is removed from the list it is also deleted. @@ -1213,7 +1227,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U32 x, y; from_region_handle(region_handle, &x, &y); - LL_ERRS() << "Object has invalid region " << x << ":" << y << "!" << LL_ENDL; + LL_WARNS("UpdateFail") << "Object has invalid region " << x << ":" << y << "!" << LL_ENDL; return retval; } @@ -1240,8 +1254,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, const F32 size = LLWorld::getInstance()->getRegionWidthInMeters(); const F32 MAX_HEIGHT = LLWorld::getInstance()->getRegionMaxHeight(); const F32 MIN_HEIGHT = LLWorld::getInstance()->getRegionMinHeight(); - S32 length; - S32 count; + S32 length = 0; + S32 count = 0; S32 this_update_precision = 32; // in bits // Temporaries, because we need to compare w/ previous to set dirty flags... @@ -1302,6 +1316,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, mesgsys->getVector3Fast(_PREHASH_ObjectData, _PREHASH_Scale, new_scale, block_num ); length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num, MAX_OBJECT_BINARY_DATA_SIZE); + length = llmin(length, MAX_OBJECT_BINARY_DATA_SIZE); // getBinaryDataFast() safely fills the buffer to max_size mTotalCRC = crc; // Might need to update mSourceMuted here to properly pick up new radius @@ -1316,7 +1331,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, setMaterial(material); if (mDrawable.notNull()) { - gPipeline.markMoved(mDrawable, FALSE); // undamped + gPipeline.markMoved(mDrawable, false); // undamped } } setClickAction(click_action); @@ -1326,15 +1341,17 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, switch(length) { - case (60 + 16): + case OBJECTDATA_FIELD_SIZE_140: + case OBJECTDATA_FIELD_SIZE_76: // pull out collision normal for avatar htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4)); ((LLVOAvatar*)this)->setFootPlane(collision_plane); count += sizeof(LLVector4); - // fall through - case 60: + + case OBJECTDATA_FIELD_SIZE_124: + case OBJECTDATA_FIELD_SIZE_60: this_update_precision = 32; - // this is a terse update + // this is a full precision update // pos htolememcpy(new_pos_parent.mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); count += sizeof(LLVector3); @@ -1359,117 +1376,21 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, resetRot(); } setAngularVelocity(new_angv); + count += sizeof(LLVector3); #if LL_DARWIN - if (length == 76) + if (length == OBJECTDATA_FIELD_SIZE_76 || + length == OBJECTDATA_FIELD_SIZE_140) { setAngularVelocity(LLVector3::zero); } #endif break; - case(32 + 16): - // pull out collision normal for avatar - htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4)); - ((LLVOAvatar*)this)->setFootPlane(collision_plane); - count += sizeof(LLVector4); - // fall through - case 32: - this_update_precision = 16; - test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT); - // This is a terse 16 update, so treat data as an array of U16's. -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - count += sizeof(U16)*3; - new_pos_parent.mV[VX] = U16_to_F32(val[VX], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VY] = U16_to_F32(val[VY], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VZ] = U16_to_F32(val[VZ], MIN_HEIGHT, MAX_HEIGHT); - -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - count += sizeof(U16)*3; - setVelocity(LLVector3(U16_to_F32(val[VX], -size, size), - U16_to_F32(val[VY], -size, size), - U16_to_F32(val[VZ], -size, size))); - -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - count += sizeof(U16)*3; - setAcceleration(LLVector3(U16_to_F32(val[VX], -size, size), - U16_to_F32(val[VY], -size, size), - U16_to_F32(val[VZ], -size, size))); - -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Quat, 4); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - count += sizeof(U16)*4; - new_rot.mQ[VX] = U16_to_F32(val[VX], -1.f, 1.f); - new_rot.mQ[VY] = U16_to_F32(val[VY], -1.f, 1.f); - new_rot.mQ[VZ] = U16_to_F32(val[VZ], -1.f, 1.f); - new_rot.mQ[VW] = U16_to_F32(val[VW], -1.f, 1.f); - -#ifdef LL_BIG_ENDIAN - htolememcpy(valswizzle, &data[count], MVT_U16Vec3, 6); - val = valswizzle; -#else - val = (U16 *) &data[count]; -#endif - new_angv.setVec(U16_to_F32(val[VX], -size, size), - U16_to_F32(val[VY], -size, size), - U16_to_F32(val[VZ], -size, size)); - if (new_angv.isExactlyZero()) - { - // reset rotation time - resetRot(); - } - setAngularVelocity(new_angv); - break; - - case 16: - this_update_precision = 8; - test_pos_parent.quantize8(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT); - // this is a terse 8 update - new_pos_parent.mV[VX] = U8_to_F32(data[0], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VY] = U8_to_F32(data[1], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VZ] = U8_to_F32(data[2], MIN_HEIGHT, MAX_HEIGHT); - - setVelocity(U8_to_F32(data[3], -size, size), - U8_to_F32(data[4], -size, size), - U8_to_F32(data[5], -size, size) ); - - setAcceleration(U8_to_F32(data[6], -size, size), - U8_to_F32(data[7], -size, size), - U8_to_F32(data[8], -size, size) ); - - new_rot.mQ[VX] = U8_to_F32(data[9], -1.f, 1.f); - new_rot.mQ[VY] = U8_to_F32(data[10], -1.f, 1.f); - new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f); - new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f); - - new_angv.setVec(U8_to_F32(data[13], -size, size), - U8_to_F32(data[14], -size, size), - U8_to_F32(data[15], -size, size) ); - if (new_angv.isExactlyZero()) - { - // reset rotation time - resetRot(); - } - setAngularVelocity(new_angv); - break; + // length values 48, 32 and 16 were once in viewer code but + // are never sent by the SL simulator + default: + LL_WARNS("UpdateFail") << "Unexpected ObjectData buffer size " << length + << " for " << getID() << " with OUT_FULL message" << LL_ENDL; } //////////////////////////////////////////////////// @@ -1503,19 +1424,44 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (mData) { delete [] mData; + mData = NULL; } + // Dec 2023 new generic data: + // Trees work as before, this field contains genome data + // Not a tree: root objects send 1 byte with the number of + // total prims in the linkset + // If the generic data size is zero, then number of prims is 1 + // + // Viewers should not check for specific data sizes exactly, but if + // the field has data, process it from the start and ignore the remainder. + // Check for appended generic data + const S32 GENERIC_DATA_BUFFER_SIZE = 16; S32 data_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Data); - if (data_size <= 0) - { - mData = NULL; - } - else - { - // ...has generic data - mData = new U8[data_size]; - mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, mData, data_size, block_num); + if (data_size > 0) + { // has generic data + if (getPCode() == LL_PCODE_LEGACY_TREE || getPCode() == LL_PCODE_TREE_NEW) + { + mData = new U8[data_size]; + mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, mData, data_size, block_num); + LL_DEBUGS("NewObjectData") << "Read " << data_size << " bytes tree genome data for " << getID() << ", pcode " + << getPCodeString() << ", value " << (S32) mData[0] << LL_ENDL; + } + else + { // Extract number of prims + U8 generic_data[GENERIC_DATA_BUFFER_SIZE]; + mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, + &generic_data[0], llmin(data_size, GENERIC_DATA_BUFFER_SIZE), block_num); + // This is sample code to extract the number of prims + // Future viewers should use it for their own purposes + if (!isAvatar()) + { + S32 num_prims = (S32) generic_data[0]; + LL_DEBUGS("NewObjectData") << "Root prim " << getID() << " has " + << num_prims << " prims in linkset" << LL_ENDL; + } + } } S32 text_size = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_Text); @@ -1566,7 +1512,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, std::unordered_map<U16, ExtraParameter*>::iterator iter; for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter) { - iter->second->in_use = FALSE; + iter->second->in_use = false; } // Unpack extra parameters @@ -1598,7 +1544,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (!iter->second->in_use) { // Send an update message in case it was formerly in use - parameterChanged(iter->first, iter->second->data, FALSE, false); + parameterChanged(iter->first, iter->second->data, false, false); } } @@ -1612,59 +1558,22 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, #endif length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num, MAX_OBJECT_BINARY_DATA_SIZE); - count = 0; + length = llmin(length, MAX_OBJECT_BINARY_DATA_SIZE); // getBinaryDataFast() safely fills the buffer to max_size + count = 0; LLVector4 collision_plane; switch(length) { - case(60 + 16): + case OBJECTDATA_FIELD_SIZE_80: + case OBJECTDATA_FIELD_SIZE_48: // pull out collision normal for avatar htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4)); ((LLVOAvatar*)this)->setFootPlane(collision_plane); count += sizeof(LLVector4); - // fall through - case 60: - // this is a terse 32 update - // pos - this_update_precision = 32; - htolememcpy(new_pos_parent.mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - count += sizeof(LLVector3); - // vel - htolememcpy((void*)getVelocity().mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - count += sizeof(LLVector3); - // acc - htolememcpy((void*)getAcceleration().mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - count += sizeof(LLVector3); - // theta - { - LLVector3 vec; - htolememcpy(vec.mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - new_rot.unpackFromVector3(vec); - } - count += sizeof(LLVector3); - // omega - htolememcpy((void*)new_angv.mV, &data[count], MVT_LLVector3, sizeof(LLVector3)); - if (new_angv.isExactlyZero()) - { - // reset rotation time - resetRot(); - } - setAngularVelocity(new_angv); -#if LL_DARWIN - if (length == 76) - { - setAngularVelocity(LLVector3::zero); - } -#endif - break; - case(32 + 16): - // pull out collision normal for avatar - htolememcpy(collision_plane.mV, &data[count], MVT_LLVector4, sizeof(LLVector4)); - ((LLVOAvatar*)this)->setFootPlane(collision_plane); - count += sizeof(LLVector4); - // fall through - case 32: - // this is a terse 16 update + + case OBJECTDATA_FIELD_SIZE_64: + case OBJECTDATA_FIELD_SIZE_32: + // this is a terse 16 bit quantized update this_update_precision = 16; test_pos_parent.quantize16(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT); @@ -1725,32 +1634,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, setAngularVelocity(new_angv); break; - case 16: - // this is a terse 8 update - this_update_precision = 8; - test_pos_parent.quantize8(-0.5f*size, 1.5f*size, MIN_HEIGHT, MAX_HEIGHT); - new_pos_parent.mV[VX] = U8_to_F32(data[0], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VY] = U8_to_F32(data[1], -0.5f*size, 1.5f*size); - new_pos_parent.mV[VZ] = U8_to_F32(data[2], MIN_HEIGHT, MAX_HEIGHT); - - setVelocity(U8_to_F32(data[3], -size, size), - U8_to_F32(data[4], -size, size), - U8_to_F32(data[5], -size, size) ); - - setAcceleration(U8_to_F32(data[6], -size, size), - U8_to_F32(data[7], -size, size), - U8_to_F32(data[8], -size, size) ); - - new_rot.mQ[VX] = U8_to_F32(data[9], -1.f, 1.f); - new_rot.mQ[VY] = U8_to_F32(data[10], -1.f, 1.f); - new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f); - new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f); - - new_angv.set(U8_to_F32(data[13], -size, size), - U8_to_F32(data[14], -size, size), - U8_to_F32(data[15], -size, size) ); - setAngularVelocity(new_angv); - break; + // Previous viewers had code for length 76, 60 or 16 byte length + // with full precision or 8 bit quanitzation, but the + // SL servers will never send those data formats. If you ever see this + // warning in Second Life, please file a bug report + default: + LL_WARNS("UpdateFail") << "Unexpected ObjectData buffer size " << length << " for " << getID() + << " with OUT_FULL message" << LL_ENDL; } U8 state; @@ -1760,13 +1650,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } default: + LL_WARNS("UpdateFail") << "Unknown uncompressed update type " << update_type << " for " << getID() << LL_ENDL; break; - } } else { - // handle the compressed case + // handle the compressed case - have dp datapacker LLUUID sound_uuid; LLUUID owner_id; F32 gain = 0; @@ -1849,7 +1739,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, setMaterial(material); if (mDrawable.notNull()) { - gPipeline.markMoved(mDrawable, FALSE); // undamped + gPipeline.markMoved(mDrawable, false); // undamped } } dp->unpackU8(click_action, "ClickAction"); @@ -1958,7 +1848,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, std::unordered_map<U16, ExtraParameter*>::iterator iter; for (iter = mExtraParameterList.begin(); iter != mExtraParameterList.end(); ++iter) { - iter->second->in_use = FALSE; + iter->second->in_use = false; } // Unpack extra params @@ -1981,7 +1871,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (!iter->second->in_use) { // Send an update message in case it was formerly in use - parameterChanged(iter->first, iter->second->data, FALSE, false); + parameterChanged(iter->first, iter->second->data, false, false); } } @@ -2020,6 +1910,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, break; default: + LL_WARNS("UpdateFail") << "Unknown compressed update type " << update_type << " for " << getID() << LL_ENDL; break; } } @@ -2027,7 +1918,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // Fix object parenting. // - BOOL b_changed_status = FALSE; + bool b_changed_status = false; if (OUT_TERSE_IMPROVED != update_type) { @@ -2067,7 +1958,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (sent_parentp && sent_parentp->getParent() == this) { // Try to recover if we attempt to attach a parent to its child - LL_WARNS() << "Attempt to attach a parent to it's child: " << this->getID() << " to " << sent_parentp->getID() << LL_ENDL; + LL_WARNS("UpdateFail") << "Attempt to attach a parent to it's child: " << this->getID() << " to " + << sent_parentp->getID() << LL_ENDL; this->removeChild(sent_parentp); sent_parentp->setDrawableParent(NULL); } @@ -2085,13 +1977,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // new parent is valid - b_changed_status = TRUE; + b_changed_status = true; // ...no current parent, so don't try to remove child if (mDrawable.notNull()) { if (mDrawable->isDead() || !mDrawable->getVObj()) { - LL_WARNS() << "Drawable is dead or no VObj!" << LL_ENDL; + LL_WARNS("UpdateFail") << "Drawable is dead or no VObj!" << LL_ENDL; sent_parentp->addChild(this); } else @@ -2101,9 +1993,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Bad, we got a cycle somehow. // Kill both the parent and the child, and // set cache misses for both of them. - LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL; - LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL; - LL_WARNS() << "Adding to cache miss list" << LL_ENDL; + LL_WARNS("UpdateFail") << "Attempting to recover from parenting cycle! " + << "Killing " << sent_parentp->getID() << " and " << getID() + << ", Adding to cache miss list" << LL_ENDL; setParent(NULL); sent_parentp->setParent(NULL); getRegion()->addCacheMissFull(getLocalID()); @@ -2116,7 +2008,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // make sure this object gets a non-damped update if (sent_parentp->mDrawable.notNull()) { - gPipeline.markMoved(sent_parentp->mDrawable, FALSE); // undamped + gPipeline.markMoved(sent_parentp->mDrawable, false); // undamped } } } @@ -2126,7 +2018,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } // Show particles, icon and HUD - hideExtraDisplayItems( FALSE ); + hideExtraDisplayItems( false ); setChanged(MOVED | SILHOUETTE); } @@ -2153,7 +2045,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, gObjectList.orphanize(this, parent_id, ip, port); // Hide particles, icon and HUD - hideExtraDisplayItems( TRUE ); + hideExtraDisplayItems( true ); } } } @@ -2244,7 +2136,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (sent_parentp && sent_parentp != cur_parentp && sent_parentp != this) { // New parent is valid, detach and reattach - b_changed_status = TRUE; + b_changed_status = true; if (mDrawable.notNull()) { if (!setDrawableParent(sent_parentp->mDrawable)) // LLViewerObject::processUpdateMessage 2 @@ -2271,7 +2163,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, sent_parentp->setChanged(MOVED | SILHOUETTE); if (sent_parentp->mDrawable.notNull()) { - gPipeline.markMoved(sent_parentp->mDrawable, FALSE); // undamped + gPipeline.markMoved(sent_parentp->mDrawable, false); // undamped } } else if (!sent_parentp) @@ -2293,7 +2185,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (remove_parent) { - b_changed_status = TRUE; + b_changed_status = true; if (mDrawable.notNull()) { // clear parent to removeChild can put the drawable on the damped list @@ -2307,7 +2199,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (mDrawable.notNull()) { // make sure this object gets a non-damped update - gPipeline.markMoved(mDrawable, FALSE); // undamped + gPipeline.markMoved(mDrawable, false); // undamped } } } @@ -2456,11 +2348,11 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, (MAG_CUTOFF >= accel_mag_sq) && (MAG_CUTOFF >= getAngularVelocity().magVecSquared())) { - mStatic = TRUE; // This object doesn't move! + mStatic = true; // This object doesn't move! } else { - mStatic = FALSE; + mStatic = false; } // BUG: This code leads to problems during group rotate and any scale operation. @@ -2475,7 +2367,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // Additionally, if any child is selected, need to update the dialogs and selection // center. - BOOL needs_refresh = mUserSelected; + bool needs_refresh = mUserSelected; for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { @@ -2483,7 +2375,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, needs_refresh = needs_refresh || child->mUserSelected; } - static LLCachedControl<bool> allow_select_avatar(gSavedSettings, "AllowSelectAvatar", FALSE); + static LLCachedControl<bool> allow_select_avatar(gSavedSettings, "AllowSelectAvatar", false); if (needs_refresh) { LLSelectMgr::getInstance()->updateSelectionCenter(); @@ -2527,9 +2419,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } -BOOL LLViewerObject::isActive() const +bool LLViewerObject::isActive() const { - return TRUE; + return true; } //load flags from cache or from message @@ -2572,7 +2464,7 @@ void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &frame_time) } } - updateDrawable(FALSE); + updateDrawable(false); } } @@ -2758,22 +2650,6 @@ void LLViewerObject::interpolateLinearMotion(const F64SecondsImplicit& frame_tim -BOOL LLViewerObject::setData(const U8 *datap, const U32 data_size) -{ - delete [] mData; - - if (datap) - { - mData = new U8[data_size]; - if (!mData) - { - return FALSE; - } - memcpy(mData, datap, data_size); /* Flawfinder: ignore */ - } - return TRUE; -} - // delete an item in the inventory, but don't tell the server. This is // used internally by remove, update, and savescript. // This will only delete the first item with an item_id in the list @@ -2813,7 +2689,7 @@ void LLViewerObject::doUpdateInventory( LLUUID item_id; LLUUID new_owner; LLUUID new_group; - BOOL group_owned = FALSE; + bool group_owned = false; if(old_item) { item_id = old_item->getUUID(); @@ -2835,7 +2711,7 @@ void LLViewerObject::doUpdateInventory( deleteInventoryItem(item_id); LLPermissions perm(item->getPermissions()); LLPermissions* obj_perm = LLSelectMgr::getInstance()->findObjectPermissions(this); - bool is_atomic = ((S32)LLAssetType::AT_OBJECT == item->getType()) ? false : true; + bool is_atomic = (S32)LLAssetType::AT_OBJECT != item->getType(); if(obj_perm) { perm.setOwnerAndGroup(LLUUID::null, obj_perm->getOwner(), obj_perm->getGroup(), is_atomic); @@ -2885,7 +2761,7 @@ void LLViewerObject::doUpdateInventory( // of the new and old script AFTER the bytecode has been saved. void LLViewerObject::saveScript( const LLViewerInventoryItem* item, - BOOL active, + bool active, bool is_new) { /* @@ -2959,7 +2835,7 @@ void LLViewerObject::dirtyInventory() delete mInventory; mInventory = NULL; } - mInventoryDirty = TRUE; + mInventoryDirty = true; } void LLViewerObject::registerInventoryListener(LLVOInventoryListener* listener, void* user_data) @@ -2988,7 +2864,7 @@ void LLViewerObject::removeInventoryListener(LLVOInventoryListener* listener) } } -BOOL LLViewerObject::isInventoryPending() +bool LLViewerObject::isInventoryPending() { return mInvRequestState != INVENTORY_REQUEST_STOPPED; } @@ -3022,7 +2898,7 @@ void LLViewerObject::requestInventory() else { // since we are going to request it now - mInventoryDirty = FALSE; + mInventoryDirty = false; // Note: throws away duplicate requests fetchInventoryFromServer(); @@ -3320,7 +3196,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) U64 new_id = gXferManager->requestFile(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ft->mFilename), ft->mFilename, LL_PATH_CACHE, object->mRegionp->getHost(), - TRUE, + true, &LLViewerObject::processTaskInvFile, (void**)ft, // This takes ownership of ft LLXferManager::HIGH_PRIORITY); @@ -3397,7 +3273,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS delete ft; } -BOOL LLViewerObject::loadTaskInvFile(const std::string& filename) +bool LLViewerObject::loadTaskInvFile(const std::string& filename) { std::string filename_and_local_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, filename); llifstream ifs(filename_and_local_path.c_str()); @@ -3459,11 +3335,11 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename) { LL_WARNS() << "unable to load task inventory: " << filename_and_local_path << LL_ENDL; - return FALSE; + return false; } doInventoryCallback(); - return TRUE; + return true; } void LLViewerObject::doInventoryCallback() @@ -3790,14 +3666,14 @@ void LLViewerObject::setPixelAreaAndAngle(LLAgent &agent) } } -BOOL LLViewerObject::updateLOD() +bool LLViewerObject::updateLOD() { - return FALSE; + return false; } -BOOL LLViewerObject::updateGeometry(LLDrawable *drawable) +bool LLViewerObject::updateGeometry(LLDrawable *drawable) { - return TRUE; + return false; } void LLViewerObject::updateGL() @@ -3815,7 +3691,7 @@ LLDrawable* LLViewerObject::createDrawable(LLPipeline *pipeline) return NULL; } -void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped) +void LLViewerObject::setScale(const LLVector3 &scale, bool damped) { LLPrimitive::setScale(scale); if (mDrawable.notNull()) @@ -3835,7 +3711,7 @@ void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped) llassert_always(LLWorld::getInstance()->getRegionFromHandle(getRegion()->getHandle())); gObjectList.addToMap(this); - mOnMap = TRUE; + mOnMap = true; } } else @@ -3843,7 +3719,7 @@ void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped) if (mOnMap) { gObjectList.removeFromMap(this); - mOnMap = FALSE; + mOnMap = false; } } } @@ -3875,7 +3751,7 @@ void LLViewerObject::setLinksetCost(F32 cost) mLinksetCost = cost; mCostStale = false; - BOOL needs_refresh = isSelected(); + bool needs_refresh = isSelected(); child_list_t::iterator iter = mChildList.begin(); while(iter != mChildList.end() && !needs_refresh) { @@ -3971,15 +3847,15 @@ F32 LLViewerObject::recursiveGetEstTrianglesMax() const S32 LLViewerObject::getAnimatedObjectMaxTris() const { S32 max_tris = 0; - if (gAgent.getRegion()) - { - LLSD features; - gAgent.getRegion()->getSimulatorFeatures(features); - if (features.has("AnimatedObjects")) + if (gAgent.getRegion()) { - max_tris = features["AnimatedObjects"]["AnimatedObjectMaxTris"].asInteger(); + LLSD features; + gAgent.getRegion()->getSimulatorFeatures(features); + if (features.has("AnimatedObjects")) + { + max_tris = features["AnimatedObjects"]["AnimatedObjectMaxTris"].asInteger(); + } } - } return max_tris; } @@ -4140,7 +4016,7 @@ void LLViewerObject::updateTextures() { } -void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */) +void LLViewerObject::boostTexturePriority(bool boost_children /* = true */) { if (isDead() || !getVolume()) { @@ -4158,7 +4034,7 @@ void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */) { LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); LLUUID sculpt_id = sculpt_params->getSculptTexture(); - LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); + LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); } if (boost_children) @@ -4251,7 +4127,7 @@ void LLViewerObject::addNVPair(const std::string& data) mNameValuePairs[nv->mName] = nv; } -BOOL LLViewerObject::removeNVPair(const std::string& name) +bool LLViewerObject::removeNVPair(const std::string& name) { char* canonical_name = gNVNameTable.addString(name); @@ -4277,14 +4153,14 @@ BOOL LLViewerObject::removeNVPair(const std::string& name) // Remove the NV pair from the local list. delete nv; mNameValuePairs.erase(iter); - return TRUE; + return true; } else { LL_DEBUGS() << "removeNVPair - No region for object" << LL_ENDL; } } - return FALSE; + return false; } @@ -4484,7 +4360,7 @@ const LLQuaternion LLViewerObject::getRotationEdit() const return global_rotation; } -void LLViewerObject::setPositionAbsoluteGlobal( const LLVector3d &pos_global, BOOL damped ) +void LLViewerObject::setPositionAbsoluteGlobal( const LLVector3d &pos_global, bool damped ) { if (isAttachment()) { @@ -4533,7 +4409,7 @@ void LLViewerObject::setPositionAbsoluteGlobal( const LLVector3d &pos_global, BO gPipeline.updateMoveNormalAsync(mDrawable); } -void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) +void LLViewerObject::setPosition(const LLVector3 &pos, bool damped) { if (getPosition() != pos) { @@ -4549,7 +4425,7 @@ void LLViewerObject::setPosition(const LLVector3 &pos, BOOL damped) } } -void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, BOOL damped) +void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, bool damped) { if (isAttachment()) { @@ -4609,7 +4485,7 @@ void LLViewerObject::setPositionGlobal(const LLVector3d &pos_global, BOOL damped } -void LLViewerObject::setPositionParent(const LLVector3 &pos_parent, BOOL damped) +void LLViewerObject::setPositionParent(const LLVector3 &pos_parent, bool damped) { // Set position relative to parent, if no parent, relative to region if (!isRoot()) @@ -4623,7 +4499,7 @@ void LLViewerObject::setPositionParent(const LLVector3 &pos_parent, BOOL damped) } } -void LLViewerObject::setPositionRegion(const LLVector3 &pos_region, BOOL damped) +void LLViewerObject::setPositionRegion(const LLVector3 &pos_region, bool damped) { if (!isRootEdit()) { @@ -4638,7 +4514,7 @@ void LLViewerObject::setPositionRegion(const LLVector3 &pos_region, BOOL damped) } } -void LLViewerObject::setPositionAgent(const LLVector3 &pos_agent, BOOL damped) +void LLViewerObject::setPositionAgent(const LLVector3 &pos_agent, bool damped) { LLVector3 pos_region = getRegion()->getPosRegionFromAgent(pos_agent); setPositionRegion(pos_region, damped); @@ -4648,7 +4524,7 @@ void LLViewerObject::setPositionAgent(const LLVector3 &pos_agent, BOOL damped) // and doesn't also move the joint-parent // TODO -- implement similar intelligence for joint-parents toward // their joint-children -void LLViewerObject::setPositionEdit(const LLVector3 &pos_edit, BOOL damped) +void LLViewerObject::setPositionEdit(const LLVector3 &pos_edit, bool damped) { if (!isRootEdit()) { @@ -4679,11 +4555,11 @@ LLViewerObject* LLViewerObject::getRootEdit() const } -BOOL LLViewerObject::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, +bool LLViewerObject::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, - BOOL pick_transparent, - BOOL pick_rigged, - BOOL pick_unselectable, + bool pick_transparent, + bool pick_rigged, + bool pick_unselectable, S32* face_hit, LLVector4a* intersection, LLVector2* tex_coord, @@ -4693,11 +4569,11 @@ BOOL LLViewerObject::lineSegmentIntersect(const LLVector4a& start, const LLVecto return false; } -BOOL LLViewerObject::lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end) +bool LLViewerObject::lineSegmentBoundingBox(const LLVector4a& start, const LLVector4a& end) { if (mDrawable.isNull() || mDrawable->isDead()) { - return FALSE; + return false; } const LLVector4a* ext = mDrawable->getSpatialExtents(); @@ -4757,20 +4633,20 @@ void LLViewerObject::setMediaURL(const std::string& media_url) { mMedia = new LLViewerObjectMedia; mMedia->mMediaURL = media_url; - mMedia->mPassedWhitelist = FALSE; + mMedia->mPassedWhitelist = false; // TODO: update materials with new image } else if (mMedia->mMediaURL != media_url) { mMedia->mMediaURL = media_url; - mMedia->mPassedWhitelist = FALSE; + mMedia->mPassedWhitelist = false; // TODO: update materials with new image } } -BOOL LLViewerObject::getMediaPassedWhitelist() const +bool LLViewerObject::getMediaPassedWhitelist() const { if (mMedia) { @@ -4778,11 +4654,11 @@ BOOL LLViewerObject::getMediaPassedWhitelist() const } else { - return FALSE; + return false; } } -void LLViewerObject::setMediaPassedWhitelist(BOOL passed) +void LLViewerObject::setMediaPassedWhitelist(bool passed) { if (mMedia) { @@ -4790,9 +4666,9 @@ void LLViewerObject::setMediaPassedWhitelist(BOOL passed) } } -BOOL LLViewerObject::setMaterial(const U8 material) +bool LLViewerObject::setMaterial(const U8 material) { - BOOL res = LLPrimitive::setMaterial(material); + bool res = LLPrimitive::setMaterial(material); if (res) { setChanged(TEXTURE); @@ -4956,7 +4832,7 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) LLViewerObject *root = getRootEdit(); if (root && root->isAnimatedObject()) { - return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } LLVOAvatar* avatar = getAvatar(); @@ -4966,7 +4842,7 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) LLViewerTexture* bakedTexture = avatar->getBakedTexture(texIndex); if (bakedTexture == NULL || bakedTexture->isMissingAsset()) { - return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } else { @@ -4975,7 +4851,7 @@ LLViewerTexture* LLViewerObject::getBakedTextureForMagicId(const LLUUID& id) } else { - return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + return LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } } @@ -5012,7 +4888,7 @@ void LLViewerObject::setTE(const U8 te, const LLTextureEntry& texture_entry) const LLUUID& image_id = getTE(te)->getID(); LLViewerTexture* bakedTexture = getBakedTextureForMagicId(image_id); - mTEImages[te] = bakedTexture ? bakedTexture : LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTEImages[te] = bakedTexture ? bakedTexture : LLViewerTextureManager::getFetchedTexture(image_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); updateAvatarMeshVisibility(image_id, old_image_id); @@ -5024,10 +4900,10 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) if (getTE(te)->getMaterialParams().notNull()) { const LLUUID& norm_id = getTE(te)->getMaterialParams()->getNormalID(); - mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTENormalMaps[te] = LLViewerTextureManager::getFetchedTexture(norm_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); const LLUUID& spec_id = getTE(te)->getMaterialParams()->getSpecularID(); - mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mTESpecularMaps[te] = LLViewerTextureManager::getFetchedTexture(spec_id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); } LLFetchedGLTFMaterial* mat = (LLFetchedGLTFMaterial*) getTE(te)->getGLTFRenderMaterial(); @@ -5069,8 +4945,8 @@ void LLViewerObject::updateTEMaterialTextures(U8 te) } else { - img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - img->addTextureStats(64.f * 64.f, TRUE); + img = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + img->addTextureStats(64.f * 64.f, true); } } @@ -5220,21 +5096,21 @@ S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) { // Invalid host == get from the agent's sim LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( - uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); + uuid, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); return setTETextureCore(te, image); } S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid) { LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture( - uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); + uuid, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); return setTENormalMapCore(te, image); } S32 LLViewerObject::setTESpecularMap(const U8 te, const LLUUID& uuid) { LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture( - uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); + uuid, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost()); return setTESpecularMapCore(te, image); } @@ -5774,8 +5650,8 @@ void LLViewerObject::setDebugText(const std::string &utf8text, const LLColor4& c } mText->setColor(color); mText->setString(utf8text); - mText->setZCompare(FALSE); - mText->setDoFade(FALSE); + mText->setZCompare(false); + mText->setDoFade(false); updateText(); } @@ -5791,8 +5667,8 @@ void LLViewerObject::appendDebugText(const std::string &utf8text) initHudText(); } mText->addLine(utf8text, LLColor4::white); - mText->setZCompare(FALSE); - mText->setDoFade(FALSE); + mText->setZCompare(false); + mText->setDoFade(false); updateText(); } @@ -5825,8 +5701,8 @@ void LLViewerObject::restoreHudText() else { // Restore default values - mText->setZCompare(TRUE); - mText->setDoFade(TRUE); + mText->setZCompare(true); + mText->setDoFade(true); } mText->setColor(mHudTextColor); mText->setString(mHudText); @@ -5867,7 +5743,7 @@ const LLViewerObject* LLViewerObject::getSubParent() const return (const LLViewerObject*) getParent(); } -BOOL LLViewerObject::isOnMap() +bool LLViewerObject::isOnMap() { return mOnMap; } @@ -5951,7 +5827,7 @@ LLVOAvatar* LLViewerObject::getAvatarAncestor() return NULL; } -BOOL LLViewerObject::isParticleSource() const +bool LLViewerObject::isParticleSource() const { return !mPartSourcep.isNull() && !mPartSourcep->isDead(); } @@ -6092,7 +5968,7 @@ void LLViewerObject::deleteParticleSource() } // virtual -void LLViewerObject::updateDrawable(BOOL force_damped) +void LLViewerObject::updateDrawable(bool force_damped) { if (!isChanged(MOVED)) { //most common case, having an empty if case here makes for better branch prediction @@ -6100,7 +5976,7 @@ void LLViewerObject::updateDrawable(BOOL force_damped) else if (mDrawable.notNull() && !mDrawable->isState(LLDrawable::ON_MOVE_LIST)) { - BOOL damped_motion = + bool damped_motion = !isChanged(SHIFTED) && // not shifted between regions this frame and... ( force_damped || // ...forced into damped motion by application logic or... ( !isSelected() && // ...not selected and... @@ -6179,7 +6055,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow if (mAudioSourcep) { - BOOL queue = flags & LL_SOUND_FLAG_QUEUE; + bool queue = flags & LL_SOUND_FLAG_QUEUE; mAudioGain = gain; mAudioSourcep->setGain(gain); mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP); @@ -6241,8 +6117,8 @@ bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) if (param) { param->data->unpack(*dp); - param->in_use = TRUE; - parameterChanged(param_type, param->data, TRUE, false); + param->in_use = true; + parameterChanged(param_type, param->data, true, false); return true; } else @@ -6344,7 +6220,7 @@ LLNetworkData* LLViewerObject::getParameterEntry(U16 param_type) const } } -BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const +bool LLViewerObject::getParameterEntryInUse(U16 param_type) const { ExtraParameter* param = getExtraParameterEntry(param_type); if (param) @@ -6353,7 +6229,7 @@ BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const } else { - return FALSE; + return false; } } @@ -6368,7 +6244,7 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_ } param->in_use = true; param->data->copy(new_value); - parameterChanged(param_type, param->data, TRUE, local_origin); + parameterChanged(param_type, param->data, true, local_origin); return true; } else @@ -6378,9 +6254,9 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_ } // Assumed to be called locally -// If in_use is TRUE, will crate a new extra parameter if none exists. +// If in_use is true, will crate a new extra parameter if none exists. // Should always return true. -bool LLViewerObject::setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin) +bool LLViewerObject::setParameterEntryInUse(U16 param_type, bool in_use, bool local_origin) { ExtraParameter* param = getExtraParameterEntryCreate(param_type); if (param && param->in_use != in_use) @@ -6401,7 +6277,7 @@ void LLViewerObject::parameterChanged(U16 param_type, bool local_origin) } } -void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin) +void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, bool in_use, bool local_origin) { if (local_origin) { @@ -6451,7 +6327,7 @@ void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL } } -void LLViewerObject::setDrawableState(U32 state, BOOL recursive) +void LLViewerObject::setDrawableState(U32 state, bool recursive) { if (mDrawable) { @@ -6468,7 +6344,7 @@ void LLViewerObject::setDrawableState(U32 state, BOOL recursive) } } -void LLViewerObject::clearDrawableState(U32 state, BOOL recursive) +void LLViewerObject::clearDrawableState(U32 state, bool recursive) { if (mDrawable) { @@ -6485,9 +6361,9 @@ void LLViewerObject::clearDrawableState(U32 state, BOOL recursive) } } -BOOL LLViewerObject::isDrawableState(U32 state, BOOL recursive) const +bool LLViewerObject::isDrawableState(U32 state, bool recursive) const { - BOOL matches = FALSE; + bool matches = false; if (mDrawable) { matches = mDrawable->isState(state); @@ -6512,7 +6388,7 @@ BOOL LLViewerObject::isDrawableState(U32 state, BOOL recursive) const //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Owned by anyone? -BOOL LLViewerObject::permAnyOwner() const +bool LLViewerObject::permAnyOwner() const { if (isRootEdit()) { @@ -6524,18 +6400,18 @@ BOOL LLViewerObject::permAnyOwner() const } } // Owned by this viewer? -BOOL LLViewerObject::permYouOwner() const +bool LLViewerObject::permYouOwner() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectYouOwner(); @@ -6548,7 +6424,7 @@ BOOL LLViewerObject::permYouOwner() const } // Owned by a group? -BOOL LLViewerObject::permGroupOwner() const +bool LLViewerObject::permGroupOwner() const { if (isRootEdit()) { @@ -6561,18 +6437,18 @@ BOOL LLViewerObject::permGroupOwner() const } // Can the owner edit -BOOL LLViewerObject::permOwnerModify() const +bool LLViewerObject::permOwnerModify() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectOwnerModify(); @@ -6585,18 +6461,18 @@ BOOL LLViewerObject::permOwnerModify() const } // Can edit -BOOL LLViewerObject::permModify() const +bool LLViewerObject::permModify() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectModify(); @@ -6609,18 +6485,18 @@ BOOL LLViewerObject::permModify() const } // Can copy -BOOL LLViewerObject::permCopy() const +bool LLViewerObject::permCopy() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectCopy(); @@ -6633,18 +6509,18 @@ BOOL LLViewerObject::permCopy() const } // Can move -BOOL LLViewerObject::permMove() const +bool LLViewerObject::permMove() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectMove(); @@ -6657,18 +6533,18 @@ BOOL LLViewerObject::permMove() const } // Can be transferred -BOOL LLViewerObject::permTransfer() const +bool LLViewerObject::permTransfer() const { if (isRootEdit()) { #ifdef HACKED_GODLIKE_VIEWER - return TRUE; + return true; #else # ifdef TOGGLE_HACKED_GODLIKE_VIEWER if (!LLGridManager::getInstance()->isInProductionGrid() && (gAgent.getGodLevel() >= GOD_MAINTENANCE)) { - return TRUE; + return true; } # endif return flagObjectTransfer(); @@ -6682,7 +6558,7 @@ BOOL LLViewerObject::permTransfer() const // Can only open objects that you own, or that someone has // given you modify rights to. JC -BOOL LLViewerObject::allowOpen() const +bool LLViewerObject::allowOpen() const { return !flagInventoryEmpty() && (permYouOwner() || permModify()); } @@ -6773,7 +6649,7 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp) } setChanged(MOVED | SILHOUETTE); - updateDrawable(FALSE); + updateDrawable(false); } // virtual @@ -6797,7 +6673,7 @@ bool LLViewerObject::specialHoverCursor() const || (mClickAction != 0); } -void LLViewerObject::updateFlags(BOOL physics_changed) +void LLViewerObject::updateFlags(bool physics_changed) { LLViewerRegion* regionp = getRegion(); if(!regionp) return; @@ -6810,10 +6686,10 @@ void LLViewerObject::updateFlags(BOOL physics_changed) gMessageSystem->addBOOL("IsTemporary", flagTemporaryOnRez() ); gMessageSystem->addBOOL("IsPhantom", flagPhantom() ); - // stinson 02/28/2012 : This CastsShadows BOOL is no longer used in either the viewer or the simulator + // stinson 02/28/2012 : This CastsShadows bool is no longer used in either the viewer or the simulator // The simulator code does not even unpack this value when the message is received. // This could be potentially hijacked in the future for another use should the urgent need arise. - gMessageSystem->addBOOL("CastsShadows", FALSE ); + gMessageSystem->addBOOL("CastsShadows", false ); if (physics_changed) { @@ -6827,9 +6703,9 @@ void LLViewerObject::updateFlags(BOOL physics_changed) gMessageSystem->sendReliable( regionp->getHost() ); } -BOOL LLViewerObject::setFlags(U32 flags, BOOL state) +bool LLViewerObject::setFlags(U32 flags, bool state) { - BOOL setit = setFlagsWithoutUpdate(flags, state); + bool setit = setFlagsWithoutUpdate(flags, state); // BUG: Sometimes viewer physics and simulator physics get // out of sync. To fix this, always send update to simulator. @@ -6840,15 +6716,15 @@ BOOL LLViewerObject::setFlags(U32 flags, BOOL state) return setit; } -BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state) +bool LLViewerObject::setFlagsWithoutUpdate(U32 flags, bool state) { - BOOL setit = FALSE; + bool setit = false; if (state) { if ((mFlags & flags) != flags) { mFlags |= flags; - setit = TRUE; + setit = true; } } else @@ -6856,7 +6732,7 @@ BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state) if ((mFlags & flags) != 0) { mFlags &= ~flags; - setit = TRUE; + setit = true; } } return setit; @@ -6979,12 +6855,12 @@ void LLAlphaObject::getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender } // virtual -void LLStaticViewerObject::updateDrawable(BOOL force_damped) +void LLStaticViewerObject::updateDrawable(bool force_damped) { // Force an immediate rebuild on any update if (mDrawable.notNull()) { - mDrawable->updateXform(TRUE); + mDrawable->updateXform(true); gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL); } clearChanged(SHIFTED); @@ -7062,8 +6938,8 @@ void LLViewerObject::resetChildrenRotationAndPosition(const std::vector<LLQuater ((LLVOAvatar*)childp)->mDrawable->mXform.setPosition(reset_pos); ((LLVOAvatar*)childp)->mDrawable->mXform.setRotation(reset_rot) ; - ((LLVOAvatar*)childp)->mDrawable->getVObj()->setPosition(reset_pos, TRUE); - ((LLVOAvatar*)childp)->mDrawable->getVObj()->setRotation(reset_rot, TRUE) ; + ((LLVOAvatar*)childp)->mDrawable->getVObj()->setPosition(reset_pos, true); + ((LLVOAvatar*)childp)->mDrawable->getVObj()->setRotation(reset_rot, true) ; LLManip::rebuild(childp); } @@ -7075,7 +6951,7 @@ void LLViewerObject::resetChildrenRotationAndPosition(const std::vector<LLQuater } //counter-translation -void LLViewerObject::resetChildrenPosition(const LLVector3& offset, BOOL simplified, BOOL skip_avatar_child) +void LLViewerObject::resetChildrenPosition(const LLVector3& offset, bool simplified, bool skip_avatar_child) { if(mChildList.empty()) { @@ -7131,18 +7007,18 @@ void LLViewerObject::resetChildrenPosition(const LLVector3& offset, BOOL simplif } // virtual -BOOL LLViewerObject::isTempAttachment() const +bool LLViewerObject::isTempAttachment() const { return (mID.notNull() && (mID == mAttachmentItemID)); } -BOOL LLViewerObject::isHiglightedOrBeacon() const +bool LLViewerObject::isHiglightedOrBeacon() const { if (LLFloaterReg::instanceVisible("beacons") && (gPipeline.getRenderBeacons() || gPipeline.getRenderHighlights())) { - BOOL has_media = (getMediaType() == LLViewerObject::MEDIA_SET); - BOOL is_scripted = !isAvatar() && !getParent() && flagScripted(); - BOOL is_physical = !isAvatar() && flagUsePhysics(); + bool has_media = (getMediaType() == LLViewerObject::MEDIA_SET); + bool is_scripted = !isAvatar() && !getParent() && flagScripted(); + bool is_physical = !isAvatar() && flagUsePhysics(); return (isParticleSource() && gPipeline.getRenderParticleBeacons()) || (isAudioSource() && gPipeline.getRenderSoundBeacons()) @@ -7151,7 +7027,7 @@ BOOL LLViewerObject::isHiglightedOrBeacon() const || (is_scripted && flagHandleTouch() && gPipeline.getRenderScriptedTouchBeacons()) || (is_physical && gPipeline.getRenderPhysicalBeacons()); } - return FALSE; + return false; } @@ -7175,12 +7051,12 @@ void LLViewerObject::setLastUpdateType(EObjectUpdateType last_update_type) mLastUpdateType = last_update_type; } -BOOL LLViewerObject::getLastUpdateCached() const +bool LLViewerObject::getLastUpdateCached() const { return mLastUpdateCached; } -void LLViewerObject::setLastUpdateCached(BOOL last_update_cached) +void LLViewerObject::setLastUpdateCached(bool last_update_cached) { mLastUpdateCached = last_update_cached; } @@ -7247,11 +7123,11 @@ void LLViewerObject::setHasRenderMaterialParams(bool has_materials) { if (has_materials) { - setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, TRUE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, true, true); } else { - setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, FALSE, true); + setParameterEntryInUse(LLNetworkData::PARAMS_RENDER_MATERIAL, false, true); } } } |