9 #ifndef hifi_OtherAvatar_h
10 #define hifi_OtherAvatar_h
16 #include <avatars-renderer/Avatar.h>
17 #include <workload/Space.h>
19 #include "InterfaceLogging.h"
22 class AvatarMotionState;
23 class DetailedMotionState;
25 class OtherAvatar :
public Avatar {
27 explicit OtherAvatar(QThread* thread);
28 virtual ~OtherAvatar();
36 virtual void instantiableAvatar()
override { };
37 virtual void createOrb()
override;
38 virtual void indicateLoadingStatus(LoadingStatus loadingStatus)
override;
39 void updateOrbPosition();
42 void setSpaceIndex(int32_t index);
43 int32_t getSpaceIndex()
const {
return _spaceIndex; }
44 void updateSpaceProxy(workload::Transaction& transaction)
const;
46 int parseDataFromBuffer(
const QByteArray& buffer)
override;
48 bool isInPhysicsSimulation()
const;
49 void rebuildCollisionShape()
override;
51 void setWorkloadRegion(uint8_t region);
52 uint8_t getWorkloadRegion() {
return _workloadRegion; }
53 bool shouldBeInPhysicsSimulation()
const;
54 bool needsPhysicsUpdate()
const;
56 const btCollisionShape* createCollisionShape(int32_t jointIndex,
bool& isBound, std::vector<int32_t>& boundJoints);
57 std::vector<DetailedMotionState*>& getDetailedMotionStates() {
return _detailedMotionStates; }
58 void forgetDetailedMotionStates();
59 BodyLOD getBodyLOD() {
return _bodyLOD; }
60 void computeShapeLOD();
62 void updateCollisionGroup(
bool myAvatarCollide);
63 bool getCollideWithOtherAvatars()
const {
return _collideWithOtherAvatars; }
65 void setCollisionWithOtherAvatarsFlags()
override;
67 void simulate(
float deltaTime,
bool inView)
override;
68 void interpolateJoints();
69 void debugJointData()
const;
73 void handleChangedAvatarEntityData();
74 void updateAttachedAvatarEntities();
75 void onAddAttachedAvatarEntity(
const QUuid&
id);
76 void onRemoveAttachedAvatarEntity(
const QUuid&
id);
78 void onIdentityRecieved()
override;
80 class AvatarEntityDataHash {
82 AvatarEntityDataHash(uint32_t h) : hash(h) {};
84 bool success {
false };
87 using MapOfAvatarEntityDataHashes = QMap<QUuid, AvatarEntityDataHash>;
88 MapOfAvatarEntityDataHashes _avatarEntityDataHashes;
90 std::vector<QUuid> _attachedAvatarEntities;
91 QUuid _otherAvatarOrbMeshPlaceholderID;
92 AvatarMotionState* _motionState {
nullptr };
93 std::vector<DetailedMotionState*> _detailedMotionStates;
94 int32_t _spaceIndex { -1 };
95 uint8_t _workloadRegion { workload::Region::INVALID };
96 BodyLOD _bodyLOD { BodyLOD::Sphere };
97 bool _needsDetailedRebuild {
false };
100 std::vector<std::vector<std::pair<quint64, JointData>>> _jointHistory;
101 std::optional<glm::vec3> _lerpServerPosition {};
109 uint8_t _avatarEntityIdentityCountdown { 2 };
112 using OtherAvatarPointer = std::shared_ptr<OtherAvatar>;
113 using AvatarPointer = std::shared_ptr<Avatar>;