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

