00001
00033 #ifndef LL_LLVOAVATAR_H
00034 #define LL_LLVOAVATAR_H
00035
00036
00037
00038 #include <set>
00039 #include <map>
00040 #include <algorithm>
00041 #include <deque>
00042
00043 #include "llchat.h"
00044 #include "llviewerobject.h"
00045 #include "lljointsolverrp3.h"
00046 #include "llviewerjointmesh.h"
00047 #include "llviewerjointattachment.h"
00048 #include "llcharacter.h"
00049 #include "material_codes.h"
00050 #include "llanimationstates.h"
00051 #include "v4coloru.h"
00052 #include "llstring.h"
00053 #include "llframetimer.h"
00054 #include "llxmltree.h"
00055 #include "llwearable.h"
00056 #include "llrendertarget.h"
00057
00058
00059
00060 #include "llvoicevisualizer.h"
00061
00062
00063 const S32 VOAVATAR_SCRATCH_TEX_WIDTH = 512;
00064 const S32 VOAVATAR_SCRATCH_TEX_HEIGHT = 512;
00065 const S32 VOAVATAR_IMPOSTOR_PERIOD = 2;
00066
00067 const LLUUID ANIM_AGENT_BODY_NOISE = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad");
00068 const LLUUID ANIM_AGENT_BREATHE_ROT = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8");
00069 const LLUUID ANIM_AGENT_EDITING = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb");
00070 const LLUUID ANIM_AGENT_EYE = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea");
00071 const LLUUID ANIM_AGENT_FLY_ADJUST = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e");
00072 const LLUUID ANIM_AGENT_HAND_MOTION = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578");
00073 const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d");
00074 const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b");
00075 const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55");
00076 const LLUUID ANIM_AGENT_WALK_ADJUST = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d");
00077
00078 class LLChat;
00079 class LLXmlTreeNode;
00080 class LLTexLayerSet;
00081 class LLTexGlobalColor;
00082 class LLTexGlobalColorInfo;
00083 class LLTexLayerSetInfo;
00084 class LLDriverParamInfo;
00085
00086 class LLHUDText;
00087 class LLHUDEffectSpiral;
00088
00089 class LLVertexBufferAvatar : public LLVertexBuffer
00090 {
00091 public:
00092 LLVertexBufferAvatar();
00093 virtual void setupVertexBuffer(U32 data_mask) const;
00094 };
00095
00096 typedef enum e_mesh_id
00097 {
00098 MESH_ID_HAIR,
00099 MESH_ID_HEAD,
00100 MESH_ID_UPPER_BODY,
00101 MESH_ID_LOWER_BODY,
00102 MESH_ID_SKIRT
00103 } eMeshID;
00104
00105 typedef enum e_render_name
00106 {
00107 RENDER_NAME_NEVER,
00108 RENDER_NAME_FADE,
00109 RENDER_NAME_ALWAYS
00110 } eRenderName;
00111
00112 const S32 BAKED_TEXTURE_COUNT = 5;
00113
00114
00115
00116
00117
00118 class LLVOAvatarBoneInfo
00119 {
00120 friend class LLVOAvatar;
00121 friend class LLVOAvatarSkeletonInfo;
00122 public:
00123 LLVOAvatarBoneInfo() : mIsJoint(FALSE) {}
00124 ~LLVOAvatarBoneInfo()
00125 {
00126 std::for_each(mChildList.begin(), mChildList.end(), DeletePointer());
00127 }
00128 BOOL parseXml(LLXmlTreeNode* node);
00129
00130 protected:
00131 LLString mName;
00132 BOOL mIsJoint;
00133 LLVector3 mPos;
00134 LLVector3 mRot;
00135 LLVector3 mScale;
00136 LLVector3 mPivot;
00137 typedef std::vector<LLVOAvatarBoneInfo*> child_list_t;
00138 child_list_t mChildList;
00139 };
00140
00141 class LLVOAvatarSkeletonInfo
00142 {
00143 friend class LLVOAvatar;
00144 public:
00145 LLVOAvatarSkeletonInfo() :
00146 mNumBones(0), mNumCollisionVolumes(0) {}
00147 ~LLVOAvatarSkeletonInfo()
00148 {
00149 std::for_each(mBoneInfoList.begin(), mBoneInfoList.end(), DeletePointer());
00150 }
00151 BOOL parseXml(LLXmlTreeNode* node);
00152 S32 getNumBones() { return mNumBones; }
00153 S32 getNumCollisionVolumes() { return mNumCollisionVolumes; }
00154
00155 protected:
00156 S32 mNumBones;
00157 S32 mNumCollisionVolumes;
00158 typedef std::vector<LLVOAvatarBoneInfo*> bone_info_list_t;
00159 bone_info_list_t mBoneInfoList;
00160 };
00161
00162
00163
00164
00165
00166
00167 class LLVOAvatarInfo
00168 {
00169 friend class LLVOAvatar;
00170 public:
00171 LLVOAvatarInfo();
00172 ~LLVOAvatarInfo();
00173
00174 protected:
00175 BOOL parseXmlSkeletonNode(LLXmlTreeNode* root);
00176 BOOL parseXmlMeshNodes(LLXmlTreeNode* root);
00177 BOOL parseXmlColorNodes(LLXmlTreeNode* root);
00178 BOOL parseXmlLayerNodes(LLXmlTreeNode* root);
00179 BOOL parseXmlDriverNodes(LLXmlTreeNode* root);
00180
00181 struct LLVOAvatarMeshInfo
00182 {
00183 typedef std::pair<LLPolyMorphTargetInfo*,BOOL> morph_info_pair_t;
00184 typedef std::vector<morph_info_pair_t> morph_info_list_t;
00185
00186 LLVOAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {}
00187 ~LLVOAvatarMeshInfo()
00188 {
00189 morph_info_list_t::iterator iter;
00190 for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++)
00191 {
00192 delete iter->first;
00193 }
00194 mPolyMorphTargetInfoList.clear();
00195 }
00196
00197 LLString mType;
00198 S32 mLOD;
00199 LLString mMeshFileName;
00200 LLString mReferenceMeshName;
00201 F32 mMinPixelArea;
00202 morph_info_list_t mPolyMorphTargetInfoList;
00203 };
00204 typedef std::vector<LLVOAvatarMeshInfo*> mesh_info_list_t;
00205 mesh_info_list_t mMeshInfoList;
00206
00207 typedef std::vector<LLPolySkeletalDistortionInfo*> skeletal_distortion_info_list_t;
00208 skeletal_distortion_info_list_t mSkeletalDistortionInfoList;
00209
00210 struct LLVOAvatarAttachmentInfo
00211 {
00212 LLVOAvatarAttachmentInfo()
00213 : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE),
00214 mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {}
00215 LLString mName;
00216 LLString mJointName;
00217 LLVector3 mPosition;
00218 LLVector3 mRotationEuler;
00219 S32 mGroup;
00220 S32 mAttachmentID;
00221 S32 mPieMenuSlice;
00222 BOOL mVisibleFirstPerson;
00223 BOOL mIsHUDAttachment;
00224 BOOL mHasPosition;
00225 BOOL mHasRotation;
00226 };
00227 typedef std::vector<LLVOAvatarAttachmentInfo*> attachment_info_list_t;
00228 attachment_info_list_t mAttachmentInfoList;
00229
00230 LLTexGlobalColorInfo *mTexSkinColorInfo;
00231 LLTexGlobalColorInfo *mTexHairColorInfo;
00232 LLTexGlobalColorInfo *mTexEyeColorInfo;
00233
00234 typedef std::vector<LLTexLayerSetInfo*> layer_info_list_t;
00235 layer_info_list_t mLayerInfoList;
00236
00237 typedef std::vector<LLDriverParamInfo*> driver_info_list_t;
00238 driver_info_list_t mDriverInfoList;
00239 };
00240
00241
00242
00243
00244 class LLVOAvatar :
00245 public LLViewerObject,
00246 public LLCharacter
00247 {
00248 protected:
00249 virtual ~LLVOAvatar();
00250
00251 public:
00252
00253 struct CompareScreenAreaGreater
00254 {
00255 bool operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs)
00256 {
00257 return lhs->getPixelArea() > rhs->getPixelArea();
00258 }
00259 };
00260
00261 enum
00262 {
00263 VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
00264 (1 << LLVertexBuffer::TYPE_NORMAL) |
00265 (1 << LLVertexBuffer::TYPE_TEXCOORD) |
00266 (1 << LLVertexBuffer::TYPE_WEIGHT) |
00267 (1 << LLVertexBuffer::TYPE_CLOTHWEIGHT)
00268 };
00269
00270 LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
00271 void markDead();
00272
00273 static void updateImpostors();
00274
00275
00276
00277
00278 static void initClass();
00279 static void cleanupClass();
00280 static BOOL parseSkeletonFile(const LLString& filename);
00281 virtual U32 processUpdateMessage( LLMessageSystem *mesgsys,
00282 void **user_data,
00283 U32 block_num,
00284 const EObjectUpdateType update_type,
00285 LLDataPacker *dp);
00286 virtual BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
00287 virtual BOOL updateLOD();
00288 void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; }
00289 BOOL isActive() const;
00290
00291
00292
00293 U32 renderFootShadows();
00294 U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255));
00295 U32 renderRigid();
00296 U32 renderSkinned(EAvatarRenderPass pass);
00297 U32 renderTransparent();
00298 void renderCollisionVolumes();
00299
00300 void updateTextures(LLAgent &agent);
00301
00302 S32 setTETexture(const U8 te, const LLUUID& uuid);
00303 void onShift(const LLVector3& shift_vector);
00304 virtual U32 getPartitionType() const;
00305
00306 void updateVisibility();
00307 void updateAttachmentVisibility(U32 camera_mode);
00308 void clampAttachmentPositions();
00309 S32 getAttachmentCount();
00310
00311 BOOL hasHUDAttachment();
00312 LLBBox getHUDBBox();
00313
00314 void rebuildHUD();
00315
00316 LLDrawable* createDrawable(LLPipeline *pipeline);
00317 BOOL updateGeometry(LLDrawable *drawable);
00318 void updateShadowFaces();
00319
00320 void setPixelAreaAndAngle(LLAgent &agent);
00321 BOOL updateJointLODs();
00322
00323 virtual void updateRegion(LLViewerRegion *regionp);
00324
00325 virtual const LLVector3 getRenderPosition() const;
00326 virtual void updateDrawable(BOOL force_damped);
00327 void updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax);
00328 void getSpatialExtents(LLVector3& newMin, LLVector3& newMax);
00329 BOOL isImpostor() const;
00330 BOOL needsImpostorUpdate() const;
00331 const LLVector3& getImpostorOffset() const;
00332 const LLVector2& getImpostorDim() const;
00333 void getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance);
00334 void cacheImpostorValues();
00335 void setImpostorDim(const LLVector2& dim);
00336
00337
00338
00339
00340 enum ETextureIndex
00341 {
00342 TEX_HEAD_BODYPAINT = 0,
00343 TEX_UPPER_SHIRT = 1,
00344 TEX_LOWER_PANTS = 2,
00345 TEX_EYES_IRIS = 3,
00346 TEX_HAIR = 4,
00347 TEX_UPPER_BODYPAINT = 5,
00348 TEX_LOWER_BODYPAINT = 6,
00349 TEX_LOWER_SHOES = 7,
00350 TEX_HEAD_BAKED = 8,
00351 TEX_UPPER_BAKED = 9,
00352 TEX_LOWER_BAKED = 10,
00353 TEX_EYES_BAKED = 11,
00354 TEX_LOWER_SOCKS = 12,
00355 TEX_UPPER_JACKET = 13,
00356 TEX_LOWER_JACKET = 14,
00357 TEX_UPPER_GLOVES = 15,
00358 TEX_UPPER_UNDERSHIRT = 16,
00359 TEX_LOWER_UNDERPANTS = 17,
00360 TEX_SKIRT = 18,
00361 TEX_SKIRT_BAKED = 19,
00362 TEX_NUM_ENTRIES = 20
00363 };
00364
00365
00366 static BOOL isTextureIndexBaked( S32 i )
00367 {
00368 switch(i)
00369 {
00370 case TEX_HEAD_BAKED:
00371 case TEX_UPPER_BAKED:
00372 case TEX_LOWER_BAKED:
00373 case TEX_EYES_BAKED:
00374 case TEX_SKIRT_BAKED:
00375 return TRUE;
00376 default:
00377 return FALSE;
00378 }
00379 }
00380
00381
00382
00383
00384 virtual const char *getAnimationPrefix() { return "avatar"; }
00385 virtual LLJoint *getRootJoint() { return &mRoot; }
00386 virtual LLVector3 getCharacterPosition();
00387 virtual LLQuaternion getCharacterRotation();
00388 virtual LLVector3 getCharacterVelocity();
00389 virtual LLVector3 getCharacterAngularVelocity();
00390 virtual F32 getTimeDilation();
00391 virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
00392 virtual BOOL allocateCharacterJoints( U32 num );
00393 virtual LLJoint *getCharacterJoint( U32 num );
00394 virtual void requestStopMotion( LLMotion* motion );
00395 virtual F32 getPixelArea() const;
00396 virtual LLPolyMesh* getHeadMesh();
00397 virtual LLPolyMesh* getUpperBodyMesh();
00398 virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
00399 virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
00400 virtual void updateVisualParams();
00401 virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
00402 virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
00403 virtual void stopMotionFromSource(const LLUUID& source_id);
00404 virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset);
00405 virtual LLJoint* findCollisionVolume(U32 volume_id);
00406 virtual S32 getCollisionVolumeID(std::string &name);
00407 virtual void addDebugText(const std::string& text);
00408 virtual const LLUUID& getID();
00409 virtual LLJoint *getJoint( const std::string &name );
00410
00411
00412
00413
00414 BOOL allocateCollisionVolumes( U32 num );
00415 void resetHUDAttachments();
00416 static void getAnimLabels( LLDynamicArray<std::string>* labels );
00417 static void getAnimNames( LLDynamicArray<std::string>* names );
00418
00419 static void onCustomizeStart();
00420 static void onCustomizeEnd();
00421
00422 void getLocalTextureByteCount( S32* gl_byte_count );
00423 static void dumpTotalLocalTextureByteCount();
00424 LLMotion* findMotion(const LLUUID& id);
00425
00426 BOOL isVisible();
00427 BOOL isSelf() { return mIsSelf; }
00428 BOOL isCulled() { return mCulled; }
00429
00430 S32 getUnbakedPixelAreaRank();
00431 static void cullAvatarsByPixelArea();
00432
00433 void dumpLocalTextures();
00434 const LLUUID& grabLocalTexture(ETextureIndex index);
00435 BOOL canGrabLocalTexture(ETextureIndex index);
00436 void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound);
00437
00438 void setCompositeUpdatesEnabled(BOOL b);
00439
00440 void addChat(const LLChat& chat);
00441 void clearChat();
00442 void startTyping() { mTyping = TRUE; mTypingTimer.reset(); }
00443 void stopTyping() { mTyping = FALSE; }
00444
00445
00446 LLString getFullname() const;
00447
00448
00449
00450
00451 F32 getPelvisToFoot() { return mPelvisToFoot; }
00452
00453 void buildCharacter();
00454 void releaseMeshData();
00455 void restoreMeshData();
00456 void updateMeshData();
00457
00458 void computeBodySize();
00459
00460 BOOL updateCharacter(LLAgent &agent);
00461 void updateHeadOffset();
00462
00463 LLUUID& getStepSound();
00464 void processAnimationStateChanges();
00465 BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start);
00466 void resetAnimations();
00467 BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims);
00468
00469 BOOL needsRenderBeam();
00470
00471
00472 void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm);
00473 void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm);
00474 void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm);
00475
00476 void slamPosition();
00477
00478 BOOL loadAvatar();
00479 BOOL setupBone(LLVOAvatarBoneInfo* info, LLViewerJoint* parent);
00480 BOOL buildSkeleton(LLVOAvatarSkeletonInfo *info);
00481
00482
00483 void processAvatarAppearance( LLMessageSystem* mesgsys );
00484 void onFirstTEMessageReceived();
00485 void updateSexDependentLayerSets( BOOL set_by_user );
00486 void dirtyMesh();
00487
00488 virtual void setParent(LLViewerObject* parent);
00489 virtual void addChild(LLViewerObject *childp);
00490 virtual void removeChild(LLViewerObject *childp);
00491
00492 LLViewerJointAttachment* getTargetAttachmentPoint(LLViewerObject* viewer_object);
00493 BOOL attachObject(LLViewerObject *viewer_object);
00494 BOOL detachObject(LLViewerObject *viewer_object);
00495 void lazyAttach();
00496
00497 void sitOnObject(LLViewerObject *sit_object);
00498 void getOffObject();
00499
00500 BOOL isWearingAttachment( const LLUUID& inv_item_id );
00501 LLViewerObject* getWornAttachment( const LLUUID& inv_item_id );
00502 const LLString getAttachedPointName(const LLUUID& inv_item_id);
00503
00504 static LLVOAvatar* findAvatarFromAttachment( LLViewerObject* obj );
00505
00506 void updateMeshTextures();
00507
00508
00509
00510
00511 enum ELocTexIndex
00512 {
00513 LOCTEX_UPPER_SHIRT = 0,
00514 LOCTEX_UPPER_BODYPAINT = 1,
00515 LOCTEX_LOWER_PANTS = 2,
00516 LOCTEX_LOWER_BODYPAINT = 3,
00517 LOCTEX_HEAD_BODYPAINT = 4,
00518 LOCTEX_LOWER_SHOES = 5,
00519 LOCTEX_LOWER_SOCKS = 6,
00520 LOCTEX_UPPER_JACKET = 7,
00521 LOCTEX_LOWER_JACKET = 8,
00522 LOCTEX_UPPER_GLOVES = 9,
00523 LOCTEX_UPPER_UNDERSHIRT = 10,
00524 LOCTEX_LOWER_UNDERPANTS = 11,
00525 LOCTEX_EYES_IRIS = 12,
00526 LOCTEX_SKIRT = 13,
00527 LOCTEX_NUM_ENTRIES = 14
00528 };
00529
00530
00531
00532
00533 LLColor4 getGlobalColor( const LLString& color_name );
00534 BOOL isLocalTextureDataAvailable( LLTexLayerSet* layerset );
00535 BOOL isLocalTextureDataFinal( LLTexLayerSet* layerset );
00536 ETextureIndex getBakedTE( LLTexLayerSet* layerset );
00537 void updateComposites();
00538 void onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user );
00539 BOOL getLocalTextureRaw( S32 index, LLImageRaw* image_raw_pp );
00540 BOOL getLocalTextureGL( S32 index, LLImageGL** image_gl_pp );
00541 const LLUUID& getLocalTextureID( S32 index );
00542 LLGLuint getScratchTexName( LLGLenum format, U32* texture_bytes );
00543 BOOL bindScratchTexture( LLGLenum format );
00544 void invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user );
00545 void forceBakeAllTextures(bool slam_for_debug = false);
00546 static void processRebakeAvatarTextures(LLMessageSystem* msg, void**);
00547 void setNewBakedTexture( ETextureIndex i, const LLUUID& uuid );
00548 void setCachedBakedTexture( ETextureIndex i, const LLUUID& uuid );
00549 void requestLayerSetUploads();
00550 bool hasPendingBakedUploads();
00551 static void onLocalTextureLoaded( BOOL succcess, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
00552 static void dumpArchetypeXML( void* );
00553 static void dumpScratchTextureByteCount();
00554 static void dumpBakedStatus();
00555 static void deleteCachedImages();
00556 static void destroyGL();
00557 static void restoreGL();
00558 static void resetImpostors();
00559 static enum EWearableType getTEWearableType( S32 te );
00560 static LLUUID getDefaultTEImageID( S32 te );
00561
00562
00563
00564
00565 void setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL set_by_user );
00566 LLColor4 getClothesColor( ETextureIndex te );
00567 BOOL teToColorParams( ETextureIndex te, const char* param_name[3] );
00568
00569 BOOL isWearingWearableType( EWearableType type );
00570
00571
00572
00573
00574 void setLocTexTE( U8 te, LLViewerImage* image, BOOL set_by_user );
00575 void setupComposites();
00576
00577
00578
00579
00580
00581 BOOL mDirtyMesh;
00582
00583 LLFace *mShadow0Facep;
00584 LLFace *mShadow1Facep;
00585
00586 LLFrameTimer mUpdateLODTimer;
00587
00588
00589
00590
00591 BOOL mIsBuilt;
00592
00593
00594
00595
00596 char mAvatarDefinition[64];
00597
00598
00599
00600
00601 S32 mNumJoints;
00602 LLViewerJoint *mSkeleton;
00603
00604 S32 mNumCollisionVolumes;
00605 LLViewerJointCollisionVolume* mCollisionVolumes;
00606
00607
00608
00609
00610 LLViewerJoint *mPelvisp;
00611 LLViewerJoint *mTorsop;
00612 LLViewerJoint *mChestp;
00613 LLViewerJoint *mNeckp;
00614 LLViewerJoint *mHeadp;
00615 LLViewerJoint *mSkullp;
00616 LLViewerJoint *mEyeLeftp;
00617 LLViewerJoint *mEyeRightp;
00618 LLViewerJoint *mHipLeftp;
00619 LLViewerJoint *mHipRightp;
00620 LLViewerJoint *mKneeLeftp;
00621 LLViewerJoint *mKneeRightp;
00622 LLViewerJoint *mAnkleLeftp;
00623 LLViewerJoint *mAnkleRightp;
00624 LLViewerJoint *mFootLeftp;
00625 LLViewerJoint *mFootRightp;
00626 LLViewerJoint *mWristLeftp;
00627 LLViewerJoint *mWristRightp;
00628
00629
00630
00631
00632 LLViewerJoint *mScreenp;
00633 F32 mHUDTargetZoom;
00634 F32 mHUDCurZoom;
00635
00636
00637
00638
00639 LLViewerJoint mHairLOD;
00640 LLViewerJointMesh mHairMesh0;
00641 LLViewerJointMesh mHairMesh1;
00642 LLViewerJointMesh mHairMesh2;
00643 LLViewerJointMesh mHairMesh3;
00644 LLViewerJointMesh mHairMesh4;
00645 LLViewerJointMesh mHairMesh5;
00646
00647 LLViewerJoint mHeadLOD;
00648 LLViewerJointMesh mHeadMesh0;
00649 LLViewerJointMesh mHeadMesh1;
00650 LLViewerJointMesh mHeadMesh2;
00651 LLViewerJointMesh mHeadMesh3;
00652 LLViewerJointMesh mHeadMesh4;
00653
00654 LLViewerJoint mEyeLashLOD;
00655 LLViewerJointMesh mEyeLashMesh0;
00656
00657 LLViewerJoint mUpperBodyLOD;
00658 LLViewerJointMesh mUpperBodyMesh0;
00659 LLViewerJointMesh mUpperBodyMesh1;
00660 LLViewerJointMesh mUpperBodyMesh2;
00661 LLViewerJointMesh mUpperBodyMesh3;
00662 LLViewerJointMesh mUpperBodyMesh4;
00663
00664 LLViewerJoint mLowerBodyLOD;
00665 LLViewerJointMesh mLowerBodyMesh0;
00666 LLViewerJointMesh mLowerBodyMesh1;
00667 LLViewerJointMesh mLowerBodyMesh2;
00668 LLViewerJointMesh mLowerBodyMesh3;
00669 LLViewerJointMesh mLowerBodyMesh4;
00670
00671 LLViewerJoint mEyeBallLeftLOD;
00672 LLViewerJointMesh mEyeBallLeftMesh0;
00673 LLViewerJointMesh mEyeBallLeftMesh1;
00674
00675 LLViewerJoint mEyeBallRightLOD;
00676 LLViewerJointMesh mEyeBallRightMesh0;
00677 LLViewerJointMesh mEyeBallRightMesh1;
00678
00679 LLViewerJoint mSkirtLOD;
00680 LLViewerJointMesh mSkirtMesh0;
00681 LLViewerJointMesh mSkirtMesh1;
00682 LLViewerJointMesh mSkirtMesh2;
00683 LLViewerJointMesh mSkirtMesh3;
00684 LLViewerJointMesh mSkirtMesh4;
00685
00686 typedef std::multimap<LLString, LLPolyMesh*> mesh_map_t;
00687 mesh_map_t mMeshes;
00688
00689
00690
00691
00692 BOOL mIsSelf;
00693
00694
00695
00696
00697 LLPointer<LLViewerImage> mShadowImagep;
00698
00699 LLUUID mLastHeadBakedID;
00700 LLUUID mLastUpperBodyBakedID;
00701 LLUUID mLastLowerBodyBakedID;
00702 LLUUID mLastEyesBakedID;
00703 LLUUID mLastSkirtBakedID;
00704
00705
00706
00707
00708 LLRenderTarget mImpostor;
00709 LLVector3 mImpostorOffset;
00710 LLVector2 mImpostorDim;
00711 BOOL mNeedsImpostorUpdate;
00712 BOOL mNeedsAnimUpdate;
00713 LLVector3 mImpostorExtents[2];
00714 LLVector3 mImpostorAngle;
00715 F32 mImpostorDistance;
00716 LLVector3 mLastAnimExtents[2];
00717
00718
00719
00720
00721 BOOL mIsDummy;
00722 S32 mSpecialRenderMode;
00723
00724
00725
00726
00727 LLTimer mAnimTimer;
00728 F32 mTimeLast;
00729
00730
00731
00732
00733 F32 mSpeedAccum;
00734
00735
00736
00737
00738 typedef std::map<LLUUID, S32>::iterator AnimIterator;
00739
00740 std::map<LLUUID, S32> mSignaledAnimations;
00741 std::map<LLUUID, S32> mPlayingAnimations;
00742
00743 typedef std::multimap<LLUUID, LLUUID> AnimationSourceMap;
00744 typedef AnimationSourceMap::iterator AnimSourceIterator;
00745 AnimationSourceMap mAnimationSources;
00746
00747 BOOL mTurning;
00748
00749
00750
00751
00752 F32 mSpeed;
00753
00754
00755
00756
00757 LLDrawable* mShadow;
00758 BOOL mInAir;
00759 LLFrameTimer mTimeInAir;
00760
00761
00762
00763
00764 BOOL mWasOnGroundLeft;
00765 BOOL mWasOnGroundRight;
00766 LLVector4 mFootPlane;
00767
00768
00769
00770
00771 BOOL mStepOnLand;
00772 U8 mStepMaterial;
00773 LLVector3 mStepObjectVelocity;
00774
00775
00776
00777
00778 F32 mPelvisToFoot;
00779 LLVector3 mBodySize;
00780 S32 mLastSkeletonSerialNum;
00781
00782
00783
00784
00785 LLVector3 mHeadOffset;
00786
00787
00788
00789
00790 LLViewerJoint mRoot;
00791
00792
00793
00794
00795 BOOL mIsSitting;
00796
00797
00798
00799
00800 LLFrameTimer mTimeVisible;
00801 LLPointer<LLHUDText> mNameText;
00802 std::deque<LLChat> mChats;
00803 LLFrameTimer mChatTimer;
00804 BOOL mTyping;
00805 LLFrameTimer mTypingTimer;
00806
00807
00808
00809
00810 BOOL mMeshValid;
00811 BOOL mVisible;
00812 LLFrameTimer mMeshInvisibleTime;
00813
00814
00815
00816
00817 LLVector4 mWindVec;
00818 F32 mWindFreq;
00819 F32 mRipplePhase;
00820 LLFrameTimer mRippleTimer;
00821 F32 mRippleTimeLast;
00822 LLVector3 mRippleAccel;
00823 LLVector3 mLastVel;
00824 BOOL mBelowWater;
00825
00826
00827
00828
00829 LLFrameTimer mAppearanceMorphTimer;
00830 BOOL mAppearanceAnimSetByUser;
00831 F32 mLastAppearanceBlendTime;
00832 BOOL mAppearanceAnimating;
00833
00834
00835
00836
00837 bool mLipSyncActive;
00838
00839
00840
00841
00842 LLVisualParam *mOohMorph;
00843 LLVisualParam *mAahMorph;
00844
00845
00846
00847
00848 static S32 sMaxVisible;
00849 static F32 sRenderDistance;
00850 static S32 sCurJoint;
00851 static S32 sCurVolume;
00852 static BOOL sShowAnimationDebug;
00853 static BOOL sUseImpostors;
00854 static BOOL sShowFootPlane;
00855 static BOOL sShowCollisionVolumes;
00856 static BOOL sVisibleInFirstPerson;
00857 static S32 sMaxOtherAvatarsToComposite;
00858
00859 static S32 sNumLODChangesThisFrame;
00860
00861
00862 static LLUUID sStepSounds[LL_MCODE_END];
00863 static LLUUID sStepSoundOnLand;
00864
00865 static S32 sRenderName;
00866 static BOOL sRenderGroupTitles;
00867 static S32 sNumVisibleChatBubbles;
00868 static BOOL sDebugInvisible;
00869 static BOOL sShowAttachmentPoints;
00870
00871
00872 static S32 sNumVisibleAvatars;
00873
00874
00875 static LLMap< LLGLenum, LLGLuint*> sScratchTexNames;
00876 static LLMap< LLGLenum, F32*> sScratchTexLastBindTime;
00877 static S32 sScratchTexBytes;
00878
00879
00880 typedef std::map<S32, LLViewerJointAttachment*> attachment_map_t;
00881 attachment_map_t mAttachmentPoints;
00882
00883 std::vector<LLPointer<LLViewerObject> > mPendingAttachment;
00884
00885
00886 static LLXmlTree sXMLTree;
00887
00888 static LLXmlTree sSkeletonXMLTree;
00889
00890
00891 static F32 sLODFactor;
00892
00893
00894 static BOOL sJointDebug;
00895 static ETextureIndex sBakedTextureIndices[BAKED_TEXTURE_COUNT];
00896
00897
00898
00899
00900 LLTexLayerSet* mHeadLayerSet;
00901 LLTexLayerSet* mUpperBodyLayerSet;
00902 LLTexLayerSet* mLowerBodyLayerSet;
00903 LLTexLayerSet* mEyesLayerSet;
00904 LLTexLayerSet* mSkirtLayerSet;
00905
00906
00907 protected:
00908 LLPointer<LLHUDEffectSpiral> mBeam;
00909 LLFrameTimer mBeamTimer;
00910 LLFrameTimer mEditEffectTimer;
00911
00912 F32 mRenderPriority;
00913 F32 mAdjustedPixelArea;
00914
00915 LLWString mNameString;
00916 LLString mTitle;
00917 BOOL mNameAway;
00918 BOOL mNameBusy;
00919 BOOL mNameMute;
00920 BOOL mNameAppearance;
00921 BOOL mVisibleChat;
00922 BOOL mRenderGroupTitles;
00923
00924
00925 LLString mDebugText;
00926 U64 mLastRegionHandle;
00927 LLFrameTimer mRegionCrossingTimer;
00928 S32 mRegionCrossingCount;
00929
00930
00931
00932
00933
00934 LLPointer<LLViewerImage> mLocalTexture[ LOCTEX_NUM_ENTRIES ];
00935 BOOL mLocalTextureBaked[ LOCTEX_NUM_ENTRIES ];
00936 S32 mLocalTextureDiscard[ LOCTEX_NUM_ENTRIES ];
00937 LLUUID mSavedTE[ TEX_NUM_ENTRIES ];
00938 BOOL mFirstTEMessageReceived;
00939 BOOL mFirstAppearanceMessageReceived;
00940
00941 BOOL mHeadBakedLoaded;
00942 S32 mHeadMaskDiscard;
00943 BOOL mUpperBakedLoaded;
00944 S32 mUpperMaskDiscard;
00945 BOOL mLowerBakedLoaded;
00946 S32 mLowerMaskDiscard;
00947 BOOL mEyesBakedLoaded;
00948 BOOL mSkirtBakedLoaded;
00949
00950
00951 U32 mHeadMaskTexName;
00952 U32 mUpperMaskTexName;
00953 U32 mLowerMaskTexName;
00954
00955 BOOL mCulled;
00956 F32 mMinPixelArea;
00957 F32 mMaxPixelArea;
00958
00959
00960
00961
00962 LLTexGlobalColor* mTexSkinColor;
00963 LLTexGlobalColor* mTexHairColor;
00964 LLTexGlobalColor* mTexEyeColor;
00965
00966 BOOL mNeedsSkin;
00967 S32 mUpdatePeriod;
00968
00969 static LLVOAvatarSkeletonInfo* sSkeletonInfo;
00970 static LLVOAvatarInfo* sAvatarInfo;
00971
00972
00973
00974
00975
00976 public:
00977 BOOL isFullyLoaded();
00978 BOOL updateIsFullyLoaded();
00979 private:
00980 BOOL mFullyLoaded;
00981 BOOL mPreviousFullyLoaded;
00982 BOOL mFullyLoadedInitialized;
00983 S32 mFullyLoadedFrameCounter;
00984 LLFrameTimer mFullyLoadedTimer;
00985
00986 protected:
00987
00988 BOOL loadSkeletonNode();
00989 BOOL loadMeshNodes();
00990
00991 BOOL isFullyBaked();
00992 void deleteLayerSetCaches();
00993 static BOOL areAllNearbyInstancesBaked();
00994
00995 static void onBakedTextureMasksLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
00996
00997 void setLocalTexture(ELocTexIndex i, LLViewerImage* tex, BOOL baked_version_exits);
00998
00999 void requestLayerSetUpdate(LLVOAvatar::ELocTexIndex i);
01000 void addLocalTextureStats(LLVOAvatar::ELocTexIndex i, LLViewerImage* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked);
01001 void addBakedTextureStats( LLViewerImage* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level);
01002 static void onInitialBakedTextureLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata );
01003 static void onBakedTextureLoaded(BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
01004 void useBakedTexture(const LLUUID& id);
01005 void dumpAvatarTEs(const char* context);
01006 void removeMissingBakedTextures();
01007 LLTexLayerSet* getLayerSet(ETextureIndex index) const;
01008 LLHost getObjectHost() const;
01009 S32 getLocalDiscardLevel( S32 index);
01010
01011 void shame();
01012
01013
01014
01015
01016
01017 private:
01018 LLVoiceVisualizer * mVoiceVisualizer;
01019 int mCurrentGesticulationLevel;
01020
01021
01022 private:
01023 static S32 sFreezeCounter ;
01024 public:
01025 static void updateFreezeCounter(S32 counter = 0 ) ;
01026 };
01027
01028 #endif // LL_VO_AVATAR_H