Trying to notify the entity changes to the render item correctly, need more work

This commit is contained in:
samcake 2016-02-10 11:52:37 -08:00
parent 9326aebf20
commit 51bacdebdd
3 changed files with 11 additions and 3 deletions

View file

@ -95,6 +95,7 @@ public: \
virtual bool addToScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) override { return _renderHelper.addToScene(self, scene, pendingChanges); } \
virtual void removeFromScene(EntityItemPointer self, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges) override { _renderHelper.removeFromScene(self, scene, pendingChanges); } \
virtual void locationChanged() override { EntityItem::locationChanged(); _renderHelper.notifyChanged(); } \
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); _renderHelper.notifyChanged(); } \
private: \
SimpleRenderableEntityItem _renderHelper;

View file

@ -1192,7 +1192,6 @@ void EntityItem::setDimensions(const glm::vec3& value) {
return;
}
setScale(value);
requiresRecalcBoxes();
}
/// The maximum bounding cube for the entity, independent of it's rotation.
@ -1916,3 +1915,8 @@ void EntityItem::locationChanged() {
requiresRecalcBoxes();
SpatiallyNestable::locationChanged(); // tell all the children, also
}
void EntityItem::dimensionsChanged() {
requiresRecalcBoxes();
SpatiallyNestable::dimensionsChanged(); // Do what you have to do
}

View file

@ -250,8 +250,9 @@ public:
const glm::vec3& getRegistrationPoint() const { return _registrationPoint; } /// registration point as ratio of entity
/// registration point as ratio of entity
void setRegistrationPoint(const glm::vec3& value)
{ _registrationPoint = glm::clamp(value, 0.0f, 1.0f); requiresRecalcBoxes(); }
void setRegistrationPoint(const glm::vec3& value) {
_registrationPoint = glm::clamp(value, 0.0f, 1.0f); dimensionsChanged(); // Registration Point affects the bounding box
}
bool hasAngularVelocity() const { return getAngularVelocity() != ENTITY_ITEM_ZERO_VEC3; }
@ -405,6 +406,8 @@ protected:
void setActionDataInternal(QByteArray actionData);
virtual void locationChanged() override;
virtual void dimensionsChanged() override;
EntityTypes::EntityType _type;
quint64 _lastSimulated; // last time this entity called simulate(), this includes velocity, angular velocity,
// and physics changes