9 #ifndef hifi_OtherAvatar_h
10 #define hifi_OtherAvatar_h
15 #include <avatars-renderer/Avatar.h>
16 #include <workload/Space.h>
18 #include "InterfaceLogging.h"
21 class AvatarMotionState;
22 class DetailedMotionState;
24 class OtherAvatar :
public Avatar {
26 explicit OtherAvatar(QThread* thread);
27 virtual ~OtherAvatar();
35 virtual void instantiableAvatar()
override { };
36 virtual void createOrb()
override;
37 virtual void indicateLoadingStatus(LoadingStatus loadingStatus)
override;
38 void updateOrbPosition();
41 void setSpaceIndex(int32_t index);
42 int32_t getSpaceIndex()
const {
return _spaceIndex; }
43 void updateSpaceProxy(workload::Transaction& transaction)
const;
45 int parseDataFromBuffer(
const QByteArray& buffer)
override;
47 bool isInPhysicsSimulation()
const;
48 void rebuildCollisionShape()
override;
50 void setWorkloadRegion(uint8_t region);
51 uint8_t getWorkloadRegion() {
return _workloadRegion; }
52 bool shouldBeInPhysicsSimulation()
const;
53 bool needsPhysicsUpdate()
const;
55 const btCollisionShape* createCollisionShape(int32_t jointIndex,
bool& isBound, std::vector<int32_t>& boundJoints);
56 std::vector<DetailedMotionState*>& getDetailedMotionStates() {
return _detailedMotionStates; }
57 void forgetDetailedMotionStates();
58 BodyLOD getBodyLOD() {
return _bodyLOD; }
59 void computeShapeLOD();
61 void updateCollisionGroup(
bool myAvatarCollide);
62 bool getCollideWithOtherAvatars()
const {
return _collideWithOtherAvatars; }
64 void setCollisionWithOtherAvatarsFlags()
override;
66 void simulate(
float deltaTime,
bool inView)
override;
67 void debugJointData()
const;
71 void handleChangedAvatarEntityData();
72 void updateAttachedAvatarEntities();
73 void onAddAttachedAvatarEntity(
const QUuid&
id);
74 void onRemoveAttachedAvatarEntity(
const QUuid&
id);
76 class AvatarEntityDataHash {
78 AvatarEntityDataHash(uint32_t h) : hash(h) {};
80 bool success {
false };
83 using MapOfAvatarEntityDataHashes = QMap<QUuid, AvatarEntityDataHash>;
84 MapOfAvatarEntityDataHashes _avatarEntityDataHashes;
86 std::vector<QUuid> _attachedAvatarEntities;
87 QUuid _otherAvatarOrbMeshPlaceholderID;
88 AvatarMotionState* _motionState {
nullptr };
89 std::vector<DetailedMotionState*> _detailedMotionStates;
90 int32_t _spaceIndex { -1 };
91 uint8_t _workloadRegion { workload::Region::INVALID };
92 BodyLOD _bodyLOD { BodyLOD::Sphere };
93 bool _needsDetailedRebuild {
false };
96 using OtherAvatarPointer = std::shared_ptr<OtherAvatar>;
97 using AvatarPointer = std::shared_ptr<Avatar>;