mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 17:03:43 +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 "Menu.h"
|
||||
#include "MyAvatar.h"
|
||||
#include "OtherAvatar.h"
|
||||
#include "SceneScriptingInterface.h"
|
||||
|
||||
// 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);
|
||||
workload::Sphere sphere(otherAvatar->getWorldPosition(), otherAvatar->getBoundingRadius());
|
||||
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);
|
||||
}
|
||||
return avatar;
|
||||
|
@ -393,6 +393,10 @@ AvatarSharedPointer AvatarManager::newSharedAvatar() {
|
|||
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) {
|
||||
auto avatar = std::static_pointer_cast<OtherAvatar>(removedAvatar);
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "AvatarMotionState.h"
|
||||
#include "MyAvatar.h"
|
||||
#include "OtherAvatar.h"
|
||||
|
||||
/**jsdoc
|
||||
* The AvatarManager API has properties and methods which manage Avatars within the same domain.
|
||||
|
@ -94,6 +95,7 @@ public:
|
|||
void getObjectsToRemoveFromPhysics(VectorOfMotionStates& motionStates);
|
||||
void getObjectsToAddToPhysics(VectorOfMotionStates& motionStates);
|
||||
void getObjectsToChange(VectorOfMotionStates& motionStates);
|
||||
|
||||
void handleChangedMotionStates(const VectorOfMotionStates& motionStates);
|
||||
void handleCollisionEvents(const CollisionEvents& collisionEvents);
|
||||
|
||||
|
@ -104,23 +106,21 @@ public:
|
|||
* @returns {number}
|
||||
*/
|
||||
Q_INVOKABLE float getAvatarDataRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* @function AvatarManager.getAvatarUpdateRate
|
||||
* @param {Uuid} sessionID
|
||||
* @param {string} [rateName=""]
|
||||
* @returns {number}
|
||||
*/
|
||||
|
||||
Q_INVOKABLE float getAvatarUpdateRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* @function AvatarManager.getAvatarSimulationRate
|
||||
* @param {Uuid} sessionID
|
||||
* @param {string} [rateName=""]
|
||||
* @returns {number}
|
||||
*/
|
||||
|
||||
Q_INVOKABLE float getAvatarSimulationRate(const QUuid& sessionID, const QString& rateName = QString("")) const;
|
||||
|
||||
/**jsdoc
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
*/
|
||||
// TODO: remove this HACK once we settle on optimal default sort coefficients
|
||||
Q_INVOKABLE float getAvatarSortCoefficient(const QString& name);
|
||||
|
||||
|
||||
/**jsdoc
|
||||
* @function AvatarManager.setAvatarSortCoefficient
|
||||
* @param {string} name
|
||||
|
@ -185,6 +185,8 @@ public slots:
|
|||
*/
|
||||
void updateAvatarRenderStatus(bool shouldRenderAvatars);
|
||||
|
||||
void handleSpaceChange(OtherAvatarPointer avatar);
|
||||
|
||||
protected:
|
||||
AvatarSharedPointer addAvatar(const QUuid& sessionUUID, const QWeakPointer<Node>& mixerWeakPointer) override;
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#ifndef hifi_OtherAvatar_h
|
||||
#define hifi_OtherAvatar_h
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <avatars-renderer/Avatar.h>
|
||||
#include "ui/overlays/Overlays.h"
|
||||
#include "ui/overlays/Sphere3DOverlay.h"
|
||||
|
@ -36,4 +38,6 @@ protected:
|
|||
int32_t _spaceIndex { -1 };
|
||||
};
|
||||
|
||||
using OtherAvatarPointer = std::shared_ptr<OtherAvatar>;
|
||||
|
||||
#endif // hifi_OtherAvatar_h
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
|
||||
#include "PhysicsBoundary.h"
|
||||
|
||||
#include <EntityItem.h>
|
||||
#include <PhysicalEntitySimulation.h>
|
||||
#include <PhysicsLogging.h>
|
||||
#include <workload/Space.h>
|
||||
|
||||
#include "avatar/AvatarManager.h"
|
||||
#include "avatar/OtherAvatar.h"
|
||||
#include "workload/GameWorkload.h"
|
||||
|
||||
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());
|
||||
PhysicalEntitySimulationPointer simulation = gameContext->_simulation;
|
||||
auto avatarManager = DependencyManager::get<AvatarManager>();
|
||||
const auto& regionChanges = inputs.get0();
|
||||
for (uint32_t i = 0; i < (uint32_t)regionChanges.size(); ++i) {
|
||||
const workload::Space::Change& change = regionChanges[i];
|
||||
auto entity = space->getOwner(change.proxyId).get<EntityItemPointer>();
|
||||
if (entity) {
|
||||
simulation->changeEntity(entity);
|
||||
auto nestable = space->getOwner(change.proxyId).get<SpatiallyNestablePointer>();
|
||||
if (nestable) {
|
||||
switch (nestable->getNestableType()) {
|
||||
case NestableType::Entity: {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(nestable);
|
||||
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
|
||||
#define hifi_PhysicsGatekeeper_h
|
||||
|
||||
#include <EntityItem.h>
|
||||
#include <workload/Engine.h>
|
||||
#include <workload/RegionTracker.h>
|
||||
|
||||
#include "PhysicalEntitySimulation.h"
|
||||
|
||||
class PhysicsBoundary {
|
||||
public:
|
||||
using Config = workload::Job::Config;
|
||||
|
|
|
@ -295,7 +295,8 @@ void EntityTreeRenderer::addPendingEntities(const render::ScenePointer& scene, r
|
|||
auto spaceIndex = _space->allocateID();
|
||||
workload::Sphere sphere(entity->getWorldPosition(), entity->getBoundingRadius());
|
||||
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);
|
||||
entity->setSpaceIndex(spaceIndex);
|
||||
connect(entity.get(), &EntityItem::spaceUpdate, this, &EntityTreeRenderer::handleSpaceUpdate, Qt::QueuedConnection);
|
||||
|
|
Loading…
Reference in a new issue