diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llviewerobject.h | |
parent | README.txt (diff) | |
download | meta-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/llviewerobject.h')
-rw-r--r-- | linden/indra/newview/llviewerobject.h | 645 |
1 files changed, 645 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewerobject.h b/linden/indra/newview/llviewerobject.h new file mode 100644 index 0000000..a439a01 --- /dev/null +++ b/linden/indra/newview/llviewerobject.h | |||
@@ -0,0 +1,645 @@ | |||
1 | /** | ||
2 | * @file llviewerobject.h | ||
3 | * @brief Description of LLViewerObject class, which is the base class for most objects in the viewer. | ||
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_LLVIEWEROBJECT_H | ||
29 | #define LL_LLVIEWEROBJECT_H | ||
30 | |||
31 | #include <map> | ||
32 | |||
33 | #include "linked_lists.h" | ||
34 | #include "llassetstorage.h" | ||
35 | #include "lldarrayptr.h" | ||
36 | #include "llhudtext.h" | ||
37 | #include "llhudicon.h" | ||
38 | #include "llinventory.h" | ||
39 | #include "llmemory.h" | ||
40 | #include "llprimitive.h" | ||
41 | #include "lluuid.h" | ||
42 | #include "llvoinventorylistener.h" | ||
43 | #include "object_flags.h" | ||
44 | #include "llquaternion.h" | ||
45 | #include "v3dmath.h" | ||
46 | #include "v3math.h" | ||
47 | |||
48 | class LLAgent; // TODO: Get rid of this. | ||
49 | class LLAudioSource; | ||
50 | class LLAudioSourceVO; | ||
51 | class LLBBox; | ||
52 | class LLDataPacker; | ||
53 | class LLColor4; | ||
54 | class LLFrameTimer; | ||
55 | class LLDrawable; | ||
56 | class LLHost; | ||
57 | class LLWorld; | ||
58 | class LLNameValue; | ||
59 | class LLNetMap; | ||
60 | class LLMessageSystem; | ||
61 | class LLPrimitive; | ||
62 | class LLPipeline; | ||
63 | class LLTextureEntry; | ||
64 | class LLViewerImage; | ||
65 | class LLViewerInventoryItem; | ||
66 | class LLViewerObject; | ||
67 | class LLViewerPartSourceScript; | ||
68 | class LLViewerRegion; | ||
69 | class LLViewerObjectMedia; | ||
70 | class LLVOInventoryListener; | ||
71 | |||
72 | typedef enum e_object_update_type | ||
73 | { | ||
74 | OUT_FULL, | ||
75 | OUT_TERSE_IMPROVED, | ||
76 | OUT_FULL_COMPRESSED, | ||
77 | OUT_FULL_CACHED, | ||
78 | } EObjectUpdateType; | ||
79 | |||
80 | |||
81 | // callback typedef for inventory | ||
82 | typedef void (*inventory_callback)(LLViewerObject*, | ||
83 | InventoryObjectList*, | ||
84 | S32 serial_num, | ||
85 | void*); | ||
86 | |||
87 | // a small struct for keeping track of joints | ||
88 | struct LLVOJointInfo | ||
89 | { | ||
90 | EHavokJointType mJointType; | ||
91 | LLVector3 mPivot; // parent-frame | ||
92 | // whether the below an axis or anchor (and thus its frame) | ||
93 | // depends on the joint type: | ||
94 | // HINGE ==> axis=parent-frame | ||
95 | // P2P ==> anchor=child-frame | ||
96 | LLVector3 mAxisOrAnchor; | ||
97 | }; | ||
98 | |||
99 | // for exporting textured materials from SL | ||
100 | struct LLMaterialExportInfo | ||
101 | { | ||
102 | public: | ||
103 | LLMaterialExportInfo(S32 mat_index, S32 texture_index, LLColor4 color) : | ||
104 | mMaterialIndex(mat_index), mTextureIndex(texture_index), mColor(color) {}; | ||
105 | |||
106 | S32 mMaterialIndex; | ||
107 | S32 mTextureIndex; | ||
108 | LLColor4 mColor; | ||
109 | }; | ||
110 | |||
111 | //============================================================================ | ||
112 | |||
113 | class LLViewerObject : public LLPrimitive, public LLRefCount | ||
114 | { | ||
115 | protected: | ||
116 | virtual ~LLViewerObject(); // use unref() | ||
117 | |||
118 | // TomY: Provide for a list of extra parameter structures, mapped by structure name | ||
119 | struct ExtraParameter | ||
120 | { | ||
121 | BOOL in_use; | ||
122 | LLNetworkData *data; | ||
123 | }; | ||
124 | std::map<U16, ExtraParameter*> mExtraParameterList; | ||
125 | |||
126 | public: | ||
127 | typedef std::vector<LLPointer<LLViewerObject> > child_list_t; | ||
128 | |||
129 | LLViewerObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp); | ||
130 | MEM_TYPE_NEW(LLMemType::MTYPE_OBJECT); | ||
131 | |||
132 | virtual void markDead(); // Mark this object as dead, and clean up its references | ||
133 | BOOL isDead() const {return mDead;} | ||
134 | BOOL isOrphaned() const { return mOrphaned; } | ||
135 | BOOL isParticleSource() const; | ||
136 | |||
137 | static void initVOClasses(); | ||
138 | static void cleanupVOClasses(); | ||
139 | |||
140 | void addNVPair(const std::string& data); | ||
141 | BOOL removeNVPair(const char *name); | ||
142 | LLNameValue *getNVPair(const char *name) const; // null if no name value pair by that name | ||
143 | |||
144 | // Object create and update functions | ||
145 | virtual BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); | ||
146 | |||
147 | // Types of media we can associate | ||
148 | enum { MEDIA_TYPE_NONE = 0, MEDIA_TYPE_WEB_PAGE = 1 }; | ||
149 | |||
150 | // Return codes for processUpdateMessage | ||
151 | enum { MEDIA_URL_REMOVED = 0x1, MEDIA_URL_ADDED = 0x2, MEDIA_URL_UPDATED = 0x4 }; | ||
152 | |||
153 | enum { CLICK_ACTION_TOUCH = 0, CLICK_ACTION_SIT = 1, CLICK_ACTION_BUY = 2 }; | ||
154 | |||
155 | virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, | ||
156 | void **user_data, | ||
157 | U32 block_num, | ||
158 | const EObjectUpdateType update_type, | ||
159 | LLDataPacker *dp); | ||
160 | |||
161 | |||
162 | virtual BOOL isActive() const; // Whether this object needs to do an idleUpdate. | ||
163 | BOOL onActiveList() const {return mOnActiveList;} | ||
164 | void setOnActiveList(BOOL on_active) { mOnActiveList = on_active; } | ||
165 | |||
166 | virtual BOOL isAttachment() const { return FALSE; } | ||
167 | virtual BOOL isHUDAttachment() const { return FALSE; } | ||
168 | virtual void updateRadius() {}; | ||
169 | virtual F32 getVObjRadius() const; // default implemenation is mDrawable->getRadius() | ||
170 | |||
171 | BOOL isJointChild() const { return mJointInfo ? TRUE : FALSE; } | ||
172 | EHavokJointType getJointType() const { return mJointInfo ? mJointInfo->mJointType : HJT_INVALID; } | ||
173 | // for jointed and other parent-relative hacks | ||
174 | LLViewerObject* getSubParent(); | ||
175 | const LLViewerObject* getSubParent() const; | ||
176 | |||
177 | // Object visiblility and GPW functions | ||
178 | virtual void setPixelAreaAndAngle(LLAgent &agent); // Override to generate accurate apparent angle and area | ||
179 | |||
180 | virtual U32 getNumVertices() const; | ||
181 | virtual U32 getNumIndices() const; | ||
182 | S32 getNumFaces() const { return mNumFaces; } | ||
183 | |||
184 | // Graphical stuff for objects - maybe broken out into render class later? | ||
185 | virtual void updateTextures(LLAgent &agent); | ||
186 | virtual void boostTexturePriority(BOOL boost_children = TRUE); // When you just want to boost priority of this object | ||
187 | |||
188 | virtual LLDrawable* createDrawable(LLPipeline *pipeline); | ||
189 | virtual BOOL updateGeometry(LLDrawable *drawable); | ||
190 | virtual BOOL updateLOD(); | ||
191 | virtual BOOL setDrawableParent(LLDrawable* parentp); | ||
192 | virtual BOOL updateLighting(BOOL do_lighting) { return TRUE; }; | ||
193 | F32 getRotTime() { return mRotTime; } | ||
194 | void resetRot(); | ||
195 | void applyAngularVelocity(F32 dt); | ||
196 | |||
197 | void setLineWidthForWindowSize(S32 window_width); | ||
198 | |||
199 | static void increaseArrowLength(); // makes axis arrows for selections longer | ||
200 | static void decreaseArrowLength(); // makes axis arrows for selections shorter | ||
201 | |||
202 | // Accessor functions | ||
203 | LLViewerRegion* getRegion() const { return mRegionp; } | ||
204 | |||
205 | BOOL isSelected() const { return mUserSelected; } | ||
206 | void setSelected(BOOL sel) { mUserSelected = sel; mRotTime = 0.f;} | ||
207 | |||
208 | const LLUUID &getID() const { return mID; } | ||
209 | U32 getLocalID() const { return mLocalID; } | ||
210 | U32 getCRC() const { return mTotalCRC; } | ||
211 | |||
212 | virtual BOOL isFlexible() const { return false; } | ||
213 | |||
214 | // This method returns true if the object is over land owned by | ||
215 | // the agent. | ||
216 | BOOL isOverAgentOwnedLand() const; | ||
217 | |||
218 | // True if over land owned by group of which the agent is | ||
219 | // either officer or member. | ||
220 | BOOL isOverGroupOwnedLand() const; | ||
221 | |||
222 | /* | ||
223 | // This method will scan through this object, and then query the | ||
224 | // selection manager to see if the local agent probably has the | ||
225 | // ability to modify the object. Since this calls into the | ||
226 | // selection manager, you should avoid calling this method from | ||
227 | // there. | ||
228 | BOOL isProbablyModifiable() const; | ||
229 | */ | ||
230 | |||
231 | virtual void setParent(LLViewerObject* parent); | ||
232 | virtual void addChild(LLViewerObject *childp); | ||
233 | virtual void removeChild(LLViewerObject *childp); | ||
234 | child_list_t& getChildren(); | ||
235 | void addThisAndAllChildren(LLDynamicArray<LLViewerObject*>& objects); | ||
236 | void addThisAndNonJointChildren(LLDynamicArray<LLViewerObject*>& objects); | ||
237 | BOOL isChild(LLViewerObject *childp) const; | ||
238 | BOOL isSeat() const; | ||
239 | |||
240 | |||
241 | //detect if given line segment (in agent space) intersects with this viewer object. | ||
242 | //returns TRUE if intersection detected and moves end to the point of intersection | ||
243 | //closest to start. | ||
244 | virtual BOOL lineSegmentIntersect(const LLVector3& start, LLVector3& end) const; | ||
245 | |||
246 | const LLVector3d getPositionGlobal() const; | ||
247 | const LLVector3 &getPositionRegion() const; | ||
248 | const LLVector3 getPositionEdit() const; | ||
249 | const LLVector3 &getPositionAgent() const; | ||
250 | const LLVector3 getRenderPosition() const; | ||
251 | |||
252 | virtual const LLVector3 getPivotPositionAgent() const; // Usually = to getPositionAgent, unless like flex objects it's not | ||
253 | |||
254 | LLViewerObject* getRootEdit() const; | ||
255 | |||
256 | const LLQuaternion getRotationRegion() const; | ||
257 | const LLQuaternion getRotationEdit() const; | ||
258 | const LLQuaternion getRenderRotation() const; | ||
259 | virtual const LLMatrix4 getRenderMatrix() const; | ||
260 | |||
261 | void setPosition(const LLVector3 &pos, BOOL damped = FALSE); | ||
262 | void setPositionGlobal(const LLVector3d &position, BOOL damped = FALSE); | ||
263 | void setPositionRegion(const LLVector3 &position, BOOL damped = FALSE); | ||
264 | void setPositionEdit(const LLVector3 &position, BOOL damped = FALSE); | ||
265 | void setPositionAgent(const LLVector3 &pos_agent, BOOL damped = FALSE); | ||
266 | void setPositionParent(const LLVector3 &pos_parent, BOOL damped = FALSE); | ||
267 | void setPositionAbsoluteGlobal( const LLVector3d &pos_global, BOOL damped = FALSE ); | ||
268 | void sendPositionUpdate() const; | ||
269 | |||
270 | virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const { return xform->getWorldMatrix(); } | ||
271 | |||
272 | inline void setRotation(const F32 x, const F32 y, const F32 z, BOOL damped = FALSE); | ||
273 | inline void setRotation(const LLQuaternion& quat, BOOL damped = FALSE); | ||
274 | void sendRotationUpdate() const; | ||
275 | |||
276 | /*virtual*/ void setNumTEs(const U8 num_tes); | ||
277 | /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry); | ||
278 | /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid); | ||
279 | S32 setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host); | ||
280 | /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color); | ||
281 | /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); | ||
282 | /*virtual*/ S32 setTEScaleS(const U8 te, const F32 s); | ||
283 | /*virtual*/ S32 setTEScaleT(const U8 te, const F32 t); | ||
284 | /*virtual*/ S32 setTEOffset(const U8 te, const F32 s, const F32 t); | ||
285 | /*virtual*/ S32 setTEOffsetS(const U8 te, const F32 s); | ||
286 | /*virtual*/ S32 setTEOffsetT(const U8 te, const F32 t); | ||
287 | /*virtual*/ S32 setTERotation(const U8 te, const F32 r); | ||
288 | /*virtual*/ S32 setTEBumpmap(const U8 te, const U8 bump ); | ||
289 | /*virtual*/ S32 setTETexGen(const U8 te, const U8 texgen ); | ||
290 | /*virtual*/ S32 setTEShiny(const U8 te, const U8 shiny ); | ||
291 | /*virtual*/ S32 setTEFullbright(const U8 te, const U8 fullbright ); | ||
292 | /*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags ); | ||
293 | /*virtual*/ BOOL setMaterial(const U8 material); | ||
294 | virtual void setTEImage(const U8 te, LLViewerImage *imagep); // Not derived from LLPrimitive | ||
295 | LLViewerImage *getTEImage(const U8 te) const; | ||
296 | |||
297 | S32 getFaceIndexOffset() { return mFaceIndexOffset; } | ||
298 | |||
299 | void fitFaceTexture(const U8 face); | ||
300 | void sendTEUpdate() const; // Sends packed representation of all texture entry information | ||
301 | |||
302 | virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE); | ||
303 | void sendScaleUpdate(); | ||
304 | |||
305 | void sendShapeUpdate(); | ||
306 | |||
307 | U8 getState() { return mState; } | ||
308 | |||
309 | F32 getAppAngle() const { return mAppAngle; } | ||
310 | F32 getMaxScale() const; | ||
311 | F32 getMidScale() const; | ||
312 | F32 getMinScale() const; | ||
313 | |||
314 | // Owner id is this object's owner | ||
315 | void setAttachedSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain, const U8 flags); | ||
316 | void adjustAudioGain(const F32 gain); | ||
317 | void clearAttachedSound() { mAudioSourcep = NULL; } | ||
318 | |||
319 | // Create if necessary | ||
320 | LLAudioSource *getAudioSource(const LLUUID& owner_id); | ||
321 | |||
322 | U8 getMediaType() const; | ||
323 | void setMediaType(U8 media_type); | ||
324 | |||
325 | const LLString& getMediaURL() const; | ||
326 | void setMediaURL(const LLString& media_url); | ||
327 | |||
328 | BOOL getMediaPassedWhitelist() const; | ||
329 | void setMediaPassedWhitelist(BOOL passed); | ||
330 | |||
331 | void sendMaterialUpdate() const; | ||
332 | |||
333 | void setCanSelect(BOOL canSelect); | ||
334 | |||
335 | void setDebugText(const std::string &utf8text); | ||
336 | void setIcon(LLViewerImage* icon_image); | ||
337 | void clearIcon(); | ||
338 | |||
339 | void markForUpdate(BOOL priority); | ||
340 | void updateVolume(const LLVolumeParams& volume_params); | ||
341 | virtual void updateSpatialExtents(LLVector3& min, LLVector3& max); | ||
342 | |||
343 | LLBBox getBoundingBoxAgent() const; | ||
344 | |||
345 | void updatePositionCaches() const; // Update the global and region position caches from the object (and parent's) xform. | ||
346 | void updateText(); // update text label position | ||
347 | virtual void updateDrawable(BOOL force_damped); // force updates on static objects | ||
348 | |||
349 | void setDrawableState(U32 state, BOOL recursive = TRUE); | ||
350 | void clearDrawableState(U32 state, BOOL recursive = TRUE); | ||
351 | |||
352 | // Called when the drawable shifts | ||
353 | virtual void onShift(const LLVector3 &shift_vector) { } | ||
354 | |||
355 | ////////////////////////////////////// | ||
356 | // | ||
357 | // Inventory methods | ||
358 | // | ||
359 | |||
360 | // This function is called when someone is interested in a viewer | ||
361 | // object's inventory. The callback is called as soon as the | ||
362 | // viewer object has the inventory stored locally. | ||
363 | void registerInventoryListener(LLVOInventoryListener* listener, void* user_data); | ||
364 | void removeInventoryListener(LLVOInventoryListener* listener); | ||
365 | BOOL isInventoryPending() { return mInventoryPending; } | ||
366 | void clearInventoryListeners(); | ||
367 | void requestInventory(); | ||
368 | static void processTaskInv(LLMessageSystem* msg, void** user_data); | ||
369 | void removeInventory(const LLUUID& item_id); | ||
370 | |||
371 | // The updateInventory() call potentially calls into the selection | ||
372 | // manager, so do no call updateInventory() from the selection | ||
373 | // manager until we have better iterators. | ||
374 | void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new); | ||
375 | LLInventoryObject* getInventoryObject(const LLUUID& item_id); | ||
376 | void getInventoryContents(InventoryObjectList& objects); | ||
377 | LLInventoryObject* getInventoryRoot(); | ||
378 | LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id); | ||
379 | S16 getInventorySerial() const { return mInventorySerialNum; } | ||
380 | |||
381 | // This function will make sure that we refresh the inventory. | ||
382 | void dirtyInventory(); | ||
383 | BOOL isInventoryDirty() { return mInventoryDirty; } | ||
384 | |||
385 | // save a script, which involves removing the old one, and rezzing | ||
386 | // in the new one. This method should be called with the asset id | ||
387 | // of the new and old script AFTER the bytecode has been saved. | ||
388 | void saveScript(const LLViewerInventoryItem* item, BOOL active, bool is_new); | ||
389 | |||
390 | // move an inventory item out of the task and into agent | ||
391 | // inventory. This operation is based on messaging. No permissions | ||
392 | // checks are made on the viewer - the server will double check. | ||
393 | void moveInventory(const LLUUID& agent_folder, const LLUUID& item_id); | ||
394 | |||
395 | // Find the number of instances of this object's inventory that are of the given type | ||
396 | S32 countInventoryContents( LLAssetType::EType type ); | ||
397 | |||
398 | BOOL permAnyOwner() const; | ||
399 | BOOL permYouOwner() const; | ||
400 | BOOL permGroupOwner() const; | ||
401 | BOOL permOwnerModify() const; | ||
402 | BOOL permModify() const; | ||
403 | BOOL permCopy() const; | ||
404 | BOOL permMove() const; | ||
405 | BOOL permTransfer() const; | ||
406 | inline BOOL usePhysics() const { return ((mFlags & FLAGS_USE_PHYSICS) != 0); } | ||
407 | inline BOOL flagScripted() const { return ((mFlags & FLAGS_SCRIPTED) != 0); } | ||
408 | inline BOOL flagHandleTouch() const { return ((mFlags & FLAGS_HANDLE_TOUCH) != 0); } | ||
409 | inline BOOL flagTakesMoney() const { return ((mFlags & FLAGS_TAKES_MONEY) != 0); } | ||
410 | inline BOOL flagPhantom() const { return ((mFlags & FLAGS_PHANTOM) != 0); } | ||
411 | inline BOOL flagInventoryEmpty() const { return ((mFlags & FLAGS_INVENTORY_EMPTY) != 0); } | ||
412 | inline BOOL flagCastShadows() const { return ((mFlags & FLAGS_CAST_SHADOWS) != 0); } | ||
413 | inline BOOL flagAllowInventoryAdd() const { return ((mFlags & FLAGS_ALLOW_INVENTORY_DROP) != 0); } | ||
414 | inline BOOL flagTemporary() const { return ((mFlags & FLAGS_TEMPORARY) != 0); } | ||
415 | inline BOOL flagTemporaryOnRez() const { return ((mFlags & FLAGS_TEMPORARY_ON_REZ) != 0); } | ||
416 | inline BOOL flagAnimSource() const { return ((mFlags & FLAGS_ANIM_SOURCE) != 0); } | ||
417 | inline BOOL flagCameraSource() const { return ((mFlags & FLAGS_CAMERA_SOURCE) != 0); } | ||
418 | inline BOOL flagCameraDecoupled() const { return ((mFlags & FLAGS_CAMERA_DECOUPLED) != 0); } | ||
419 | |||
420 | // Does "open" object menu item apply? | ||
421 | BOOL allowOpen() const; | ||
422 | |||
423 | void setClickAction(U8 action) { mClickAction = action; } | ||
424 | U8 getClickAction() const { return mClickAction; } | ||
425 | bool specialHoverCursor() const; // does it have a special hover cursor? | ||
426 | |||
427 | void setRegion(LLViewerRegion *regionp); | ||
428 | virtual void updateRegion(LLViewerRegion *regionp) {} | ||
429 | |||
430 | void updateFlags(); | ||
431 | BOOL setFlags(U32 flag, BOOL state); | ||
432 | |||
433 | virtual void dump() const; | ||
434 | static U32 getNumZombieObjects() { return sNumZombieObjects; } | ||
435 | |||
436 | void printNameValuePairs() const; | ||
437 | |||
438 | virtual S32 getLOD() const { return 3; } | ||
439 | |||
440 | virtual LLNetworkData* getParameterEntry(U16 param_type) const; | ||
441 | virtual bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin); | ||
442 | virtual BOOL getParameterEntryInUse(U16 param_type) const; | ||
443 | virtual bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin); | ||
444 | // Called when a parameter is changed | ||
445 | virtual void parameterChanged(U16 param_type, bool local_origin); | ||
446 | virtual void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin); | ||
447 | |||
448 | friend class LLViewerObjectList; | ||
449 | friend class LLViewerMediaList; | ||
450 | |||
451 | private: | ||
452 | ExtraParameter* createNewParameterEntry(U16 param_type); | ||
453 | ExtraParameter* getExtraParameterEntry(U16 param_type) const; | ||
454 | ExtraParameter* getExtraParameterEntryCreate(U16 param_type); | ||
455 | bool unpackParameterEntry(U16 param_type, LLDataPacker *dp); | ||
456 | |||
457 | public: | ||
458 | // | ||
459 | // Viewer-side only types - use the LL_PCODE_APP mask. | ||
460 | // | ||
461 | typedef enum e_vo_types | ||
462 | { | ||
463 | LL_VO_CLOUDS = LL_PCODE_APP | 0x20, | ||
464 | LL_VO_SURFACE_PATCH = LL_PCODE_APP | 0x30, | ||
465 | LL_VO_STARS = LL_PCODE_APP | 0x40, | ||
466 | LL_VO_SQUARE_TORUS = LL_PCODE_APP | 0x50, | ||
467 | LL_VO_SKY = LL_PCODE_APP | 0x60, | ||
468 | LL_VO_WATER = LL_PCODE_APP | 0x70, | ||
469 | LL_VO_GROUND = LL_PCODE_APP | 0x80, | ||
470 | LL_VO_PART_GROUP = LL_PCODE_APP | 0x90, | ||
471 | LL_VO_TRIANGLE_TORUS = LL_PCODE_APP | 0xa0, | ||
472 | } EVOType; | ||
473 | |||
474 | child_list_t mChildList; | ||
475 | LLUUID mID; | ||
476 | |||
477 | // unique within region, not unique across regions | ||
478 | // Local ID = 0 is not used | ||
479 | U32 mLocalID; | ||
480 | |||
481 | // Last total CRC received from sim, used for caching | ||
482 | U32 mTotalCRC; | ||
483 | |||
484 | LLPointer<LLViewerImage> *mTEImages; | ||
485 | |||
486 | // Selection, picking and rendering variables | ||
487 | U32 mGLName; // GL "name" used by selection code | ||
488 | BOOL mbCanSelect; // true if user can select this object by clicking | ||
489 | |||
490 | // Grabbed from UPDATE_FLAGS | ||
491 | U32 mFlags; | ||
492 | |||
493 | // Pipeline classes | ||
494 | LLPointer<LLDrawable> mDrawable; | ||
495 | |||
496 | // Band-aid to select object after all creation initialization is done | ||
497 | BOOL mCreateSelected; | ||
498 | |||
499 | // Replace textures with web pages on this object while drawing | ||
500 | BOOL mRenderMedia; | ||
501 | |||
502 | // In bits | ||
503 | S32 mBestUpdatePrecision; | ||
504 | |||
505 | // TODO: Make all this stuff private. JC | ||
506 | LLPointer<LLHUDText> mText; | ||
507 | LLPointer<LLHUDIcon> mIcon; | ||
508 | |||
509 | static BOOL sUseSharedDrawables; | ||
510 | |||
511 | protected: | ||
512 | // delete an item in the inventory, but don't tell the | ||
513 | // server. This is used internally by remove, update, and | ||
514 | // savescript. | ||
515 | void deleteInventoryItem(const LLUUID& item_id); | ||
516 | |||
517 | // do the update/caching logic. called by saveScript and | ||
518 | // updateInventory. | ||
519 | void doUpdateInventory(LLViewerInventoryItem* item, U8 key, bool is_new); | ||
520 | |||
521 | |||
522 | static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp); | ||
523 | |||
524 | BOOL setData(const U8 *datap, const U32 data_size); | ||
525 | |||
526 | ////////////////////////// | ||
527 | // | ||
528 | // inventory functionality | ||
529 | // | ||
530 | |||
531 | static void processTaskInvFile(void** user_data, S32 error_code); | ||
532 | void loadTaskInvFile(const char* filename); | ||
533 | void doInventoryCallback(); | ||
534 | |||
535 | BOOL isOnMap(); | ||
536 | |||
537 | void unpackParticleSource(const S32 block_num, const LLUUID& owner_id); | ||
538 | void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id); | ||
539 | |||
540 | private: | ||
541 | void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string | ||
542 | void deleteTEImages(); // correctly deletes list of images | ||
543 | |||
544 | protected: | ||
545 | typedef std::map<char *, LLNameValue *> name_value_map_t; | ||
546 | name_value_map_t mNameValuePairs; // Any name-value pairs stored by script | ||
547 | |||
548 | F64 mLastInterpUpdateSecs; // Last update for purposes of interpolation | ||
549 | F64 mLastMessageUpdateSecs; // Last update from a message from the simulator | ||
550 | |||
551 | // extra data sent from the sim...currently only used for tree species info | ||
552 | U8* mData; | ||
553 | |||
554 | LLPointer<LLViewerPartSourceScript> mPartSourcep; // Particle source associated with this object. | ||
555 | LLAudioSourceVO *mAudioSourcep; | ||
556 | |||
557 | F32 mAppAngle; // Apparent visual arc in degrees | ||
558 | F32 mPixelArea; // Apparent area in pixels | ||
559 | |||
560 | // This is the object's inventory from the viewer's perspective. | ||
561 | InventoryObjectList* mInventory; | ||
562 | class LLInventoryCallbackInfo | ||
563 | { | ||
564 | public: | ||
565 | ~LLInventoryCallbackInfo(); | ||
566 | LLVOInventoryListener* mListener; | ||
567 | void* mInventoryData; | ||
568 | }; | ||
569 | LLLinkedList<LLInventoryCallbackInfo> mInventoryCallbacks; | ||
570 | S16 mInventorySerialNum; | ||
571 | |||
572 | LLViewerRegion *mRegionp; // Region that this object belongs to. | ||
573 | BOOL mInventoryPending; | ||
574 | BOOL mInventoryDirty; | ||
575 | BOOL mDead; | ||
576 | BOOL mOrphaned; // This is an orphaned child | ||
577 | BOOL mUserSelected; // Cached user select information | ||
578 | BOOL mOnActiveList; | ||
579 | BOOL mOnMap; // On the map. | ||
580 | BOOL mStatic; // Object doesn't move. | ||
581 | S32 mFaceIndexOffset; // offset into drawable's faces, zero except in special cases | ||
582 | S32 mNumFaces; | ||
583 | |||
584 | S32 mLastUpdateFrame; // frames in which an object had last moved for smart coalescing of drawables | ||
585 | // (child objects not moving relative to parent) | ||
586 | |||
587 | F32 mTimeDilation; // Time dilation sent with the object. | ||
588 | F32 mRotTime; // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega) | ||
589 | LLQuaternion mLastRot; // last rotation received from the simulator | ||
590 | |||
591 | LLVOJointInfo* mJointInfo; | ||
592 | U8 mState; // legacy | ||
593 | LLViewerObjectMedia* mMedia; // NULL if no media associated | ||
594 | U8 mClickAction; | ||
595 | |||
596 | static U32 sNumZombieObjects; // Objects which are dead, but not deleted | ||
597 | |||
598 | static BOOL sMapDebug; // Map render mode | ||
599 | static LLColor4 sEditSelectColor; | ||
600 | static LLColor4 sNoEditSelectColor; | ||
601 | static F32 sCurrentPulse; | ||
602 | static BOOL sPulseEnabled; | ||
603 | |||
604 | static S32 sAxisArrowLength; | ||
605 | |||
606 | // These two caches are only correct for non-parented objects right now! | ||
607 | mutable LLVector3 mPositionRegion; | ||
608 | mutable LLVector3 mPositionAgent; | ||
609 | |||
610 | private: | ||
611 | static S32 sNumObjects; | ||
612 | }; | ||
613 | |||
614 | |||
615 | /////////////////// | ||
616 | // | ||
617 | // Inlines | ||
618 | // | ||
619 | // | ||
620 | |||
621 | inline void LLViewerObject::setRotation(const LLQuaternion& quat, BOOL damped) | ||
622 | { | ||
623 | LLPrimitive::setRotation(quat); | ||
624 | setChanged(ROTATED | SILHOUETTE); | ||
625 | updateDrawable(damped); | ||
626 | } | ||
627 | |||
628 | inline void LLViewerObject::setRotation(const F32 x, const F32 y, const F32 z, BOOL damped) | ||
629 | { | ||
630 | LLPrimitive::setRotation(x, y, z); | ||
631 | setChanged(ROTATED | SILHOUETTE); | ||
632 | updateDrawable(damped); | ||
633 | } | ||
634 | |||
635 | class LLViewerObjectMedia | ||
636 | { | ||
637 | public: | ||
638 | LLViewerObjectMedia() : mMediaURL(), mPassedWhitelist(FALSE), mMediaType(0) { } | ||
639 | |||
640 | LLString mMediaURL; // for web pages on surfaces, one per prim | ||
641 | BOOL mPassedWhitelist; // user has OK'd display | ||
642 | U8 mMediaType; // see LLTextureEntry::WEB_PAGE, etc. | ||
643 | }; | ||
644 | |||
645 | #endif | ||