aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerobjectlist.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llviewerobjectlist.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llviewerobjectlist.h')
-rw-r--r--linden/indra/newview/llviewerobjectlist.h275
1 files changed, 275 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewerobjectlist.h b/linden/indra/newview/llviewerobjectlist.h
new file mode 100644
index 0000000..3122d9d
--- /dev/null
+++ b/linden/indra/newview/llviewerobjectlist.h
@@ -0,0 +1,275 @@
1/**
2 * @file llviewerobjectlist.h
3 * @brief Description of LLViewerObjectList class.
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLVIEWEROBJECTLIST_H
29#define LL_LLVIEWEROBJECTLIST_H
30
31#include <map>
32#include <set>
33
34// common includes
35#include "doublelinkedlist.h"
36#include "llstat.h"
37#include "lldarrayptr.h"
38#include "llskipmap.h"
39#include "llstring.h"
40
41// project includes
42#include "llviewerobject.h"
43
44class LLNetMap;
45class LLDebugBeacon;
46
47const U32 CLOSE_BIN_SIZE = 10;
48const U32 NUM_BINS = 16;
49
50// GL name = position in object list + GL_NAME_INDEX_OFFSET so that
51// we can have special numbers like zero.
52const U32 GL_NAME_LAND = 0;
53const U32 GL_NAME_PARCEL_WALL = 1;
54
55const U32 GL_NAME_INDEX_OFFSET = 10;
56
57class LLViewerObjectList
58{
59public:
60 LLViewerObjectList();
61 ~LLViewerObjectList();
62
63 void destroy();
64
65 // For internal use only. Does NOT take a local id, takes an index into
66 // an internal dynamic array.
67 inline LLViewerObject *getObject(const S32 index);
68
69 inline LLViewerObject *findObject(const LLUUID &id);
70 LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp); // Create a viewer-side object
71 LLViewerObject *createObject(const LLPCode pcode, LLViewerRegion *regionp,
72 const LLUUID &uuid, const U32 local_id, const LLHost &sender);
73
74 LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly
75
76 BOOL killObject(LLViewerObject *objectp);
77 void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region.
78 void killAllObjects();
79 void removeDrawable(LLDrawable* drawablep);
80
81 void cleanDeadObjects(const BOOL use_timer = TRUE); // Clean up the dead object list.
82
83 // Simulator and viewer side object updates...
84 void processUpdateCore(LLViewerObject* objectp, void** data, U32 block, const EObjectUpdateType update_type, LLDataPacker* dpp, BOOL justCreated);
85 void processObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type, bool cached=false, bool compressed=false);
86 void processCompressedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
87 void processCachedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type);
88 void updateApparentAngles(LLAgent &agent);
89 void update(LLAgent &agent, LLWorld &world);
90
91 void shiftObjects(const LLVector3 &offset);
92
93 void renderObjectsForMap(LLNetMap &netmap);
94 void renderObjectBounds(const LLVector3 &center);
95
96 void addDebugBeacon(const LLVector3 &pos_agent, const LLString &string,
97 const LLColor4 &color=LLColor4(1.f, 0.f, 0.f, 0.5f),
98 const LLColor4 &text_color=LLColor4(1.f, 1.f, 1.f, 1.f),
99 S32 line_width = 1);
100 void renderObjectBeacons();
101 void resetObjectBeacons();
102
103 void relightAllObjects();
104 void dirtyAllObjectInventory();
105
106 void updateActive(LLViewerObject *objectp);
107 void updateAvatarVisibility();
108
109 // Selection related stuff
110 U32 renderObjectsForSelect(LLCamera &camera, BOOL pick_parcel_wall = FALSE, BOOL keep_pick_list = FALSE);
111 LLViewerObject *getSelectedObject(const U32 object_id);
112
113 inline S32 getNumObjects() { return mObjects.count(); }
114
115 void addToMap(LLViewerObject *objectp);
116 void removeFromMap(LLViewerObject *objectp);
117
118
119 ////////////////////////////////////////////
120 //
121 // Only accessed by markDead in LLViewerObject
122 void cleanupReferences(LLViewerObject *objectp);
123
124 S32 findReferences(LLDrawable *drawablep) const; // Find references to drawable in all objects, and return value.
125
126 S32 getOrphanParentCount() const { return mOrphanParents.count(); }
127 S32 getOrphanCount() const { return mNumOrphans; }
128 void orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port);
129 void findOrphans(LLViewerObject* objectp, U32 ip, U32 port);
130
131public:
132 // Class for keeping track of orphaned objects
133 class OrphanInfo
134 {
135 public:
136 OrphanInfo();
137 OrphanInfo(const U64 parent_info, const LLUUID child_info);
138 bool operator==(const OrphanInfo &rhs) const;
139 bool operator!=(const OrphanInfo &rhs) const;
140 U64 mParentInfo;
141 LLUUID mChildInfo;
142 };
143
144
145 U32 mCurBin; // Current bin we're working on...
146
147 //////////////////////
148 //
149 // Statistics data
150 //
151 //
152 LLStat mNumObjectsStat;
153 LLStat mNumActiveObjectsStat;
154 LLStat mNumNewObjectsStat;
155 LLStat mNumSizeCulledStat;
156 LLStat mNumVisCulledStat;
157
158 S32 mNumNewObjects;
159
160 S32 mNumSizeCulled;
161 S32 mNumVisCulled;
162
163 // if we paused in the last frame
164 // used to discount stats from this frame
165 BOOL mWasPaused;
166
167 static void getUUIDFromLocal(LLUUID &id,
168 const U32 local_id,
169 const U32 ip,
170 const U32 port);
171 static void setUUIDAndLocal(const LLUUID &id,
172 const U32 local_id,
173 const U32 ip,
174 const U32 port); // Requires knowledge of message system info!
175
176 static BOOL removeFromLocalIDTable(const LLViewerObject &object);
177 // Used ONLY by the orphaned object code.
178 static U64 getIndex(const U32 local_id, const U32 ip, const U32 port);
179
180 S32 mNumUnknownUpdates;
181 S32 mNumDeadObjectUpdates;
182 S32 mNumUnknownKills;
183 S32 mNumDeadObjects;
184protected:
185 LLDynamicArray<U64> mOrphanParents; // LocalID/ip,port of orphaned objects
186 LLDynamicArray<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects
187 S32 mNumOrphans;
188
189 LLDynamicArrayPtr<LLPointer<LLViewerObject>, 256> mObjects;
190 std::set<LLPointer<LLViewerObject> > mActiveObjects;
191
192 LLDynamicArrayPtr<LLPointer<LLViewerObject> > mMapObjects;
193
194 typedef std::map<LLUUID, LLPointer<LLViewerObject> > vo_map;
195 vo_map mDeadObjects; // Need to keep multiple entries per UUID
196
197 std::map<LLUUID, LLPointer<LLViewerObject> > mUUIDObjectMap;
198
199 LLDynamicArray<LLDebugBeacon> mDebugBeacons;
200
201 S32 mCurLazyUpdateIndex;
202
203 static U32 sSimulatorMachineIndex;
204 static LLMap<U64, U32> sIPAndPortToIndex;
205
206 static std::map<U64, LLUUID> sIndexAndLocalIDToUUID;
207
208 std::set<LLViewerObject *> mSelectPickList;
209
210 friend class LLViewerObject;
211};
212
213
214class LLDebugBeacon
215{
216public:
217 ~LLDebugBeacon()
218 {
219 if (mHUDObject.notNull())
220 {
221 mHUDObject->markDead();
222 }
223 }
224
225 LLVector3 mPositionAgent;
226 LLString mString;
227 LLColor4 mColor;
228 LLColor4 mTextColor;
229 S32 mLineWidth;
230 LLPointer<LLHUDObject> mHUDObject;
231};
232
233
234
235// Global object list
236extern LLViewerObjectList gObjectList;
237
238// Inlines
239inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id)
240{
241 std::map<LLUUID, LLPointer<LLViewerObject> >::iterator iter = mUUIDObjectMap.find(id);
242 if(iter != mUUIDObjectMap.end())
243 {
244 return iter->second;
245 }
246 else
247 {
248 return NULL;
249 }
250}
251
252inline LLViewerObject *LLViewerObjectList::getObject(const S32 index)
253{
254 LLViewerObject *objectp;
255 objectp = mObjects[index];
256 if (objectp->isDead())
257 {
258 //llwarns << "Dead object " << objectp->mID << " in getObject" << llendl;
259 return NULL;
260 }
261 return objectp;
262}
263
264inline void LLViewerObjectList::addToMap(LLViewerObject *objectp)
265{
266 mMapObjects.put(objectp);
267}
268
269inline void LLViewerObjectList::removeFromMap(LLViewerObject *objectp)
270{
271 mMapObjects.removeObj(objectp);
272}
273
274
275#endif // LL_VIEWER_OBJECT_LIST_H