mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
change some more parameters back to being pass-by-reference, where it's safe
This commit is contained in:
parent
3cc423ca03
commit
96e9580473
16 changed files with 26 additions and 25 deletions
|
@ -33,7 +33,8 @@ EntityItemPointer RenderableModelEntityItem::factory(const EntityItemID& entityI
|
||||||
|
|
||||||
RenderableModelEntityItem::RenderableModelEntityItem(const EntityItemID& entityItemID, bool dimensionsInitialized) :
|
RenderableModelEntityItem::RenderableModelEntityItem(const EntityItemID& entityItemID, bool dimensionsInitialized) :
|
||||||
ModelEntityItem(entityItemID),
|
ModelEntityItem(entityItemID),
|
||||||
_dimensionsInitialized(dimensionsInitialized) {
|
_dimensionsInitialized(dimensionsInitialized)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderableModelEntityItem::~RenderableModelEntityItem() {
|
RenderableModelEntityItem::~RenderableModelEntityItem() {
|
||||||
|
@ -44,7 +45,7 @@ RenderableModelEntityItem::~RenderableModelEntityItem() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderableModelEntityItem::setDimensions(const glm::vec3 value) {
|
void RenderableModelEntityItem::setDimensions(const glm::vec3& value) {
|
||||||
_dimensionsInitialized = true;
|
_dimensionsInitialized = true;
|
||||||
ModelEntityItem::setDimensions(value);
|
ModelEntityItem::setDimensions(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
|
|
||||||
virtual ~RenderableModelEntityItem();
|
virtual ~RenderableModelEntityItem();
|
||||||
|
|
||||||
virtual void setDimensions(const glm::vec3 value) override;
|
virtual void setDimensions(const glm::vec3& value) override;
|
||||||
|
|
||||||
virtual EntityItemProperties getProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()) const override;
|
virtual EntityItemProperties getProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()) const override;
|
||||||
virtual bool setProperties(const EntityItemProperties& properties) override;
|
virtual bool setProperties(const EntityItemProperties& properties) override;
|
||||||
|
|
|
@ -1192,7 +1192,7 @@ const Transform EntityItem::getTransformToCenter() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityItem::setDimensions(const glm::vec3 value) {
|
void EntityItem::setDimensions(const glm::vec3& value) {
|
||||||
if (value.x <= 0.0f || value.y <= 0.0f || value.z <= 0.0f) {
|
if (value.x <= 0.0f || value.y <= 0.0f || value.z <= 0.0f) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ public:
|
||||||
|
|
||||||
/// Dimensions in meters (0.0 - TREE_SCALE)
|
/// Dimensions in meters (0.0 - TREE_SCALE)
|
||||||
inline const glm::vec3 getDimensions() const { return getScale(); }
|
inline const glm::vec3 getDimensions() const { return getScale(); }
|
||||||
virtual void setDimensions(const glm::vec3 value);
|
virtual void setDimensions(const glm::vec3& value);
|
||||||
|
|
||||||
float getGlowLevel() const { return _glowLevel; }
|
float getGlowLevel() const { return _glowLevel; }
|
||||||
void setGlowLevel(float glowLevel) { _glowLevel = glowLevel; }
|
void setGlowLevel(float glowLevel) { _glowLevel = glowLevel; }
|
||||||
|
|
|
@ -1796,6 +1796,6 @@ QList<QString> EntityItemProperties::listChangedProperties() {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityItemProperties::parentDependentPropertyChanged() {
|
bool EntityItemProperties::parentDependentPropertyChanged() const {
|
||||||
return localPositionChanged() || positionChanged() || localRotationChanged() || rotationChanged();
|
return localPositionChanged() || positionChanged() || localRotationChanged() || rotationChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public:
|
||||||
{ return (float)(usecTimestampNow() - getLastEdited()) / (float)USECS_PER_SECOND; }
|
{ return (float)(usecTimestampNow() - getLastEdited()) / (float)USECS_PER_SECOND; }
|
||||||
EntityPropertyFlags getChangedProperties() const;
|
EntityPropertyFlags getChangedProperties() const;
|
||||||
|
|
||||||
bool parentDependentPropertyChanged(); // was there a changed in a property that requires parent info to interpret?
|
bool parentDependentPropertyChanged() const; // was there a changed in a property that requires parent info to interpret?
|
||||||
|
|
||||||
AACube getMaximumAACube() const;
|
AACube getMaximumAACube() const;
|
||||||
AABox getAABox() const;
|
AABox getAABox() const;
|
||||||
|
|
|
@ -64,7 +64,7 @@ void EntityScriptingInterface::setEntityTree(EntityTreePointer elementTree) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityItemProperties convertLocationToScriptSemantics(EntityItemProperties entitySideProperties) {
|
EntityItemProperties convertLocationToScriptSemantics(const EntityItemProperties& entitySideProperties) {
|
||||||
// In EntityTree code, properties.position and properties.rotation are relative to the parent. In javascript,
|
// In EntityTree code, properties.position and properties.rotation are relative to the parent. In javascript,
|
||||||
// they are in world-space. The local versions are put into localPosition and localRotation and position and
|
// they are in world-space. The local versions are put into localPosition and localRotation and position and
|
||||||
// rotation are converted from local to world space.
|
// rotation are converted from local to world space.
|
||||||
|
@ -85,7 +85,7 @@ EntityItemProperties convertLocationToScriptSemantics(EntityItemProperties entit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EntityItemProperties convertLocationFromScriptSemantics(EntityItemProperties scriptSideProperties) {
|
EntityItemProperties convertLocationFromScriptSemantics(const EntityItemProperties& scriptSideProperties) {
|
||||||
// convert position and rotation properties from world-space to local, unless localPosition and localRotation
|
// convert position and rotation properties from world-space to local, unless localPosition and localRotation
|
||||||
// are set. If they are set, they overwrite position and rotation.
|
// are set. If they are set, they overwrite position and rotation.
|
||||||
EntityItemProperties entitySideProperties = scriptSideProperties;
|
EntityItemProperties entitySideProperties = scriptSideProperties;
|
||||||
|
@ -190,7 +190,7 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit
|
||||||
return convertLocationToScriptSemantics(results);
|
return convertLocationToScriptSemantics(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties scriptSideProperties) {
|
QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& scriptSideProperties) {
|
||||||
EntityItemProperties properties = scriptSideProperties;
|
EntityItemProperties properties = scriptSideProperties;
|
||||||
EntityItemID entityID(id);
|
EntityItemID entityID(id);
|
||||||
// If we have a local entity tree set, then also update it.
|
// If we have a local entity tree set, then also update it.
|
||||||
|
|
|
@ -86,7 +86,7 @@ public slots:
|
||||||
|
|
||||||
/// edits a model updating only the included properties, will return the identified EntityItemID in case of
|
/// edits a model updating only the included properties, will return the identified EntityItemID in case of
|
||||||
/// successful edit, if the input entityID is for an unknown model this function will have no effect
|
/// successful edit, if the input entityID is for an unknown model this function will have no effect
|
||||||
Q_INVOKABLE QUuid editEntity(QUuid entityID, EntityItemProperties properties);
|
Q_INVOKABLE QUuid editEntity(QUuid entityID, const EntityItemProperties& properties);
|
||||||
|
|
||||||
/// deletes a model
|
/// deletes a model
|
||||||
Q_INVOKABLE void deleteEntity(QUuid entityID);
|
Q_INVOKABLE void deleteEntity(QUuid entityID);
|
||||||
|
|
|
@ -40,7 +40,7 @@ LightEntityItem::LightEntityItem(const EntityItemID& entityItemID) : EntityItem(
|
||||||
_cutoff = PI;
|
_cutoff = PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightEntityItem::setDimensions(const glm::vec3 value) {
|
void LightEntityItem::setDimensions(const glm::vec3& value) {
|
||||||
if (_isSpotlight) {
|
if (_isSpotlight) {
|
||||||
// If we are a spotlight, treat the z value as our radius or length, and
|
// If we are a spotlight, treat the z value as our radius or length, and
|
||||||
// recalculate the x/y dimensions to properly encapsulate the spotlight.
|
// recalculate the x/y dimensions to properly encapsulate the spotlight.
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
ALLOW_INSTANTIATION // This class can be instantiated
|
ALLOW_INSTANTIATION // This class can be instantiated
|
||||||
|
|
||||||
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
||||||
virtual void setDimensions(const glm::vec3 value);
|
virtual void setDimensions(const glm::vec3& value);
|
||||||
|
|
||||||
// methods for getting/setting all properties of an entity
|
// methods for getting/setting all properties of an entity
|
||||||
virtual EntityItemProperties getProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()) const;
|
virtual EntityItemProperties getProperties(EntityPropertyFlags desiredProperties = EntityPropertyFlags()) const;
|
||||||
|
|
|
@ -41,7 +41,7 @@ TextEntityItem::TextEntityItem(const EntityItemID& entityItemID) : EntityItem(en
|
||||||
|
|
||||||
const float TEXT_ENTITY_ITEM_FIXED_DEPTH = 0.01f;
|
const float TEXT_ENTITY_ITEM_FIXED_DEPTH = 0.01f;
|
||||||
|
|
||||||
void TextEntityItem::setDimensions(const glm::vec3 value) {
|
void TextEntityItem::setDimensions(const glm::vec3& value) {
|
||||||
// NOTE: Text Entities always have a "depth" of 1cm.
|
// NOTE: Text Entities always have a "depth" of 1cm.
|
||||||
EntityItem::setDimensions(glm::vec3(value.x, value.y, TEXT_ENTITY_ITEM_FIXED_DEPTH));
|
EntityItem::setDimensions(glm::vec3(value.x, value.y, TEXT_ENTITY_ITEM_FIXED_DEPTH));
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
ALLOW_INSTANTIATION // This class can be instantiated
|
ALLOW_INSTANTIATION // This class can be instantiated
|
||||||
|
|
||||||
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
||||||
virtual void setDimensions(const glm::vec3 value);
|
virtual void setDimensions(const glm::vec3& value);
|
||||||
virtual ShapeType getShapeType() const { return SHAPE_TYPE_BOX; }
|
virtual ShapeType getShapeType() const { return SHAPE_TYPE_BOX; }
|
||||||
|
|
||||||
// methods for getting/setting all properties of an entity
|
// methods for getting/setting all properties of an entity
|
||||||
|
|
|
@ -34,7 +34,7 @@ WebEntityItem::WebEntityItem(const EntityItemID& entityItemID) : EntityItem(enti
|
||||||
|
|
||||||
const float WEB_ENTITY_ITEM_FIXED_DEPTH = 0.01f;
|
const float WEB_ENTITY_ITEM_FIXED_DEPTH = 0.01f;
|
||||||
|
|
||||||
void WebEntityItem::setDimensions(const glm::vec3 value) {
|
void WebEntityItem::setDimensions(const glm::vec3& value) {
|
||||||
// NOTE: Web Entities always have a "depth" of 1cm.
|
// NOTE: Web Entities always have a "depth" of 1cm.
|
||||||
EntityItem::setDimensions(glm::vec3(value.x, value.y, WEB_ENTITY_ITEM_FIXED_DEPTH));
|
EntityItem::setDimensions(glm::vec3(value.x, value.y, WEB_ENTITY_ITEM_FIXED_DEPTH));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
ALLOW_INSTANTIATION // This class can be instantiated
|
ALLOW_INSTANTIATION // This class can be instantiated
|
||||||
|
|
||||||
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
/// set dimensions in domain scale units (0.0 - 1.0) this will also reset radius appropriately
|
||||||
virtual void setDimensions(const glm::vec3 value);
|
virtual void setDimensions(const glm::vec3& value);
|
||||||
virtual ShapeType getShapeType() const { return SHAPE_TYPE_BOX; }
|
virtual ShapeType getShapeType() const { return SHAPE_TYPE_BOX; }
|
||||||
|
|
||||||
// methods for getting/setting all properties of an entity
|
// methods for getting/setting all properties of an entity
|
||||||
|
|
|
@ -99,7 +99,7 @@ void SpatiallyNestable::setParentID(const QUuid& parentID) {
|
||||||
parentChanged();
|
parentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 SpatiallyNestable::worldToLocal(glm::vec3 position, QUuid parentID, int parentJointIndex) {
|
glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position, const QUuid& parentID, int parentJointIndex) {
|
||||||
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
||||||
Transform parentTransform;
|
Transform parentTransform;
|
||||||
if (parentFinder) {
|
if (parentFinder) {
|
||||||
|
@ -122,7 +122,7 @@ glm::vec3 SpatiallyNestable::worldToLocal(glm::vec3 position, QUuid parentID, in
|
||||||
return result.getTranslation();
|
return result.getTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat SpatiallyNestable::worldToLocal(glm::quat orientation, QUuid parentID, int parentJointIndex) {
|
glm::quat SpatiallyNestable::worldToLocal(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex) {
|
||||||
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
||||||
Transform parentTransform;
|
Transform parentTransform;
|
||||||
if (parentFinder) {
|
if (parentFinder) {
|
||||||
|
@ -144,7 +144,7 @@ glm::quat SpatiallyNestable::worldToLocal(glm::quat orientation, QUuid parentID,
|
||||||
return result.getRotation();
|
return result.getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec3 SpatiallyNestable::localToWorld(glm::vec3 position, QUuid parentID, int parentJointIndex) {
|
glm::vec3 SpatiallyNestable::localToWorld(const glm::vec3& position, const QUuid& parentID, int parentJointIndex) {
|
||||||
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
||||||
Transform parentTransform;
|
Transform parentTransform;
|
||||||
if (parentFinder) {
|
if (parentFinder) {
|
||||||
|
@ -162,7 +162,7 @@ glm::vec3 SpatiallyNestable::localToWorld(glm::vec3 position, QUuid parentID, in
|
||||||
return result.getTranslation();
|
return result.getTranslation();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat SpatiallyNestable::localToWorld(glm::quat orientation, QUuid parentID, int parentJointIndex) {
|
glm::quat SpatiallyNestable::localToWorld(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex) {
|
||||||
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
|
||||||
Transform parentTransform;
|
Transform parentTransform;
|
||||||
if (parentFinder) {
|
if (parentFinder) {
|
||||||
|
|
|
@ -47,11 +47,11 @@ public:
|
||||||
virtual quint16 getParentJointIndex() const { return _parentJointIndex; }
|
virtual quint16 getParentJointIndex() const { return _parentJointIndex; }
|
||||||
virtual void setParentJointIndex(quint16 parentJointIndex) { _parentJointIndex = parentJointIndex; }
|
virtual void setParentJointIndex(quint16 parentJointIndex) { _parentJointIndex = parentJointIndex; }
|
||||||
|
|
||||||
static glm::vec3 worldToLocal(glm::vec3 position, QUuid parentID, int parentJointIndex);
|
static glm::vec3 worldToLocal(const glm::vec3& position, const QUuid& parentID, int parentJointIndex);
|
||||||
static glm::quat worldToLocal(glm::quat orientation, QUuid parentID, int parentJointIndex);
|
static glm::quat worldToLocal(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex);
|
||||||
|
|
||||||
static glm::vec3 localToWorld(glm::vec3 position, QUuid parentID, int parentJointIndex);
|
static glm::vec3 localToWorld(const glm::vec3& position, const QUuid& parentID, int parentJointIndex);
|
||||||
static glm::quat localToWorld(glm::quat orientation, QUuid parentID, int parentJointIndex);
|
static glm::quat localToWorld(const glm::quat& orientation, const QUuid& parentID, int parentJointIndex);
|
||||||
|
|
||||||
// world frame
|
// world frame
|
||||||
virtual const Transform getTransform() const;
|
virtual const Transform getTransform() const;
|
||||||
|
|
Loading…
Reference in a new issue