Moves some constants out of llavatarconstants.h 8ebf8f4608bd: Change various const constants to constexpr e07d5d43ba30: CID-143595 30b6935fc66d: CID-143595 acc96f9051cb: Fix a memory leak in viewer side baking initial wearable setup Sync llmodel.* Changesets assimilated: f8f7706c2902: CID-143554 - fix out of bounds access 223eb65adce4: CID-143554 - Chase 2ceb49aaa133: CID-42838, CID-42930, CID-42933, CID-42938, CID-42940, CID-42945, CID-42948, CID-56111, CID-83907 d220005d9f23: Missing null check before deref 31dbb0f3b6ee: CID-42571 CID-42576 CID-42578 49caf082e65c: change unordered_map to flat_map Doesn't cause as many problems as a hashmap when it comes to assumptions in the LLUI system. f93f5e881484: "update" linux cef downgrade to fix javascript problems cba818dd9269: Various null checks and etc. 1b4c6bc483bb: CID-42847, CID-42854, CID-42886, CID-42921, CID-42922, CID-42923, CID-42924, CID-42925, CID-42927, CID-42928, CID-83871, CID-83876, CID-83878, CID-83880, CID-83900, CID-143573 0fe90cd9ec24: Various file size related things a79f6f653dca: CID-42918 - Initialize member pointers in LLFloaterGodTools 0b70d600d978: Tweak LLFloaterBuyLand initializations e8b173ffe813: CID-42854 - Additional fix to LLDrawInfo b5d745cf3fde: Fix signage 4f2e2f384781: Initialize and cleanup various class member variables. CID-42899, CID-42900, CID-42902, CID-42903, CID-42904, CID-42905, CID-42909, CID-42910, CID-42911, CID-42912, CID-42913, CID-42967, CID-83853, CID-83898, CID-83890, CID-143584 9851a3e39b4c: Fix platform specific include directories 5c074e84f1be: Initialize and clenaup various more class member variables. CID-42885, CID-42853, CID-42894, CID-42895, CID-42896, CID-83908, CID-143574, CID-143575, CID-143576, CID-143576, CID-143578 ac262854ac92: Brace sub-object in initialization to make our intentions clear to clang 358da477d4c1: More double brace init c3850119314a: Initialize various member pointers in panels CID-83902, CID-83903, CID-83905, CID-83909, CID-83911, CID-83912, CID-143572
319 lines
9.5 KiB
C++
319 lines
9.5 KiB
C++
/**
|
|
* @file llviewerobjectlist.h
|
|
* @brief Description of LLViewerObjectList class.
|
|
*
|
|
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
|
*
|
|
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
*
|
|
* Second Life Viewer Source Code
|
|
* The source code in this file ("Source Code") is provided by Linden Lab
|
|
* to you under the terms of the GNU General Public License, version 2.0
|
|
* ("GPL"), unless you have obtained a separate licensing agreement
|
|
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
|
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
|
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
*
|
|
* There are special exceptions to the terms and conditions of the GPL as
|
|
* it is applied to this Source Code. View the full text of the exception
|
|
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
|
* online at
|
|
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
*
|
|
* By copying, modifying or distributing this software, you acknowledge
|
|
* that you have read and understood your obligations described above,
|
|
* and agree to abide by those obligations.
|
|
*
|
|
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
|
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
|
* COMPLETENESS OR PERFORMANCE.
|
|
* $/LicenseInfo$
|
|
*/
|
|
|
|
#ifndef LL_LLVIEWEROBJECTLIST_H
|
|
#define LL_LLVIEWEROBJECTLIST_H
|
|
|
|
#include <map>
|
|
#include <set>
|
|
|
|
// common includes
|
|
#include "llstat.h"
|
|
#include "llstring.h"
|
|
|
|
// project includes
|
|
#include "llviewerobject.h"
|
|
#include "llvoavatar.h"
|
|
|
|
class LLCamera;
|
|
class LLNetMap;
|
|
class LLDebugBeacon;
|
|
|
|
constexpr U32 CLOSE_BIN_SIZE = 10;
|
|
constexpr U32 NUM_BINS = 128;
|
|
|
|
// GL name = position in object list + GL_NAME_INDEX_OFFSET so that
|
|
// we can have special numbers like zero.
|
|
constexpr U32 GL_NAME_LAND = 0;
|
|
constexpr U32 GL_NAME_PARCEL_WALL = 1;
|
|
|
|
constexpr U32 GL_NAME_INDEX_OFFSET = 10;
|
|
|
|
class LLViewerObjectList
|
|
{
|
|
public:
|
|
LLViewerObjectList();
|
|
~LLViewerObjectList();
|
|
|
|
void destroy();
|
|
|
|
friend class LocalBitmap; // tag: vaa emerald local_asset_browser
|
|
|
|
// For internal use only. Does NOT take a local id, takes an index into
|
|
// an internal dynamic array.
|
|
inline LLViewerObject *getObject(const S32 index);
|
|
|
|
inline LLViewerObject *findObject(const LLUUID &id) const;
|
|
inline LLVOAvatar *findAvatar(const LLUUID &id) const;
|
|
LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp); // Create a viewer-side object
|
|
LLViewerObject *createObject(const LLPCode pcode, LLViewerRegion *regionp,
|
|
const LLUUID &uuid, const U32 local_id, const LLHost &sender);
|
|
|
|
LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly
|
|
|
|
BOOL killObject(LLViewerObject *objectp);
|
|
void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region.
|
|
void killAllObjects();
|
|
void removeDrawable(LLDrawable* drawablep);
|
|
|
|
void cleanDeadObjects(const BOOL use_timer = TRUE); // Clean up the dead object list.
|
|
|
|
// Simulator and viewer side object updates...
|
|
void processUpdateCore(LLViewerObject* objectp, void** data, U32 block, const EObjectUpdateType update_type, LLDataPacker* dpp, BOOL justCreated);
|
|
void processObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type, bool cached=false, bool compressed=false);
|
|
void processCompressedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
|
|
void processCachedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
|
|
void updateApparentAngles(LLAgent &agent);
|
|
void update(LLAgent &agent, LLWorld &world);
|
|
|
|
void fetchObjectCosts();
|
|
void fetchPhysicsFlags();
|
|
|
|
bool gotObjectPhysicsFlags(LLViewerObject* objectp);
|
|
|
|
void updateObjectCost(LLViewerObject* object);
|
|
void updateObjectCost(const LLUUID& object_id, F32 object_cost, F32 link_cost, F32 physics_cost, F32 link_physics_cost);
|
|
void onObjectCostFetchFailure(const LLUUID& object_id);
|
|
|
|
void updatePhysicsFlags(const LLViewerObject* object);
|
|
void onPhysicsFlagsFetchFailure(const LLUUID& object_id);
|
|
void updatePhysicsShapeType(const LLUUID& object_id, S32 type);
|
|
void updatePhysicsProperties(const LLUUID& object_id,
|
|
F32 density,
|
|
F32 friction,
|
|
F32 restitution,
|
|
F32 gravity_multiplier);
|
|
|
|
void shiftObjects(const LLVector3 &offset);
|
|
void repartitionObjects();
|
|
|
|
bool hasMapObjectInRegion(LLViewerRegion* regionp) ;
|
|
void clearAllMapObjectsInRegion(LLViewerRegion* regionp) ;
|
|
void renderObjectsForMap(LLNetMap &netmap);
|
|
void renderObjectBounds(const LLVector3 ¢er);
|
|
|
|
void addDebugBeacon(const LLVector3 &pos_agent, const std::string &string,
|
|
const LLColor4 &color=LLColor4(1.f, 0.f, 0.f, 0.5f),
|
|
const LLColor4 &text_color=LLColor4(1.f, 1.f, 1.f, 1.f),
|
|
S32 line_width = 1);
|
|
void renderObjectBeacons();
|
|
void resetObjectBeacons();
|
|
|
|
void dirtyAllObjectInventory();
|
|
|
|
void removeFromActiveList(LLViewerObject* objectp);
|
|
void updateActive(LLViewerObject *objectp);
|
|
|
|
void updateAvatarVisibility();
|
|
|
|
// Selection related stuff
|
|
void generatePickList(LLCamera &camera);
|
|
|
|
LLViewerObject *getSelectedObject(const U32 object_id);
|
|
|
|
inline S32 getNumObjects() { return (S32) mObjects.size(); }
|
|
|
|
void addToMap(LLViewerObject *objectp);
|
|
void removeFromMap(LLViewerObject *objectp);
|
|
|
|
void clearDebugText();
|
|
|
|
////////////////////////////////////////////
|
|
//
|
|
// Only accessed by markDead in LLViewerObject
|
|
void cleanupReferences(LLViewerObject *objectp);
|
|
|
|
S32 findReferences(LLDrawable *drawablep) const; // Find references to drawable in all objects, and return value.
|
|
|
|
S32 getOrphanParentCount() const { return (S32) mOrphanParents.size(); }
|
|
S32 getOrphanCount() const { return mNumOrphans; }
|
|
void orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port);
|
|
void findOrphans(LLViewerObject* objectp, U32 ip, U32 port);
|
|
|
|
public:
|
|
// Class for keeping track of orphaned objects
|
|
class OrphanInfo
|
|
{
|
|
public:
|
|
OrphanInfo();
|
|
OrphanInfo(const U64 parent_info, const LLUUID child_info);
|
|
bool operator==(const OrphanInfo &rhs) const;
|
|
bool operator!=(const OrphanInfo &rhs) const;
|
|
U64 mParentInfo;
|
|
LLUUID mChildInfo;
|
|
};
|
|
|
|
|
|
U32 mCurBin; // Current bin we're working on...
|
|
|
|
S32 mNumNewObjects;
|
|
|
|
S32 mNumSizeCulled;
|
|
S32 mNumVisCulled;
|
|
|
|
// if we paused in the last frame
|
|
// used to discount stats from this frame
|
|
BOOL mWasPaused;
|
|
|
|
static void getUUIDFromLocal(LLUUID &id,
|
|
const U32 local_id,
|
|
const U32 ip,
|
|
const U32 port);
|
|
static void setUUIDAndLocal(const LLUUID &id,
|
|
const U32 local_id,
|
|
const U32 ip,
|
|
const U32 port); // Requires knowledge of message system info!
|
|
|
|
static BOOL removeFromLocalIDTable(const LLViewerObject* objectp);
|
|
// Used ONLY by the orphaned object code.
|
|
static U64 getIndex(const U32 local_id, const U32 ip, const U32 port);
|
|
|
|
S32 mNumUnknownUpdates;
|
|
S32 mNumDeadObjectUpdates;
|
|
S32 mNumUnknownKills;
|
|
S32 mNumDeadObjects;
|
|
S32 mMinNumDeadObjects;
|
|
//protected:
|
|
std::vector<U64> mOrphanParents; // LocalID/ip,port of orphaned objects
|
|
std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects
|
|
S32 mNumOrphans;
|
|
|
|
static LLStat sCacheHitRate;
|
|
|
|
typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
|
|
|
|
vobj_list_t mObjects;
|
|
std::vector<LLPointer<LLViewerObject> > mActiveObjects;
|
|
|
|
vobj_list_t mMapObjects;
|
|
|
|
std::set<LLUUID> mDeadObjects;
|
|
|
|
boost::unordered_map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
|
|
boost::unordered_map<LLUUID, LLPointer<LLVOAvatar> > mUUIDAvatarMap;
|
|
|
|
//set of objects that need to update their cost
|
|
std::set<LLUUID> mStaleObjectCost;
|
|
std::set<LLUUID> mPendingObjectCost;
|
|
|
|
//set of objects that need to update their physics flags
|
|
std::set<LLUUID> mStalePhysicsFlags;
|
|
std::set<LLUUID> mPendingPhysicsFlags;
|
|
|
|
std::vector<LLDebugBeacon> mDebugBeacons;
|
|
|
|
S32 mCurLazyUpdateIndex;
|
|
|
|
static U32 sSimulatorMachineIndex;
|
|
static std::map<U64, U32> sIPAndPortToIndex;
|
|
|
|
static std::map<U64, LLUUID> sIndexAndLocalIDToUUID;
|
|
|
|
std::set<LLViewerObject *> mSelectPickList;
|
|
|
|
friend class LLViewerObject;
|
|
};
|
|
|
|
|
|
class LLDebugBeacon
|
|
{
|
|
public:
|
|
~LLDebugBeacon()
|
|
{
|
|
if (mHUDObject.notNull())
|
|
{
|
|
mHUDObject->markDead();
|
|
}
|
|
}
|
|
|
|
LLVector3 mPositionAgent;
|
|
std::string mString;
|
|
LLColor4 mColor;
|
|
LLColor4 mTextColor;
|
|
S32 mLineWidth;
|
|
LLPointer<LLHUDObject> mHUDObject;
|
|
};
|
|
|
|
|
|
|
|
// Global object list
|
|
extern LLViewerObjectList gObjectList;
|
|
|
|
// Inlines
|
|
inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id) const
|
|
{
|
|
boost::unordered_map<LLUUID, LLPointer<LLViewerObject> >::const_iterator iter = mUUIDObjectMap.find(id);
|
|
if(iter != mUUIDObjectMap.end())
|
|
{
|
|
return iter->second;
|
|
}
|
|
else
|
|
{
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
inline LLVOAvatar *LLViewerObjectList::findAvatar(const LLUUID &id) const
|
|
{
|
|
boost::unordered_map<LLUUID, LLPointer<LLVOAvatar> >::const_iterator iter = mUUIDAvatarMap.find(id);
|
|
return (iter != mUUIDAvatarMap.end()) ? iter->second.get() : NULL;
|
|
}
|
|
|
|
inline LLViewerObject *LLViewerObjectList::getObject(const S32 index)
|
|
{
|
|
LLViewerObject *objectp;
|
|
objectp = mObjects[index];
|
|
if (objectp->isDead())
|
|
{
|
|
//LL_WARNS() << "Dead object " << objectp->mID << " in getObject" << LL_ENDL;
|
|
return NULL;
|
|
}
|
|
return objectp;
|
|
}
|
|
|
|
inline void LLViewerObjectList::addToMap(LLViewerObject *objectp)
|
|
{
|
|
mMapObjects.push_back(objectp);
|
|
}
|
|
|
|
inline void LLViewerObjectList::removeFromMap(LLViewerObject *objectp)
|
|
{
|
|
std::vector<LLPointer<LLViewerObject> >::iterator iter = std::find(mMapObjects.begin(), mMapObjects.end(), objectp);
|
|
if (iter != mMapObjects.end())
|
|
{
|
|
mMapObjects.erase(iter);
|
|
}
|
|
}
|
|
|
|
|
|
#endif // LL_VIEWER_OBJECT_LIST_H
|