mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-30 13:22:55 +02:00
stub for avatars changing workload regions
This commit is contained in:
parent
55b1a6762c
commit
3c01433e12
6 changed files with 40 additions and 14 deletions
|
@ -44,7 +44,6 @@
|
||||||
#include "InterfaceLogging.h"
|
#include "InterfaceLogging.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "MyAvatar.h"
|
#include "MyAvatar.h"
|
||||||
#include "OtherAvatar.h"
|
|
||||||
#include "SceneScriptingInterface.h"
|
#include "SceneScriptingInterface.h"
|
||||||
|
|
||||||
// 50 times per second - target is 45hz, but this helps account for any small deviations
|
// 50 times per second - target is 45hz, but this helps account for any small deviations
|
||||||
|
@ -91,7 +90,8 @@ AvatarSharedPointer AvatarManager::addAvatar(const QUuid& sessionUUID, const QWe
|
||||||
otherAvatar->setSpaceIndex(spaceIndex);
|
otherAvatar->setSpaceIndex(spaceIndex);
|
||||||
workload::Sphere sphere(otherAvatar->getWorldPosition(), otherAvatar->getBoundingRadius());
|
workload::Sphere sphere(otherAvatar->getWorldPosition(), otherAvatar->getBoundingRadius());
|
||||||
workload::Transaction transaction;
|
workload::Transaction transaction;
|
||||||
transaction.reset(spaceIndex, sphere, workload::Owner(otherAvatar));
|
SpatiallyNestablePointer nestable = std::static_pointer_cast<SpatiallyNestable>(otherAvatar);
|
||||||
|
transaction.reset(spaceIndex, sphere, workload::Owner(nestable));
|
||||||
_space->enqueueTransaction(transaction);
|
_space->enqueueTransaction(transaction);
|
||||||
}
|
}
|
||||||
return avatar;
|
return avatar;
|
||||||
|
@ -393,6 +393,10 @@ AvatarSharedPointer AvatarManager::newSharedAvatar() {
|
||||||
return AvatarSharedPointer(new OtherAvatar(qApp->thread()), [](OtherAvatar* ptr) { ptr->deleteLater(); });
|
return AvatarSharedPointer(new OtherAvatar(qApp->thread()), [](OtherAvatar* ptr) { ptr->deleteLater(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvatarManager::handleSpaceChange(OtherAvatarPointer avatar) {
|
||||||
|
// WORKLOAD_AVATARS_BOOKMARK: implement this
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) {
|
void AvatarManager::handleRemovedAvatar(const AvatarSharedPointer& removedAvatar, KillAvatarReason removalReason) {
|
||||||
auto avatar = std::static_pointer_cast<OtherAvatar>(removedAvatar);
|
auto avatar = std::static_pointer_cast<OtherAvatar>(removedAvatar);
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "AvatarMotionState.h"
|
#include "AvatarMotionState.h"
|
||||||
#include "MyAvatar.h"
|
#include "MyAvatar.h"
|
||||||
|
#include "OtherAvatar.h"
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* The AvatarManager API has properties and methods which manage Avatars within the same domain.
|
* The AvatarManager API has properties and methods which manage Avatars within the same domain.
|
||||||
|
@ -94,6 +95,7 @@ public:
|
||||||
void getObjectsToRemoveFromPhysics(VectorOfMotionStates& motionStates);
|
void getObjectsToRemoveFromPhysics(VectorOfMotionStates& motionStates);
|
||||||
void getObjectsToAddToPhysics(VectorOfMotionStates& motionStates);
|
void getObjectsToAddToPhysics(VectorOfMotionStates& motionStates);
|
||||||
void getObjectsToChange(VectorOfMotionStates& motionStates);
|
void getObjectsToChange(VectorOfMotionStates& motionStates);
|
||||||
|
|
||||||
void handleChangedMotionStates(const VectorOfMotionStates& motionStates);
|
void handleChangedMotionStates(const VectorOfMotionStates& motionStates);
|
||||||
void handleCollisionEvents(const CollisionEvents& collisionEvents);
|
void handleCollisionEvents(const CollisionEvents& collisionEvents);
|
||||||
|
|
||||||
|
@ -111,7 +113,6 @@ public:
|
||||||
* @param {string} [rateName=""]
|
* @param {string} [rateName=""]
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Q_INVOKABLE float getAvatarUpdateRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
|
Q_INVOKABLE float getAvatarUpdateRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -120,7 +121,6 @@ public:
|
||||||
* @param {string} [rateName=""]
|
* @param {string} [rateName=""]
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Q_INVOKABLE float getAvatarSimulationRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
|
Q_INVOKABLE float getAvatarSimulationRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -185,6 +185,8 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
||||||
|
|
||||||
|
void handleSpaceChange(OtherAvatarPointer avatar);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AvatarSharedPointer addAvatar(const QUuid& sessionUUID, const QWeakPointer<Node>& mixerWeakPointer) override;
|
AvatarSharedPointer addAvatar(const QUuid& sessionUUID, const QWeakPointer<Node>& mixerWeakPointer) override;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#ifndef hifi_OtherAvatar_h
|
#ifndef hifi_OtherAvatar_h
|
||||||
#define hifi_OtherAvatar_h
|
#define hifi_OtherAvatar_h
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <avatars-renderer/Avatar.h>
|
#include <avatars-renderer/Avatar.h>
|
||||||
#include "ui/overlays/Overlays.h"
|
#include "ui/overlays/Overlays.h"
|
||||||
#include "ui/overlays/Sphere3DOverlay.h"
|
#include "ui/overlays/Sphere3DOverlay.h"
|
||||||
|
@ -36,4 +38,6 @@ protected:
|
||||||
int32_t _spaceIndex { -1 };
|
int32_t _spaceIndex { -1 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using OtherAvatarPointer = std::shared_ptr<OtherAvatar>;
|
||||||
|
|
||||||
#endif // hifi_OtherAvatar_h
|
#endif // hifi_OtherAvatar_h
|
||||||
|
|
|
@ -10,9 +10,13 @@
|
||||||
|
|
||||||
#include "PhysicsBoundary.h"
|
#include "PhysicsBoundary.h"
|
||||||
|
|
||||||
|
#include <EntityItem.h>
|
||||||
|
#include <PhysicalEntitySimulation.h>
|
||||||
#include <PhysicsLogging.h>
|
#include <PhysicsLogging.h>
|
||||||
#include <workload/Space.h>
|
#include <workload/Space.h>
|
||||||
|
|
||||||
|
#include "avatar/AvatarManager.h"
|
||||||
|
#include "avatar/OtherAvatar.h"
|
||||||
#include "workload/GameWorkload.h"
|
#include "workload/GameWorkload.h"
|
||||||
|
|
||||||
void PhysicsBoundary::run(const workload::WorkloadContextPointer& context, const Inputs& inputs) {
|
void PhysicsBoundary::run(const workload::WorkloadContextPointer& context, const Inputs& inputs) {
|
||||||
|
@ -22,12 +26,26 @@ void PhysicsBoundary::run(const workload::WorkloadContextPointer& context, const
|
||||||
}
|
}
|
||||||
GameWorkloadContext* gameContext = static_cast<GameWorkloadContext*>(context.get());
|
GameWorkloadContext* gameContext = static_cast<GameWorkloadContext*>(context.get());
|
||||||
PhysicalEntitySimulationPointer simulation = gameContext->_simulation;
|
PhysicalEntitySimulationPointer simulation = gameContext->_simulation;
|
||||||
|
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||||
const auto& regionChanges = inputs.get0();
|
const auto& regionChanges = inputs.get0();
|
||||||
for (uint32_t i = 0; i < (uint32_t)regionChanges.size(); ++i) {
|
for (uint32_t i = 0; i < (uint32_t)regionChanges.size(); ++i) {
|
||||||
const workload::Space::Change& change = regionChanges[i];
|
const workload::Space::Change& change = regionChanges[i];
|
||||||
auto entity = space->getOwner(change.proxyId).get<EntityItemPointer>();
|
auto nestable = space->getOwner(change.proxyId).get<SpatiallyNestablePointer>();
|
||||||
if (entity) {
|
if (nestable) {
|
||||||
|
switch (nestable->getNestableType()) {
|
||||||
|
case NestableType::Entity: {
|
||||||
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(nestable);
|
||||||
simulation->changeEntity(entity);
|
simulation->changeEntity(entity);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case NestableType::Avatar: {
|
||||||
|
auto avatar = std::static_pointer_cast<OtherAvatar>(nestable);
|
||||||
|
avatarManager->handleSpaceChange(avatar);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,9 @@
|
||||||
#ifndef hifi_PhysicsGatekeeper_h
|
#ifndef hifi_PhysicsGatekeeper_h
|
||||||
#define hifi_PhysicsGatekeeper_h
|
#define hifi_PhysicsGatekeeper_h
|
||||||
|
|
||||||
#include <EntityItem.h>
|
|
||||||
#include <workload/Engine.h>
|
#include <workload/Engine.h>
|
||||||
#include <workload/RegionTracker.h>
|
#include <workload/RegionTracker.h>
|
||||||
|
|
||||||
#include "PhysicalEntitySimulation.h"
|
|
||||||
|
|
||||||
class PhysicsBoundary {
|
class PhysicsBoundary {
|
||||||
public:
|
public:
|
||||||
using Config = workload::Job::Config;
|
using Config = workload::Job::Config;
|
||||||
|
|
|
@ -295,7 +295,8 @@ void EntityTreeRenderer::addPendingEntities(const render::ScenePointer& scene, r
|
||||||
auto spaceIndex = _space->allocateID();
|
auto spaceIndex = _space->allocateID();
|
||||||
workload::Sphere sphere(entity->getWorldPosition(), entity->getBoundingRadius());
|
workload::Sphere sphere(entity->getWorldPosition(), entity->getBoundingRadius());
|
||||||
workload::Transaction transaction;
|
workload::Transaction transaction;
|
||||||
transaction.reset(spaceIndex, sphere, workload::Owner(entity));
|
SpatiallyNestablePointer nestable = std::static_pointer_cast<SpatiallyNestable>(entity);
|
||||||
|
transaction.reset(spaceIndex, sphere, workload::Owner(nestable));
|
||||||
_space->enqueueTransaction(transaction);
|
_space->enqueueTransaction(transaction);
|
||||||
entity->setSpaceIndex(spaceIndex);
|
entity->setSpaceIndex(spaceIndex);
|
||||||
connect(entity.get(), &EntityItem::spaceUpdate, this, &EntityTreeRenderer::handleSpaceUpdate, Qt::QueuedConnection);
|
connect(entity.get(), &EntityItem::spaceUpdate, this, &EntityTreeRenderer::handleSpaceUpdate, Qt::QueuedConnection);
|
||||||
|
|
Loading…
Reference in a new issue