mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 05:52:38 +02:00
Minimal temporary setup for avatars in GVR
This commit is contained in:
parent
d9152136ea
commit
22f7cbc00d
2 changed files with 28 additions and 0 deletions
|
@ -47,6 +47,25 @@ RenderingClient::RenderingClient(QObject *parent, const QString& launchURLString
|
|||
connect(audioThread, &QThread::started, audioClient.data(), &AudioClient::start);
|
||||
|
||||
audioThread->start();
|
||||
|
||||
|
||||
connect(&_avatarTimer, &QTimer::timeout, this, &RenderingClient::sendAvatarPacket);
|
||||
_avatarTimer.setInterval(16); // 60 FPS
|
||||
_avatarTimer.start();
|
||||
_fakeAvatar.setDisplayName("GearVR");
|
||||
_fakeAvatar.setFaceModelURL(QUrl(DEFAULT_HEAD_MODEL_URL));
|
||||
_fakeAvatar.setSkeletonModelURL(QUrl(DEFAULT_BODY_MODEL_URL));
|
||||
_fakeAvatar.toByteArray(); // Creates HeadData
|
||||
}
|
||||
|
||||
void RenderingClient::sendAvatarPacket() {
|
||||
_fakeAvatar.setPosition(_position);
|
||||
_fakeAvatar.setHeadOrientation(_orientation);
|
||||
|
||||
QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData);
|
||||
packet.append(_fakeAvatar.toByteArray());
|
||||
DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer);
|
||||
_fakeAvatar.sendIdentityPacket();
|
||||
}
|
||||
|
||||
RenderingClient::~RenderingClient() {
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include <AvatarData.h>
|
||||
|
||||
#include "Client.h"
|
||||
|
||||
class RenderingClient : public Client {
|
||||
|
@ -35,6 +39,8 @@ private slots:
|
|||
void goToLocation(const glm::vec3& newPosition,
|
||||
bool hasOrientationChange, const glm::quat& newOrientation,
|
||||
bool shouldFaceLocation);
|
||||
void sendAvatarPacket();
|
||||
|
||||
private:
|
||||
virtual void processVerifiedPacket(const HifiSockAddr& senderSockAddr, const QByteArray& incomingPacket);
|
||||
|
||||
|
@ -42,6 +48,9 @@ private:
|
|||
|
||||
glm::vec3 _position;
|
||||
glm::quat _orientation;
|
||||
|
||||
QTimer _avatarTimer;
|
||||
AvatarData _fakeAvatar;
|
||||
};
|
||||
|
||||
#endif // hifi_RenderingClient_h
|
||||
|
|
Loading…
Reference in a new issue