From fe84232ab459765041b141b7f458862b0bfd9dac Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 3 Apr 2017 14:22:37 -0700 Subject: [PATCH] More work on thread safety --- libraries/entities/src/EntityItem.h | 2 +- libraries/entities/src/LightEntityItem.h | 37 ++++++++---------------- libraries/entities/src/LineEntityItem.h | 3 +- libraries/entities/src/ModelEntityItem.h | 2 +- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index e705fcbe2a..a751fd88b2 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -510,7 +510,7 @@ protected: // NOTE: _volumeMultiplier is used to allow some mass properties code exist in the EntityItem base class // rather than in all of the derived classes. If we ever collapse these classes to one we could do it a // different way. - const float _volumeMultiplier { 1.0f }; + float _volumeMultiplier { 1.0f }; glm::vec3 _gravity; glm::vec3 _acceleration; float _damping; diff --git a/libraries/entities/src/LightEntityItem.h b/libraries/entities/src/LightEntityItem.h index f0ed58f47a..b3cadcf0c7 100644 --- a/libraries/entities/src/LightEntityItem.h +++ b/libraries/entities/src/LightEntityItem.h @@ -57,41 +57,27 @@ public: EntityPropertyFlags& propertyFlags, bool overwriteLocalData, bool& somethingChanged) override; - const rgbColor& getColor() const { return _color; } - xColor getXColor() const { - xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; - } + const rgbColor& getColor() const; + xColor getXColor() const; - void setColor(const rgbColor& value) { memcpy(_color, value, sizeof(_color)); } - void setColor(const xColor& value) { - _color[RED_INDEX] = value.red; - _color[GREEN_INDEX] = value.green; - _color[BLUE_INDEX] = value.blue; - _lightPropertiesChanged = true; - } + void setColor(const rgbColor& value); + void setColor(const xColor& value); - bool getIsSpotlight() const { return _isSpotlight; } + bool getIsSpotlight() const; void setIsSpotlight(bool value); void setIgnoredColor(const rgbColor& value) { } void setIgnoredAttenuation(float value) { } - float getIntensity() const { return _intensity; } - void setIntensity(float value) { - _intensity = value; - _lightPropertiesChanged = true; - } - - float getFalloffRadius() const { return _falloffRadius; } + float getIntensity() const; + void setIntensity(float value); + float getFalloffRadius() const; void setFalloffRadius(float value); - float getExponent() const { return _exponent; } - void setExponent(float value) { - _exponent = value; - _lightPropertiesChanged = true; - } + float getExponent() const; + void setExponent(float value); - float getCutoff() const { return _cutoff; } + float getCutoff() const; void setCutoff(float value); static bool getLightsArePickable() { return _lightsArePickable; } @@ -108,6 +94,7 @@ private: float _exponent { DEFAULT_EXPONENT }; float _cutoff { DEFAULT_CUTOFF }; +protected: // Dirty flag turn true when either light properties is changing values. // This gets back to false in the somethingChangedNotification() call // Which is called after a setProperties() or a readEntitySubClassFromBUfferCall on the entity. diff --git a/libraries/entities/src/LineEntityItem.h b/libraries/entities/src/LineEntityItem.h index 7a882f6b9d..bb8ae8a21a 100644 --- a/libraries/entities/src/LineEntityItem.h +++ b/libraries/entities/src/LineEntityItem.h @@ -73,8 +73,9 @@ class LineEntityItem : public EntityItem { private: rgbColor _color; float _lineWidth; - bool _pointsChanged; QVector _points; +protected: + bool _pointsChanged; }; #endif // hifi_LineEntityItem_h diff --git a/libraries/entities/src/ModelEntityItem.h b/libraries/entities/src/ModelEntityItem.h index 972bf1e18d..e1cb5cd92c 100644 --- a/libraries/entities/src/ModelEntityItem.h +++ b/libraries/entities/src/ModelEntityItem.h @@ -130,7 +130,7 @@ private: void setAnimationSettings(const QString& value); // only called for old bitstream format ShapeType computeTrueShapeType() const; -private: +protected: // these are used: // - to bounce joint data from an animation into the model/rig. // - to relay changes from scripts to model/rig.