mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
make SpatiallyNestable::_transform private
This commit is contained in:
parent
275e77d29e
commit
37923e81bb
4 changed files with 33 additions and 10 deletions
|
@ -79,9 +79,9 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) :
|
|||
_simulated(false)
|
||||
{
|
||||
// explicitly set transform parts to set dirty flags used by batch rendering
|
||||
_transform.setTranslation(ENTITY_ITEM_DEFAULT_POSITION);
|
||||
_transform.setRotation(ENTITY_ITEM_DEFAULT_ROTATION);
|
||||
_transform.setScale(ENTITY_ITEM_DEFAULT_DIMENSIONS);
|
||||
setPosition(ENTITY_ITEM_DEFAULT_POSITION);
|
||||
setRotation(ENTITY_ITEM_DEFAULT_ROTATION);
|
||||
setScale(ENTITY_ITEM_DEFAULT_DIMENSIONS);
|
||||
quint64 now = usecTimestampNow();
|
||||
_lastSimulated = now;
|
||||
_lastUpdated = now;
|
||||
|
@ -1176,7 +1176,7 @@ void EntityItem::setDimensions(const glm::vec3& value) {
|
|||
if (value.x <= 0.0f || value.y <= 0.0f || value.z <= 0.0f) {
|
||||
return;
|
||||
}
|
||||
_transform.setScale(value);
|
||||
setScale(value);
|
||||
requiresRecalcBoxes();
|
||||
}
|
||||
|
||||
|
|
|
@ -184,8 +184,7 @@ public:
|
|||
const Transform getTransformToCenter() const;
|
||||
void setTranformToCenter(const Transform& transform);
|
||||
|
||||
inline const Transform& getTransform() const { return _transform; }
|
||||
inline void setTransform(const Transform& transform) { _transform = transform; requiresRecalcBoxes(); }
|
||||
virtual void setTransform(const Transform& transform) { SpatiallyNestable::setTransform(transform); requiresRecalcBoxes(); }
|
||||
|
||||
/// Position in meters (-TREE_SCALE - TREE_SCALE)
|
||||
virtual const glm::vec3& getPosition() const { return SpatiallyNestable::getPosition(); }
|
||||
|
@ -204,7 +203,7 @@ public:
|
|||
void setDescription(QString value) { _description = value; }
|
||||
|
||||
/// Dimensions in meters (0.0 - TREE_SCALE)
|
||||
inline const glm::vec3& getDimensions() const { return _transform.getScale(); }
|
||||
inline const glm::vec3& getDimensions() const { return getScale(); }
|
||||
virtual void setDimensions(const glm::vec3& value);
|
||||
|
||||
float getGlowLevel() const { return _glowLevel; }
|
||||
|
|
|
@ -35,3 +35,15 @@ void SpatiallyNestable::setOrientation(const glm::quat& orientation) {
|
|||
const Transform& SpatiallyNestable::getTransform() const {
|
||||
return _transform;
|
||||
}
|
||||
|
||||
void SpatiallyNestable::setTransform(const Transform& transform) {
|
||||
_transform = transform;
|
||||
}
|
||||
|
||||
const glm::vec3& SpatiallyNestable::getScale() const {
|
||||
return _transform.getScale();
|
||||
}
|
||||
|
||||
void SpatiallyNestable::setScale(const glm::vec3& scale) {
|
||||
_transform.setScale(scale);
|
||||
}
|
||||
|
|
|
@ -27,20 +27,32 @@ public:
|
|||
SpatiallyNestable();
|
||||
virtual ~SpatiallyNestable() { }
|
||||
|
||||
// world frame
|
||||
virtual const Transform& getTransform() const;
|
||||
virtual void setTransform(const Transform& transform);
|
||||
|
||||
virtual const glm::vec3& getPosition() const;
|
||||
virtual void setPosition(const glm::vec3& position);
|
||||
|
||||
virtual const glm::quat& getOrientation() const;
|
||||
virtual void setOrientation(const glm::quat& orientation);
|
||||
virtual const Transform& getTransform() const;
|
||||
|
||||
virtual const glm::vec3& getScale() const;
|
||||
virtual void setScale(const glm::vec3& scale);
|
||||
|
||||
// model frame
|
||||
// ...
|
||||
|
||||
|
||||
protected:
|
||||
Transform _transform;
|
||||
|
||||
QUuid _parentID; // what is this thing's transform relative to?
|
||||
int _parentJointIndex; // which joint of the parent is this relative to?
|
||||
|
||||
SpatiallyNestableWeakPointer _parent;
|
||||
QVector<SpatiallyNestableWeakPointer> _children;
|
||||
|
||||
private:
|
||||
Transform _transform;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue