mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 10:28:57 +02:00
Use strongly typed enum instead of nested alias
This commit is contained in:
parent
78f7935d53
commit
6f29d9e7b8
5 changed files with 14 additions and 17 deletions
|
@ -47,7 +47,7 @@ const QString AvatarData::FRAME_NAME = "com.highfidelity.recording.AvatarData";
|
|||
static std::once_flag frameTypeRegistration;
|
||||
|
||||
AvatarData::AvatarData() :
|
||||
SpatiallyNestable(NestableTypes::Avatar, QUuid()),
|
||||
SpatiallyNestable(NestableType::Avatar, QUuid()),
|
||||
_handPosition(0.0f),
|
||||
_targetScale(1.0f),
|
||||
_handState(0),
|
||||
|
|
|
@ -36,7 +36,7 @@ int EntityItem::_maxActionsDataSize = 800;
|
|||
quint64 EntityItem::_rememberDeletedActionTime = 20 * USECS_PER_SECOND;
|
||||
|
||||
EntityItem::EntityItem(const EntityItemID& entityItemID) :
|
||||
SpatiallyNestable(NestableTypes::Entity, entityItemID),
|
||||
SpatiallyNestable(NestableType::Entity, entityItemID),
|
||||
_type(EntityTypes::Unknown),
|
||||
_lastSimulated(0),
|
||||
_lastUpdated(0),
|
||||
|
@ -1294,7 +1294,7 @@ void EntityItem::updatePosition(const glm::vec3& value) {
|
|||
setLocalPosition(value);
|
||||
_dirtyFlags |= Simulation::DIRTY_POSITION;
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableTypes::Entity) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||
entity->_dirtyFlags |= Simulation::DIRTY_POSITION;
|
||||
}
|
||||
|
@ -1317,7 +1317,7 @@ void EntityItem::updateRotation(const glm::quat& rotation) {
|
|||
setLocalOrientation(rotation);
|
||||
_dirtyFlags |= Simulation::DIRTY_ROTATION;
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableTypes::Entity) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||
entity->_dirtyFlags |= Simulation::DIRTY_ROTATION;
|
||||
entity->_dirtyFlags |= Simulation::DIRTY_POSITION;
|
||||
|
|
|
@ -219,7 +219,7 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
|
|||
// if the entity has children, run UpdateEntityOperator on them. If the children have children, recurse
|
||||
QQueue<SpatiallyNestablePointer> toProcess;
|
||||
foreach (SpatiallyNestablePointer child, entity->getChildren()) {
|
||||
if (child && child->getNestableType() == NestableTypes::Entity) {
|
||||
if (child && child->getNestableType() == NestableType::Entity) {
|
||||
toProcess.enqueue(child);
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
|
|||
childEntity, newChildBBRelProperties);
|
||||
recurseTreeWithOperator(&theChildOperator);
|
||||
foreach (SpatiallyNestablePointer childChild, childEntity->getChildren()) {
|
||||
if (childChild && childChild->getNestableType() == NestableTypes::Entity) {
|
||||
if (childChild && childChild->getNestableType() == NestableType::Entity) {
|
||||
toProcess.enqueue(childChild);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "SpatiallyNestable.h"
|
||||
|
||||
|
||||
SpatiallyNestable::SpatiallyNestable(NestableTypes::NestableType nestableType, QUuid id) :
|
||||
SpatiallyNestable::SpatiallyNestable(NestableType nestableType, QUuid id) :
|
||||
_nestableType(nestableType),
|
||||
_id(id),
|
||||
_transform() {
|
||||
|
|
|
@ -25,17 +25,14 @@ using SpatiallyNestableWeakConstPointer = std::weak_ptr<const SpatiallyNestable>
|
|||
using SpatiallyNestablePointer = std::shared_ptr<SpatiallyNestable>;
|
||||
using SpatiallyNestableConstPointer = std::shared_ptr<const SpatiallyNestable>;
|
||||
|
||||
class NestableTypes {
|
||||
public:
|
||||
using NestableType = enum NestableType_t {
|
||||
Entity,
|
||||
Avatar
|
||||
};
|
||||
enum class NestableType {
|
||||
Entity,
|
||||
Avatar
|
||||
};
|
||||
|
||||
class SpatiallyNestable : public std::enable_shared_from_this<SpatiallyNestable> {
|
||||
public:
|
||||
SpatiallyNestable(NestableTypes::NestableType nestableType, QUuid id);
|
||||
SpatiallyNestable(NestableType nestableType, QUuid id);
|
||||
virtual ~SpatiallyNestable() { }
|
||||
|
||||
virtual const QUuid& getID() const { return _id; }
|
||||
|
@ -88,17 +85,17 @@ public:
|
|||
virtual void setLocalScale(const glm::vec3& scale);
|
||||
|
||||
QList<SpatiallyNestablePointer> getChildren() const;
|
||||
NestableTypes::NestableType getNestableType() const { return _nestableType; }
|
||||
NestableType getNestableType() const { return _nestableType; }
|
||||
|
||||
// this object's frame
|
||||
virtual const Transform getAbsoluteJointTransformInObjectFrame(int jointIndex) const;
|
||||
virtual glm::quat getAbsoluteJointRotationInObjectFrame(int index) const { assert(false); return glm::quat(); }
|
||||
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const { assert(false); return glm::vec3(); }
|
||||
|
||||
|
||||
SpatiallyNestablePointer getThisPointer() const;
|
||||
|
||||
protected:
|
||||
NestableTypes::NestableType _nestableType; // EntityItem or an AvatarData
|
||||
const NestableType _nestableType; // EntityItem or an AvatarData
|
||||
QUuid _id;
|
||||
QUuid _parentID; // what is this thing's transform relative to?
|
||||
quint16 _parentJointIndex { 0 }; // which joint of the parent is this relative to?
|
||||
|
|
Loading…
Reference in a new issue