summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatar.h')
-rw-r--r--indra/newview/llvoavatar.h1331
1 files changed, 791 insertions, 540 deletions
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index f8b2c068ff..301c032b25 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -46,8 +46,9 @@
#include "llviewerjointmesh.h"
#include "llviewerjointattachment.h"
#include "llrendertarget.h"
-#include "llwearable.h"
#include "llvoavatardefines.h"
+#include "lltexglobalcolor.h"
+#include "lldriverparam.h"
extern const LLUUID ANIM_AGENT_BODY_NOISE;
extern const LLUUID ANIM_AGENT_BREATHE_ROT;
@@ -65,10 +66,8 @@ class LLVoiceVisualizer;
class LLHUDText;
class LLHUDEffectSpiral;
class LLTexGlobalColor;
-
class LLVOAvatarBoneInfo;
class LLVOAvatarSkeletonInfo;
-class LLVOAvatarXmlInfo;
//------------------------------------------------------------------------
// LLVOAvatar
@@ -77,686 +76,938 @@ class LLVOAvatar :
public LLViewerObject,
public LLCharacter
{
+public:
+ friend class LLVOAvatarSelf;
protected:
- virtual ~LLVOAvatar();
+ struct LLVOAvatarXmlInfo;
+ struct LLMaskedMorph;
+
+/********************************************************************************
+ ** **
+ ** INITIALIZATION
+ **/
public:
LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
- /*virtual*/ void markDead();
- void startDefaultMotions();
+ virtual void markDead();
+ static void initClass(); // Initialize data that's only init'd once per class.
+ static void cleanupClass(); // Cleanup data that's only init'd once per class.
+ void initInstance(); // Called after construction to initialize the class.
+protected:
+ virtual ~LLVOAvatar();
+ BOOL loadSkeletonNode();
+ BOOL loadMeshNodes();
+ virtual BOOL loadLayersets();
+
+/** Initialization
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** INHERITED
+ **/
+
+ //--------------------------------------------------------------------
+ // LLViewerObject interface and related
+ //--------------------------------------------------------------------
+public:
+ virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
+ void **user_data,
+ U32 block_num,
+ const EObjectUpdateType update_type,
+ LLDataPacker *dp);
+ virtual BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+ virtual BOOL updateLOD();
+ BOOL updateJointLODs();
+ virtual BOOL isActive() const; // Whether this object needs to do an idleUpdate.
+ virtual void updateTextures(LLAgent &agent);
+ virtual S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim.
+ virtual void onShift(const LLVector3& shift_vector);
+ virtual U32 getPartitionType() const;
+ virtual const LLVector3 getRenderPosition() const;
+ virtual void updateDrawable(BOOL force_damped);
+ virtual LLDrawable* createDrawable(LLPipeline *pipeline);
+ virtual BOOL updateGeometry(LLDrawable *drawable);
+ virtual void setPixelAreaAndAngle(LLAgent &agent);
+ virtual void updateRegion(LLViewerRegion *regionp);
+ virtual void updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax);
+ virtual void getSpatialExtents(LLVector3& newMin, LLVector3& newMax);
+ virtual BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end,
+ S32 face = -1, // which face to check, -1 = ALL_SIDES
+ BOOL pick_transparent = FALSE,
+ S32* face_hit = NULL, // which face was hit
+ LLVector3* intersection = NULL, // return the intersection point
+ LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
+ LLVector3* normal = NULL, // return the surface normal at the intersection point
+ LLVector3* bi_normal = NULL); // return the surface bi-normal at the intersection point
+
+ //--------------------------------------------------------------------
+ // LLCharacter interface and related
+ //--------------------------------------------------------------------
+public:
+ virtual LLVector3 getCharacterPosition();
+ virtual LLQuaternion getCharacterRotation();
+ virtual LLVector3 getCharacterVelocity();
+ virtual LLVector3 getCharacterAngularVelocity();
+ virtual LLJoint* getCharacterJoint(U32 num);
+ virtual BOOL allocateCharacterJoints(U32 num);
+
+ virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
+ virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
+ virtual void stopMotionFromSource(const LLUUID& source_id);
+ virtual void requestStopMotion(LLMotion* motion);
+ LLMotion* findMotion(const LLUUID& id) const;
+ void startDefaultMotions();
+
+ virtual LLJoint* getJoint(const std::string &name);
+ virtual LLJoint* getRootJoint() { return &mRoot; }
+
+ virtual const char* getAnimationPrefix() { return "avatar"; }
+ virtual const LLUUID& getID();
+ virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset);
+ virtual LLJoint* findCollisionVolume(U32 volume_id);
+ virtual S32 getCollisionVolumeID(std::string &name);
+ virtual void addDebugText(const std::string& text);
+ virtual F32 getTimeDilation();
+ virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
+ virtual F32 getPixelArea() const;
+ virtual LLPolyMesh* getHeadMesh();
+ virtual LLPolyMesh* getUpperBodyMesh();
+ virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
+ virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
+ virtual void updateVisualParams();
+
+
+/** Inherited
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** STATE
+ **/
+
+public:
+ virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
+private:
+ BOOL mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients
- static void updateImpostors();
+ //--------------------------------------------------------------------
+ // Updates
+ //--------------------------------------------------------------------
+public:
+ virtual BOOL updateCharacter(LLAgent &agent);
+ void idleUpdateVoiceVisualizer(bool voice_enabled);
+ void idleUpdateMisc(bool detailed_update);
+ void idleUpdateAppearanceAnimation();
+ void idleUpdateLipSync(bool voice_enabled);
+ void idleUpdateLoadingEffect();
+ void idleUpdateWindEffect();
+ void idleUpdateNameTag(const LLVector3& root_pos_last);
+ void idleUpdateRenderCost();
+ void idleUpdateTractorBeam();
+ void idleUpdateBelowWater();
//--------------------------------------------------------------------
- // LLViewerObject interface
- //--------------------------------------------------------------------
-public:
- static void initClass(); // Initialize data that's only init'd once per class.
- static void cleanupClass(); // Cleanup data that's only init'd once per class.
- static BOOL parseSkeletonFile(const std::string& filename);
- virtual U32 processUpdateMessage(LLMessageSystem *mesgsys,
- void **user_data,
- U32 block_num,
- const EObjectUpdateType update_type,
- LLDataPacker *dp);
- /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
- void idleUpdateVoiceVisualizer(bool voice_enabled);
- void idleUpdateMisc(bool detailed_update);
- void idleUpdateAppearanceAnimation();
- void idleUpdateLipSync(bool voice_enabled);
- void idleUpdateLoadingEffect();
- void idleUpdateWindEffect();
- void idleUpdateNameTag(const LLVector3& root_pos_last);
- void idleUpdateRenderCost();
- void idleUpdateTractorBeam();
- void idleUpdateBelowWater();
-
-public:
- virtual BOOL updateLOD();
- /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
-
- // Graphical stuff for objects - maybe broken out into render class later?
- U32 renderFootShadows();
- U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255));
- U32 renderRigid();
- U32 renderSkinned(EAvatarRenderPass pass);
- U32 renderTransparent(BOOL first_pass);
- void renderCollisionVolumes();
-
- /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end,
- S32 face = -1, // which face to check, -1 = ALL_SIDES
- BOOL pick_transparent = FALSE,
- S32* face_hit = NULL, // which face was hit
- LLVector3* intersection = NULL, // return the intersection point
- LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
- LLVector3* normal = NULL, // return the surface normal at the intersection point
- LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point
- );
-
- /*virtual*/ void updateTextures(LLAgent &agent);
- // If setting a baked texture, need to request it from a non-local sim.
- /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid);
- /*virtual*/ void onShift(const LLVector3& shift_vector);
- virtual U32 getPartitionType() const;
+ // Static preferences (controlled by user settings/menus)
+ //--------------------------------------------------------------------
+public:
+ static S32 sRenderName;
+ static BOOL sRenderGroupTitles;
+ static S32 sMaxVisible;
+ static F32 sRenderDistance; //distance at which avatars will render (affected by control "RenderAvatarMaxVisible")
+ static BOOL sShowAnimationDebug; // show animation debug info
+ static BOOL sUseImpostors; //use impostors for far away avatars
+ static BOOL sShowFootPlane; // show foot collision plane reported by server
+ static BOOL sShowCollisionVolumes; // show skeletal collision volumes
+ static BOOL sVisibleInFirstPerson;
+ static S32 sNumLODChangesThisFrame;
+ static S32 sNumVisibleChatBubbles;
+ static BOOL sDebugInvisible;
+ static BOOL sShowAttachmentPoints;
+ static F32 sLODFactor; // user-settable LOD factor
+ static BOOL sJointDebug; // output total number of joints being touched for each avatar
+ static BOOL sDebugAvatarRotation;
+
+ //--------------------------------------------------------------------
+ // Region state
+ //--------------------------------------------------------------------
+public:
+ LLHost getObjectHost() const;
+
+ //--------------------------------------------------------------------
+ // Loading state
+ //--------------------------------------------------------------------
+public:
+ BOOL isFullyLoaded() const;
+ virtual BOOL updateIsFullyLoaded();
+ BOOL processFullyLoadedChange(bool loading);
+private:
+ BOOL mFullyLoaded;
+ BOOL mPreviousFullyLoaded;
+ BOOL mFullyLoadedInitialized;
+ S32 mFullyLoadedFrameCounter;
+ LLFrameTimer mFullyLoadedTimer;
+
+/** State
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** SKELETON
+ **/
+
+public:
+ void updateHeadOffset();
+ F32 getPelvisToFoot() const { return mPelvisToFoot; }
+ LLVector3 mHeadOffset; // current head position
+ LLViewerJoint mRoot;
+protected:
+ static BOOL parseSkeletonFile(const std::string& filename);
+ void buildCharacter();
+ BOOL loadAvatar();
+ BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 &current_volume_num, S32 &current_joint_num);
+ BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info);
+private:
+ BOOL mIsBuilt; // state of deferred character building
+ S32 mNumJoints;
+ LLViewerJoint* mSkeleton;
- void updateVisibility();
- void updateAttachmentVisibility(U32 camera_mode);
- void clampAttachmentPositions();
- S32 getAttachmentCount(); // Warning: order(N) not order(1)
+ //--------------------------------------------------------------------
+ // Pelvis height adjustment members.
+ //--------------------------------------------------------------------
+public:
+ LLVector3 mBodySize;
+ S32 mLastSkeletonSerialNum;
+private:
+ F32 mPelvisToFoot;
- // HUD functions
- BOOL hasHUDAttachment() const;
- LLBBox getHUDBBox() const;
- void rebuildHUD();
+ //--------------------------------------------------------------------
+ // Cached pointers to well known joints
+ //--------------------------------------------------------------------
+public:
+ LLViewerJoint* mPelvisp;
+ LLViewerJoint* mTorsop;
+ LLViewerJoint* mChestp;
+ LLViewerJoint* mNeckp;
+ LLViewerJoint* mHeadp;
+ LLViewerJoint* mSkullp;
+ LLViewerJoint* mEyeLeftp;
+ LLViewerJoint* mEyeRightp;
+ LLViewerJoint* mHipLeftp;
+ LLViewerJoint* mHipRightp;
+ LLViewerJoint* mKneeLeftp;
+ LLViewerJoint* mKneeRightp;
+ LLViewerJoint* mAnkleLeftp;
+ LLViewerJoint* mAnkleRightp;
+ LLViewerJoint* mFootLeftp;
+ LLViewerJoint* mFootRightp;
+ LLViewerJoint* mWristLeftp;
+ LLViewerJoint* mWristRightp;
- /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
- /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
+ //--------------------------------------------------------------------
+ // XML parse tree
+ //--------------------------------------------------------------------
+private:
+ static LLXmlTree sXMLTree; // avatar config file
+ static LLXmlTree sSkeletonXMLTree; // avatar skeleton file
+
+/** Skeleton
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** RENDERING
+ **/
+
+public:
+ U32 renderFootShadows();
+ U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255));
+ U32 renderRigid();
+ U32 renderSkinned(EAvatarRenderPass pass);
+ U32 renderTransparent(BOOL first_pass);
+ void renderCollisionVolumes();
+ static void deleteCachedImages(bool clearAll=true);
+ static void destroyGL();
+ static void restoreGL();
+ BOOL mIsDummy; // for special views
+ S32 mSpecialRenderMode; // special lighting
+private:
+ BOOL mNeedsSkin; // avatar has been animated and verts have not been updated
+ S32 mUpdatePeriod;
+ S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer.
- /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent);
- BOOL updateJointLODs();
+ //--------------------------------------------------------------------
+ // Morph masks
+ //--------------------------------------------------------------------
+public:
+ void invalidateMorphMasks(LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES);
+ BOOL morphMaskNeedsUpdate(LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES);
+ void addMaskedMorph(LLVOAvatarDefines::EBakedTextureIndex index, LLPolyMorphTarget* morph_target, BOOL invert, std::string layer);
+ void setMorphMasksValid(BOOL new_status, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES);
+ void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLVOAvatarDefines::EBakedTextureIndex index = LLVOAvatarDefines::BAKED_NUM_INDICES);
- virtual void updateRegion(LLViewerRegion *regionp);
+ //--------------------------------------------------------------------
+ // Visibility
+ //--------------------------------------------------------------------
+protected:
+ void updateVisibility();
+private:
+ U32 mVisibilityRank;
+ BOOL mVisible;
- virtual const LLVector3 getRenderPosition() const;
- virtual void updateDrawable(BOOL force_damped);
- void updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax);
- void getSpatialExtents(LLVector3& newMin, LLVector3& newMax);
- BOOL isImpostor() const;
- BOOL needsImpostorUpdate() const;
+ //--------------------------------------------------------------------
+ // Shadowing
+ //--------------------------------------------------------------------
+public:
+ void updateShadowFaces();
+ LLDrawable* mShadow;
+private:
+ LLFace* mShadow0Facep;
+ LLFace* mShadow1Facep;
+ LLPointer<LLViewerImage> mShadowImagep;
+
+ //--------------------------------------------------------------------
+ // Impostors
+ //--------------------------------------------------------------------
+public:
+ BOOL isImpostor() const;
+ BOOL needsImpostorUpdate() const;
const LLVector3& getImpostorOffset() const;
const LLVector2& getImpostorDim() const;
- void getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance) const;
- void cacheImpostorValues();
- void setImpostorDim(const LLVector2& dim);
-
- //--------------------------------------------------------------------
- // LLCharacter interface
- //--------------------------------------------------------------------
-public:
- virtual const char *getAnimationPrefix() { return "avatar"; }
- virtual LLJoint *getRootJoint() { return &mRoot; }
- virtual LLVector3 getCharacterPosition();
- virtual LLQuaternion getCharacterRotation();
- virtual LLVector3 getCharacterVelocity();
- virtual LLVector3 getCharacterAngularVelocity();
- virtual F32 getTimeDilation();
- virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
- virtual BOOL allocateCharacterJoints( U32 num );
- virtual LLJoint *getCharacterJoint( U32 num );
- virtual void requestStopMotion( LLMotion* motion );
- virtual F32 getPixelArea() const;
- virtual LLPolyMesh* getHeadMesh();
- virtual LLPolyMesh* getUpperBodyMesh();
- virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
- virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
- virtual void updateVisualParams();
- virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
- virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
- virtual void stopMotionFromSource(const LLUUID& source_id);
- virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset);
- virtual LLJoint* findCollisionVolume(U32 volume_id);
- virtual S32 getCollisionVolumeID(std::string &name);
- virtual void addDebugText(const std::string& text);
- virtual const LLUUID& getID();
- virtual LLJoint *getJoint( const std::string &name );
-
- //--------------------------------------------------------------------
- // Other public functions
- //--------------------------------------------------------------------
-public:
- static void onCustomizeStart();
- static void onCustomizeEnd();
-
-public:
- static void dumpTotalLocalTextureByteCount();
-protected:
- void getLocalTextureByteCount( S32* gl_byte_count );
+ void getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance) const;
+ void cacheImpostorValues();
+ void setImpostorDim(const LLVector2& dim);
+ static void resetImpostors();
+ static void updateImpostors();
+ LLRenderTarget mImpostor;
+ BOOL mNeedsImpostorUpdate;
+private:
+ LLVector3 mImpostorOffset;
+ LLVector2 mImpostorDim;
+ BOOL mNeedsAnimUpdate;
+ LLVector3 mImpostorExtents[2];
+ LLVector3 mImpostorAngle;
+ F32 mImpostorDistance;
+ F32 mImpostorPixelArea;
+ LLVector3 mLastAnimExtents[2];
+ //--------------------------------------------------------------------
+ // Wind rippling in clothes
+ //--------------------------------------------------------------------
public:
- LLMotion* findMotion(const LLUUID& id);
-
- BOOL isVisible();
- BOOL isSelf() const { return mIsSelf; }
- BOOL isCulled() const { return mCulled; }
+ LLVector4 mWindVec;
+ F32 mRipplePhase;
+ BOOL mBelowWater;
+private:
+ F32 mWindFreq;
+ LLFrameTimer mRippleTimer;
+ F32 mRippleTimeLast;
+ LLVector3 mRippleAccel;
+ LLVector3 mLastVel;
+ //--------------------------------------------------------------------
+ // Culling
+ //--------------------------------------------------------------------
public:
- static void cullAvatarsByPixelArea();
- void setVisibilityRank(U32 rank);
- U32 getVisibilityRank(); // unused
-protected:
- S32 getUnbakedPixelAreaRank();
+ static void cullAvatarsByPixelArea();
+ BOOL isCulled() const { return mCulled; }
+private:
+ BOOL mCulled;
+ //--------------------------------------------------------------------
+ // Freeze counter
+ //--------------------------------------------------------------------
public:
- void dumpLocalTextures();
- const LLUUID& grabLocalTexture(LLVOAvatarDefines::ETextureIndex index);
- BOOL canGrabLocalTexture(LLVOAvatarDefines::ETextureIndex index);
- BOOL isTextureDefined(U8 te) const;
- BOOL isTextureVisible(U8 te) const;
- void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound);
-
- void setCompositeUpdatesEnabled(BOOL b);
-
- void addChat(const LLChat& chat);
- void clearChat();
- void startTyping() { mTyping = TRUE; mTypingTimer.reset(); }
- void stopTyping() { mTyping = FALSE; }
+ static void updateFreezeCounter(S32 counter = 0);
+private:
+ static S32 sFreezeCounter;
- // Returns "FirstName LastName"
- std::string getFullname() const;
+ //--------------------------------------------------------------------
+ // Constants
+ //--------------------------------------------------------------------
+public:
+ virtual LLViewerImage::EBoostLevel getAvatarBoostLevel() const { return LLViewerImage::BOOST_AVATAR; }
+ virtual LLViewerImage::EBoostLevel getAvatarBakedBoostLevel() const { return LLViewerImage::BOOST_AVATAR_BAKED; }
+ virtual S32 getTexImageSize() const;
+ virtual S32 getTexImageArea() const { return getTexImageSize()*getTexImageSize(); }
- BOOL updateCharacter(LLAgent &agent);
- void updateHeadOffset();
+/** Rendering
+ ** **
+ *******************************************************************************/
- F32 getPelvisToFoot() const { return mPelvisToFoot; }
+/********************************************************************************
+ ** **
+ ** TEXTURES
+ **/
+ //--------------------------------------------------------------------
+ // Loading status
+ //--------------------------------------------------------------------
public:
- BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims);
- void processAnimationStateChanges();
+ virtual BOOL isTextureDefined(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
+ BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex index) const;
protected:
- BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start);
- void resetAnimations();
+ BOOL isFullyBaked();
+ static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);
+ //--------------------------------------------------------------------
+ // Baked textures
+ //--------------------------------------------------------------------
public:
- void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm);
- void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
- void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm);
-
- void slamPosition(); // Slam position to transmitted position (for teleport);
+ void releaseComponentTextures(); // ! BACKWARDS COMPATIBILITY !
+protected:
+ static void onBakedTextureMasksLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ static void onInitialBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ static void onBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+ virtual void removeMissingBakedTextures();
+ void useBakedTexture(const LLUUID& id);
- // morph targets and such
- void processAvatarAppearance( LLMessageSystem* mesgsys );
- void onFirstTEMessageReceived();
- void updateSexDependentLayerSets( BOOL set_by_user );
- void dirtyMesh(); // Dirty the avatar mesh
- void hideSkirt();
+ typedef std::deque<LLMaskedMorph *> morph_list_t;
+ struct BakedTextureData
+ {
+ LLUUID mLastTextureIndex;
+ LLTexLayerSet* mTexLayerSet; // Only exists for self
+ bool mIsLoaded;
+ bool mIsUsed;
+ LLVOAvatarDefines::ETextureIndex mTextureIndex;
+ U32 mMaskTexName;
+ // Stores pointers to the joint meshes that this baked texture deals with
+ std::vector< LLViewerJointMesh * > mMeshes; // std::vector<LLViewerJointMesh> mJoints[i]->mMeshParts
+ morph_list_t mMaskedMorphs;
+ BOOL mMorphMasksValid;
+ };
+ typedef std::vector<BakedTextureData> bakedtexturedata_vec_t;
+ bakedtexturedata_vec_t mBakedTextureDatas;
- virtual void setParent(LLViewerObject* parent);
- virtual void addChild(LLViewerObject *childp);
- virtual void removeChild(LLViewerObject *childp);
+ //--------------------------------------------------------------------
+ // Local Textures
+ //--------------------------------------------------------------------
+protected:
+ virtual void setLocalTexture(LLVOAvatarDefines::ETextureIndex type, LLViewerImage* tex, BOOL baked_version_exits, U32 index = 0);
+ virtual void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex type, LLViewerImage* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked, U32 index = 0);
- LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object);
- BOOL attachObject(LLViewerObject *viewer_object);
- BOOL detachObject(LLViewerObject *viewer_object);
- void lazyAttach();
-
- void sitOnObject(LLViewerObject *sit_object);
- void getOffObject();
-
- BOOL isWearingAttachment( const LLUUID& inv_item_id );
- LLViewerObject* getWornAttachment( const LLUUID& inv_item_id );
- const std::string getAttachedPointName(const LLUUID& inv_item_id);
-
- static LLVOAvatar* findAvatarFromAttachment( LLViewerObject* obj );
-
- void updateMeshTextures();
-
- //--------------------------------------------------------------------
- // texture compositing (used only by the LLTexLayer series of classes)
- //--------------------------------------------------------------------
-public:
- LLColor4 getGlobalColor( const std::string& color_name );
- BOOL isLocalTextureDataAvailable( LLTexLayerSet* layerset );
- BOOL isLocalTextureDataFinal( LLTexLayerSet* layerset );
- LLVOAvatarDefines::ETextureIndex getBakedTE( LLTexLayerSet* layerset );
- void updateComposites();
- void onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user );
- BOOL getLocalTextureRaw( LLVOAvatarDefines::ETextureIndex index, LLImageRaw* image_raw_pp );
- BOOL getLocalTextureGL( LLVOAvatarDefines::ETextureIndex index, LLImageGL** image_gl_pp );
- const LLUUID& getLocalTextureID( LLVOAvatarDefines::ETextureIndex index );
- LLGLuint getScratchTexName( LLGLenum format, U32* texture_bytes );
- BOOL bindScratchTexture( LLGLenum format );
- void invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user );
- void invalidateAll();
- void forceBakeAllTextures(bool slam_for_debug = false);
- static void processRebakeAvatarTextures(LLMessageSystem* msg, void**);
- void setNewBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid );
- void setCachedBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid );
- void releaseUnnecessaryTextures();
- void requestLayerSetUploads();
- bool hasPendingBakedUploads();
- static void onLocalTextureLoaded( BOOL succcess, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
- static void dumpArchetypeXML( void* );
- static void dumpScratchTextureByteCount();
- static void dumpBakedStatus();
- static void deleteCachedImages(bool clearAll=true);
- static void destroyGL();
- static void restoreGL();
- static void resetImpostors();
- static enum EWearableType getTEWearableType(LLVOAvatarDefines::ETextureIndex te );
- static LLUUID getDefaultTEImageID(LLVOAvatarDefines::ETextureIndex te );
- static void onChangeSelfInvisible(BOOL newvalue);
- void setInvisible(BOOL newvalue);
- static LLColor4 getDummyColor();
+ //--------------------------------------------------------------------
+ // Texture accessors
+ //--------------------------------------------------------------------
+private:
+ virtual void setImage(const U8 te, LLViewerImage *imagep);
+ virtual LLViewerImage* getImage(const U8 te) const;
+ virtual const LLTextureEntry* getTexEntry(const U8 te_num) const;
+ virtual void setTexEntry(const U8 index, const LLTextureEntry &te);
//--------------------------------------------------------------------
- // Clothing colors (conventience functions to access visual parameters
+ // Layers
//--------------------------------------------------------------------
-public:
- void setClothesColor( LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL set_by_user );
- LLColor4 getClothesColor( LLVOAvatarDefines::ETextureIndex te );
- BOOL teToColorParams( LLVOAvatarDefines::ETextureIndex te, const char* param_name[3] );
-
- BOOL isWearingWearableType( EWearableType type );
- void wearableUpdated( EWearableType type );
+protected:
+ void deleteLayerSetCaches(bool clearAll = true);
+ void addBakedTextureStats(LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level);
//--------------------------------------------------------------------
- // texture compositing
+ // Composites
//--------------------------------------------------------------------
public:
- void setLocTexTE( U8 te, LLViewerImage* image, BOOL set_by_user );
- void setupComposites();
+ virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL set_by_user);
+ virtual void invalidateAll();
+ virtual void setCompositeUpdatesEnabled(BOOL b);
//--------------------------------------------------------------------
- // Handling partially loaded avatars (Ruth)
+ // Static texture/mesh/baked dictionary
//--------------------------------------------------------------------
public:
- BOOL isFullyLoaded();
- BOOL updateIsFullyLoaded();
+ static BOOL isIndexLocalTexture(LLVOAvatarDefines::ETextureIndex i);
+ static BOOL isIndexBakedTexture(LLVOAvatarDefines::ETextureIndex i);
private:
- BOOL mFullyLoaded;
- BOOL mPreviousFullyLoaded;
- BOOL mFullyLoadedInitialized;
- S32 mFullyLoadedFrameCounter;
- LLFrameTimer mFullyLoadedTimer;
+ static const LLVOAvatarDefines::LLVOAvatarDictionary *getDictionary() { return sAvatarDictionary; }
+ static LLVOAvatarDefines::LLVOAvatarDictionary* sAvatarDictionary;
+ static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo;
+ static LLVOAvatarXmlInfo* sAvatarXmlInfo;
//--------------------------------------------------------------------
- // Collision Volumes
+ // Messaging
//--------------------------------------------------------------------
public:
- S32 mNumCollisionVolumes;
- LLViewerJointCollisionVolume* mCollisionVolumes;
+ void onFirstTEMessageReceived();
+private:
+ BOOL mFirstTEMessageReceived;
+ BOOL mFirstAppearanceMessageReceived;
+
+/** Textures
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** MESHES
+ **/
+
+public:
+ void updateMeshTextures();
+ void updateSexDependentLayerSets(BOOL set_by_user);
+ void dirtyMesh(); // Dirty the avatar mesh
+ void updateMeshData();
+protected:
+ void releaseMeshData();
+ /*virtual*/ void restoreMeshData();
+private:
+ BOOL mDirtyMesh;
+
+ typedef std::multimap<std::string, LLPolyMesh*> polymesh_map_t;
+ polymesh_map_t mMeshes;
+ std::vector<LLViewerJoint *> mMeshLOD;
//--------------------------------------------------------------------
- // cached pointers to well known joints
+ // Destroy invisible mesh
//--------------------------------------------------------------------
-public:
- LLViewerJoint* mPelvisp;
- LLViewerJoint* mTorsop;
- LLViewerJoint* mChestp;
- LLViewerJoint* mNeckp;
- LLViewerJoint* mHeadp;
- LLViewerJoint* mSkullp;
- LLViewerJoint* mEyeLeftp;
- LLViewerJoint* mEyeRightp;
- LLViewerJoint* mHipLeftp;
- LLViewerJoint* mHipRightp;
- LLViewerJoint* mKneeLeftp;
- LLViewerJoint* mKneeRightp;
- LLViewerJoint* mAnkleLeftp;
- LLViewerJoint* mAnkleRightp;
- LLViewerJoint* mFootLeftp;
- LLViewerJoint* mFootRightp;
- LLViewerJoint* mWristLeftp;
- LLViewerJoint* mWristRightp;
+protected:
+ BOOL mMeshValid;
+ LLFrameTimer mMeshInvisibleTime;
+
+/** Meshes
+ ** **
+ *******************************************************************************/
+/********************************************************************************
+ ** **
+ ** APPEARANCE
+ **/
+
+public:
+ void processAvatarAppearance(LLMessageSystem* mesgsys);
+ void hideSkirt();
+ void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound);
+
//--------------------------------------------------------------------
- // impostor state
+ // Appearance morphing
//--------------------------------------------------------------------
public:
- LLRenderTarget mImpostor;
- BOOL mNeedsImpostorUpdate;
+ BOOL mAppearanceAnimating;
private:
- LLVector3 mImpostorOffset;
- LLVector2 mImpostorDim;
- BOOL mNeedsAnimUpdate;
- LLVector3 mImpostorExtents[2];
- LLVector3 mImpostorAngle;
- F32 mImpostorDistance;
- F32 mImpostorPixelArea;
- LLVector3 mLastAnimExtents[2];
+ LLFrameTimer mAppearanceMorphTimer;
+ BOOL mAppearanceAnimSetByUser;
+ F32 mLastAppearanceBlendTime;
//--------------------------------------------------------------------
- // Misc Render State
+ // Clothing colors (convenience functions to access visual parameters)
//--------------------------------------------------------------------
public:
- BOOL mIsDummy; // For special views
- S32 mSpecialRenderMode; // Special lighting
+ void setClothesColor(LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL set_by_user);
+ LLColor4 getClothesColor(LLVOAvatarDefines::ETextureIndex te);
+ BOOL teToColorParams(LLVOAvatarDefines::ETextureIndex te, const char* param_name[3]);
//--------------------------------------------------------------------
- // animation state data
+ // Global colors
//--------------------------------------------------------------------
public:
- typedef std::map<LLUUID, S32>::iterator AnimIterator;
+ LLColor4 getGlobalColor(const std::string& color_name ) const;
+ void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user);
+private:
+ LLTexGlobalColor* mTexSkinColor;
+ LLTexGlobalColor* mTexHairColor;
+ LLTexGlobalColor* mTexEyeColor;
- std::map<LLUUID, S32> mSignaledAnimations; // requested state of Animation name/value
- std::map<LLUUID, S32> mPlayingAnimations; // current state of Animation name/value
+ //--------------------------------------------------------------------
+ // Visibility
+ //--------------------------------------------------------------------
+public:
+ BOOL isVisible() const;
+ void setVisibilityRank(U32 rank);
+ U32 getVisibilityRank() const { return mVisibilityRank; } // unused
+ static S32 sNumVisibleAvatars; // Number of instances of this class
+ static LLColor4 getDummyColor();
+/** Appearance
+ ** **
+ *******************************************************************************/
- typedef std::multimap<LLUUID, LLUUID> AnimationSourceMap;
- typedef AnimationSourceMap::iterator AnimSourceIterator;
- AnimationSourceMap mAnimationSources; // object ids that triggered anim ids
+/********************************************************************************
+ ** **
+ ** WEARABLES
+ **/
+public:
+ BOOL isWearingWearableType(EWearableType type ) const;
+
//--------------------------------------------------------------------
- // Shadowing
+ // Attachments
//--------------------------------------------------------------------
public:
- void updateShadowFaces();
- LLDrawable* mShadow;
-private:
- LLFace* mShadow0Facep;
- LLFace* mShadow1Facep;
- LLPointer<LLViewerImage> mShadowImagep;
+ void clampAttachmentPositions();
+ virtual LLViewerJointAttachment* attachObject(LLViewerObject *viewer_object);
+ BOOL detachObject(LLViewerObject *viewer_object);
+ static LLVOAvatar* findAvatarFromAttachment(LLViewerObject* obj);
+protected:
+ LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object);
+ void lazyAttach();
//--------------------------------------------------------------------
- // Keeps track of foot step state for generating sounds
+ // Map of attachment points, by ID
//--------------------------------------------------------------------
public:
- void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; }
- LLVector4 mFootPlane;
-private:
- BOOL mWasOnGroundLeft;
- BOOL mWasOnGroundRight;
+ S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self
+ typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t;
+ attachment_map_t mAttachmentPoints;
+ std::vector<LLPointer<LLViewerObject> > mPendingAttachment;
//--------------------------------------------------------------------
- // Pelvis height adjustment members.
+ // HUD functions
//--------------------------------------------------------------------
public:
- LLVector3 mBodySize;
- S32 mLastSkeletonSerialNum;
-private:
- F32 mPelvisToFoot;
+ BOOL hasHUDAttachment() const;
+ LLBBox getHUDBBox() const;
+ void rebuildHUD();
+ void resetHUDAttachments();
+
+/** Wearables
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** ACTIONS
+ **/
//--------------------------------------------------------------------
- // Display the name, then optionally fade it out
+ // Animations
//--------------------------------------------------------------------
public:
- LLFrameTimer mChatTimer;
- LLPointer<LLHUDText> mNameText;
+ BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const;
+ void processAnimationStateChanges();
+protected:
+ BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start);
+ void resetAnimations();
private:
- LLFrameTimer mTimeVisible;
- std::deque<LLChat> mChats;
- BOOL mTyping;
- LLFrameTimer mTypingTimer;
+ LLTimer mAnimTimer;
+ F32 mTimeLast;
//--------------------------------------------------------------------
- // wind rippling in clothes
+ // Animation state data
//--------------------------------------------------------------------
public:
- LLVector4 mWindVec;
- F32 mRipplePhase;
- BOOL mBelowWater;
-private:
- F32 mWindFreq;
- LLFrameTimer mRippleTimer;
- F32 mRippleTimeLast;
- LLVector3 mRippleAccel;
- LLVector3 mLastVel;
+ typedef std::map<LLUUID, S32>::iterator AnimIterator;
+ std::map<LLUUID, S32> mSignaledAnimations; // requested state of Animation name/value
+ std::map<LLUUID, S32> mPlayingAnimations; // current state of Animation name/value
+
+ typedef std::multimap<LLUUID, LLUUID> AnimationSourceMap;
+ typedef AnimationSourceMap::iterator AnimSourceIterator;
+ AnimationSourceMap mAnimationSources; // object ids that triggered anim ids
//--------------------------------------------------------------------
- // appearance morphing
+ // Chat
//--------------------------------------------------------------------
public:
- BOOL mAppearanceAnimating;
+ void addChat(const LLChat& chat);
+ void clearChat();
+ void startTyping() { mTyping = TRUE; mTypingTimer.reset(); }
+ void stopTyping() { mTyping = FALSE; }
private:
- LLFrameTimer mAppearanceMorphTimer;
- BOOL mAppearanceAnimSetByUser;
- F32 mLastAppearanceBlendTime;
+ BOOL mVisibleChat;
//--------------------------------------------------------------------
- // Attachments
+ // Lip synch morphs
+ //--------------------------------------------------------------------
+private:
+ bool mLipSyncActive; // we're morphing for lip sync
+ LLVisualParam* mOohMorph; // cached pointers morphs for lip sync
+ LLVisualParam* mAahMorph; // cached pointers morphs for lip sync
+
+ //--------------------------------------------------------------------
+ // Flight
//--------------------------------------------------------------------
public:
- // map of attachment points, by ID
- typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t;
- attachment_map_t mAttachmentPoints;
- std::vector<LLPointer<LLViewerObject> > mPendingAttachment;
+ BOOL mInAir;
+ LLFrameTimer mTimeInAir;
+
+/** Actions
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** PHYSICS
+ **/
+
+private:
+ F32 mSpeedAccum; // measures speed (for diagnostics mostly).
+ BOOL mTurning; // controls hysteresis on avatar rotation
+ F32 mSpeed; // misc. animation repeated state
//--------------------------------------------------------------------
- // static preferences that are controlled by user settings/menus
+ // Collision volumes
//--------------------------------------------------------------------
public:
- static S32 sRenderName;
- static BOOL sRenderGroupTitles;
- static S32 sMaxVisible;
- static F32 sRenderDistance; //distance at which avatars will render (affected by control "RenderAvatarMaxVisible")
- static BOOL sShowAnimationDebug; // show animation debug info
- static BOOL sUseImpostors; //use impostors for far away avatars
- static BOOL sShowFootPlane; // show foot collision plane reported by server
- static BOOL sVisibleInFirstPerson;
- static S32 sNumLODChangesThisFrame;
- static S32 sNumVisibleChatBubbles;
- static BOOL sDebugInvisible;
- static BOOL sShowAttachmentPoints;
- static F32 sLODFactor; // user-settable LOD factor
- static BOOL sJointDebug; // output total number of joints being touched for each avatar
- static BOOL sDebugAvatarRotation;
+ S32 mNumCollisionVolumes;
+ LLViewerJointCollisionVolume* mCollisionVolumes;
+protected:
+ BOOL allocateCollisionVolumes(U32 num);
- static S32 sNumVisibleAvatars; // Number of instances of this class
-
//--------------------------------------------------------------------
- // Miscellaneous public variables.
+ // Dimensions
//--------------------------------------------------------------------
public:
- BOOL mInAir;
- LLFrameTimer mTimeInAir;
- LLVector3 mHeadOffset; // current head position
- LLViewerJoint mRoot; // avatar skeleton
- BOOL mIsSitting; // sitting state
+ void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm);
+ void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
+ void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm);
+ void slamPosition(); // Slam position to transmitted position (for teleport);
+protected:
+ void computeBodySize();
//--------------------------------------------------------------------
- // Private member variables.
+ // Material being stepped on
//--------------------------------------------------------------------
private:
- BOOL mIsSelf; // True if this avatar is for this viewer's agent
+ BOOL mStepOnLand;
+ U8 mStepMaterial;
+ LLVector3 mStepObjectVelocity;
- LLViewerJoint *mScreenp; // special purpose joint for HUD attachments
- BOOL mIsBuilt; // state of deferred character building
- F32 mSpeedAccum; // measures speed (for diagnostics mostly).
-
-
- // LLFrameTimer mUpdateLODTimer; // controls frequency of LOD change calculations
- BOOL mDirtyMesh;
- BOOL mTurning; // controls hysteresis on avatar rotation
- F32 mSpeed; // misc. animation repeated state
+/** Physics
+ ** **
+ *******************************************************************************/
- // Keep track of the material being stepped on
- BOOL mStepOnLand;
- U8 mStepMaterial;
- LLVector3 mStepObjectVelocity;
+/********************************************************************************
+ ** **
+ ** HIERARCHY
+ **/
- // Destroy mesh data after being invisible for a while
- BOOL mMeshValid;
- BOOL mVisible;
- LLFrameTimer mMeshInvisibleTime;
+public:
+ virtual void setParent(LLViewerObject* parent);
+ virtual void addChild(LLViewerObject *childp);
+ virtual void removeChild(LLViewerObject *childp);
- // Lip synch morph stuff
- bool mLipSyncActive; // we're morphing for lip sync
- LLVisualParam* mOohMorph; // cached pointers morphs for lip sync
- LLVisualParam* mAahMorph; // cached pointers morphs for lip sync
+ //--------------------------------------------------------------------
+ // Sitting
+ //--------------------------------------------------------------------
+public:
+ void sitOnObject(LLViewerObject *sit_object);
+ void getOffObject();
+ BOOL mIsSitting;
- // Skeleton for skinned avatar
- S32 mNumJoints;
- LLViewerJoint* mSkeleton;
+/** Hierarchy
+ ** **
+ *******************************************************************************/
- // Scratch textures used for compositing
- static LLMap< LLGLenum, LLGLuint*> sScratchTexNames;
- static LLMap< LLGLenum, F32*> sScratchTexLastBindTime;
- static S32 sScratchTexBytes;
+/********************************************************************************
+ ** **
+ ** NAME
+ **/
- // Global table of sound ids per material, and the ground
- const static LLUUID sStepSounds[LL_MCODE_END];
- const static LLUUID sStepSoundOnLand;
-
- // Xml parse tree of avatar config file
- static LLXmlTree sXMLTree;
- // Xml parse tree of avatar skeleton file
- static LLXmlTree sSkeletonXMLTree;
+public:
+ std::string getFullname() const; // Returns "FirstName LastName"
+protected:
+ static void getAnimLabels(LLDynamicArray<std::string>* labels);
+ static void getAnimNames(LLDynamicArray<std::string>* names);
+private:
+ LLWString mNameString;
+ std::string mTitle;
+ BOOL mNameAway;
+ BOOL mNameBusy;
+ BOOL mNameMute;
+ BOOL mNameAppearance;
+ BOOL mRenderGroupTitles;
- // Voice Visualizer is responsible for detecting the user's voice signal, and when the
- // user speaks, it puts a voice symbol over the avatar's head, and triggering gesticulations
- LLVoiceVisualizer* mVoiceVisualizer;
- int mCurrentGesticulationLevel;
-
- // Animation timer
- LLTimer mAnimTimer;
- F32 mTimeLast;
-
- LLPointer<LLHUDEffectSpiral> mBeam;
- LLFrameTimer mBeamTimer;
-
- F32 mAdjustedPixelArea;
-
- LLWString mNameString;
- std::string mTitle;
- BOOL mNameAway;
- BOOL mNameBusy;
- BOOL mNameMute;
- BOOL mNameAppearance;
- BOOL mVisibleChat;
- BOOL mRenderGroupTitles;
-
- std::string mDebugText;
- U64 mLastRegionHandle;
- LLFrameTimer mRegionCrossingTimer;
- S32 mRegionCrossingCount;
-
//--------------------------------------------------------------------
- // local textures for compositing.
+ // Display the name (then optionally fade it out)
//--------------------------------------------------------------------
+public:
+ LLFrameTimer mChatTimer;
+ LLPointer<LLHUDText> mNameText;
private:
- LLUUID mSavedTE[ LLVOAvatarDefines::TEX_NUM_INDICES ];
- BOOL mFirstTEMessageReceived;
- BOOL mFirstAppearanceMessageReceived;
- BOOL mHasBakedHair;
-
- BOOL mCulled;
- U32 mVisibilityRank;
- F32 mMinPixelArea; // debug
- F32 mMaxPixelArea; // debug
- BOOL mHasGrey; // debug
-
+ LLFrameTimer mTimeVisible;
+ std::deque<LLChat> mChats;
+ BOOL mTyping;
+ LLFrameTimer mTypingTimer;
+
+/** Name
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** SOUNDS
+ **/
+
//--------------------------------------------------------------------
- // Global Colors
+ // Voice visualizer
//--------------------------------------------------------------------
-private:
- LLTexGlobalColor* mTexSkinColor;
- LLTexGlobalColor* mTexHairColor;
- LLTexGlobalColor* mTexEyeColor;
-
- BOOL mNeedsSkin; //if TRUE, avatar has been animated and verts have not been updated
- S32 mUpdatePeriod;
+public:
+ // Responsible for detecting the user's voice signal (and when the
+ // user speaks, it puts a voice symbol over the avatar's head) and gesticulations
+ LLVoiceVisualizer* mVoiceVisualizer;
+ int mCurrentGesticulationLevel;
//--------------------------------------------------------------------
- // Internal functions
+ // Step sound
//--------------------------------------------------------------------
protected:
- void buildCharacter();
- void releaseMeshData();
- void restoreMeshData();
- void updateMeshData();
- void computeBodySize();
- const LLUUID& getStepSound() const;
- BOOL needsRenderBeam();
-
- BOOL allocateCollisionVolumes( U32 num );
- void resetHUDAttachments();
- static void getAnimLabels( LLDynamicArray<std::string>* labels );
- static void getAnimNames( LLDynamicArray<std::string>* names );
+ const LLUUID& getStepSound() const;
+private:
+ // Global table of sound ids per material, and the ground
+ const static LLUUID sStepSounds[LL_MCODE_END];
+ const static LLUUID sStepSoundOnLand;
//--------------------------------------------------------------------
- // Textures and Layers
+ // Foot step state (for generating sounds)
//--------------------------------------------------------------------
-protected:
- BOOL loadSkeletonNode();
- BOOL loadMeshNodes();
- BOOL isFullyBaked();
- void deleteLayerSetCaches(bool clearAll = true);
- static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);
- static void onBakedTextureMasksLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
- void setLocalTexture(LLVOAvatarDefines::ETextureIndex i, LLViewerImage* tex, BOOL baked_version_exits);
- void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i);
- void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerImage* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
- void addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level);
- static void onInitialBakedTextureLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
- static void onBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
- void useBakedTexture(const LLUUID& id);
- void dumpAvatarTEs(const std::string& context);
- void removeMissingBakedTextures();
- LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const;
- LLHost getObjectHost() const;
- S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex index);
public:
- static void updateFreezeCounter(S32 counter = 0 );
+ void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; }
+ LLVector4 mFootPlane;
private:
- static S32 sFreezeCounter;
+ BOOL mWasOnGroundLeft;
+ BOOL mWasOnGroundRight;
+
+/** Sounds
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** DIAGNOSTICS
+ **/
- //-----------------------------------------------------------------------------------------------
- // Avatar skeleton setup.
- //-----------------------------------------------------------------------------------------------
-private:
- BOOL loadAvatar();
- BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 &current_volume_num, S32 &current_joint_num);
- BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info);
-
- //-----------------------------------------------------------------------------------------------
- // Per-avatar information about texture data.
- // To-do: Move this to private implementation class
- //-----------------------------------------------------------------------------------------------
+public:
+ static void dumpArchetypeXML(void*);
+ static void dumpBakedStatus();
+ const std::string getBakedStatusForPrintout() const;
+ void dumpAvatarTEs(const std::string& context);
+
+ static F32 sUnbakedTime; // Total seconds with >=1 unbaked avatars
+ static F32 sUnbakedUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
+ static F32 sGreyTime; // Total seconds with >=1 grey avatars
+ static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
+protected:
+ S32 getUnbakedPixelAreaRank();
+ BOOL mHasGrey;
private:
- struct BakedTextureData
+ F32 mMinPixelArea;
+ F32 mMaxPixelArea;
+ F32 mAdjustedPixelArea;
+ std::string mDebugText;
+
+/** Diagnostics
+ ** **
+ *******************************************************************************/
+
+/********************************************************************************
+ ** **
+ ** SUPPORT CLASSES
+ **/
+
+protected: // Shared with LLVOAvatarSelf
+
+ struct LLVOAvatarXmlInfo
{
- LLUUID mLastTextureIndex;
- LLTexLayerSet* mTexLayerSet;
- bool mIsLoaded;
- bool mIsUsed;
- LLVOAvatarDefines::ETextureIndex mTextureIndex;
- U32 mMaskTexName;
- // Stores pointers to the joint meshes that this baked texture deals with
- std::vector< LLViewerJointMesh * > mMeshes; // std::vector<LLViewerJointMesh> mJoints[i]->mMeshParts
+ LLVOAvatarXmlInfo();
+ ~LLVOAvatarXmlInfo();
+
+ BOOL parseXmlSkeletonNode(LLXmlTreeNode* root);
+ BOOL parseXmlMeshNodes(LLXmlTreeNode* root);
+ BOOL parseXmlColorNodes(LLXmlTreeNode* root);
+ BOOL parseXmlLayerNodes(LLXmlTreeNode* root);
+ BOOL parseXmlDriverNodes(LLXmlTreeNode* root);
+ BOOL parseXmlMorphNodes(LLXmlTreeNode* root);
+
+ struct LLVOAvatarMeshInfo
+ {
+ typedef std::pair<LLPolyMorphTargetInfo*,BOOL> morph_info_pair_t;
+ typedef std::vector<morph_info_pair_t> morph_info_list_t;
+
+ LLVOAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {}
+ ~LLVOAvatarMeshInfo()
+ {
+ morph_info_list_t::iterator iter;
+ for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++)
+ {
+ delete iter->first;
+ }
+ mPolyMorphTargetInfoList.clear();
+ }
+
+ std::string mType;
+ S32 mLOD;
+ std::string mMeshFileName;
+ std::string mReferenceMeshName;
+ F32 mMinPixelArea;
+ morph_info_list_t mPolyMorphTargetInfoList;
+ };
+ typedef std::vector<LLVOAvatarMeshInfo*> mesh_info_list_t;
+ mesh_info_list_t mMeshInfoList;
+
+ typedef std::vector<LLPolySkeletalDistortionInfo*> skeletal_distortion_info_list_t;
+ skeletal_distortion_info_list_t mSkeletalDistortionInfoList;
+
+ struct LLVOAvatarAttachmentInfo
+ {
+ LLVOAvatarAttachmentInfo()
+ : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE),
+ mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {}
+ std::string mName;
+ std::string mJointName;
+ LLVector3 mPosition;
+ LLVector3 mRotationEuler;
+ S32 mGroup;
+ S32 mAttachmentID;
+ S32 mPieMenuSlice;
+ BOOL mVisibleFirstPerson;
+ BOOL mIsHUDAttachment;
+ BOOL mHasPosition;
+ BOOL mHasRotation;
+ };
+ typedef std::vector<LLVOAvatarAttachmentInfo*> attachment_info_list_t;
+ attachment_info_list_t mAttachmentInfoList;
+
+ LLTexGlobalColorInfo *mTexSkinColorInfo;
+ LLTexGlobalColorInfo *mTexHairColorInfo;
+ LLTexGlobalColorInfo *mTexEyeColorInfo;
+
+ typedef std::vector<LLTexLayerSetInfo*> layer_info_list_t;
+ layer_info_list_t mLayerInfoList;
+
+ typedef std::vector<LLDriverParamInfo*> driver_info_list_t;
+ driver_info_list_t mDriverInfoList;
+
+ struct LLVOAvatarMorphInfo
+ {
+ LLVOAvatarMorphInfo()
+ : mInvert(FALSE) {}
+ std::string mName;
+ std::string mRegion;
+ std::string mLayer;
+ BOOL mInvert;
+ };
+
+ typedef std::vector<LLVOAvatarMorphInfo*> morph_info_list_t;
+ morph_info_list_t mMorphMaskInfoList;
};
- typedef std::vector<BakedTextureData> bakedtexturedata_vec_t;
- bakedtexturedata_vec_t mBakedTextureData;
- struct LocalTextureData
+ struct LLMaskedMorph
{
- LocalTextureData() : mIsBakedReady(FALSE), mDiscard(MAX_DISCARD_LEVEL+1), mImage(NULL)
- {}
- LLPointer<LLViewerImage> mImage;
- BOOL mIsBakedReady;
- S32 mDiscard;
+ LLMaskedMorph(LLPolyMorphTarget *morph_target, BOOL invert, std::string layer) :
+ mMorphTarget(morph_target),
+ mInvert(invert),
+ mLayer(layer)
+ {
+ morph_target->addPendingMorphMask();
+ }
+
+ LLPolyMorphTarget *mMorphTarget;
+ BOOL mInvert;
+ std::string mLayer;
};
- typedef std::map<LLVOAvatarDefines::ETextureIndex, LocalTextureData> localtexture_map_t;
- localtexture_map_t mLocalTextureData;
-
- typedef std::multimap<std::string, LLPolyMesh*> polymesh_map_t;
- polymesh_map_t mMeshes;
- std::vector<LLViewerJoint *> mMeshLOD;
- S32 mNumInitFaces ; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer.
-
- //-----------------------------------------------------------------------------------------------
- // Static texture/mesh/baked dictionary for avatars
- //-----------------------------------------------------------------------------------------------
-public:
- static BOOL isIndexLocalTexture(LLVOAvatarDefines::ETextureIndex i);
- static BOOL isIndexBakedTexture(LLVOAvatarDefines::ETextureIndex i);
-private:
- static const LLVOAvatarDefines::LLVOAvatarDictionary *getDictionary() { return sAvatarDictionary; }
- static LLVOAvatarDefines::LLVOAvatarDictionary *sAvatarDictionary;
- static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo;
- static LLVOAvatarXmlInfo* sAvatarXmlInfo;
- //-----------------------------------------------------------------------------------------------
- // Diagnostics
- //-----------------------------------------------------------------------------------------------
-public:
- static F32 sUnbakedTime; // Total seconds with >=1 unbaked avatars
- static F32 sUnbakedUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
- static F32 sGreyTime; // Total seconds with >=1 grey avatars
- static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame)
+/** Support classes
+ ** **
+ *******************************************************************************/
- const std::string getBakedStatusForPrintout() const;
-};
+}; // LLVOAvatar
-//-----------------------------------------------------------------------------------------------
+//------------------------------------------------------------------------
// Inlines
-//-----------------------------------------------------------------------------------------------
-inline BOOL LLVOAvatar::isTextureDefined(U8 te) const
-{
- return (getTEImage(te)->getID() != IMG_DEFAULT_AVATAR && getTEImage(te)->getID() != IMG_DEFAULT);
-}
-
-inline BOOL LLVOAvatar::isTextureVisible(U8 te) const
+//------------------------------------------------------------------------
+inline BOOL LLVOAvatar::isTextureVisible(LLVOAvatarDefines::ETextureIndex te) const
{
return ((isTextureDefined(te) || isSelf())
&& (getTEImage(te)->getID() != IMG_INVISIBLE