llviewerobject.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224
  1. /**
  2. * @file llviewerobject.h
  3. * @brief Description of LLViewerObject class, which is the base class for most
  4. * objects in the viewer.
  5. *
  6. * $LicenseInfo:firstyear=2001&license=viewergpl$
  7. *
  8. * Copyright (c) 2001-2009, Linden Research, Inc.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #ifndef LL_LLVIEWEROBJECT_H
  34. #define LL_LLVIEWEROBJECT_H
  35. #include <map>
  36. #include "llassetstorage.h"
  37. #include "llbbox.h"
  38. #include "llgltfasset.h"
  39. #include "llinventory.h"
  40. #include "llprimitive.h"
  41. #include "llvertexbuffer.h"
  42. #include "object_flags.h"
  43. #include "llhudicon.h"
  44. #include "llvoinventorylistener.h"
  45. class LLAlphaObject;
  46. class LLAudioSource;
  47. class LLAudioSourceVO;
  48. class LLDataPacker;
  49. class LLDataPackerBinaryBuffer;
  50. class LLDrawable;
  51. class LLGLTFMaterial;
  52. class LLHUDText;
  53. class LLMaterialID;
  54. class LLNameValue;
  55. class LLMessageSystem;
  56. class LLPartSysData;
  57. class LLReflectionMap;
  58. class LLReflectionProbeParams;
  59. class LLRenderMaterialParams;
  60. class LLViewerFetchedTexture;
  61. class LLViewerTexture;
  62. class LLViewerInventoryItem;
  63. class LLViewerObject;
  64. class LLViewerPartSourceScript;
  65. class LLViewerRegion;
  66. class LLVOAvatar;
  67. class LLVOAvatarPuppet;
  68. class LLVOPartGroup;
  69. class LLVOVolume;
  70. typedef enum e_object_update_type
  71. {
  72. OUT_FULL,
  73. OUT_TERSE_IMPROVED,
  74. OUT_FULL_COMPRESSED,
  75. OUT_FULL_CACHED,
  76. OUT_UNKNOWN,
  77. } EObjectUpdateType;
  78. // Callback typedef for inventory
  79. typedef void (*inventory_callback)(LLViewerObject*,
  80. LLInventoryObject::object_list_t*,
  81. S32 serial_num, void*);
  82. class LLViewerObjectMedia
  83. {
  84. public:
  85. LLViewerObjectMedia()
  86. : mMediaURL(),
  87. mPassedWhitelist(false),
  88. mMediaType(0)
  89. {
  90. }
  91. std::string mMediaURL; // For web pages on surfaces, one per prim
  92. U8 mMediaType; // See LLTextureEntry::WEB_PAGE, etc.
  93. bool mPassedWhitelist; // User has OK'd display
  94. };
  95. class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
  96. {
  97. friend class LLViewerMediaList;
  98. friend class LLViewerObjectList;
  99. protected:
  100. LOG_CLASS(LLViewerObject);
  101. ~LLViewerObject() override; // use unref()
  102. class LLInventoryCallbackInfo
  103. {
  104. public:
  105. ~LLInventoryCallbackInfo();
  106. public:
  107. LLViewerObject* mObject;
  108. LLVOInventoryListener* mListener;
  109. void* mInventoryData;
  110. };
  111. typedef std::list<LLInventoryCallbackInfo*> callback_list_t;
  112. public:
  113. typedef std::list<LLPointer<LLViewerObject> > child_list_t;
  114. typedef std::list<LLPointer<LLViewerObject> > vobj_list_t;
  115. typedef const child_list_t const_child_list_t;
  116. // Viewer-side only types; use the LL_PCODE_APP mask.
  117. typedef enum e_vo_types
  118. {
  119. LL_VO_CLOUDS = LL_PCODE_APP | 0x20,
  120. LL_VO_SURFACE_PATCH = LL_PCODE_APP | 0x30,
  121. LL_VO_WL_SKY = LL_PCODE_APP | 0x40,
  122. LL_VO_SQUARE_TORUS = LL_PCODE_APP | 0x50,
  123. LL_VO_SKY = LL_PCODE_APP | 0x60,
  124. LL_VO_VOID_WATER = LL_PCODE_APP | 0x70,
  125. LL_VO_WATER = LL_PCODE_APP | 0x80,
  126. LL_VO_PART_GROUP = LL_PCODE_APP | 0xa0,
  127. LL_VO_TRIANGLE_TORUS = LL_PCODE_APP | 0xb0,
  128. LL_VO_HUD_PART_GROUP = LL_PCODE_APP | 0xc0,
  129. } EVOType;
  130. typedef enum e_physics_shape_types
  131. {
  132. PHYSICS_SHAPE_PRIM = 0,
  133. PHYSICS_SHAPE_NONE,
  134. PHYSICS_SHAPE_CONVEX_HULL,
  135. } EPhysicsShapeType;
  136. // Types of media we can associate
  137. enum { MEDIA_NONE = 0, MEDIA_SET = 1 };
  138. // Return codes for processUpdateMessage
  139. enum
  140. {
  141. MEDIA_URL_REMOVED = 0x1,
  142. MEDIA_URL_ADDED = 0x2,
  143. MEDIA_URL_UPDATED = 0x4,
  144. MEDIA_FLAGS_CHANGED = 0x8,
  145. INVALID_UPDATE = 0x80000000
  146. };
  147. LLViewerObject(const LLUUID& id, LLPCode pcode, LLViewerRegion* regionp,
  148. bool is_global = false);
  149. LL_INLINE virtual LLVOVolume* asVolume() { return NULL; }
  150. // To void slow dynamic casts...
  151. LL_INLINE virtual LLAlphaObject* asAlphaObject()
  152. {
  153. return NULL;
  154. }
  155. LL_INLINE virtual LLVOPartGroup* asVOPartGroup()
  156. {
  157. return NULL;
  158. }
  159. // Mark this object as dead, and clean up its references
  160. virtual void markDead();
  161. LL_INLINE bool isDead() const { return mDead; }
  162. LL_INLINE bool isOrphaned() const { return mOrphaned; }
  163. bool isParticleSource() const;
  164. LL_INLINE virtual LLVOAvatar* asAvatar() { return NULL; }
  165. static void initVOClasses();
  166. static void cleanupVOClasses();
  167. void addNVPair(const std::string& data);
  168. bool removeNVPair(const std::string& name);
  169. // NULL if no name value pair by that name:
  170. LLNameValue* getNVPair(const std::string& name) const;
  171. // Object creation and updating methods
  172. virtual void idleUpdate(F64 time);
  173. static U32 extractSpatialExtents(LLDataPackerBinaryBuffer* dp,
  174. LLVector3& pos, LLVector3& scale,
  175. LLQuaternion& rot);
  176. virtual U32 processUpdateMessage(LLMessageSystem* mesgsys,
  177. void** user_data, U32 block_num,
  178. EObjectUpdateType update_type,
  179. LLDataPacker* dp);
  180. // Whether this object needs to do an idleUpdate():
  181. LL_INLINE virtual bool isActive() const { return true; }
  182. LL_INLINE bool onActiveList() const { return mOnActiveList; }
  183. LL_INLINE void setOnActiveList(bool on_active) { mOnActiveList = on_active; }
  184. LL_INLINE virtual bool isAttachment() const { return false; }
  185. LL_INLINE virtual bool isTempAttachment() const
  186. {
  187. return mID.notNull() && mID == mAttachmentItemID;
  188. }
  189. const std::string& getAttachmentItemName();
  190. // If this object is directly or indirectly parented by an avatar, return
  191. // it. Normally getAvatar() is the correct method to call and it returns
  192. // the avatar used for skinning. The exception is with animated objects
  193. // that are also attachments; in that case, getAvatar() returns the puppet
  194. // avatar, used for skinning, and getAvatarAncestor() returns the avatar to
  195. // which the object is attached.
  196. LLVOAvatar* getAvatarAncestor();
  197. virtual LLVOAvatar* getAvatar() const;
  198. bool hasRenderMaterialParams() const;
  199. void setHasRenderMaterialParams(bool has_params);
  200. const LLUUID& getRenderMaterialID(U8 te) const;
  201. // Sets the render material Id for the given texture entry (or -1 for all
  202. // texture entries).
  203. void setRenderMaterialID(S32 te, const LLUUID& id,
  204. bool update_server = true,
  205. bool local_origin = true);
  206. LL_INLINE void setRenderMaterialIDs(const LLUUID& id)
  207. {
  208. setRenderMaterialID(-1, id, true);
  209. }
  210. LL_INLINE virtual bool isHUDAttachment() const { return false; }
  211. LL_INLINE virtual void updateRadius() {}
  212. // default implementation is mDrawable->getRadius():
  213. virtual F32 getVObjRadius() const;
  214. // For jointed and other parent-relative hacks
  215. LLViewerObject* getSubParent();
  216. const LLViewerObject* getSubParent() const;
  217. // These methods return mPuppetAvatar for the edit root prim of this link
  218. // set
  219. LLVOAvatarPuppet* getPuppetAvatar();
  220. LLVOAvatarPuppet* getPuppetAvatar() const;
  221. void linkPuppetAvatar();
  222. void unlinkPuppetAvatar();
  223. // Links or unlinks as needed
  224. void updatePuppetAvatar();
  225. LL_INLINE virtual bool isAnimatedObject() const { return false; }
  226. // Object visiblility and GPW methods
  227. // Override to generate accurate apparent angle and area
  228. virtual void setPixelAreaAndAngle();
  229. virtual U32 getNumVertices() const;
  230. virtual U32 getNumIndices() const;
  231. LL_INLINE S32 getNumFaces() const { return mNumFaces; }
  232. // Graphical stuff for objects - maybe broken out into render class later ?
  233. LL_INLINE virtual void updateTextures() {}
  234. LL_INLINE virtual void faceMappingChanged() {}
  235. // When you just want to boost priority of this object:
  236. virtual void boostTexturePriority(bool boost_children = true);
  237. LL_INLINE virtual LLDrawable* createDrawable() { return NULL; }
  238. LL_INLINE virtual bool updateGeometry(LLDrawable*) { return true; }
  239. LL_INLINE void updateGL() override {}
  240. LL_INLINE virtual void resetVertexBuffers() {}
  241. LL_INLINE virtual void updateFaceSize(S32 idx) {}
  242. LL_INLINE virtual bool updateLOD() { return false; }
  243. virtual bool setDrawableParent(LLDrawable* parentp);
  244. // Used also in llselectmgr.cpp
  245. void resetRot();
  246. void setLineWidthForWindowSize(S32 window_width);
  247. // Accessor methods
  248. LL_INLINE LLViewerRegion* getRegion() const { return mRegionp; }
  249. LL_INLINE bool isSelected() const { return mUserSelected; }
  250. bool isAnySelected() const;
  251. virtual void setSelected(bool sel);
  252. // This sets the local id for this object, taking care as well to log it
  253. // when it relates to our debugged object. HB
  254. void setlocalID(U32 local_id);
  255. LL_INLINE const LLUUID& getID() const { return mID; }
  256. LL_INLINE U32 getLocalID() const { return mLocalID; }
  257. LL_INLINE U32 getCRC() const { return mTotalCRC; }
  258. LL_INLINE S32 getListIndex() const { return mListIndex; }
  259. LL_INLINE void setListIndex(S32 idx) { mListIndex = idx; }
  260. LL_INLINE virtual bool isFlexible() const { return false; }
  261. LL_INLINE virtual bool isSculpted() const { return false; }
  262. LL_INLINE virtual bool isMesh() const { return false; }
  263. LL_INLINE virtual bool isRiggedMesh() const { return false; }
  264. LL_INLINE virtual bool hasLightTexture() const { return false; }
  265. LL_INLINE virtual bool isReflectionProbe() const { return false; }
  266. // This method returns true if the object is over land owned by the agent,
  267. // one of its groups, or it encroaches and anti-encroachment is enabled.
  268. bool isReturnable();
  269. struct PotentialReturnableObject
  270. {
  271. LLBBox box;
  272. LLViewerRegion* region;
  273. };
  274. typedef std::vector<PotentialReturnableObject> returnable_vec_t;
  275. void buildReturnablesForChildrenVO(returnable_vec_t& returnables,
  276. LLViewerObject* childp,
  277. LLViewerRegion* target_regionp);
  278. void constructAndAddReturnable(returnable_vec_t& returnables,
  279. LLViewerObject* childp,
  280. LLViewerRegion* target_regionp);
  281. virtual bool setParent(LLViewerObject* parent);
  282. LL_INLINE virtual void onReparent(LLViewerObject* old_parent,
  283. LLViewerObject* new_parent)
  284. {
  285. }
  286. LL_INLINE virtual void afterReparent() {}
  287. virtual void addChild(LLViewerObject* childp);
  288. virtual void removeChild(LLViewerObject* childp);
  289. LL_INLINE const_child_list_t& getChildren() const { return mChildList; }
  290. LL_INLINE S32 numChildren() const { return mChildList.size(); }
  291. void addThisAndAllChildren(std::vector<LLViewerObject*>& objects);
  292. void addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects);
  293. bool isChild(LLViewerObject* childp) const;
  294. // Returns true if at least one avatar is sitting on this object
  295. bool isSeat() const;
  296. // Returns true if agent is sitting on this object
  297. bool isAgentSeat() const;
  298. // Detects if given line segment (in agent space) intersects with this
  299. // object. Returns true if intersection detected and returns information
  300. // about the intersection.
  301. virtual bool lineSegmentIntersect(const LLVector4a& start,
  302. const LLVector4a& end,
  303. // Which face to check, -1 = ALL_SIDES
  304. S32 face = -1,
  305. bool pick_transparent = false,
  306. bool pick_rigged = false,
  307. // Which face was hit
  308. S32* face_hit = NULL,
  309. // Returns the intersection point
  310. LLVector4a* intersection = NULL,
  311. // Return the texture coordinates
  312. LLVector2* tex_coord = NULL,
  313. // Returns the surface normal
  314. LLVector4a* normal = NULL,
  315. // Returns the surface tangent
  316. LLVector4a* tangent = NULL);
  317. virtual bool lineSegmentBoundingBox(const LLVector4a& start,
  318. const LLVector4a& end);
  319. virtual const LLVector3d getPositionGlobal() const;
  320. virtual const LLVector3& getPositionRegion() const;
  321. virtual const LLVector3 getPositionEdit() const;
  322. virtual const LLVector3& getPositionAgent() const;
  323. virtual const LLVector3 getRenderPosition() const;
  324. LLMatrix4a getAgentToGLTFAssetTransform() const;
  325. LLMatrix4a getGLTFAssetToAgentTransform() const;
  326. LLVector3 getGLTFNodePositionAgent(S32 node_index) const;
  327. LLMatrix4a getGLTFNodeTransformAgent(S32 node_index) const;
  328. void getGLTFNodeTransformAgent(S32 node_index, LLVector3* positionp,
  329. LLQuaternion* rotationp,
  330. LLVector3* scalep) const;
  331. // Moves the node at the given index by the given offset in agent space
  332. void moveGLTFNode(S32 node_index, const LLVector3& offset);
  333. // Sets the rotation in agent space of the given node
  334. void setGLTFNodeRotationAgent(S32 node_index, const LLQuaternion& rot);
  335. // Usually = to getPositionAgent, unless, like for flex objects, it is not:
  336. LL_INLINE virtual const LLVector3 getPivotPositionAgent() const
  337. {
  338. return getRenderPosition();
  339. }
  340. LLViewerObject* getRootEdit() const;
  341. const LLQuaternion getRotationRegion() const;
  342. const LLQuaternion getRotationEdit() const;
  343. const LLQuaternion getRenderRotation() const;
  344. virtual const LLMatrix4& getRenderMatrix() const;
  345. // Note: this used to be setPosition() in LL's code, but there is also a
  346. // setPosition(const LLVector3& pos) method in LLXForm, which we derivate
  347. // from, via LLPrimitive... Since "damped" can be omitted here, this means
  348. // we could end up calling the wrong setPosition() method ! HB
  349. void setPositionLocal(const LLVector3& pos, bool damped = false);
  350. void setPositionGlobal(const LLVector3d& position, bool damped = false);
  351. void setPositionRegion(const LLVector3& position);
  352. void setPositionEdit(const LLVector3& position, bool damped = false);
  353. void setPositionAgent(const LLVector3& pos_agent);
  354. void setPositionParent(const LLVector3& pos_parent, bool damped = false);
  355. void setPositionAbsoluteGlobal(const LLVector3d& pos_global);
  356. LL_INLINE virtual const LLMatrix4& getWorldMatrix(LLXformMatrix* xfm) const
  357. {
  358. return xfm->getWorldMatrix();
  359. }
  360. LL_INLINE void setRotation(F32 x, F32 y, F32 z, bool damped = false)
  361. {
  362. LLPrimitive::setRotation(x, y, z);
  363. setChanged(ROTATED | SILHOUETTE);
  364. updateDrawable(damped);
  365. }
  366. LL_INLINE void setRotation(const LLQuaternion& quat, bool damped = false)
  367. {
  368. LLPrimitive::setRotation(quat);
  369. setChanged(ROTATED | SILHOUETTE);
  370. updateDrawable(damped);
  371. }
  372. LLViewerTexture* getBakedTextureForMagicId(const LLUUID& id);
  373. void updateAvatarMeshVisibility(const LLUUID& id, const LLUUID& old_id);
  374. void refreshBakeTexture();
  375. void setNumTEs(U8 num_tes) override;
  376. void setTE(U8 te, const LLTextureEntry& tex_entry) override;
  377. S32 setTETexture(U8 te, const LLUUID& uuid) override;
  378. S32 setTENormalMap(U8 te, const LLUUID& uuid);
  379. S32 setTESpecularMap(U8 te, const LLUUID& uuid);
  380. S32 setTETextureCore(U8 te, LLViewerTexture* texp);
  381. S32 setTENormalMapCore(U8 te, LLViewerTexture* texp);
  382. S32 setTESpecularMapCore(U8 te, LLViewerTexture* texp);
  383. S32 setTEColor(U8 te, const LLColor3& color) override;
  384. S32 setTEColor(U8 te, const LLColor4& color) override;
  385. S32 setTEScale(U8 te, F32 s, F32 t) override;
  386. S32 setTEScaleS(U8 te, F32 s) override;
  387. S32 setTEScaleT(U8 te, F32 t) override;
  388. S32 setTEOffset(U8 te, F32 s, F32 t) override;
  389. S32 setTEOffsetS(U8 te, F32 s) override;
  390. S32 setTEOffsetT(U8 te, F32 t) override;
  391. S32 setTERotation(U8 te, F32 r) override;
  392. S32 setTEBumpmap(U8 te, U8 bump) override;
  393. S32 setTETexGen(U8 te, U8 texgen) override;
  394. // *FIXME: this confusingly acts upon a superset of setTETexGen's flags
  395. // without absorbing its semantics:
  396. S32 setTEMediaTexGen(U8 te, U8 media) override;
  397. S32 setTEShiny(U8 te, U8 shiny) override;
  398. S32 setTEFullbright(U8 te, U8 fullbright) override;
  399. S32 setTEMediaFlags(U8 te, U8 media_flags) override;
  400. S32 setTEGlow(U8 te, F32 glow) override;
  401. S32 setTEMaterialID(U8 te, const LLMaterialID& matidp) override;
  402. S32 setTEMaterialParams(U8 te, const LLMaterialPtr p) override;
  403. virtual S32 setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* matp);
  404. void updateTEMaterialTextures(U8 te);
  405. // Used by materials update methods to properly kick off rebuilds of VBs
  406. // etc when materials updates require changes.
  407. void refreshMaterials();
  408. bool setMaterial(U8 material) override;
  409. // Not derived from LLPrimitive:
  410. virtual void setTEImage(U8 te, LLViewerTexture* texp);
  411. virtual void changeTEImage(S32 index, LLViewerTexture* texp);
  412. virtual void changeTENormalMap(S32 index, LLViewerTexture* texp);
  413. virtual void changeTESpecularMap(S32 index, LLViewerTexture* texp);
  414. LLViewerTexture* getTEImage(U8 te) const;
  415. LLViewerTexture* getTENormalMap(U8 te) const;
  416. LLViewerTexture* getTESpecularMap(U8 te) const;
  417. bool isImageAlphaBlended(U8 te) const;
  418. void fitFaceTexture(U8 face);
  419. // Sends packed representation of all texture entry information
  420. void sendTEUpdate() const;
  421. virtual void setScale(const LLVector3& scale, bool damped = false);
  422. LL_INLINE virtual F32 getStreamingCost(S32* bytes = NULL,
  423. S32* visible_bytes = NULL,
  424. F32* unscaled_value = NULL) const
  425. {
  426. return 0.f;
  427. }
  428. LL_INLINE virtual U32 getTriangleCount(S32* vcount = NULL) const
  429. {
  430. return 0;
  431. }
  432. LL_INLINE virtual U32 getHighLODTriangleCount()
  433. {
  434. return 0;
  435. }
  436. U32 recursiveGetTriangleCount(S32* vcountp = NULL) const;
  437. void setObjectCostStale();
  438. void setObjectCost(F32 cost);
  439. F32 getObjectCost();
  440. void setLinksetCost(F32 cost);
  441. F32 getLinksetCost();
  442. void setPhysicsCost(F32 cost);
  443. F32 getPhysicsCost();
  444. void setLinksetPhysicsCost(F32 cost);
  445. F32 getLinksetPhysicsCost();
  446. F32 recursiveGetEstTrianglesMax() const;
  447. S32 getAnimatedObjectMaxTris() const;
  448. LL_INLINE virtual F32 getEstTrianglesMax() const { return 0.f; }
  449. LL_INLINE virtual F32 getEstTrianglesStreamingCost() const
  450. {
  451. return 0.f;
  452. }
  453. void sendShapeUpdate();
  454. LL_INLINE U8 getAttachmentState() const { return mAttachmentState; }
  455. LL_INLINE F32 getAppAngle() const { return mAppAngle; }
  456. LL_INLINE F32 getPixelArea() const { return mPixelArea; }
  457. LL_INLINE void setPixelArea(F32 area) { mPixelArea = area; }
  458. F32 getMaxScale() const;
  459. F32 getMidScale() const;
  460. F32 getMinScale() const;
  461. // Owner id is this object's owner
  462. void setAttachedSound(const LLUUID& audio_uuid, const LLUUID& owner_id,
  463. F32 gain, U8 flags);
  464. LL_INLINE void clearAttachedSound() { mAudioSourcep = NULL; }
  465. void adjustAudioGain(F32 gain);
  466. LL_INLINE F32 getSoundCutOffRadius() const { return mSoundCutOffRadius; }
  467. // Creates if necessary
  468. LLAudioSource* getAudioSource(const LLUUID& owner_id);
  469. LL_INLINE bool isAudioSource() const { return mAudioSourcep != NULL; }
  470. LL_INLINE LLViewerPartSourceScript* getPartSource() { return mPartSourcep.get(); }
  471. LL_INLINE U8 getMediaType() const
  472. {
  473. return mMedia ? mMedia->mMediaType : MEDIA_NONE;
  474. }
  475. void setMediaType(U8 media_type);
  476. LL_INLINE const std::string& getMediaURL() const
  477. {
  478. return mMedia ? mMedia->mMediaURL : LLStringUtil::null;
  479. }
  480. void setMediaURL(const std::string& media_url);
  481. #if 0 // Not used
  482. LL_INLINE bool getMediaPassedWhitelist() const
  483. {
  484. return mMedia && mMedia->mPassedWhitelist;
  485. }
  486. LL_INLINE void setMediaPassedWhitelist(bool passed)
  487. {
  488. if (mMedia)
  489. {
  490. mMedia->mPassedWhitelist = passed;
  491. }
  492. }
  493. #endif
  494. void sendMaterialUpdate() const;
  495. void setDebugText(const std::string& utf8text);
  496. LLHUDIcon* setIcon(LLViewerTexture* texp, F32 scale = 0.03f);
  497. LL_INLINE void clearIcon() { mIcon = NULL; }
  498. void recursiveMarkForUpdate();
  499. virtual void markForUpdate(bool rebuild_all = false);
  500. void updateVolume(const LLVolumeParams& volume_params);
  501. virtual void updateSpatialExtents(LLVector4a& min, LLVector4a& max);
  502. virtual F32 getBinRadius();
  503. LLBBox getBoundingBoxAgent() const;
  504. // Updates the global and region position caches from the object (and
  505. // parent's) xform.
  506. void updatePositionCaches() const;
  507. // Update text label position
  508. void updateText();
  509. // Force updates on static objects
  510. virtual void updateDrawable(bool force_damped);
  511. void setDrawableState(U32 state, bool recursive = true);
  512. void clearDrawableState(U32 state, bool recursive = true);
  513. bool isDrawableState(U32 state, bool recursive = true) const;
  514. // Called when the drawable shifts
  515. LL_INLINE virtual void onShift(const LLVector4a& shift_vector)
  516. {
  517. }
  518. //////////////////////////////////////
  519. //
  520. // Inventory methods
  521. //
  522. // This method is called when someone is interested in a viewer object's
  523. // inventory. The callback is called as soon as the viewer object has the
  524. // inventory stored locally.
  525. void registerInventoryListener(LLVOInventoryListener* listener,
  526. void* user_data);
  527. void removeInventoryListener(LLVOInventoryListener* listener);
  528. enum EInventoryRequestState
  529. {
  530. INVENTORY_REQUEST_STOPPED,
  531. INVENTORY_REQUEST_PENDING,
  532. INVENTORY_XFER
  533. };
  534. LL_INLINE bool isInventoryPending()
  535. {
  536. return mInvRequestState != INVENTORY_REQUEST_STOPPED;
  537. }
  538. void clearInventoryListeners();
  539. LL_INLINE bool hasInventoryListeners() { return !mInventoryCallbacks.empty(); }
  540. void requestInventory();
  541. static void processTaskInv(LLMessageSystem* msg, void** user_data);
  542. void removeInventory(const LLUUID& item_id);
  543. // The updateInventory() call potentially calls into the selection manager,
  544. // so do no call updateInventory() from the selection manager until we have
  545. // better iterators.
  546. void updateInventory(LLViewerInventoryItem* itemp, bool is_new = false);
  547. LLInventoryObject* getInventoryObject(const LLUUID& item_id);
  548. LLInventoryItem* getInventoryItem(const LLUUID& item_id);
  549. void getInventoryContents(LLInventoryObject::object_list_t& objects);
  550. LLInventoryObject* getInventoryRoot();
  551. // Gets the object inventory item corresponding to a given asset Id, and
  552. // when 'type' is specified (and not AT_NONE), matching that type as well
  553. // (else the asset type is ignored).
  554. LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id,
  555. LLAssetType::EType type =
  556. LLAssetType::AT_NONE);
  557. LL_INLINE S16 getInventorySerial() const { return mInventorySerialNum; }
  558. // This methods does viewer-side only object inventory modifications
  559. void updateViewerInventoryAsset(const LLViewerInventoryItem* item,
  560. const LLUUID& new_asset);
  561. // This method will make sure that we refresh the inventory.
  562. void dirtyInventory();
  563. LL_INLINE bool isInventoryDirty() { return mInventoryDirty; }
  564. // Saves a script, which involves removing the old one, and rezzing in the
  565. // new one. This method should be called with the asset Id of the new and
  566. // old script AFTER the bytecode has been saved.
  567. void saveScript(const LLViewerInventoryItem* item, bool active,
  568. bool is_new);
  569. // Moves an inventory item out of the task and into agent inventory. This
  570. // operation is based on messaging. No permission checks are made on the
  571. // viewer; the server will double-check.
  572. void moveInventory(const LLUUID& agent_folder, const LLUUID& item_id);
  573. // Finds the number of instances of this object's inventory that are of the
  574. // given type
  575. S32 countInventoryContents(LLAssetType::EType type);
  576. bool permAnyOwner() const;
  577. bool permYouOwner() const;
  578. bool permGroupOwner() const;
  579. bool permOwnerModify() const;
  580. bool permModify() const;
  581. bool permCopy() const;
  582. bool permMove() const;
  583. bool permTransfer() const;
  584. LL_INLINE bool flagUsePhysics() const { return (mFlags & FLAGS_USE_PHYSICS) != 0; }
  585. LL_INLINE bool flagObjectAnyOwner() const { return (mFlags & FLAGS_OBJECT_ANY_OWNER) != 0; }
  586. LL_INLINE bool flagObjectYouOwner() const { return (mFlags & FLAGS_OBJECT_YOU_OWNER) != 0; }
  587. LL_INLINE bool flagObjectGroupOwned() const { return (mFlags & FLAGS_OBJECT_GROUP_OWNED) != 0; }
  588. LL_INLINE bool flagObjectOwnerModify() const { return (mFlags & FLAGS_OBJECT_OWNER_MODIFY) != 0; }
  589. LL_INLINE bool flagObjectModify() const { return (mFlags & FLAGS_OBJECT_MODIFY) != 0; }
  590. LL_INLINE bool flagObjectCopy() const { return (mFlags & FLAGS_OBJECT_COPY) != 0; }
  591. LL_INLINE bool flagObjectMove() const { return (mFlags & FLAGS_OBJECT_MOVE) != 0; }
  592. LL_INLINE bool flagObjectTransfer() const { return (mFlags & FLAGS_OBJECT_TRANSFER) != 0; }
  593. LL_INLINE bool flagObjectPermanent() const { return (mFlags & FLAGS_AFFECTS_NAVMESH) != 0; }
  594. LL_INLINE bool flagCharacter() const { return (mFlags & FLAGS_CHARACTER) != 0; }
  595. LL_INLINE bool flagVolumeDetect() const { return (mFlags & FLAGS_VOLUME_DETECT) != 0; }
  596. LL_INLINE bool flagIncludeInSearch() const { return (mFlags & FLAGS_INCLUDE_IN_SEARCH) != 0; }
  597. LL_INLINE bool flagScripted() const { return (mFlags & FLAGS_SCRIPTED) != 0; }
  598. LL_INLINE bool flagHandleTouch() const { return (mFlags & FLAGS_HANDLE_TOUCH) != 0; }
  599. LL_INLINE bool flagTakesMoney() const { return (mFlags & FLAGS_TAKES_MONEY) != 0; }
  600. LL_INLINE bool flagPhantom() const { return (mFlags & FLAGS_PHANTOM) != 0; }
  601. LL_INLINE bool flagInventoryEmpty() const { return (mFlags & FLAGS_INVENTORY_EMPTY) != 0; }
  602. LL_INLINE bool flagAllowInventoryAdd() const { return (mFlags & FLAGS_ALLOW_INVENTORY_DROP) != 0; }
  603. LL_INLINE bool flagTemporaryOnRez() const { return (mFlags & FLAGS_TEMPORARY_ON_REZ) != 0; }
  604. LL_INLINE bool flagAnimSource() const { return (mFlags & FLAGS_ANIM_SOURCE) != 0; }
  605. LL_INLINE bool flagCameraSource() const { return (mFlags & FLAGS_CAMERA_SOURCE) != 0; }
  606. LL_INLINE bool flagCameraDecoupled() const { return (mFlags & FLAGS_CAMERA_DECOUPLED) != 0; }
  607. LL_INLINE bool flagsLoaded() const { return mFlagsLoaded; }
  608. U8 getPhysicsShapeType() const;
  609. LL_INLINE F32 getPhysicsGravity() const { return mPhysicsGravity; }
  610. LL_INLINE F32 getPhysicsFriction() const { return mPhysicsFriction; }
  611. LL_INLINE F32 getPhysicsDensity() const { return mPhysicsDensity; }
  612. LL_INLINE F32 getPhysicsRestitution() const { return mPhysicsRestitution; }
  613. bool isPermanentEnforced() const;
  614. bool isHiglightedOrBeacon() const;
  615. bool getIncludeInSearch() const;
  616. void setIncludeInSearch(bool include_in_search);
  617. // Does "open" object menu item apply ?
  618. bool allowOpen() const;
  619. LL_INLINE void setClickAction(U8 action) { mClickAction = action; }
  620. LL_INLINE U8 getClickAction() const { return mClickAction; }
  621. // Returns true if it got a special hover cursor
  622. bool specialHoverCursor() const;
  623. void setRegion(LLViewerRegion* regionp);
  624. LL_INLINE virtual void updateRegion(LLViewerRegion*)
  625. {
  626. }
  627. void updateFlags(bool physics_changed = false);
  628. void loadFlags(U32 flags); // loads flags from cache or from message
  629. bool setFlags(U32 flag, bool state);
  630. bool setFlagsWithoutUpdate(U32 flag, bool state);
  631. void setPhysicsShapeType(U8 type);
  632. void setPhysicsGravity(F32 gravity);
  633. void setPhysicsFriction(F32 friction);
  634. void setPhysicsDensity(F32 density);
  635. void setPhysicsRestitution(F32 restitution);
  636. virtual void dump() const;
  637. LL_INLINE static U32 getNumObjects() { return sNumObjects; }
  638. void printNameValuePairs() const;
  639. LL_INLINE virtual S32 getLOD() const { return 3; }
  640. // Allows to (un)lock the LOD of all child objects of this object's root
  641. // object. Returns true if at least one primitive LOD got (un)locked.
  642. bool recursiveSetMaxLOD(bool lock = true);
  643. // Returns true when one (or more) of the child objects of this object's
  644. // root object is locked at max LOD.
  645. bool isLockedAtMaxLOD();
  646. virtual U32 getPartitionType() const;
  647. void dirtySpatialGroup() const;
  648. virtual void dirtyMesh();
  649. // Note: these used to be declared as virtual, but no child class was
  650. // overriding them... So, let's keep things simple, shall we ?
  651. bool setParameterEntry(U16 param_type, const LLNetworkData& new_value,
  652. bool local_origin);
  653. bool getParameterEntryInUse(U16 param_type) const;
  654. bool setParameterEntryInUse(U16 param_type, bool in_use,
  655. bool local_origin);
  656. // Shortcut methods to avoid using getParameterEntry() (sometimes together
  657. // with getParameterEntryInUse()) and speed things up; they return a NULL
  658. // pointer when the extra parameter does not exist or is not in use. HB
  659. LLFlexibleObjectData* getFlexibleObjectData() const;
  660. LLLightParams* getLightParams() const;
  661. LLSculptParams* getSculptParams() const;
  662. LLLightImageParams* getLightImageParams() const;
  663. LLExtendedMeshParams* getExtendedMeshParams() const;
  664. LLRenderMaterialParams* getMaterialRenderParams() const;
  665. LLReflectionProbeParams* getReflectionProbeParams() const;
  666. // Called when a parameter is changed
  667. virtual void parameterChanged(U16 param_type, bool local_origin);
  668. virtual void parameterChanged(U16 param_type, LLNetworkData* data,
  669. bool in_use, bool local_origin);
  670. LL_INLINE bool isShrinkWrapped() const { return mShouldShrinkWrap; }
  671. // Used to improve performance; If an object is likely to rebuild its
  672. // vertex buffer often as a side effect of some update (color update,
  673. // scale, etc), setting this to true will cause it to be pushed deeper
  674. // into the octree and isolate it from other nodes so that nearby objects
  675. // would not attempt to share a vertex buffer with this object.
  676. void shrinkWrap();
  677. static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value,
  678. std::string name);
  679. static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value,
  680. std::string name);
  681. static void unpackU32(LLDataPackerBinaryBuffer* dp, U32& value,
  682. std::string name);
  683. static void unpackU8(LLDataPackerBinaryBuffer* dp, U8& value,
  684. std::string name);
  685. static U32 unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id);
  686. // Counter-translation
  687. void resetChildrenPosition(const LLVector3& offset,
  688. bool simplified = false,
  689. bool skip_avatar_child = false);
  690. // Counter-rotation
  691. void resetChildrenRotationAndPosition(const std::vector<LLQuaternion>& rot,
  692. const std::vector<LLVector3>& pos);
  693. void saveUnselectedChildrenRotation(std::vector<LLQuaternion>& rotations);
  694. void saveUnselectedChildrenPosition(std::vector<LLVector3>& positions);
  695. std::vector<LLVector3> mUnselectedChildrenPositions;
  696. LL_INLINE const LLUUID& getAttachmentItemID() const
  697. {
  698. return mAttachmentItemID;
  699. }
  700. LL_INLINE void setAttachmentItemID(const LLUUID& id)
  701. {
  702. mAttachmentItemID = id;
  703. }
  704. // Find and sets the inventory item ID of the attached object:
  705. const LLUUID& extractAttachmentItemID();
  706. LL_INLINE EObjectUpdateType getLastUpdateType() const
  707. {
  708. return mLastUpdateType;
  709. }
  710. LL_INLINE void setLastUpdateType(EObjectUpdateType type)
  711. {
  712. mLastUpdateType = type;
  713. }
  714. LL_INLINE bool getLastUpdateCached() const { return mLastUpdateCached; }
  715. LL_INLINE void setLastUpdateCached(bool b) { mLastUpdateCached = b; }
  716. virtual void updateRiggingInfo() {}
  717. LL_INLINE bool getDebugUpdateMsg() const { return mDebugUpdateMsg; }
  718. LL_INLINE void setDebugUpdateMsg() { mDebugUpdateMsg = true; }
  719. void toggleDebugUpdateMsg();
  720. static void setDebugObjectId(const LLUUID& id);
  721. LL_INLINE static const LLUUID& getDebuggedObjectId()
  722. {
  723. return sDebugObjectId;
  724. }
  725. LL_INLINE static bool isDebuggedObject(const LLUUID& object_id)
  726. {
  727. return object_id == sDebugObjectId;
  728. }
  729. LL_INLINE static void setVelocityInterpolate(bool value)
  730. {
  731. sVelocityInterpolate = value;
  732. }
  733. LL_INLINE static void setPingInterpolate(bool value)
  734. {
  735. sPingInterpolate = value;
  736. }
  737. static void setUpdateInterpolationTimes(F32 interpolate_time,
  738. F32 phase_out_time,
  739. F32 region_interp_time);
  740. // Flags for createObject()
  741. static constexpr S32 CO_FLAG_UI_AVATAR = 1 << 0;
  742. static constexpr S32 CO_FLAG_PUPPET_AVATAR = 1 << 1;
  743. protected:
  744. // Delete an item in the inventory, but do not tell the server. This is
  745. // used internally by remove, update, and save script.
  746. void deleteInventoryItem(const LLUUID& item_id);
  747. // Do the update/caching logic. called by saveScript and updateInventory.
  748. void doUpdateInventory(LLPointer<LLViewerInventoryItem>& itemp,
  749. bool is_new);
  750. static LLViewerObject* createObject(const LLUUID& id, LLPCode pcode,
  751. LLViewerRegion* regionp,
  752. S32 flags = 0);
  753. bool setData(const U8* datap, U32 data_size);
  754. // Hide or show HUD, icon and particles
  755. void hideExtraDisplayItems(bool hidden);
  756. LL_INLINE bool isOnMap() { return mOnMap; }
  757. //////////////////////////
  758. // Inventory functionality
  759. static void processTaskInvFile(void** user_data, S32 error_code,
  760. LLExtStat ext_status);
  761. bool loadTaskInvFile(const std::string& filename);
  762. void doInventoryCallback();
  763. void unpackParticleSource(S32 block_num, const LLUUID& owner_id);
  764. void unpackParticleSource(LLDataPacker& dp, const LLUUID& owner_id,
  765. bool legacy);
  766. void deleteParticleSource();
  767. void setParticleSource(const LLPartSysData& particle_params,
  768. const LLUUID& owner_id);
  769. private:
  770. bool isAssetInInventory(LLViewerInventoryItem* itemp,
  771. LLAssetType::EType type);
  772. LLNetworkData* createNewParameterEntry(U16 param_type);
  773. LLNetworkData* getExtraParameterEntry(U16 param_type) const;
  774. LLNetworkData* getExtraParameterEntryCreate(U16 param_type);
  775. bool unpackParameterEntry(U16 param_type, LLDataPacker* dp);
  776. // This method checks to see if the given media URL has changed its
  777. // version and the update wasn't due to this agent's last action.
  778. U32 checkMediaURL(const std::string& media_url);
  779. // Motion prediction between updates
  780. void interpolateLinearMotion(F64 time, F32 dt);
  781. void applyAngularVelocity(F32 dt);
  782. // Clears NV pairs and then individually adds \n separated NV pairs from
  783. // \0 terminated string
  784. void setNameValueList(const std::string& list);
  785. void deleteTEImages(); // correctly deletes list of images
  786. static void initObjectDataMap();
  787. void fetchInventoryFromServer();
  788. void setRenderMaterialIDs(const LLRenderMaterialParams* paramsp,
  789. bool local_origin);
  790. void rebuildMaterial();
  791. LLViewerFetchedTexture* getFetchedTexForMat(const LLUUID& id, F32 vsize,
  792. U32 prio = 0); // BOOST_NONE
  793. public:
  794. LLUUID mID;
  795. LLUUID mOwnerID; // null if unknown
  796. LLPointer<LLVOAvatarPuppet> mPuppetAvatar;
  797. LLJointRiggingInfoTab mJointRiggingInfoTab;
  798. // Pipeline classes
  799. LLPointer<LLDrawable> mDrawable;
  800. LLPointer<LLGLTF::Asset> mGLTFAsset;
  801. // *TODO: make all this stuff private. JC
  802. LLPointer<LLHUDIcon> mIcon;
  803. LLPointer<LLHUDText> mText;
  804. LLPointer<LLReflectionMap> mReflectionProbe;
  805. LLColor4 mHudTextColor;
  806. // Cached values used to restore the text after switching off debug info
  807. // hovertexts:
  808. std::string mHudTextString;
  809. // Unique within region, not unique across regions. Local ID=0 is not used
  810. U32 mLocalID;
  811. // Last total CRC received from sim, used for caching
  812. U32 mTotalCRC;
  813. // Index into LLViewerObjectList::mActiveObjects or -1 if not in list
  814. S32 mListIndex;
  815. // In bits
  816. S32 mBestUpdatePrecision;
  817. // Sent to sim in UPDATE_FLAGS, received in ObjectPhysicsProperties
  818. U8 mPhysicsShapeType;
  819. F32 mPhysicsGravity;
  820. F32 mPhysicsFriction;
  821. F32 mPhysicsDensity;
  822. F32 mPhysicsRestitution;
  823. // True if user can select this object by clicking
  824. bool mCanSelect;
  825. // Band-aid to select object after all creation initialization is done
  826. bool mCreateSelected;
  827. bool mIsReflectionProbe;
  828. // This is a special case for mirrors and other high resolution probes.
  829. bool mIsHeroProbe;
  830. static bool sUseNewTargetOmegaCode;
  831. protected:
  832. // Region that this object belongs to.
  833. LLViewerRegion* mRegionp;
  834. // Last update for purposes of interpolation
  835. F64 mLastInterpUpdateSecs;
  836. // Region crossing interpolation expiry time
  837. F64 mRegionCrossExpire;
  838. // Last update from a message from the simulator
  839. F64 mLastMessageUpdateSecs;
  840. // Latest time stamp on message from simulator
  841. TPACKETID mLatestRecvPacketID;
  842. // Extra data sent from the sim...currently only used for tree species info
  843. U8* mData;
  844. // Particle source associated with this object.
  845. LLPointer<LLViewerPartSourceScript> mPartSourcep;
  846. LLAudioSourceVO* mAudioSourcep;
  847. F32 mAudioGain;
  848. F32 mSoundCutOffRadius;
  849. // Apparent visual arc in degrees
  850. F32 mAppAngle;
  851. // Apparent area in pixels
  852. F32 mPixelArea;
  853. EInventoryRequestState mInvRequestState;
  854. U64 mInvRequestXFerId;
  855. S32 mNumFaces;
  856. // Amount (in seconds) that object has rotated according to angular
  857. // velocity (llSetTargetOmega)
  858. F32 mRotTime;
  859. // Accumulated rotation from the angular velocity computations
  860. LLQuaternion mAngularVelocityRot;
  861. LLQuaternion mPreviousRotation;
  862. // NULL if no media associated
  863. LLViewerObjectMedia* mMedia;
  864. // Resource cost of this object or -1 if unknown
  865. F32 mObjectCost;
  866. F32 mLinksetCost;
  867. F32 mPhysicsCost;
  868. F32 mLinksetPhysicsCost;
  869. // These two caches are only correct for non-parented objects right now !
  870. mutable LLVector3 mPositionRegion;
  871. mutable LLVector3 mPositionAgent;
  872. // This is the object's inventory from the viewer's perspective.
  873. S16 mInventorySerialNum;
  874. S16 mExpectedInventorySerialNum;
  875. LLInventoryObject::object_list_t* mInventory;
  876. callback_list_t mInventoryCallbacks;
  877. // Ids of itemsadded to the contents of the object but have not yet been
  878. // updated on the server.
  879. uuid_list_t mPendingInventoryItemsIDs;
  880. // Any name-value pairs stored by script
  881. typedef std::map<char*, LLNameValue*> name_value_map_t;
  882. name_value_map_t mNameValuePairs;
  883. child_list_t mChildList;
  884. // There used to be an 'mExtraParameterList' parameter-type-keyed map of
  885. // pointers to heap-allocated instances of an ExtraParameter structure,
  886. // itself conntaining a LLNetworkData* 'data' pointer and an 'in_use' bool.
  887. // Given the small number (9, as I am writing this) of extra parameters, it
  888. // is way more efficient to use the two tiny arrays below, that get
  889. // allocated together with the rest of the member variables (no additionnal
  890. // heap allocation needed and cache locality ensured). Plus, with the use
  891. // of a seperate mExtraParameterInUse array (which entries are all cleared
  892. // to false and can be true only after the corresponding LLNetworkData
  893. // structure has been successfully allocated), we save ourselves a check
  894. // on the LLNetworkData pointers validity (non-NULL value)... HB
  895. LLNetworkData* mExtraParameters[LL_EPARAMS_COUNT];
  896. bool mExtraParameterInUse[LL_EPARAMS_COUNT];
  897. U8 mClickAction;
  898. // This encodes the attachment id in a somewhat complex way. 0 if not an
  899. // attachment.
  900. U8 mAttachmentState;
  901. bool mShouldShrinkWrap;
  902. mutable bool mPhysicsShapeUnknown;
  903. bool mCostStale;
  904. bool mInventoryDirty;
  905. bool mDead;
  906. // true when this is an orphaned child:
  907. bool mOrphaned;
  908. // Cached user select information:
  909. bool mUserSelected;
  910. bool mOnActiveList;
  911. bool mOnMap; // On the map.
  912. bool mStatic; // Object does not move
  913. private:
  914. bool mFlagsLoaded;
  915. bool mLastUpdateCached;
  916. bool mDebugUpdateMsg;
  917. typedef std::vector<LLPointer<LLViewerTexture> > te_images_vec_t;
  918. te_images_vec_t mTEImages;
  919. te_images_vec_t mTENormalMaps;
  920. te_images_vec_t mTESpecularMaps;
  921. // ItemID of the associated object is in user inventory.
  922. LLUUID mAttachmentItemID;
  923. // Grabbed from UPDATE_FLAGS
  924. U32 mFlags;
  925. EObjectUpdateType mLastUpdateType;
  926. static LLUUID sDebugObjectId;
  927. static S32 sNumObjects;
  928. // For motion interpolation
  929. static F64 sPhaseOutUpdateInterpolationTime;
  930. static F64 sMaxUpdateInterpolationTime;
  931. static F64 sMaxRegionCrossingInterpolationTime;
  932. static bool sVelocityInterpolate;
  933. static bool sPingInterpolate;
  934. static std::map<std::string, U32> sObjectDataMap;
  935. };
  936. // Sub-class of viewer object that can be added to particle partitions
  937. class LLAlphaObject : public LLViewerObject
  938. {
  939. public:
  940. LLAlphaObject(const LLUUID& id, LLPCode pcode, LLViewerRegion* regionp)
  941. : LLViewerObject(id, pcode, regionp),
  942. mDepth(0.f)
  943. {
  944. }
  945. LL_INLINE LLAlphaObject* asAlphaObject() override
  946. {
  947. return this;
  948. }
  949. LL_INLINE virtual F32 getPartSize(S32 idx) { return 0.f; }
  950. virtual void getGeometry(S32 idx,
  951. LLStrider<LLVector4a>& verticesp,
  952. LLStrider<LLVector3>& normalsp,
  953. LLStrider<LLVector2>& texcoordsp,
  954. LLStrider<LLColor4U>& colorsp,
  955. LLStrider<LLColor4U>& emissivep,
  956. LLStrider<U16>& indicesp) = 0;
  957. LL_INLINE virtual bool getBlendFunc(S32 face, U32& src, U32& dst)
  958. {
  959. return true;
  960. }
  961. public:
  962. F32 mDepth;
  963. };
  964. class LLStaticViewerObject : public LLViewerObject
  965. {
  966. public:
  967. LLStaticViewerObject(const LLUUID& id, LLPCode pcode,
  968. LLViewerRegion* regionp, bool is_global = false)
  969. : LLViewerObject(id, pcode, regionp, is_global)
  970. {
  971. }
  972. void updateDrawable(bool force_damped) override;
  973. };
  974. #endif