summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp858
1 files changed, 449 insertions, 409 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index f1fac106c7..d50cb43cb0 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -107,22 +107,23 @@
#include "llmeshrepository.h"
#include "llgltfmateriallist.h"
#include "llgl.h"
+#include "gltf/asset.h"
//#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 +247,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 +257,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 +265,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 +287,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 +311,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 +448,7 @@ void LLViewerObject::markDead()
}
// Mark itself as dead
- mDead = TRUE;
+ mDead = true;
if(mRegionp)
{
mRegionp->removeFromCreatedList(getLocalID());
@@ -751,7 +752,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 +764,7 @@ BOOL LLViewerObject::isAnySelected() const
return any_selected;
}
-void LLViewerObject::setSelected(BOOL sel)
+void LLViewerObject::setSelected(bool sel)
{
mUserSelected = sel;
resetRot();
@@ -900,12 +901,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 +914,7 @@ BOOL LLViewerObject::setParent(LLViewerObject* parent)
return ret ;
}
- return FALSE ;
+ return false ;
}
void LLViewerObject::addChild(LLViewerObject *childp)
@@ -981,7 +982,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 +1020,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 +1064,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 +1079,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 +1109,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 +1131,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 +1167,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 +1228,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 +1255,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 +1317,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,25 +1332,27 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
setMaterial(material);
if (mDrawable.notNull())
{
- gPipeline.markMoved(mDrawable, FALSE); // undamped
+ gPipeline.markMoved(mDrawable, false); // undamped
}
}
setClickAction(click_action);
- count = 0;
- LLVector4 collision_plane;
-
+ count = 0;
+ LLVector4 collision_plane;
+
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 +1377,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,20 +1425,45 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
if (mData)
{
delete [] mData;
- }
+ mData = NULL;
+ }
- // Check for appended generic data
- 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);
- }
+ // 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)
+ { // 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);
if (text_size > 1)
@@ -1529,12 +1476,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
std::string temp_string;
mesgsys->getStringFast(_PREHASH_ObjectData, _PREHASH_Text, temp_string, block_num );
-
+
LLColor4U coloru;
mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_TextColor, coloru.mV, 4, block_num);
-
+
// alpha was flipped so that it zero encoded better
coloru.mV[3] = 255 - coloru.mV[3];
+
mText->setColor(LLColor4(coloru));
mText->setString(temp_string);
@@ -1566,7 +1514,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 +1546,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,60 +1560,23 @@ 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):
- // 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):
+ 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 32:
- // this is a terse 16 update
- this_update_precision = 16;
+
+ 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);
#ifdef LL_BIG_ENDIAN
@@ -1725,33 +1636,14 @@ 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;
mesgsys->getU8Fast(_PREHASH_ObjectData, _PREHASH_State, state, block_num );
@@ -1760,13 +1652,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 +1741,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");
@@ -1914,6 +1806,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
{
std::string temp_string;
dp->unpackString(temp_string, "Text");
+
LLColor4U coloru;
dp->unpackBinaryDataFixed(coloru.mV, 4, "Color");
coloru.mV[3] = 255 - coloru.mV[3];
@@ -1958,7 +1851,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 +1874,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 +1913,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
break;
default:
+ LL_WARNS("UpdateFail") << "Unknown compressed update type " << update_type << " for " << getID() << LL_ENDL;
break;
}
}
@@ -2027,7 +1921,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 +1961,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 +1980,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 +1996,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 +2011,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 +2021,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
}
// Show particles, icon and HUD
- hideExtraDisplayItems( FALSE );
+ hideExtraDisplayItems( false );
setChanged(MOVED | SILHOUETTE);
}
@@ -2153,7 +2048,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
gObjectList.orphanize(this, parent_id, ip, port);
// Hide particles, icon and HUD
- hideExtraDisplayItems( TRUE );
+ hideExtraDisplayItems( true );
}
}
}
@@ -2244,7 +2139,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 +2166,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 +2188,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 +2202,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 +2351,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 +2370,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 +2378,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 +2422,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 +2467,7 @@ void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &frame_time)
}
}
- updateDrawable(FALSE);
+ updateDrawable(false);
}
}
@@ -2758,22 +2653,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 +2692,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();
@@ -2885,7 +2764,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 +2838,7 @@ void LLViewerObject::dirtyInventory()
delete mInventory;
mInventory = NULL;
}
- mInventoryDirty = TRUE;
+ mInventoryDirty = true;
}
void LLViewerObject::registerInventoryListener(LLVOInventoryListener* listener, void* user_data)
@@ -2988,7 +2867,7 @@ void LLViewerObject::removeInventoryListener(LLVOInventoryListener* listener)
}
}
-BOOL LLViewerObject::isInventoryPending()
+bool LLViewerObject::isInventoryPending()
{
return mInvRequestState != INVENTORY_REQUEST_STOPPED;
}
@@ -3022,7 +2901,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 +3199,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 +3276,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 +3338,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 +3669,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 +3694,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 +3714,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 +3722,7 @@ void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped)
if (mOnMap)
{
gObjectList.removeFromMap(this);
- mOnMap = FALSE;
+ mOnMap = false;
}
}
}
@@ -3875,7 +3754,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)
{
@@ -4147,7 +4026,7 @@ void LLViewerObject::updateTextures()
{
}
-void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */)
+void LLViewerObject::boostTexturePriority(bool boost_children /* = true */)
{
if (isDead() || !getVolume())
{
@@ -4165,7 +4044,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)
@@ -4258,7 +4137,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);
@@ -4284,14 +4163,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;
}
@@ -4372,6 +4251,168 @@ const LLVector3 &LLViewerObject::getPositionAgent() const
return mPositionAgent;
}
+LLMatrix4a LLViewerObject::getGLTFAssetToAgentTransform() const
+{
+ LLMatrix4 root;
+ root.initScale(getScale());
+ root.rotate(getRenderRotation());
+ root.translate(getRenderPosition());
+
+ LLMatrix4a mat;
+ mat.loadu((F32*)root.mMatrix);
+
+ return mat;
+}
+
+LLVector3 LLViewerObject::getGLTFNodePositionAgent(S32 node_index) const
+{
+ LLVector3 ret;
+ getGLTFNodeTransformAgent(node_index, &ret, nullptr, nullptr);
+ return ret;
+
+}
+
+LLMatrix4a LLViewerObject::getAgentToGLTFAssetTransform() const
+{
+ LLMatrix4 root;
+ LLVector3 scale = getScale();
+ scale.mV[0] = 1.f / scale.mV[0];
+ scale.mV[1] = 1.f / scale.mV[1];
+ scale.mV[2] = 1.f / scale.mV[2];
+
+ root.translate(-getRenderPosition());
+ root.rotate(~getRenderRotation());
+
+ LLMatrix4 scale_mat;
+ scale_mat.initScale(scale);
+
+ root *= scale_mat;
+ LLMatrix4a mat;
+ mat.loadu((F32*)root.mMatrix);
+
+ return mat;
+}
+
+LLMatrix4a LLViewerObject::getGLTFNodeTransformAgent(S32 node_index) const
+{
+ LLMatrix4a mat;
+
+ if (mGLTFAsset && node_index >= 0 && node_index < mGLTFAsset->mNodes.size())
+ {
+ auto& node = mGLTFAsset->mNodes[node_index];
+
+ LLMatrix4a asset_to_agent = getGLTFAssetToAgentTransform();
+ LLMatrix4a node_to_agent;
+ matMul(node.mAssetMatrix, asset_to_agent, node_to_agent);
+
+ mat = node_to_agent;
+ }
+ else
+ {
+ mat.setIdentity();
+ }
+
+ return mat;
+}
+void LLViewerObject::getGLTFNodeTransformAgent(S32 node_index, LLVector3* position, LLQuaternion* rotation, LLVector3* scale) const
+{
+ LLMatrix4a node_to_agent = getGLTFNodeTransformAgent(node_index);
+
+ if (position)
+ {
+ LLVector4a p = node_to_agent.getTranslation();
+ position->set(p.getF32ptr());
+ }
+
+ if (rotation)
+ {
+ rotation->set(node_to_agent.asMatrix4());
+ }
+
+ if (scale)
+ {
+ scale->mV[0] = node_to_agent.mMatrix[0].getLength3().getF32();
+ scale->mV[1] = node_to_agent.mMatrix[1].getLength3().getF32();
+ scale->mV[2] = node_to_agent.mMatrix[2].getLength3().getF32();
+ }
+}
+
+void decomposeMatrix(const LLMatrix4a& mat, LLVector3& position, LLQuaternion& rotation, LLVector3& scale)
+{
+ LLVector4a p = mat.getTranslation();
+ position.set(p.getF32ptr());
+
+ rotation.set(mat.asMatrix4());
+
+ scale.mV[0] = mat.mMatrix[0].getLength3().getF32();
+ scale.mV[1] = mat.mMatrix[1].getLength3().getF32();
+ scale.mV[2] = mat.mMatrix[2].getLength3().getF32();
+}
+
+void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion& rotation)
+{
+ if (mGLTFAsset && node_index >= 0 && node_index < mGLTFAsset->mNodes.size())
+ {
+ auto& node = mGLTFAsset->mNodes[node_index];
+
+ LLMatrix4a agent_to_asset = getAgentToGLTFAssetTransform();
+ LLMatrix4a agent_to_node = agent_to_asset;
+
+ if (node.mParent != -1)
+ {
+ auto& parent = mGLTFAsset->mNodes[node.mParent];
+ matMul(agent_to_asset, parent.mAssetMatrixInv, agent_to_node);
+ }
+
+ LLQuaternion agent_to_node_rot(agent_to_node.asMatrix4());
+ LLQuaternion new_rot;
+
+ new_rot = rotation * agent_to_node_rot;
+ new_rot.normalize();
+
+ LLVector3 pos;
+ LLQuaternion rot;
+ LLVector3 scale;
+ decomposeMatrix(node.mMatrix, pos, rot, scale);
+
+ node.mMatrix.asMatrix4().initAll(scale, new_rot, pos);
+
+ mGLTFAsset->updateTransforms();
+ }
+}
+
+void LLViewerObject::moveGLTFNode(S32 node_index, const LLVector3& offset)
+{
+ if (mGLTFAsset && node_index >= 0 && node_index < mGLTFAsset->mNodes.size())
+ {
+ auto& node = mGLTFAsset->mNodes[node_index];
+
+ LLMatrix4a agent_to_asset = getAgentToGLTFAssetTransform();
+ LLMatrix4a agent_to_node;
+ matMul(agent_to_asset, node.mAssetMatrixInv, agent_to_node);
+
+ LLVector4a origin = LLVector4a::getZero();
+ LLVector4a offset_v;
+ offset_v.load3(offset.mV);
+
+
+ agent_to_node.affineTransform(offset_v, offset_v);
+ agent_to_node.affineTransform(origin, origin);
+
+ offset_v.sub(origin);
+ offset_v.getF32ptr()[3] = 1.f;
+
+ LLMatrix4a trans;
+ trans.setIdentity();
+ trans.mMatrix[3] = offset_v;
+
+ matMul(trans, node.mMatrix, node.mMatrix);
+
+ // TODO -- only update transforms for this node and its children (or use a dirty flag)
+ mGLTFAsset->updateTransforms();
+ }
+}
+
const LLVector3 &LLViewerObject::getPositionRegion() const
{
if (!isRoot())
@@ -4491,7 +4532,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())
{
@@ -4540,7 +4581,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)
{
@@ -4556,7 +4597,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())
{
@@ -4616,7 +4657,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())
@@ -4630,7 +4671,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())
{
@@ -4645,7 +4686,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);
@@ -4655,7 +4696,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())
{
@@ -4686,11 +4727,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,
@@ -4700,11 +4741,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();
@@ -4764,20 +4805,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)
{
@@ -4785,11 +4826,11 @@ BOOL LLViewerObject::getMediaPassedWhitelist() const
}
else
{
- return FALSE;
+ return false;
}
}
-void LLViewerObject::setMediaPassedWhitelist(BOOL passed)
+void LLViewerObject::setMediaPassedWhitelist(bool passed)
{
if (mMedia)
{
@@ -4797,9 +4838,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);
@@ -4963,7 +5004,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();
@@ -4973,7 +5014,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
{
@@ -4982,7 +5023,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);
}
}
@@ -5019,7 +5060,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);
@@ -5031,10 +5072,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();
@@ -5076,8 +5117,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);
}
}
@@ -5227,21 +5268,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);
}
@@ -5359,7 +5400,6 @@ S32 LLViewerObject::setTEFullbright(const U8 te, const U8 fullbright)
return retval;
}
-
S32 LLViewerObject::setTEMediaFlags(const U8 te, const U8 media_flags)
{
// this might need work for media type
@@ -5781,8 +5821,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();
}
@@ -5798,8 +5838,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();
}
@@ -5832,8 +5872,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);
@@ -5874,7 +5914,7 @@ const LLViewerObject* LLViewerObject::getSubParent() const
return (const LLViewerObject*) getParent();
}
-BOOL LLViewerObject::isOnMap()
+bool LLViewerObject::isOnMap()
{
return mOnMap;
}
@@ -5958,7 +5998,7 @@ LLVOAvatar* LLViewerObject::getAvatarAncestor()
return NULL;
}
-BOOL LLViewerObject::isParticleSource() const
+bool LLViewerObject::isParticleSource() const
{
return !mPartSourcep.isNull() && !mPartSourcep->isDead();
}
@@ -6099,7 +6139,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
@@ -6107,7 +6147,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...
@@ -6186,7 +6226,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);
@@ -6248,8 +6288,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
@@ -6351,7 +6391,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)
@@ -6360,7 +6400,7 @@ BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const
}
else
{
- return FALSE;
+ return false;
}
}
@@ -6375,7 +6415,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
@@ -6385,9 +6425,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)
@@ -6408,7 +6448,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)
{
@@ -6458,7 +6498,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)
{
@@ -6475,7 +6515,7 @@ void LLViewerObject::setDrawableState(U32 state, BOOL recursive)
}
}
-void LLViewerObject::clearDrawableState(U32 state, BOOL recursive)
+void LLViewerObject::clearDrawableState(U32 state, bool recursive)
{
if (mDrawable)
{
@@ -6492,9 +6532,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);
@@ -6519,7 +6559,7 @@ BOOL LLViewerObject::isDrawableState(U32 state, BOOL recursive) const
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Owned by anyone?
-BOOL LLViewerObject::permAnyOwner() const
+bool LLViewerObject::permAnyOwner() const
{
if (isRootEdit())
{
@@ -6531,18 +6571,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();
@@ -6555,7 +6595,7 @@ BOOL LLViewerObject::permYouOwner() const
}
// Owned by a group?
-BOOL LLViewerObject::permGroupOwner() const
+bool LLViewerObject::permGroupOwner() const
{
if (isRootEdit())
{
@@ -6568,18 +6608,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();
@@ -6592,18 +6632,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();
@@ -6616,18 +6656,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();
@@ -6640,18 +6680,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();
@@ -6664,18 +6704,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();
@@ -6689,7 +6729,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());
}
@@ -6780,7 +6820,7 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp)
}
setChanged(MOVED | SILHOUETTE);
- updateDrawable(FALSE);
+ updateDrawable(false);
}
// virtual
@@ -6804,7 +6844,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;
@@ -6817,10 +6857,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)
{
@@ -6834,9 +6874,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.
@@ -6847,15 +6887,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
@@ -6863,7 +6903,7 @@ BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state)
if ((mFlags & flags) != 0)
{
mFlags &= ~flags;
- setit = TRUE;
+ setit = true;
}
}
return setit;
@@ -6986,12 +7026,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);
@@ -7069,8 +7109,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);
}
@@ -7082,7 +7122,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())
{
@@ -7138,18 +7178,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())
@@ -7158,7 +7198,7 @@ BOOL LLViewerObject::isHiglightedOrBeacon() const
|| (is_scripted && flagHandleTouch() && gPipeline.getRenderScriptedTouchBeacons())
|| (is_physical && gPipeline.getRenderPhysicalBeacons());
}
- return FALSE;
+ return false;
}
@@ -7182,12 +7222,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;
}
@@ -7254,11 +7294,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);
}
}
}