From fdc1146339df706d0ee6e37a8dfcc7382ede0532 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 27 Feb 2015 12:14:50 -0800 Subject: [PATCH 1/7] Update RenderableLightEntityItem to use update light entity --- .../src/RenderableLightEntityItem.cpp | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableLightEntityItem.cpp b/libraries/entities-renderer/src/RenderableLightEntityItem.cpp index 1e0a9b6fc7..770473074a 100644 --- a/libraries/entities-renderer/src/RenderableLightEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableLightEntityItem.cpp @@ -32,25 +32,19 @@ void RenderableLightEntityItem::render(RenderArgs* args) { float largestDiameter = glm::max(dimensions.x, dimensions.y, dimensions.z); const float MAX_COLOR = 255.0f; - float diffuseR = getDiffuseColor()[RED_INDEX] / MAX_COLOR; - float diffuseG = getDiffuseColor()[GREEN_INDEX] / MAX_COLOR; - float diffuseB = getDiffuseColor()[BLUE_INDEX] / MAX_COLOR; + float colorR = getColor()[RED_INDEX] / MAX_COLOR; + float colorG = getColor()[GREEN_INDEX] / MAX_COLOR; + float colorB = getColor()[BLUE_INDEX] / MAX_COLOR; - float ambientR = getAmbientColor()[RED_INDEX] / MAX_COLOR; - float ambientG = getAmbientColor()[GREEN_INDEX] / MAX_COLOR; - float ambientB = getAmbientColor()[BLUE_INDEX] / MAX_COLOR; + glm::vec3 color = glm::vec3(colorR, colorG, colorB); + glm::vec3 diffuse = color; + glm::vec3 ambient = color; + glm::vec3 specular = color; - float specularR = getSpecularColor()[RED_INDEX] / MAX_COLOR; - float specularG = getSpecularColor()[GREEN_INDEX] / MAX_COLOR; - float specularB = getSpecularColor()[BLUE_INDEX] / MAX_COLOR; - - glm::vec3 ambient = glm::vec3(ambientR, ambientG, ambientB); - glm::vec3 diffuse = glm::vec3(diffuseR, diffuseG, diffuseB); - glm::vec3 specular = glm::vec3(specularR, specularG, specularB); glm::vec3 direction = IDENTITY_FRONT * rotation; - float constantAttenuation = getConstantAttenuation(); - float linearAttenuation = getLinearAttenuation(); - float quadraticAttenuation = getQuadraticAttenuation(); + float constantAttenuation = 0.0f; + float linearAttenuation = 0.0f; + float quadraticAttenuation = 0.0f; float exponent = getExponent(); float cutoff = glm::radians(getCutoff()); From 093e5db90d130f549ee187c152e16ba70c74461f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 27 Feb 2015 13:42:56 -0800 Subject: [PATCH 2/7] Update entity light properties to use new model Rename constantAttenuation -> intensity Rename diffuseColor -> color Remove remaining attenuation and colors --- .../entities/src/EntityItemProperties.cpp | 14 ++-- libraries/entities/src/EntityItemProperties.h | 6 +- libraries/entities/src/LightEntityItem.cpp | 80 +++++++++---------- libraries/entities/src/LightEntityItem.h | 58 +++----------- 4 files changed, 61 insertions(+), 97 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index f3f84876ba..ef59495d96 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -52,7 +52,7 @@ EntityItemProperties::EntityItemProperties() : CONSTRUCT_PROPERTY(diffuseColor, ), CONSTRUCT_PROPERTY(ambientColor, ), CONSTRUCT_PROPERTY(specularColor, ), - CONSTRUCT_PROPERTY(constantAttenuation, 1.0f), + CONSTRUCT_PROPERTY(intensity, 1.0f), CONSTRUCT_PROPERTY(linearAttenuation, 0.0f), CONSTRUCT_PROPERTY(quadraticAttenuation, 0.0f), CONSTRUCT_PROPERTY(exponent, 0.0f), @@ -225,7 +225,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { CHECK_PROPERTY_CHANGE(PROP_DIFFUSE_COLOR, diffuseColor); CHECK_PROPERTY_CHANGE(PROP_AMBIENT_COLOR, ambientColor); CHECK_PROPERTY_CHANGE(PROP_SPECULAR_COLOR, specularColor); - CHECK_PROPERTY_CHANGE(PROP_CONSTANT_ATTENUATION, constantAttenuation); + CHECK_PROPERTY_CHANGE(PROP_INTENSITY, intensity); CHECK_PROPERTY_CHANGE(PROP_LINEAR_ATTENUATION, linearAttenuation); CHECK_PROPERTY_CHANGE(PROP_QUADRATIC_ATTENUATION, quadraticAttenuation); CHECK_PROPERTY_CHANGE(PROP_EXPONENT, exponent); @@ -284,7 +284,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(diffuseColor, getDiffuseColor()); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(ambientColor, getAmbientColor()); COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(specularColor, getSpecularColor()); - COPY_PROPERTY_TO_QSCRIPTVALUE(constantAttenuation); + COPY_PROPERTY_TO_QSCRIPTVALUE(intensity); COPY_PROPERTY_TO_QSCRIPTVALUE(linearAttenuation); COPY_PROPERTY_TO_QSCRIPTVALUE(quadraticAttenuation); COPY_PROPERTY_TO_QSCRIPTVALUE(exponent); @@ -362,7 +362,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object) { COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(diffuseColor, setDiffuseColor); COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(ambientColor, setAmbientColor); COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(specularColor, setSpecularColor); - COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(constantAttenuation, setConstantAttenuation); + COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(intensity, setIntensity); COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(linearAttenuation, setLinearAttenuation); COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(quadraticAttenuation, setQuadraticAttenuation); COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(exponent, setExponent); @@ -546,7 +546,7 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem APPEND_ENTITY_PROPERTY(PROP_DIFFUSE_COLOR, appendColor, properties.getDiffuseColor()); APPEND_ENTITY_PROPERTY(PROP_AMBIENT_COLOR, appendColor, properties.getAmbientColor()); APPEND_ENTITY_PROPERTY(PROP_SPECULAR_COLOR, appendColor, properties.getSpecularColor()); - APPEND_ENTITY_PROPERTY(PROP_CONSTANT_ATTENUATION, appendValue, properties.getConstantAttenuation()); + APPEND_ENTITY_PROPERTY(PROP_INTENSITY, appendValue, properties.getIntensity()); APPEND_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION, appendValue, properties.getLinearAttenuation()); APPEND_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION, appendValue, properties.getQuadraticAttenuation()); APPEND_ENTITY_PROPERTY(PROP_EXPONENT, appendValue, properties.getExponent()); @@ -768,7 +768,7 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int READ_ENTITY_PROPERTY_COLOR_TO_PROPERTIES(PROP_DIFFUSE_COLOR, setDiffuseColor); READ_ENTITY_PROPERTY_COLOR_TO_PROPERTIES(PROP_AMBIENT_COLOR, setAmbientColor); READ_ENTITY_PROPERTY_COLOR_TO_PROPERTIES(PROP_SPECULAR_COLOR, setSpecularColor); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CONSTANT_ATTENUATION, float, setConstantAttenuation); + READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_INTENSITY, float, setIntensity); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINEAR_ATTENUATION, float, setLinearAttenuation); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_QUADRATIC_ATTENUATION, float, setQuadraticAttenuation); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EXPONENT, float, setExponent); @@ -838,7 +838,7 @@ void EntityItemProperties::markAllChanged() { _diffuseColorChanged = true; _ambientColorChanged = true; _specularColorChanged = true; - _constantAttenuationChanged = true; + _intensityChanged = true; _linearAttenuationChanged = true; _quadraticAttenuationChanged = true; _exponentChanged = true; diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 2391bcde84..9b43a21402 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -69,7 +69,7 @@ enum EntityPropertyList { PROP_DIFFUSE_COLOR, PROP_AMBIENT_COLOR, PROP_SPECULAR_COLOR, - PROP_CONSTANT_ATTENUATION, + PROP_INTENSITY, // Previously PROP_CONSTANT_ATTENUATION PROP_LINEAR_ATTENUATION, PROP_QUADRATIC_ATTENUATION, PROP_EXPONENT, @@ -168,7 +168,7 @@ public: DEFINE_PROPERTY_REF(PROP_DIFFUSE_COLOR, DiffuseColor, diffuseColor, xColor); DEFINE_PROPERTY_REF(PROP_AMBIENT_COLOR, AmbientColor, ambientColor, xColor); DEFINE_PROPERTY_REF(PROP_SPECULAR_COLOR, SpecularColor, specularColor, xColor); - DEFINE_PROPERTY(PROP_CONSTANT_ATTENUATION, ConstantAttenuation, constantAttenuation, float); + DEFINE_PROPERTY(PROP_INTENSITY, Intensity, intensity, float); DEFINE_PROPERTY(PROP_LINEAR_ATTENUATION, LinearAttenuation, linearAttenuation, float); DEFINE_PROPERTY(PROP_QUADRATIC_ATTENUATION, QuadraticAttenuation, quadraticAttenuation, float); DEFINE_PROPERTY(PROP_EXPONENT, Exponent, exponent, float); @@ -291,7 +291,7 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) { DEBUG_PROPERTY_IF_CHANGED(debug, properties, DiffuseColor, diffuseColor, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, AmbientColor, ambientColor, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, SpecularColor, specularColor, ""); - DEBUG_PROPERTY_IF_CHANGED(debug, properties, ConstantAttenuation, constantAttenuation, ""); + DEBUG_PROPERTY_IF_CHANGED(debug, properties, Intensity, intensity, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, LinearAttenuation, linearAttenuation, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, QuadraticAttenuation, quadraticAttenuation, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, Exponent, exponent, ""); diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index 4a8dc2d582..1551eb5011 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -14,6 +14,7 @@ #include +#include "EntityItemID.h" #include "EntityTree.h" #include "EntityTreeElement.h" #include "LightEntityItem.h" @@ -32,12 +33,8 @@ LightEntityItem::LightEntityItem(const EntityItemID& entityItemID, const EntityI // default property values const quint8 MAX_COLOR = 255; - _ambientColor[RED_INDEX] = _ambientColor[GREEN_INDEX] = _ambientColor[BLUE_INDEX] = 0; - _diffuseColor[RED_INDEX] = _diffuseColor[GREEN_INDEX] = _diffuseColor[BLUE_INDEX] = MAX_COLOR; - _specularColor[RED_INDEX] = _specularColor[GREEN_INDEX] = _specularColor[BLUE_INDEX] = MAX_COLOR; - _constantAttenuation = 1.0f; - _linearAttenuation = 0.0f; - _quadraticAttenuation = 0.0f; + _color[RED_INDEX] = _color[GREEN_INDEX] = _color[BLUE_INDEX] = 0; + _intensity = 1.0f; _exponent = 0.0f; _cutoff = PI; @@ -54,12 +51,8 @@ EntityItemProperties LightEntityItem::getProperties() const { EntityItemProperties properties = EntityItem::getProperties(); // get the properties from our base class COPY_ENTITY_PROPERTY_TO_PROPERTIES(isSpotlight, getIsSpotlight); - COPY_ENTITY_PROPERTY_TO_PROPERTIES(diffuseColor, getDiffuseXColor); - COPY_ENTITY_PROPERTY_TO_PROPERTIES(ambientColor, getAmbientXColor); - COPY_ENTITY_PROPERTY_TO_PROPERTIES(specularColor, getSpecularXColor); - COPY_ENTITY_PROPERTY_TO_PROPERTIES(constantAttenuation, getConstantAttenuation); - COPY_ENTITY_PROPERTY_TO_PROPERTIES(linearAttenuation, getLinearAttenuation); - COPY_ENTITY_PROPERTY_TO_PROPERTIES(quadraticAttenuation, getQuadraticAttenuation); + COPY_ENTITY_PROPERTY_TO_PROPERTIES(color, getXColor); + COPY_ENTITY_PROPERTY_TO_PROPERTIES(intensity, getIntensity); COPY_ENTITY_PROPERTY_TO_PROPERTIES(exponent, getExponent); COPY_ENTITY_PROPERTY_TO_PROPERTIES(cutoff, getCutoff); @@ -70,17 +63,11 @@ bool LightEntityItem::setProperties(const EntityItemProperties& properties) { bool somethingChanged = EntityItem::setProperties(properties); // set the properties in our base class SET_ENTITY_PROPERTY_FROM_PROPERTIES(isSpotlight, setIsSpotlight); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(diffuseColor, setDiffuseColor); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(ambientColor, setAmbientColor); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(specularColor, setSpecularColor); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(isSpotlight, setIsSpotlight); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(constantAttenuation, setConstantAttenuation); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(linearAttenuation, setLinearAttenuation); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(quadraticAttenuation, setQuadraticAttenuation); + SET_ENTITY_PROPERTY_FROM_PROPERTIES(color, setColor); + SET_ENTITY_PROPERTY_FROM_PROPERTIES(intensity, setIntensity); SET_ENTITY_PROPERTY_FROM_PROPERTIES(exponent, setExponent); SET_ENTITY_PROPERTY_FROM_PROPERTIES(cutoff, setCutoff); - if (somethingChanged) { bool wantDebug = false; if (wantDebug) { @@ -101,15 +88,34 @@ int LightEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesRead = 0; const unsigned char* dataAt = data; - READ_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, bool, _isSpotlight); - READ_ENTITY_PROPERTY_COLOR(PROP_DIFFUSE_COLOR, _diffuseColor); - READ_ENTITY_PROPERTY_COLOR(PROP_AMBIENT_COLOR, _ambientColor); - READ_ENTITY_PROPERTY_COLOR(PROP_SPECULAR_COLOR, _specularColor); - READ_ENTITY_PROPERTY(PROP_CONSTANT_ATTENUATION, float, _constantAttenuation); - READ_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION, float, _linearAttenuation); - READ_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION, float, _quadraticAttenuation); - READ_ENTITY_PROPERTY(PROP_EXPONENT, float, _exponent); - READ_ENTITY_PROPERTY(PROP_CUTOFF, float, _cutoff); + if (args.bitstreamVersion < VERSION_ENTITIES_LIGHT_HAS_NEW_PROPERTIES) { + rgbColor diffuseColor; + rgbColor ambientColor; + rgbColor specularColor; + float attenuation; + + READ_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, bool, _isSpotlight); + + // _diffuseColor has been renamed to _color + READ_ENTITY_PROPERTY_COLOR(PROP_DIFFUSE_COLOR, _color); + + READ_ENTITY_PROPERTY_COLOR(PROP_AMBIENT_COLOR, ambientColor); + READ_ENTITY_PROPERTY_COLOR(PROP_SPECULAR_COLOR, specularColor); + + // _constantAttenuation has been renamed to _intensity + READ_ENTITY_PROPERTY(PROP_INTENSITY, float, _intensity); + + READ_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION, float, attenuation); + READ_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION, float, attenuation); + READ_ENTITY_PROPERTY(PROP_EXPONENT, float, _exponent); + READ_ENTITY_PROPERTY(PROP_CUTOFF, float, _cutoff); + } else { + READ_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, bool, _isSpotlight); + READ_ENTITY_PROPERTY_COLOR(PROP_COLOR, _color); + READ_ENTITY_PROPERTY(PROP_INTENSITY, float, _intensity); + READ_ENTITY_PROPERTY(PROP_EXPONENT, float, _exponent); + READ_ENTITY_PROPERTY(PROP_CUTOFF, float, _cutoff); + } return bytesRead; } @@ -119,12 +125,8 @@ int LightEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, EntityPropertyFlags LightEntityItem::getEntityProperties(EncodeBitstreamParams& params) const { EntityPropertyFlags requestedProperties = EntityItem::getEntityProperties(params); requestedProperties += PROP_IS_SPOTLIGHT; - requestedProperties += PROP_DIFFUSE_COLOR; - requestedProperties += PROP_AMBIENT_COLOR; - requestedProperties += PROP_SPECULAR_COLOR; - requestedProperties += PROP_CONSTANT_ATTENUATION; - requestedProperties += PROP_LINEAR_ATTENUATION; - requestedProperties += PROP_QUADRATIC_ATTENUATION; + requestedProperties += PROP_COLOR; + requestedProperties += PROP_INTENSITY; requestedProperties += PROP_EXPONENT; requestedProperties += PROP_CUTOFF; return requestedProperties; @@ -140,12 +142,8 @@ void LightEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit bool successPropertyFits = true; APPEND_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, appendValue, getIsSpotlight()); - APPEND_ENTITY_PROPERTY(PROP_DIFFUSE_COLOR, appendColor, getDiffuseColor()); - APPEND_ENTITY_PROPERTY(PROP_AMBIENT_COLOR, appendColor, getAmbientColor()); - APPEND_ENTITY_PROPERTY(PROP_SPECULAR_COLOR, appendColor, getSpecularColor()); - APPEND_ENTITY_PROPERTY(PROP_CONSTANT_ATTENUATION, appendValue, getConstantAttenuation()); - APPEND_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION, appendValue, getLinearAttenuation()); - APPEND_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION, appendValue, getQuadraticAttenuation()); + APPEND_ENTITY_PROPERTY(PROP_COLOR, appendColor, getColor()); + APPEND_ENTITY_PROPERTY(PROP_INTENSITY, appendValue, getIntensity()); APPEND_ENTITY_PROPERTY(PROP_EXPONENT, appendValue, getExponent()); APPEND_ENTITY_PROPERTY(PROP_CUTOFF, appendValue, getCutoff()); } diff --git a/libraries/entities/src/LightEntityItem.h b/libraries/entities/src/LightEntityItem.h index 5e39ba26a2..cdbdb59ece 100644 --- a/libraries/entities/src/LightEntityItem.h +++ b/libraries/entities/src/LightEntityItem.h @@ -43,53 +43,23 @@ public: ReadBitstreamToTreeParams& args, EntityPropertyFlags& propertyFlags, bool overwriteLocalData); - const rgbColor& getAmbientColor() const { return _ambientColor; } - xColor getAmbientXColor() const { - xColor color = { _ambientColor[RED_INDEX], _ambientColor[GREEN_INDEX], _ambientColor[BLUE_INDEX] }; return color; + const rgbColor& getColor() const { return _color; } + xColor getXColor() const { + xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; } - void setAmbientColor(const rgbColor& value) { memcpy(_ambientColor, value, sizeof(_ambientColor)); } - void setAmbientColor(const xColor& value) { - _ambientColor[RED_INDEX] = value.red; - _ambientColor[GREEN_INDEX] = value.green; - _ambientColor[BLUE_INDEX] = value.blue; - } - - const rgbColor& getDiffuseColor() const { return _diffuseColor; } - xColor getDiffuseXColor() const { - xColor color = { _diffuseColor[RED_INDEX], _diffuseColor[GREEN_INDEX], _diffuseColor[BLUE_INDEX] }; return color; - } - - void setDiffuseColor(const rgbColor& value) { memcpy(_diffuseColor, value, sizeof(_diffuseColor)); } - void setDiffuseColor(const xColor& value) { - _diffuseColor[RED_INDEX] = value.red; - _diffuseColor[GREEN_INDEX] = value.green; - _diffuseColor[BLUE_INDEX] = value.blue; - } - - const rgbColor& getSpecularColor() const { return _specularColor; } - xColor getSpecularXColor() const { - xColor color = { _specularColor[RED_INDEX], _specularColor[GREEN_INDEX], _specularColor[BLUE_INDEX] }; return color; - } - - void setSpecularColor(const rgbColor& value) { memcpy(_specularColor, value, sizeof(_specularColor)); } - void setSpecularColor(const xColor& value) { - _specularColor[RED_INDEX] = value.red; - _specularColor[GREEN_INDEX] = value.green; - _specularColor[BLUE_INDEX] = value.blue; + 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; } bool getIsSpotlight() const { return _isSpotlight; } void setIsSpotlight(bool value) { _isSpotlight = value; } - float getConstantAttenuation() const { return _constantAttenuation; } - void setConstantAttenuation(float value) { _constantAttenuation = value; } - - float getLinearAttenuation() const { return _linearAttenuation; } - void setLinearAttenuation(float value) { _linearAttenuation = value; } - - float getQuadraticAttenuation() const { return _quadraticAttenuation; } - void setQuadraticAttenuation(float value) { _quadraticAttenuation = value; } + float getIntensity() const { return _intensity; } + void setIntensity(float value) { _intensity = value; } float getExponent() const { return _exponent; } void setExponent(float value) { _exponent = value; } @@ -103,13 +73,9 @@ public: protected: // properties of a light - rgbColor _ambientColor; - rgbColor _diffuseColor; - rgbColor _specularColor; + rgbColor _color; bool _isSpotlight; - float _constantAttenuation; - float _linearAttenuation; - float _quadraticAttenuation; + float _intensity; float _exponent; float _cutoff; From a7f84bcd307e01b6e55cf8e91ab1bb40546bb25f Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 27 Feb 2015 13:46:04 -0800 Subject: [PATCH 3/7] Update entity server version number --- libraries/networking/src/PacketHeaders.cpp | 2 +- libraries/networking/src/PacketHeaders.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/networking/src/PacketHeaders.cpp b/libraries/networking/src/PacketHeaders.cpp index db97e216ee..c8f6b6e25c 100644 --- a/libraries/networking/src/PacketHeaders.cpp +++ b/libraries/networking/src/PacketHeaders.cpp @@ -74,7 +74,7 @@ PacketVersion versionForPacketType(PacketType type) { return 1; case PacketTypeEntityAddOrEdit: case PacketTypeEntityData: - return VERSION_MODEL_ENTITIES_SUPPORT_SHAPE_TYPE; + return VERSION_ENTITIES_LIGHT_HAS_INTENSITY_AND_COLOR_PROPERTIES; case PacketTypeEntityErase: return 2; case PacketTypeAudioStreamStats: diff --git a/libraries/networking/src/PacketHeaders.h b/libraries/networking/src/PacketHeaders.h index 32f33c01d9..44a464201b 100644 --- a/libraries/networking/src/PacketHeaders.h +++ b/libraries/networking/src/PacketHeaders.h @@ -128,6 +128,7 @@ const PacketVersion VERSION_ENTITIES_MODELS_HAVE_ANIMATION_SETTINGS = 5; const PacketVersion VERSION_ENTITIES_HAVE_USER_DATA = 6; const PacketVersion VERSION_ENTITIES_HAS_LAST_SIMULATED_TIME = 7; const PacketVersion VERSION_MODEL_ENTITIES_SUPPORT_SHAPE_TYPE = 8; +const PacketVersion VERSION_ENTITIES_LIGHT_HAS_INTENSITY_AND_COLOR_PROPERTIES = 9; const PacketVersion VERSION_OCTREE_HAS_FILE_BREAKS = 1; #endif // hifi_PacketHeaders_h From 20f3d23ae793d2b0fd3a1fd9ad16695d9b6d5722 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 27 Feb 2015 13:46:26 -0800 Subject: [PATCH 4/7] Update editEntities to use new light properties --- examples/html/entityProperties.html | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index f54c2c9ce3..ef7791ea15 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -128,11 +128,11 @@ var elLightSections = document.querySelectorAll(".light-section"); var elLightSpotLight = document.getElementById("property-light-spot-light"); - var elLightDiffuseRed = document.getElementById("property-light-diffuse-red"); - var elLightDiffuseGreen = document.getElementById("property-light-diffuse-green"); - var elLightDiffuseBlue = document.getElementById("property-light-diffuse-blue"); + var elLightColorRed = document.getElementById("property-light-color-red"); + var elLightColorGreen = document.getElementById("property-light-color-green"); + var elLightColorBlue = document.getElementById("property-light-color-blue"); - var elLightConstantAttenuation = document.getElementById("property-light-constant-attenuation"); + var elLightIntensity = document.getElementById("property-light-intensity"); var elLightExponent = document.getElementById("property-light-exponent"); var elLightCutoff = document.getElementById("property-light-cutoff"); @@ -305,11 +305,11 @@ elLightSections[i].style.display = 'block'; } - elLightDiffuseRed.value = properties.diffuseColor.red; - elLightDiffuseGreen.value = properties.diffuseColor.green; - elLightDiffuseBlue.value = properties.diffuseColor.blue; + elLightColorRed.value = properties.color.red; + elLightColorGreen.value = properties.color.green; + elLightColorBlue.value = properties.color.blue; - elLightConstantAttenuation.value = properties.constantAttenuation; + elLightIntensity.value = properties.intensity; elLightExponent.value = properties.exponent; elLightCutoff.value = properties.cutoff; } @@ -380,13 +380,13 @@ elLightSpotLight.addEventListener('change', createEmitCheckedPropertyUpdateFunction('isSpotlight')); - var lightDiffuseChangeFunction = createEmitColorPropertyUpdateFunction( - 'diffuseColor', elLightDiffuseRed, elLightDiffuseGreen, elLightDiffuseBlue); - elLightDiffuseRed.addEventListener('change', lightDiffuseChangeFunction); - elLightDiffuseGreen.addEventListener('change', lightDiffuseChangeFunction); - elLightDiffuseBlue.addEventListener('change', lightDiffuseChangeFunction); + var lightColorChangeFunction = createEmitColorPropertyUpdateFunction( + 'color', elLightColorRed, elLightColorGreen, elLightColorBlue); + elLightColorRed.addEventListener('change', lightColorChangeFunction); + elLightColorGreen.addEventListener('change', lightColorChangeFunction); + elLightColorBlue.addEventListener('change', lightColorChangeFunction); - elLightConstantAttenuation.addEventListener('change', createEmitNumberPropertyUpdateFunction('constantAttenuation')); + elLightIntensity.addEventListener('change', createEmitNumberPropertyUpdateFunction('intensity')); elLightExponent.addEventListener('change', createEmitNumberPropertyUpdateFunction('exponent')); elLightCutoff.addEventListener('change', createEmitNumberPropertyUpdateFunction('cutoff')); @@ -708,15 +708,15 @@
Color
-
R
-
G
-
B
+
R
+
G
+
B
Intensity
- +
From 61bc32493f4452f1eb7e63f4617a1f7a7a463876 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 27 Feb 2015 13:49:17 -0800 Subject: [PATCH 5/7] Fix entity version name in LightEntityItem --- libraries/entities/src/LightEntityItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index 1551eb5011..8f075b099e 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -88,7 +88,7 @@ int LightEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesRead = 0; const unsigned char* dataAt = data; - if (args.bitstreamVersion < VERSION_ENTITIES_LIGHT_HAS_NEW_PROPERTIES) { + if (args.bitstreamVersion < VERSION_ENTITIES_LIGHT_HAS_INTENSITY_AND_COLOR_PROPERTIES) { rgbColor diffuseColor; rgbColor ambientColor; rgbColor specularColor; From 84691f922c6d92e4d1ee11e014e4be627a3e4c79 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 27 Feb 2015 14:04:56 -0800 Subject: [PATCH 6/7] Remove old light color properties --- .../entities/src/EntityItemProperties.cpp | 37 +------------------ libraries/entities/src/EntityItemProperties.h | 20 +++------- libraries/entities/src/LightEntityItem.cpp | 10 ++--- 3 files changed, 12 insertions(+), 55 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index ef59495d96..e53a6ede3d 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -49,12 +49,7 @@ EntityItemProperties::EntityItemProperties() : CONSTRUCT_PROPERTY(ignoreForCollisions, ENTITY_ITEM_DEFAULT_IGNORE_FOR_COLLISIONS), CONSTRUCT_PROPERTY(collisionsWillMove, ENTITY_ITEM_DEFAULT_COLLISIONS_WILL_MOVE), CONSTRUCT_PROPERTY(isSpotlight, false), - CONSTRUCT_PROPERTY(diffuseColor, ), - CONSTRUCT_PROPERTY(ambientColor, ), - CONSTRUCT_PROPERTY(specularColor, ), CONSTRUCT_PROPERTY(intensity, 1.0f), - CONSTRUCT_PROPERTY(linearAttenuation, 0.0f), - CONSTRUCT_PROPERTY(quadraticAttenuation, 0.0f), CONSTRUCT_PROPERTY(exponent, 0.0f), CONSTRUCT_PROPERTY(cutoff, PI), CONSTRUCT_PROPERTY(locked, ENTITY_ITEM_DEFAULT_LOCKED), @@ -222,12 +217,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { CHECK_PROPERTY_CHANGE(PROP_IGNORE_FOR_COLLISIONS, ignoreForCollisions); CHECK_PROPERTY_CHANGE(PROP_COLLISIONS_WILL_MOVE, collisionsWillMove); CHECK_PROPERTY_CHANGE(PROP_IS_SPOTLIGHT, isSpotlight); - CHECK_PROPERTY_CHANGE(PROP_DIFFUSE_COLOR, diffuseColor); - CHECK_PROPERTY_CHANGE(PROP_AMBIENT_COLOR, ambientColor); - CHECK_PROPERTY_CHANGE(PROP_SPECULAR_COLOR, specularColor); CHECK_PROPERTY_CHANGE(PROP_INTENSITY, intensity); - CHECK_PROPERTY_CHANGE(PROP_LINEAR_ATTENUATION, linearAttenuation); - CHECK_PROPERTY_CHANGE(PROP_QUADRATIC_ATTENUATION, quadraticAttenuation); CHECK_PROPERTY_CHANGE(PROP_EXPONENT, exponent); CHECK_PROPERTY_CHANGE(PROP_CUTOFF, cutoff); CHECK_PROPERTY_CHANGE(PROP_LOCKED, locked); @@ -281,12 +271,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine) cons COPY_PROPERTY_TO_QSCRIPTVALUE(ignoreForCollisions); COPY_PROPERTY_TO_QSCRIPTVALUE(collisionsWillMove); COPY_PROPERTY_TO_QSCRIPTVALUE(isSpotlight); - COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(diffuseColor, getDiffuseColor()); - COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(ambientColor, getAmbientColor()); - COPY_PROPERTY_TO_QSCRIPTVALUE_COLOR_GETTER(specularColor, getSpecularColor()); COPY_PROPERTY_TO_QSCRIPTVALUE(intensity); - COPY_PROPERTY_TO_QSCRIPTVALUE(linearAttenuation); - COPY_PROPERTY_TO_QSCRIPTVALUE(quadraticAttenuation); COPY_PROPERTY_TO_QSCRIPTVALUE(exponent); COPY_PROPERTY_TO_QSCRIPTVALUE(cutoff); COPY_PROPERTY_TO_QSCRIPTVALUE(locked); @@ -359,12 +344,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object) { COPY_PROPERTY_FROM_QSCRIPTVALUE_BOOL(ignoreForCollisions, setIgnoreForCollisions); COPY_PROPERTY_FROM_QSCRIPTVALUE_BOOL(collisionsWillMove, setCollisionsWillMove); COPY_PROPERTY_FROM_QSCRIPTVALUE_BOOL(isSpotlight, setIsSpotlight); - COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(diffuseColor, setDiffuseColor); - COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(ambientColor, setAmbientColor); - COPY_PROPERTY_FROM_QSCRIPTVALUE_COLOR(specularColor, setSpecularColor); COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(intensity, setIntensity); - COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(linearAttenuation, setLinearAttenuation); - COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(quadraticAttenuation, setQuadraticAttenuation); COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(exponent, setExponent); COPY_PROPERTY_FROM_QSCRIPTVALUE_FLOAT(cutoff, setCutoff); COPY_PROPERTY_FROM_QSCRIPTVALUE_BOOL(locked, setLocked); @@ -543,12 +523,8 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem if (properties.getType() == EntityTypes::Light) { APPEND_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, appendValue, properties.getIsSpotlight()); - APPEND_ENTITY_PROPERTY(PROP_DIFFUSE_COLOR, appendColor, properties.getDiffuseColor()); - APPEND_ENTITY_PROPERTY(PROP_AMBIENT_COLOR, appendColor, properties.getAmbientColor()); - APPEND_ENTITY_PROPERTY(PROP_SPECULAR_COLOR, appendColor, properties.getSpecularColor()); + APPEND_ENTITY_PROPERTY(PROP_COLOR, appendColor, properties.getColor()); APPEND_ENTITY_PROPERTY(PROP_INTENSITY, appendValue, properties.getIntensity()); - APPEND_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION, appendValue, properties.getLinearAttenuation()); - APPEND_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION, appendValue, properties.getQuadraticAttenuation()); APPEND_ENTITY_PROPERTY(PROP_EXPONENT, appendValue, properties.getExponent()); APPEND_ENTITY_PROPERTY(PROP_CUTOFF, appendValue, properties.getCutoff()); } @@ -765,12 +741,8 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int if (properties.getType() == EntityTypes::Light) { READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_IS_SPOTLIGHT, bool, setIsSpotlight); - READ_ENTITY_PROPERTY_COLOR_TO_PROPERTIES(PROP_DIFFUSE_COLOR, setDiffuseColor); - READ_ENTITY_PROPERTY_COLOR_TO_PROPERTIES(PROP_AMBIENT_COLOR, setAmbientColor); - READ_ENTITY_PROPERTY_COLOR_TO_PROPERTIES(PROP_SPECULAR_COLOR, setSpecularColor); + READ_ENTITY_PROPERTY_COLOR_TO_PROPERTIES(PROP_COLOR, setColor); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_INTENSITY, float, setIntensity); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LINEAR_ATTENUATION, float, setLinearAttenuation); - READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_QUADRATIC_ATTENUATION, float, setQuadraticAttenuation); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_EXPONENT, float, setExponent); READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CUTOFF, float, setCutoff); } @@ -835,12 +807,7 @@ void EntityItemProperties::markAllChanged() { _ignoreForCollisionsChanged = true; _collisionsWillMoveChanged = true; - _diffuseColorChanged = true; - _ambientColorChanged = true; - _specularColorChanged = true; _intensityChanged = true; - _linearAttenuationChanged = true; - _quadraticAttenuationChanged = true; _exponentChanged = true; _cutoffChanged = true; _lockedChanged = true; diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 9b43a21402..12cc50b6ea 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -66,12 +66,12 @@ enum EntityPropertyList { // property used by Light entity PROP_IS_SPOTLIGHT, - PROP_DIFFUSE_COLOR, - PROP_AMBIENT_COLOR, - PROP_SPECULAR_COLOR, + PROP_DIFFUSE_COLOR_UNUSED, + PROP_AMBIENT_COLOR_UNUSED, + PROP_SPECULAR_COLOR_UNUSED, PROP_INTENSITY, // Previously PROP_CONSTANT_ATTENUATION - PROP_LINEAR_ATTENUATION, - PROP_QUADRATIC_ATTENUATION, + PROP_LINEAR_ATTENUATION_UNUSED, + PROP_QUADRATIC_ATTENUATION_UNUSED, PROP_EXPONENT, PROP_CUTOFF, @@ -165,12 +165,7 @@ public: DEFINE_PROPERTY(PROP_IGNORE_FOR_COLLISIONS, IgnoreForCollisions, ignoreForCollisions, bool); DEFINE_PROPERTY(PROP_COLLISIONS_WILL_MOVE, CollisionsWillMove, collisionsWillMove, bool); DEFINE_PROPERTY(PROP_IS_SPOTLIGHT, IsSpotlight, isSpotlight, bool); - DEFINE_PROPERTY_REF(PROP_DIFFUSE_COLOR, DiffuseColor, diffuseColor, xColor); - DEFINE_PROPERTY_REF(PROP_AMBIENT_COLOR, AmbientColor, ambientColor, xColor); - DEFINE_PROPERTY_REF(PROP_SPECULAR_COLOR, SpecularColor, specularColor, xColor); DEFINE_PROPERTY(PROP_INTENSITY, Intensity, intensity, float); - DEFINE_PROPERTY(PROP_LINEAR_ATTENUATION, LinearAttenuation, linearAttenuation, float); - DEFINE_PROPERTY(PROP_QUADRATIC_ATTENUATION, QuadraticAttenuation, quadraticAttenuation, float); DEFINE_PROPERTY(PROP_EXPONENT, Exponent, exponent, float); DEFINE_PROPERTY(PROP_CUTOFF, Cutoff, cutoff, float); DEFINE_PROPERTY(PROP_LOCKED, Locked, locked, bool); @@ -288,12 +283,7 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) { DEBUG_PROPERTY_IF_CHANGED(debug, properties, IgnoreForCollisions, ignoreForCollisions, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, CollisionsWillMove, collisionsWillMove, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, IsSpotlight, isSpotlight, ""); - DEBUG_PROPERTY_IF_CHANGED(debug, properties, DiffuseColor, diffuseColor, ""); - DEBUG_PROPERTY_IF_CHANGED(debug, properties, AmbientColor, ambientColor, ""); - DEBUG_PROPERTY_IF_CHANGED(debug, properties, SpecularColor, specularColor, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, Intensity, intensity, ""); - DEBUG_PROPERTY_IF_CHANGED(debug, properties, LinearAttenuation, linearAttenuation, ""); - DEBUG_PROPERTY_IF_CHANGED(debug, properties, QuadraticAttenuation, quadraticAttenuation, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, Exponent, exponent, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, Cutoff, cutoff, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, Locked, locked, ""); diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index 8f075b099e..d2fce92dca 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -97,16 +97,16 @@ int LightEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, READ_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, bool, _isSpotlight); // _diffuseColor has been renamed to _color - READ_ENTITY_PROPERTY_COLOR(PROP_DIFFUSE_COLOR, _color); + READ_ENTITY_PROPERTY_COLOR(PROP_DIFFUSE_COLOR_UNUSED, _color); - READ_ENTITY_PROPERTY_COLOR(PROP_AMBIENT_COLOR, ambientColor); - READ_ENTITY_PROPERTY_COLOR(PROP_SPECULAR_COLOR, specularColor); + READ_ENTITY_PROPERTY_COLOR(PROP_AMBIENT_COLOR_UNUSED, ambientColor); + READ_ENTITY_PROPERTY_COLOR(PROP_SPECULAR_COLOR_UNUSED, specularColor); // _constantAttenuation has been renamed to _intensity READ_ENTITY_PROPERTY(PROP_INTENSITY, float, _intensity); - READ_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION, float, attenuation); - READ_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION, float, attenuation); + READ_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION_UNUSED, float, attenuation); + READ_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION_UNUSED, float, attenuation); READ_ENTITY_PROPERTY(PROP_EXPONENT, float, _exponent); READ_ENTITY_PROPERTY(PROP_CUTOFF, float, _cutoff); } else { From 1a3eb68e2d9c452dd7d844635c1a65c3ef206738 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 2 Mar 2015 09:25:18 -0800 Subject: [PATCH 7/7] Update lightEntityItem old version handling to be more clear --- libraries/entities/src/LightEntityItem.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libraries/entities/src/LightEntityItem.cpp b/libraries/entities/src/LightEntityItem.cpp index d2fce92dca..3265891b18 100644 --- a/libraries/entities/src/LightEntityItem.cpp +++ b/libraries/entities/src/LightEntityItem.cpp @@ -89,24 +89,27 @@ int LightEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, const unsigned char* dataAt = data; if (args.bitstreamVersion < VERSION_ENTITIES_LIGHT_HAS_INTENSITY_AND_COLOR_PROPERTIES) { - rgbColor diffuseColor; - rgbColor ambientColor; - rgbColor specularColor; - float attenuation; + rgbColor ignoredColor; + float ignoredAttenuation; READ_ENTITY_PROPERTY(PROP_IS_SPOTLIGHT, bool, _isSpotlight); // _diffuseColor has been renamed to _color READ_ENTITY_PROPERTY_COLOR(PROP_DIFFUSE_COLOR_UNUSED, _color); - READ_ENTITY_PROPERTY_COLOR(PROP_AMBIENT_COLOR_UNUSED, ambientColor); - READ_ENTITY_PROPERTY_COLOR(PROP_SPECULAR_COLOR_UNUSED, specularColor); + // Ambient and specular color are from an older format and are no longer supported. + // Their values will be ignored. + READ_ENTITY_PROPERTY_COLOR(PROP_AMBIENT_COLOR_UNUSED, ignoredColor); + READ_ENTITY_PROPERTY_COLOR(PROP_SPECULAR_COLOR_UNUSED, ignoredColor); // _constantAttenuation has been renamed to _intensity READ_ENTITY_PROPERTY(PROP_INTENSITY, float, _intensity); - READ_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION_UNUSED, float, attenuation); - READ_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION_UNUSED, float, attenuation); + // Linear and quadratic attenuation are from an older format and are no longer supported. + // Their values will be ignored. + READ_ENTITY_PROPERTY(PROP_LINEAR_ATTENUATION_UNUSED, float, ignoredAttenuation); + READ_ENTITY_PROPERTY(PROP_QUADRATIC_ATTENUATION_UNUSED, float, ignoredAttenuation); + READ_ENTITY_PROPERTY(PROP_EXPONENT, float, _exponent); READ_ENTITY_PROPERTY(PROP_CUTOFF, float, _cutoff); } else {