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.cpp752
1 files changed, 331 insertions, 421 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 26c8483223..8ea5ee33f3 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,7 +1332,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 +1342,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 +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,19 +1425,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);
@@ -1567,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
@@ -1599,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);
}
}
@@ -1613,59 +1560,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);
@@ -1726,32 +1636,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;
@@ -1761,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;
@@ -1850,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");
@@ -1960,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
@@ -1983,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);
}
}
@@ -2022,6 +1913,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
break;
default:
+ LL_WARNS("UpdateFail") << "Unknown compressed update type " << update_type << " for " << getID() << LL_ENDL;
break;
}
}
@@ -2029,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)
{
@@ -2048,14 +1940,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
if(mesgsys != NULL)
{
- LLViewerObjectList::getUUIDFromLocal(parent_uuid,
+ gObjectList.getUUIDFromLocal(parent_uuid,
parent_id,
mesgsys->getSenderIP(),
mesgsys->getSenderPort());
}
else
{
- LLViewerObjectList::getUUIDFromLocal(parent_uuid,
+ gObjectList.getUUIDFromLocal(parent_uuid,
parent_id,
mRegionp->getHost().getAddress(),
mRegionp->getHost().getPort());
@@ -2069,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);
}
@@ -2087,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
@@ -2103,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());
@@ -2118,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
}
}
}
@@ -2128,7 +2021,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
}
// Show particles, icon and HUD
- hideExtraDisplayItems( FALSE );
+ hideExtraDisplayItems( false );
setChanged(MOVED | SILHOUETTE);
}
@@ -2155,7 +2048,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
gObjectList.orphanize(this, parent_id, ip, port);
// Hide particles, icon and HUD
- hideExtraDisplayItems( TRUE );
+ hideExtraDisplayItems( true );
}
}
}
@@ -2169,7 +2062,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
// Debugging for suspected problems with local ids.
//LLUUID parent_uuid;
- //LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort() );
+ //gObjectList.getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort() );
//if (parent_uuid != cur_parentp->getID() )
//{
// LL_ERRS() << "Local ID match but UUID mismatch of viewer object" << LL_ENDL;
@@ -2192,14 +2085,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
if(mesgsys != NULL)
{
- LLViewerObjectList::getUUIDFromLocal(parent_uuid,
+ gObjectList.getUUIDFromLocal(parent_uuid,
parent_id,
gMessageSystem->getSenderIP(),
gMessageSystem->getSenderPort());
}
else
{
- LLViewerObjectList::getUUIDFromLocal(parent_uuid,
+ gObjectList.getUUIDFromLocal(parent_uuid,
parent_id,
mRegionp->getHost().getAddress(),
mRegionp->getHost().getPort());
@@ -2246,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
@@ -2273,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)
@@ -2295,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
@@ -2309,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
}
}
}
@@ -2458,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.
@@ -2477,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++)
{
@@ -2485,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();
@@ -2529,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
@@ -2574,7 +2467,7 @@ void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &frame_time)
}
}
- updateDrawable(FALSE);
+ updateDrawable(false);
}
}
@@ -2760,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
@@ -2815,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();
@@ -2837,7 +2714,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);
@@ -2887,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)
{
/*
@@ -2961,7 +2838,7 @@ void LLViewerObject::dirtyInventory()
delete mInventory;
mInventory = NULL;
}
- mInventoryDirty = TRUE;
+ mInventoryDirty = true;
}
void LLViewerObject::registerInventoryListener(LLVOInventoryListener* listener, void* user_data)
@@ -2990,7 +2867,7 @@ void LLViewerObject::removeInventoryListener(LLVOInventoryListener* listener)
}
}
-BOOL LLViewerObject::isInventoryPending()
+bool LLViewerObject::isInventoryPending()
{
return mInvRequestState != INVENTORY_REQUEST_STOPPED;
}
@@ -3024,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();
@@ -3419,7 +3296,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);
@@ -3496,7 +3373,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());
@@ -3558,11 +3435,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::loadTaskInvLLSD(const LLSD& inv_result)
@@ -3930,14 +3807,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 true;
}
void LLViewerObject::updateGL()
@@ -3955,7 +3832,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())
@@ -3975,7 +3852,7 @@ void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped)
llassert_always(LLWorld::getInstance()->getRegionFromHandle(getRegion()->getHandle()));
gObjectList.addToMap(this);
- mOnMap = TRUE;
+ mOnMap = true;
}
}
else
@@ -3983,7 +3860,7 @@ void LLViewerObject::setScale(const LLVector3 &scale, BOOL damped)
if (mOnMap)
{
gObjectList.removeFromMap(this);
- mOnMap = FALSE;
+ mOnMap = false;
}
}
}
@@ -4015,7 +3892,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)
{
@@ -4111,15 +3988,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;
}
@@ -4280,7 +4157,7 @@ void LLViewerObject::updateTextures()
{
}
-void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */)
+void LLViewerObject::boostTexturePriority(bool boost_children /* = true */)
{
if (isDead() || !getVolume())
{
@@ -4298,7 +4175,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)
@@ -4391,7 +4268,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);
@@ -4417,14 +4294,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;
}
@@ -4510,7 +4387,7 @@ LLMatrix4a LLViewerObject::getGLTFAssetToAgentTransform() const
LLMatrix4 root;
root.initScale(getScale());
root.rotate(getRenderRotation());
- root.translate(getPositionAgent());
+ root.translate(getRenderPosition());
LLMatrix4a mat;
mat.loadu((F32*)root.mMatrix);
@@ -4534,7 +4411,7 @@ LLMatrix4a LLViewerObject::getAgentToGLTFAssetTransform() const
scale.mV[1] = 1.f / scale.mV[1];
scale.mV[2] = 1.f / scale.mV[2];
- root.translate(-getPositionAgent());
+ root.translate(-getRenderPosition());
root.rotate(~getRenderRotation());
LLMatrix4 scale_mat;
@@ -4551,13 +4428,15 @@ LLMatrix4a LLViewerObject::getGLTFNodeTransformAgent(S32 node_index) const
{
LLMatrix4a mat;
- if (mGLTFAsset.notNull() && node_index >= 0 && node_index < mGLTFAsset->mNodes.size())
+ 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);
+ LLMatrix4a am;
+ am.loadu(glm::value_ptr(node.mAssetMatrix));
+ matMul(am, asset_to_agent, node_to_agent);
mat = node_to_agent;
}
@@ -4568,6 +4447,7 @@ LLMatrix4a LLViewerObject::getGLTFNodeTransformAgent(S32 node_index) const
return mat;
}
+
void LLViewerObject::getGLTFNodeTransformAgent(S32 node_index, LLVector3* position, LLQuaternion* rotation, LLVector3* scale) const
{
LLMatrix4a node_to_agent = getGLTFNodeTransformAgent(node_index);
@@ -4605,7 +4485,7 @@ void decomposeMatrix(const LLMatrix4a& mat, LLVector3& position, LLQuaternion& r
void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion& rotation)
{
- if (mGLTFAsset.notNull() && node_index >= 0 && node_index < mGLTFAsset->mNodes.size())
+ if (mGLTFAsset && node_index >= 0 && node_index < mGLTFAsset->mNodes.size())
{
auto& node = mGLTFAsset->mNodes[node_index];
@@ -4615,7 +4495,9 @@ void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion
if (node.mParent != -1)
{
auto& parent = mGLTFAsset->mNodes[node.mParent];
- matMul(agent_to_asset, parent.mAssetMatrixInv, agent_to_node);
+ LLMatrix4a ami;
+ ami.loadu(glm::value_ptr(parent.mAssetMatrixInv));
+ matMul(agent_to_asset, ami, agent_to_node);
}
LLQuaternion agent_to_node_rot(agent_to_node.asMatrix4());
@@ -4627,9 +4509,13 @@ void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion
LLVector3 pos;
LLQuaternion rot;
LLVector3 scale;
- decomposeMatrix(node.mMatrix, pos, rot, scale);
+ LLMatrix4a mat;
+ mat.loadu(glm::value_ptr(node.mMatrix));
+ decomposeMatrix(mat, pos, rot, scale);
+
+ mat.asMatrix4().initAll(scale, new_rot, pos);
- node.mMatrix.asMatrix4().initAll(scale, new_rot, pos);
+ node.mMatrix = glm::make_mat4(mat.getF32ptr());
mGLTFAsset->updateTransforms();
}
@@ -4637,13 +4523,15 @@ void LLViewerObject::setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion
void LLViewerObject::moveGLTFNode(S32 node_index, const LLVector3& offset)
{
- if (mGLTFAsset.notNull() && node_index >= 0 && node_index < mGLTFAsset->mNodes.size())
+ 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);
+ LLMatrix4a ami;
+ ami.loadu(glm::value_ptr(node.mAssetMatrixInv));
+ matMul(agent_to_asset, ami, agent_to_node);
LLVector4a origin = LLVector4a::getZero();
LLVector4a offset_v;
@@ -4660,7 +4548,12 @@ void LLViewerObject::moveGLTFNode(S32 node_index, const LLVector3& offset)
trans.setIdentity();
trans.mMatrix[3] = offset_v;
- matMul(trans, node.mMatrix, node.mMatrix);
+ LLMatrix4a mat;
+ mat.loadu(glm::value_ptr(node.mMatrix));
+
+ matMul(trans, mat, mat);
+
+ node.mMatrix = glm::make_mat4(mat.getF32ptr());
// TODO -- only update transforms for this node and its children (or use a dirty flag)
mGLTFAsset->updateTransforms();
@@ -4786,7 +4679,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())
{
@@ -4835,7 +4728,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)
{
@@ -4851,7 +4744,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())
{
@@ -4911,7 +4804,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())
@@ -4925,7 +4818,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())
{
@@ -4940,7 +4833,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);
@@ -4950,7 +4843,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())
{
@@ -4981,11 +4874,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,
@@ -4995,11 +4888,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();
@@ -5059,20 +4952,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)
{
@@ -5080,11 +4973,11 @@ BOOL LLViewerObject::getMediaPassedWhitelist() const
}
else
{
- return FALSE;
+ return false;
}
}
-void LLViewerObject::setMediaPassedWhitelist(BOOL passed)
+void LLViewerObject::setMediaPassedWhitelist(bool passed)
{
if (mMedia)
{
@@ -5092,9 +4985,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);
@@ -5258,7 +5151,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();
@@ -5268,7 +5161,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
{
@@ -5277,7 +5170,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);
}
}
@@ -5314,7 +5207,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);
@@ -5326,10 +5219,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();
@@ -5371,8 +5264,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);
}
}
@@ -5522,21 +5415,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);
}
@@ -6075,8 +5968,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();
}
@@ -6092,8 +5985,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();
}
@@ -6126,8 +6019,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);
@@ -6168,7 +6061,7 @@ const LLViewerObject* LLViewerObject::getSubParent() const
return (const LLViewerObject*) getParent();
}
-BOOL LLViewerObject::isOnMap()
+bool LLViewerObject::isOnMap()
{
return mOnMap;
}
@@ -6252,7 +6145,7 @@ LLVOAvatar* LLViewerObject::getAvatarAncestor()
return NULL;
}
-BOOL LLViewerObject::isParticleSource() const
+bool LLViewerObject::isParticleSource() const
{
return !mPartSourcep.isNull() && !mPartSourcep->isDead();
}
@@ -6393,7 +6286,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
@@ -6401,7 +6294,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...
@@ -6480,7 +6373,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);
@@ -6542,8 +6435,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
@@ -6645,7 +6538,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)
@@ -6654,7 +6547,7 @@ BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const
}
else
{
- return FALSE;
+ return false;
}
}
@@ -6669,7 +6562,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
@@ -6679,9 +6572,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)
@@ -6702,7 +6595,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)
{
@@ -6752,7 +6645,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)
{
@@ -6769,7 +6662,7 @@ void LLViewerObject::setDrawableState(U32 state, BOOL recursive)
}
}
-void LLViewerObject::clearDrawableState(U32 state, BOOL recursive)
+void LLViewerObject::clearDrawableState(U32 state, bool recursive)
{
if (mDrawable)
{
@@ -6786,9 +6679,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);
@@ -6813,7 +6706,7 @@ BOOL LLViewerObject::isDrawableState(U32 state, BOOL recursive) const
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Owned by anyone?
-BOOL LLViewerObject::permAnyOwner() const
+bool LLViewerObject::permAnyOwner() const
{
if (isRootEdit())
{
@@ -6825,18 +6718,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();
@@ -6849,7 +6742,7 @@ BOOL LLViewerObject::permYouOwner() const
}
// Owned by a group?
-BOOL LLViewerObject::permGroupOwner() const
+bool LLViewerObject::permGroupOwner() const
{
if (isRootEdit())
{
@@ -6862,18 +6755,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();
@@ -6886,18 +6779,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();
@@ -6910,18 +6803,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();
@@ -6934,18 +6827,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();
@@ -6958,18 +6851,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();
@@ -6983,7 +6876,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());
}
@@ -7074,7 +6967,7 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp)
}
setChanged(MOVED | SILHOUETTE);
- updateDrawable(FALSE);
+ updateDrawable(false);
}
// virtual
@@ -7098,7 +6991,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;
@@ -7111,10 +7004,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)
{
@@ -7128,9 +7021,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.
@@ -7141,15 +7034,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
@@ -7157,7 +7050,7 @@ BOOL LLViewerObject::setFlagsWithoutUpdate(U32 flags, BOOL state)
if ((mFlags & flags) != 0)
{
mFlags &= ~flags;
- setit = TRUE;
+ setit = true;
}
}
return setit;
@@ -7280,12 +7173,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);
@@ -7363,8 +7256,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);
}
@@ -7376,7 +7269,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())
{
@@ -7432,18 +7325,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())
@@ -7452,7 +7345,7 @@ BOOL LLViewerObject::isHiglightedOrBeacon() const
|| (is_scripted && flagHandleTouch() && gPipeline.getRenderScriptedTouchBeacons())
|| (is_physical && gPipeline.getRenderPhysicalBeacons());
}
- return FALSE;
+ return false;
}
@@ -7476,12 +7369,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;
}
@@ -7548,11 +7441,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);
}
}
}
@@ -7751,6 +7644,23 @@ void LLViewerObject::shrinkWrap()
}
}
+void LLViewerObject::setGLTFAsset(const LLUUID& id)
+{
+ //get the sculpt params and set the sculpt type and id
+ auto* param = getExtraParameterEntryCreate(LLNetworkData::PARAMS_SCULPT);
+
+ LLSculptParams* sculpt_params = (LLSculptParams*)param->data;
+ sculpt_params->setSculptTexture(id, LL_SCULPT_TYPE_GLTF);
+
+ setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, true, true);
+
+ // Update the volume
+ LLVolumeParams volume_params;
+ volume_params.setSculptID(id, LL_SCULPT_TYPE_GLTF);
+ updateVolume(volume_params);
+}
+
+
class ObjectPhysicsProperties : public LLHTTPNode
{
public:
@@ -7760,7 +7670,7 @@ public:
const LLSD& input) const
{
LLSD object_data = input["body"]["ObjectData"];
- S32 num_entries = object_data.size();
+ S32 num_entries = static_cast<S32>(object_data.size());
for ( S32 i = 0; i < num_entries; i++ )
{