llviewerobject.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLVIEWEROBJECT_H
00033 #define LL_LLVIEWEROBJECT_H
00034 
00035 #include <map>
00036 
00037 #include "llassetstorage.h"
00038 #include "lldarrayptr.h"
00039 #include "llhudtext.h"
00040 #include "llhudicon.h"
00041 #include "llinventory.h"
00042 #include "llmemory.h"
00043 #include "llmemtype.h"
00044 #include "llprimitive.h"
00045 #include "lluuid.h"
00046 #include "llvoinventorylistener.h"
00047 #include "object_flags.h"
00048 #include "llquaternion.h"
00049 #include "v3dmath.h"
00050 #include "v3math.h"
00051 #include "llvertexbuffer.h"
00052 
00053 class LLAgent;                  // TODO: Get rid of this.
00054 class LLAudioSource;
00055 class LLAudioSourceVO;
00056 class LLBBox;
00057 class LLDataPacker;
00058 class LLColor4;
00059 class LLFrameTimer;
00060 class LLDrawable;
00061 class LLHost;
00062 class LLWorld;
00063 class LLNameValue;
00064 class LLNetMap;
00065 class LLMessageSystem;
00066 class LLPrimitive;
00067 class LLPipeline;
00068 class LLTextureEntry;
00069 class LLViewerImage;
00070 class LLViewerInventoryItem;
00071 class LLViewerObject;
00072 class LLViewerPartSourceScript;
00073 class LLViewerRegion;
00074 class LLViewerObjectMedia;
00075 class LLVOInventoryListener;
00076 
00077 typedef enum e_object_update_type
00078 {
00079         OUT_FULL,
00080         OUT_TERSE_IMPROVED,
00081         OUT_FULL_COMPRESSED,
00082         OUT_FULL_CACHED,
00083 } EObjectUpdateType;
00084 
00085 
00086 // callback typedef for inventory
00087 typedef void (*inventory_callback)(LLViewerObject*,
00088                                                                    InventoryObjectList*,
00089                                                                    S32 serial_num,
00090                                                                    void*);
00091 
00092 // a small struct for keeping track of joints
00093 struct LLVOJointInfo
00094 {
00095         EHavokJointType mJointType;
00096         LLVector3 mPivot;                       // parent-frame
00097         // whether the below an axis or anchor (and thus its frame)
00098         // depends on the joint type:
00099         //     HINGE   ==>   axis=parent-frame
00100         //     P2P     ==>   anchor=child-frame
00101         LLVector3 mAxisOrAnchor;        
00102 };
00103 
00104 // for exporting textured materials from SL
00105 struct LLMaterialExportInfo
00106 {
00107 public:
00108         LLMaterialExportInfo(S32 mat_index, S32 texture_index, LLColor4 color) : 
00109           mMaterialIndex(mat_index), mTextureIndex(texture_index), mColor(color) {};
00110 
00111         S32                     mMaterialIndex;
00112         S32                     mTextureIndex;
00113         LLColor4        mColor;
00114 };
00115 
00116 //============================================================================
00117 
00118 class LLViewerObject : public LLPrimitive, public LLRefCount
00119 {
00120 protected:
00121         ~LLViewerObject(); // use unref()
00122 
00123         // TomY: Provide for a list of extra parameter structures, mapped by structure name
00124         struct ExtraParameter
00125         {
00126                 BOOL in_use;
00127                 LLNetworkData *data;
00128         };
00129         std::map<U16, ExtraParameter*> mExtraParameterList;
00130 
00131 public:
00132         typedef std::vector<LLPointer<LLViewerObject> > child_list_t;
00133 
00134         LLViewerObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp);
00135         MEM_TYPE_NEW(LLMemType::MTYPE_OBJECT);
00136 
00137         virtual void markDead();                                // Mark this object as dead, and clean up its references
00138         BOOL isDead() const                                                                     {return mDead;}
00139         BOOL isOrphaned() const                                                         { return mOrphaned; }
00140         BOOL isParticleSource() const;
00141 
00142         static void initVOClasses();
00143         static void cleanupVOClasses();
00144 
00145         void                    addNVPair(const std::string& data);
00146         BOOL                    removeNVPair(const char *name);
00147         LLNameValue             *getNVPair(const char *name) const;                     // null if no name value pair by that name
00148 
00149         // Object create and update functions
00150         virtual BOOL    idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
00151 
00152         // Types of media we can associate
00153         enum { MEDIA_TYPE_NONE = 0, MEDIA_TYPE_WEB_PAGE = 1 };
00154 
00155         // Return codes for processUpdateMessage
00156         enum { MEDIA_URL_REMOVED = 0x1, MEDIA_URL_ADDED = 0x2, MEDIA_URL_UPDATED = 0x4 };
00157 
00158         virtual U32             processUpdateMessage(LLMessageSystem *mesgsys,
00159                                                                                 void **user_data,
00160                                                                                 U32 block_num,
00161                                                                                 const EObjectUpdateType update_type,
00162                                                                                 LLDataPacker *dp);
00163 
00164 
00165         virtual BOOL    isActive() const; // Whether this object needs to do an idleUpdate.
00166         BOOL                    onActiveList() const                            {return mOnActiveList;}
00167         void                    setOnActiveList(BOOL on_active)         { mOnActiveList = on_active; }
00168 
00169         virtual BOOL    isAttachment() const { return FALSE; }
00170         virtual BOOL    isHUDAttachment() const { return FALSE; }
00171         virtual void    updateRadius() {};
00172         virtual F32     getVObjRadius() const; // default implemenation is mDrawable->getRadius()
00173         
00174         BOOL                    isJointChild() const { return mJointInfo ? TRUE : FALSE; } 
00175         EHavokJointType getJointType() const { return mJointInfo ? mJointInfo->mJointType : HJT_INVALID; }
00176         // for jointed and other parent-relative hacks
00177         LLViewerObject* getSubParent();
00178         const LLViewerObject* getSubParent() const;
00179         
00180         // Object visiblility and GPW functions
00181         virtual void setPixelAreaAndAngle(LLAgent &agent); // Override to generate accurate apparent angle and area
00182 
00183         virtual U32 getNumVertices() const;
00184         virtual U32 getNumIndices() const;
00185         S32 getNumFaces() const { return mNumFaces; }
00186 
00187         // Graphical stuff for objects - maybe broken out into render class later?
00188         virtual void updateTextures(LLAgent &agent);
00189         virtual void boostTexturePriority(BOOL boost_children = TRUE);  // When you just want to boost priority of this object
00190         
00191         virtual LLDrawable* createDrawable(LLPipeline *pipeline);
00192         virtual BOOL            updateGeometry(LLDrawable *drawable);
00193         virtual void            updateFaceSize(S32 idx);
00194         virtual BOOL            updateLOD();
00195         virtual BOOL            setDrawableParent(LLDrawable* parentp);
00196         F32                                     getRotTime() { return mRotTime; }
00197         void                            resetRot();
00198         void                            applyAngularVelocity(F32 dt);
00199 
00200         void setLineWidthForWindowSize(S32 window_width);
00201 
00202         static void increaseArrowLength();                              // makes axis arrows for selections longer
00203         static void decreaseArrowLength();                              // makes axis arrows for selections shorter
00204 
00205         // Accessor functions
00206         LLViewerRegion* getRegion() const                               { return mRegionp; }
00207 
00208         BOOL isSelected() const                                                 { return mUserSelected; }
00209         virtual void setSelected(BOOL sel)                              { mUserSelected = sel; mRotTime = 0.f;}
00210 
00211         const LLUUID &getID() const                                             { return mID; }
00212         U32 getLocalID() const                                                  { return mLocalID; }
00213         U32 getCRC() const                                                              { return mTotalCRC; }
00214 
00215         virtual BOOL isFlexible() const                                 { return false; }
00216 
00217         // This method returns true if the object is over land owned by
00218         // the agent.
00219         BOOL isOverAgentOwnedLand() const;
00220 
00221         // True if over land owned by group of which the agent is
00222         // either officer or member.
00223         BOOL isOverGroupOwnedLand() const;
00224 
00225         /*
00226         // This method will scan through this object, and then query the
00227         // selection manager to see if the local agent probably has the
00228         // ability to modify the object. Since this calls into the
00229         // selection manager, you should avoid calling this method from
00230         // there.
00231         BOOL isProbablyModifiable() const;
00232         */
00233 
00234         virtual void setParent(LLViewerObject* parent);
00235         virtual void addChild(LLViewerObject *childp);
00236         virtual void removeChild(LLViewerObject *childp);
00237         child_list_t& getChildren();
00238         void addThisAndAllChildren(LLDynamicArray<LLViewerObject*>& objects);
00239         void addThisAndNonJointChildren(LLDynamicArray<LLViewerObject*>& objects);
00240         BOOL isChild(LLViewerObject *childp) const;
00241         BOOL isSeat() const;
00242         
00243 
00244         //detect if given line segment (in agent space) intersects with this viewer object.
00245         //returns TRUE if intersection detected and moves end to the point of intersection
00246         //closest to start.
00247         virtual BOOL lineSegmentIntersect(const LLVector3& start, LLVector3& end) const;
00248         
00249         virtual const LLVector3d getPositionGlobal() const;
00250         virtual const LLVector3 &getPositionRegion() const;
00251         virtual const LLVector3 getPositionEdit() const;
00252         virtual const LLVector3 &getPositionAgent() const;
00253         virtual const LLVector3 getRenderPosition() const;
00254 
00255         virtual const LLVector3 getPivotPositionAgent() const; // Usually = to getPositionAgent, unless like flex objects it's not
00256 
00257         LLViewerObject* getRootEdit() const;
00258 
00259         const LLQuaternion getRotationRegion() const;
00260         const LLQuaternion getRotationEdit() const;
00261         const LLQuaternion getRenderRotation() const;
00262         virtual const LLMatrix4 getRenderMatrix() const;
00263 
00264         void setPosition(const LLVector3 &pos, BOOL damped = FALSE);
00265         void setPositionGlobal(const LLVector3d &position, BOOL damped = FALSE);
00266         void setPositionRegion(const LLVector3 &position, BOOL damped = FALSE);
00267         void setPositionEdit(const LLVector3 &position, BOOL damped = FALSE);
00268         void setPositionAgent(const LLVector3 &pos_agent, BOOL damped = FALSE);
00269         void setPositionParent(const LLVector3 &pos_parent, BOOL damped = FALSE);
00270         void setPositionAbsoluteGlobal( const LLVector3d &pos_global, BOOL damped = FALSE );
00271 
00272         virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const             { return xform->getWorldMatrix(); }
00273 
00274         inline void setRotation(const F32 x, const F32 y, const F32 z, BOOL damped = FALSE);
00275         inline void setRotation(const LLQuaternion& quat, BOOL damped = FALSE);
00276         void sendRotationUpdate() const;
00277 
00278         /*virtual*/     void    setNumTEs(const U8 num_tes);
00279         /*virtual*/     void    setTE(const U8 te, const LLTextureEntry &texture_entry);
00280         /*virtual*/ S32         setTETexture(const U8 te, const LLUUID &uuid);
00281         S32 setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host);
00282         /*virtual*/ S32         setTEColor(const U8 te, const LLColor3 &color);
00283         /*virtual*/ S32         setTEColor(const U8 te, const LLColor4 &color);
00284         /*virtual*/ S32         setTEScale(const U8 te, const F32 s, const F32 t);
00285         /*virtual*/ S32         setTEScaleS(const U8 te, const F32 s);
00286         /*virtual*/ S32         setTEScaleT(const U8 te, const F32 t);
00287         /*virtual*/ S32         setTEOffset(const U8 te, const F32 s, const F32 t);
00288         /*virtual*/ S32         setTEOffsetS(const U8 te, const F32 s);
00289         /*virtual*/ S32         setTEOffsetT(const U8 te, const F32 t);
00290         /*virtual*/ S32         setTERotation(const U8 te, const F32 r);
00291         /*virtual*/     S32             setTEBumpmap(const U8 te, const U8 bump );
00292         /*virtual*/     S32             setTETexGen(const U8 te, const U8 texgen );
00293         /*virtual*/     S32             setTEShiny(const U8 te, const U8 shiny );
00294         /*virtual*/     S32             setTEFullbright(const U8 te, const U8 fullbright );
00295         /*virtual*/     S32             setTEMediaFlags(const U8 te, const U8 media_flags );
00296         /*virtual*/ S32     setTEGlow(const U8 te, const F32 glow);
00297         /*virtual*/     BOOL    setMaterial(const U8 material);
00298         virtual         void    setTEImage(const U8 te, LLViewerImage *imagep); // Not derived from LLPrimitive
00299         LLViewerImage           *getTEImage(const U8 te) const;
00300         
00301         void fitFaceTexture(const U8 face);
00302         void sendTEUpdate() const;                      // Sends packed representation of all texture entry information
00303         
00304         virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE);
00305 
00306         void sendShapeUpdate();
00307 
00308         U8 getState()                                                   { return mState; }
00309 
00310         F32 getAppAngle() const                                 { return mAppAngle; }
00311         F32 getPixelArea() const                                { return mPixelArea; }
00312         void setPixelArea(F32 area)                             { mPixelArea = area; }
00313         F32 getMaxScale() const;
00314         F32 getMidScale() const;
00315         F32 getMinScale() const;
00316 
00317         // Owner id is this object's owner
00318         void setAttachedSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain, const U8 flags);
00319         void adjustAudioGain(const F32 gain);
00320         void clearAttachedSound()                                                               { mAudioSourcep = NULL; }
00321 
00322          // Create if necessary
00323         LLAudioSource *getAudioSource(const LLUUID& owner_id);
00324         bool isAudioSource() {return mAudioSourcep != NULL;}
00325 
00326         U8 getMediaType() const;
00327         void setMediaType(U8 media_type);
00328 
00329         const LLString& getMediaURL() const;
00330         void setMediaURL(const LLString& media_url);
00331 
00332         BOOL getMediaPassedWhitelist() const;
00333         void setMediaPassedWhitelist(BOOL passed);
00334 
00335         void sendMaterialUpdate() const;
00336 
00337         void setCanSelect(BOOL canSelect);
00338 
00339         void setDebugText(const std::string &utf8text);
00340         void setIcon(LLViewerImage* icon_image);
00341         void clearIcon();
00342 
00343         void markForUpdate(BOOL priority);
00344         void updateVolume(const LLVolumeParams& volume_params);
00345         virtual void updateSpatialExtents(LLVector3& min, LLVector3& max);
00346         virtual F32 getBinRadius();
00347         
00348         LLBBox                          getBoundingBoxAgent() const;
00349 
00350         void updatePositionCaches() const; // Update the global and region position caches from the object (and parent's) xform.
00351         void updateText(); // update text label position
00352         virtual void updateDrawable(BOOL force_damped); // force updates on static objects
00353 
00354         void setDrawableState(U32 state, BOOL recursive = TRUE);
00355         void clearDrawableState(U32 state, BOOL recursive = TRUE);
00356 
00357         // Called when the drawable shifts
00358         virtual void onShift(const LLVector3 &shift_vector)     { }
00359                 
00361         //
00362         // Inventory methods
00363         //
00364 
00365         // This function is called when someone is interested in a viewer
00366         // object's inventory. The callback is called as soon as the
00367         // viewer object has the inventory stored locally.
00368         void registerInventoryListener(LLVOInventoryListener* listener, void* user_data);
00369         void removeInventoryListener(LLVOInventoryListener* listener);
00370         BOOL isInventoryPending() { return mInventoryPending; }
00371         void clearInventoryListeners();
00372         void requestInventory();
00373         void fetchInventoryFromServer();
00374         static void processTaskInv(LLMessageSystem* msg, void** user_data);
00375         void removeInventory(const LLUUID& item_id);
00376 
00377         // The updateInventory() call potentially calls into the selection
00378         // manager, so do no call updateInventory() from the selection
00379         // manager until we have better iterators.
00380         void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
00381         LLInventoryObject* getInventoryObject(const LLUUID& item_id);
00382         void getInventoryContents(InventoryObjectList& objects);
00383         LLInventoryObject* getInventoryRoot();
00384         LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id);
00385         S16 getInventorySerial() const { return mInventorySerialNum; }
00386 
00387         // These functions does viewer-side only object inventory modifications
00388         void updateViewerInventoryAsset(
00389                 const LLViewerInventoryItem* item,
00390                 const LLUUID& new_asset);
00391 
00392         // This function will make sure that we refresh the inventory.
00393         void dirtyInventory();
00394         BOOL isInventoryDirty() { return mInventoryDirty; }
00395 
00396         // save a script, which involves removing the old one, and rezzing
00397         // in the new one. This method should be called with the asset id
00398         // of the new and old script AFTER the bytecode has been saved.
00399         void saveScript(const LLViewerInventoryItem* item, BOOL active, bool is_new);
00400 
00401         // move an inventory item out of the task and into agent
00402         // inventory. This operation is based on messaging. No permissions
00403         // checks are made on the viewer - the server will double check.
00404         void moveInventory(const LLUUID& agent_folder, const LLUUID& item_id);
00405 
00406         // Find the number of instances of this object's inventory that are of the given type
00407         S32 countInventoryContents( LLAssetType::EType type );
00408 
00409         BOOL                    permAnyOwner() const;   
00410         BOOL                    permYouOwner() const;
00411         BOOL                    permGroupOwner() const;
00412         BOOL                    permOwnerModify() const;
00413         BOOL                    permModify() const;     
00414         BOOL                    permCopy() const;       
00415         BOOL                    permMove() const;               
00416         BOOL                    permTransfer() const;
00417         inline BOOL             usePhysics() const                              { return ((mFlags & FLAGS_USE_PHYSICS) != 0); }
00418         inline BOOL             flagScripted() const                    { return ((mFlags & FLAGS_SCRIPTED) != 0); }
00419         inline BOOL             flagHandleTouch() const                 { return ((mFlags & FLAGS_HANDLE_TOUCH) != 0); }
00420         inline BOOL             flagTakesMoney() const                  { return ((mFlags & FLAGS_TAKES_MONEY) != 0); }
00421         inline BOOL             flagPhantom() const                             { return ((mFlags & FLAGS_PHANTOM) != 0); }
00422         inline BOOL             flagInventoryEmpty() const              { return ((mFlags & FLAGS_INVENTORY_EMPTY) != 0); }
00423         inline BOOL             flagCastShadows() const                 { return ((mFlags & FLAGS_CAST_SHADOWS) != 0); }
00424         inline BOOL             flagAllowInventoryAdd() const   { return ((mFlags & FLAGS_ALLOW_INVENTORY_DROP) != 0); }
00425         inline BOOL             flagTemporary() const                   { return ((mFlags & FLAGS_TEMPORARY) != 0); }
00426         inline BOOL             flagTemporaryOnRez() const              { return ((mFlags & FLAGS_TEMPORARY_ON_REZ) != 0); }
00427         inline BOOL             flagAnimSource() const                  { return ((mFlags & FLAGS_ANIM_SOURCE) != 0); }
00428         inline BOOL             flagCameraSource() const                { return ((mFlags & FLAGS_CAMERA_SOURCE) != 0); }
00429         inline BOOL             flagCameraDecoupled() const             { return ((mFlags & FLAGS_CAMERA_DECOUPLED) != 0); }
00430 
00431         bool getIncludeInSearch() const;
00432         void setIncludeInSearch(bool include_in_search);
00433 
00434         // Does "open" object menu item apply?
00435         BOOL allowOpen() const;
00436 
00437         void setClickAction(U8 action) { mClickAction = action; }
00438         U8 getClickAction() const { return mClickAction; }
00439         bool specialHoverCursor() const;        // does it have a special hover cursor?
00440 
00441         void                    setRegion(LLViewerRegion *regionp);
00442         virtual void    updateRegion(LLViewerRegion *regionp) {}
00443 
00444         void updateFlags();
00445         BOOL setFlags(U32 flag, BOOL state);
00446         
00447         virtual void dump() const;
00448         static U32              getNumZombieObjects()                   { return sNumZombieObjects; }
00449 
00450         void printNameValuePairs() const;
00451 
00452         virtual S32 getLOD() const { return 3; } 
00453         virtual U32 getPartitionType() const;
00454         virtual void dirtySpatialGroup() const;
00455         virtual void dirtyMesh();
00456 
00457         virtual LLNetworkData* getParameterEntry(U16 param_type) const;
00458         virtual bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin);
00459         virtual BOOL getParameterEntryInUse(U16 param_type) const;
00460         virtual bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin);
00461         // Called when a parameter is changed
00462         virtual void parameterChanged(U16 param_type, bool local_origin);
00463         virtual void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin);
00464         
00465         friend class LLViewerObjectList;
00466         friend class LLViewerMediaList;
00467 
00468 private:
00469         ExtraParameter* createNewParameterEntry(U16 param_type);
00470         ExtraParameter* getExtraParameterEntry(U16 param_type) const;
00471         ExtraParameter* getExtraParameterEntryCreate(U16 param_type);
00472         bool unpackParameterEntry(U16 param_type, LLDataPacker *dp);
00473         
00474 public:
00475         //
00476         // Viewer-side only types - use the LL_PCODE_APP mask.
00477         //
00478         typedef enum e_vo_types
00479         {
00480                 LL_VO_CLOUDS =                          LL_PCODE_APP | 0x20,
00481                 LL_VO_SURFACE_PATCH =           LL_PCODE_APP | 0x30,
00482                 //LL_VO_STARS =                         LL_PCODE_APP | 0x40,
00483                 LL_VO_SQUARE_TORUS =            LL_PCODE_APP | 0x50,
00484                 LL_VO_SKY =                                     LL_PCODE_APP | 0x60,
00485                 LL_VO_WATER =                           LL_PCODE_APP | 0x70,
00486                 LL_VO_GROUND =                          LL_PCODE_APP | 0x80,
00487                 LL_VO_PART_GROUP =                      LL_PCODE_APP | 0x90,
00488                 LL_VO_TRIANGLE_TORUS =          LL_PCODE_APP | 0xa0,
00489                 LL_VO_WL_SKY =                          LL_PCODE_APP | 0xb0, // should this be moved to 0x40?
00490         } EVOType;
00491 
00492         child_list_t    mChildList;
00493         LLUUID                  mID;
00494 
00495         // unique within region, not unique across regions
00496         // Local ID = 0 is not used
00497         U32                             mLocalID;
00498 
00499         // Last total CRC received from sim, used for caching
00500         U32                             mTotalCRC;
00501 
00502         LLPointer<LLViewerImage> *mTEImages;
00503 
00504         // Selection, picking and rendering variables
00505         U32                             mGLName;                        // GL "name" used by selection code
00506         BOOL                    mbCanSelect;            // true if user can select this object by clicking
00507 
00508         // Grabbed from UPDATE_FLAGS
00509         U32                             mFlags;
00510 
00511         // Pipeline classes
00512         LLPointer<LLDrawable> mDrawable;
00513 
00514         // Band-aid to select object after all creation initialization is done
00515         BOOL mCreateSelected;
00516 
00517         // Replace textures with web pages on this object while drawing
00518         BOOL mRenderMedia;
00519 
00520         // In bits
00521         S32                             mBestUpdatePrecision;
00522 
00523         // TODO: Make all this stuff private.  JC
00524         LLPointer<LLHUDText> mText;
00525         LLPointer<LLHUDIcon> mIcon;
00526 
00527         static                  BOOL            sUseSharedDrawables;
00528 
00529 protected:
00530         // delete an item in the inventory, but don't tell the
00531         // server. This is used internally by remove, update, and
00532         // savescript.
00533         void deleteInventoryItem(const LLUUID& item_id);
00534 
00535         // do the update/caching logic. called by saveScript and
00536         // updateInventory.
00537         void doUpdateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
00538 
00539 
00540         static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp);
00541 
00542         BOOL setData(const U8 *datap, const U32 data_size);
00543 
00544         // Hide or show HUD, icon and particles
00545         void    hideExtraDisplayItems( BOOL hidden );
00546 
00548         //
00549         // inventory functionality
00550         //
00551 
00552         static void processTaskInvFile(void** user_data, S32 error_code, LLExtStat ext_status);
00553         void loadTaskInvFile(const char* filename);
00554         void doInventoryCallback();
00555         
00556         BOOL isOnMap();
00557 
00558         void unpackParticleSource(const S32 block_num, const LLUUID& owner_id);
00559         void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id);
00560         void deleteParticleSource();
00561         void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id);
00562 
00563 private:
00564         void setNameValueList(const std::string& list);         // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string
00565         void deleteTEImages(); // correctly deletes list of images
00566         
00567 protected:
00568         typedef std::map<char *, LLNameValue *> name_value_map_t;
00569         name_value_map_t mNameValuePairs;       // Any name-value pairs stored by script
00570 
00571         F64                             mLastInterpUpdateSecs;                  // Last update for purposes of interpolation
00572         F64                             mLastMessageUpdateSecs;                 // Last update from a message from the simulator
00573         TPACKETID               mLatestRecvPacketID;                    // Latest time stamp on message from simulator
00574         // extra data sent from the sim...currently only used for tree species info
00575         U8* mData;
00576 
00577         LLPointer<LLViewerPartSourceScript>             mPartSourcep;   // Particle source associated with this object.
00578         LLAudioSourceVO* mAudioSourcep;
00579         F32                             mAudioGain;
00580         
00581         F32                             mAppAngle;      // Apparent visual arc in degrees
00582         F32                             mPixelArea; // Apparent area in pixels
00583 
00584         // This is the object's inventory from the viewer's perspective.
00585         InventoryObjectList* mInventory;
00586         class LLInventoryCallbackInfo
00587         {
00588         public:
00589                 ~LLInventoryCallbackInfo();
00590                 LLVOInventoryListener* mListener;
00591                 void* mInventoryData;
00592         };
00593         typedef std::list<LLInventoryCallbackInfo*> callback_list_t;
00594         callback_list_t mInventoryCallbacks;
00595         S16 mInventorySerialNum;
00596 
00597         LLViewerRegion  *mRegionp;                                      // Region that this object belongs to.
00598         BOOL                    mInventoryPending;
00599         BOOL                    mInventoryDirty;
00600         BOOL                    mDead;
00601         BOOL                    mOrphaned;                                      // This is an orphaned child
00602         BOOL                    mUserSelected;                          // Cached user select information
00603         BOOL                    mOnActiveList;
00604         BOOL                    mOnMap;                                         // On the map.
00605         BOOL                    mStatic;                                        // Object doesn't move.
00606         S32                             mNumFaces;
00607 
00608         F32                             mTimeDilation;                          // Time dilation sent with the object.
00609         F32                             mRotTime;                                       // Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega)
00610         LLQuaternion    mLastRot;                                       // last rotation received from the simulator
00611 
00612         LLVOJointInfo*  mJointInfo;
00613         U8                              mState; // legacy
00614         LLViewerObjectMedia* mMedia;    // NULL if no media associated
00615         U8 mClickAction;
00616 
00617         static                  U32                     sNumZombieObjects;                      // Objects which are dead, but not deleted
00618 
00619         static                  BOOL            sMapDebug;                                      // Map render mode
00620         static                  LLColor4        sEditSelectColor;
00621         static                  LLColor4        sNoEditSelectColor;
00622         static                  F32                     sCurrentPulse;
00623         static                  BOOL            sPulseEnabled;
00624 
00625         static                  S32                     sAxisArrowLength;
00626 
00627         // These two caches are only correct for non-parented objects right now!
00628         mutable LLVector3               mPositionRegion;
00629         mutable LLVector3               mPositionAgent;
00630 
00631 private:        
00632         static S32 sNumObjects;
00633 };
00634 
00636 //
00637 // Inlines
00638 //
00639 //
00640 
00641 inline void LLViewerObject::setRotation(const LLQuaternion& quat, BOOL damped)
00642 {
00643         LLPrimitive::setRotation(quat);
00644         setChanged(ROTATED | SILHOUETTE);
00645         updateDrawable(damped);
00646 }
00647 
00648 inline void LLViewerObject::setRotation(const F32 x, const F32 y, const F32 z, BOOL damped)
00649 {
00650         LLPrimitive::setRotation(x, y, z);
00651         setChanged(ROTATED | SILHOUETTE);
00652         updateDrawable(damped);
00653 }
00654 
00655 class LLViewerObjectMedia
00656 {
00657 public:
00658         LLViewerObjectMedia() : mMediaURL(), mPassedWhitelist(FALSE), mMediaType(0) { }
00659 
00660         LLString mMediaURL;     // for web pages on surfaces, one per prim
00661         BOOL mPassedWhitelist;  // user has OK'd display
00662         U8 mMediaType;                  // see LLTextureEntry::WEB_PAGE, etc.
00663 };
00664 
00665 // subclass of viewer object that can be added to particle partitions
00666 class LLAlphaObject : public LLViewerObject
00667 {
00668 public:
00669         LLAlphaObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp)
00670         : LLViewerObject(id,type,regionp) 
00671         { mDepth = 0.f; }
00672 
00673         virtual F32 getPartSize(S32 idx);
00674         virtual void getGeometry(S32 idx,
00675                                                                 LLStrider<LLVector3>& verticesp,
00676                                                                 LLStrider<LLVector3>& normalsp, 
00677                                                                 LLStrider<LLVector2>& texcoordsp,
00678                                                                 LLStrider<LLColor4U>& colorsp, 
00679                                                                 LLStrider<U16>& indicesp) = 0;
00680 
00681         F32 mDepth;
00682 };
00683 
00684 class LLStaticViewerObject : public LLViewerObject
00685 {
00686 public:
00687         LLStaticViewerObject(const LLUUID& id, const LLPCode type, LLViewerRegion* regionp)
00688                 : LLViewerObject(id,type,regionp)
00689         { }
00690 
00691         virtual void updateDrawable(BOOL force_damped);
00692 };
00693 
00694 extern BOOL gVelocityInterpolate;
00695 extern BOOL gPingInterpolate;
00696 
00697 #endif

Generated on Fri May 16 08:34:15 2008 for SecondLife by  doxygen 1.5.5