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

Generated on Thu Jul 1 06:09:32 2010 for Second Life Viewer by  doxygen 1.4.7