Browse Source

Minor refactor to manually rename the range-based-for-loop index.

Yao Wei Tjong 姚伟忠 8 years ago
parent
commit
617b2d8cf7

+ 5 - 5
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -2759,7 +2759,7 @@ void CreatePivotlessFbxBoneStruct(OutModel &model)
 {
     // Init
     model.pivotlessBones_.Clear();
-    aiMatrix4x4 chain[TransformationComp_MAXIMUM];
+    aiMatrix4x4 chains[TransformationComp_MAXIMUM];
 
     for (unsigned i = 0; i < model.bones_.Size(); ++i)
     {
@@ -2769,13 +2769,13 @@ void CreatePivotlessFbxBoneStruct(OutModel &model)
         if (mainBoneName.Find("$AssimpFbx$") != String::NPOS)
             continue;
 
-        std::fill_n(chain, static_cast<unsigned int>(TransformationComp_MAXIMUM), aiMatrix4x4());
-        FillChainTransforms(model, &chain[0], mainBoneName);
+        std::fill_n(chains, static_cast<unsigned int>(TransformationComp_MAXIMUM), aiMatrix4x4());
+        FillChainTransforms(model, &chains[0], mainBoneName);
 
         // Calculate chained transform
         aiMatrix4x4 finalTransform;
-        for (const auto& j : chain)
-            finalTransform = finalTransform * j;
+        for (const auto& chain : chains)
+            finalTransform = finalTransform * chain;
 
         // New bone node
         auto*pnode = new aiNode;

+ 4 - 4
Source/Urho3D/Graphics/DecalSet.cpp

@@ -555,8 +555,8 @@ void DecalSet::SetDecalsAttr(const PODVector<unsigned char>& value)
             {
                 for (float& blendWeight : i->blendWeights_)
                     blendWeight = buffer.ReadFloat();
-                for (unsigned char& blendIndice : i->blendIndices_)
-                    blendIndice = buffer.ReadUByte();
+                for (unsigned char& blendIndex : i->blendIndices_)
+                    blendIndex = buffer.ReadUByte();
             }
         }
 
@@ -625,8 +625,8 @@ PODVector<unsigned char> DecalSet::GetDecalsAttr() const
             {
                 for (float blendWeight : j->blendWeights_)
                     ret.WriteFloat(blendWeight);
-                for (unsigned char blendIndice : j->blendIndices_)
-                    ret.WriteUByte(blendIndice);
+                for (unsigned char blendIndex : j->blendIndices_)
+                    ret.WriteUByte(blendIndex);
             }
         }
 

+ 6 - 6
Source/Urho3D/Graphics/Direct3D11/D3D11ShaderVariation.cpp

@@ -146,7 +146,7 @@ void ShaderVariation::Release()
     compilerOutput_.Clear();
 
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
-        useTextureUnit_[i] = false;
+        useTextureUnits_[i] = false;
     for (unsigned i = 0; i < MAX_SHADER_PARAMETER_GROUPS; ++i)
         constantBufferSizes_[i] = 0;
     parameters_.Clear();
@@ -214,7 +214,7 @@ bool ShaderVariation::LoadByteCode(const String& binaryShaderName)
         unsigned reg = file->ReadUByte();
 
         if (reg < MAX_TEXTURE_UNITS)
-            useTextureUnit_[reg] = true;
+            useTextureUnits_[reg] = true;
     }
 
     unsigned byteCodeSize = file->ReadUInt();
@@ -335,7 +335,7 @@ bool ShaderVariation::Compile()
 
     URHO3D_SAFE_RELEASE(shaderCode);
     URHO3D_SAFE_RELEASE(errorMsgs);
-    
+
     return !byteCode_.Empty();
 }
 
@@ -380,7 +380,7 @@ void ShaderVariation::ParseParameters(unsigned char* bufData, unsigned bufSize)
         if (resourceDesc.Type == D3D_SIT_CBUFFER)
             cbRegisterMap[resourceName] = resourceDesc.BindPoint;
         else if (resourceDesc.Type == D3D_SIT_SAMPLER && resourceDesc.BindPoint < MAX_TEXTURE_UNITS)
-            useTextureUnit_[resourceDesc.BindPoint] = true;
+            useTextureUnits_[resourceDesc.BindPoint] = true;
     }
 
     for (unsigned i = 0; i < shaderDesc.ConstantBuffers; ++i)
@@ -453,13 +453,13 @@ void ShaderVariation::SaveByteCode(const String& binaryShaderName)
     unsigned usedTextureUnits = 0;
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
     {
-        if (useTextureUnit_[i])
+        if (useTextureUnits_[i])
             ++usedTextureUnits;
     }
     file->WriteUInt(usedTextureUnits);
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
     {
-        if (useTextureUnit_[i])
+        if (useTextureUnits_[i])
         {
             file->WriteString(graphics_->GetTextureUnitName((TextureUnit)i));
             file->WriteUByte((unsigned char)i);

+ 3 - 3
Source/Urho3D/Graphics/Direct3D11/D3D11Texture.cpp

@@ -137,9 +137,9 @@ void Texture::UpdateParameters()
     if (shadowCompare_)
         filterModeIndex += 5;
     samplerDesc.Filter = d3dFilterMode[filterModeIndex];
-    samplerDesc.AddressU = d3dAddressMode[addressMode_[0]];
-    samplerDesc.AddressV = d3dAddressMode[addressMode_[1]];
-    samplerDesc.AddressW = d3dAddressMode[addressMode_[2]];
+    samplerDesc.AddressU = d3dAddressMode[addressModes_[0]];
+    samplerDesc.AddressV = d3dAddressMode[addressModes_[1]];
+    samplerDesc.AddressW = d3dAddressMode[addressModes_[2]];
     samplerDesc.MaxAnisotropy = anisotropy_ ? anisotropy_ : graphics_->GetDefaultTextureAnisotropy();
     samplerDesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL;
     samplerDesc.MinLOD = -M_INFINITY;

+ 5 - 5
Source/Urho3D/Graphics/Direct3D9/D3D9ShaderVariation.cpp

@@ -159,7 +159,7 @@ void ShaderVariation::Release()
     compilerOutput_.Clear();
 
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
-        useTextureUnit_[i] = false;
+        useTextureUnits_[i] = false;
     parameters_.Clear();
 }
 
@@ -214,7 +214,7 @@ bool ShaderVariation::LoadByteCode(const String& binaryShaderName)
         unsigned reg = file->ReadUByte();
 
         if (reg < MAX_TEXTURE_UNITS)
-            useTextureUnit_[reg] = true;
+            useTextureUnits_[reg] = true;
     }
 
     unsigned byteCodeSize = file->ReadUInt();
@@ -350,7 +350,7 @@ void ShaderVariation::ParseParameters(unsigned char* bufData, unsigned bufSize)
             if (reg < MAX_TEXTURE_UNITS)
             {
                 if (name != "AlbedoBuffer" && name != "NormalBuffer" && name != "DepthBuffer" && name != "LightBuffer")
-                    useTextureUnit_[reg] = true;
+                    useTextureUnits_[reg] = true;
             }
         }
         else
@@ -405,13 +405,13 @@ void ShaderVariation::SaveByteCode(const String& binaryShaderName)
     unsigned usedTextureUnits = 0;
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
     {
-        if (useTextureUnit_[i])
+        if (useTextureUnits_[i])
             ++usedTextureUnits;
     }
     file->WriteUInt(usedTextureUnits);
     for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
     {
-        if (useTextureUnit_[i])
+        if (useTextureUnits_[i])
         {
             file->WriteString(graphics_->GetTextureUnitName((TextureUnit)i));
             file->WriteUByte((unsigned char)i);

+ 17 - 17
Source/Urho3D/Graphics/Octree.cpp

@@ -77,8 +77,8 @@ Octant::Octant(const BoundingBox& box, unsigned level, Octant* parent, Octree* r
 {
     Initialize(box);
 
-    for (auto& i : children_)
-        i = nullptr;
+    for (auto& child : children_)
+        child = nullptr;
 }
 
 Octant::~Octant()
@@ -201,10 +201,10 @@ void Octant::ResetRoot()
     for (PODVector<Drawable*>::Iterator i = drawables_.Begin(); i != drawables_.End(); ++i)
         (*i)->SetOctant(nullptr);
 
-    for (auto& i : children_)
+    for (auto& child : children_)
     {
-        if (i)
-            i->ResetRoot();
+        if (child)
+            child->ResetRoot();
     }
 }
 
@@ -214,10 +214,10 @@ void Octant::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
     {
         debug->AddBoundingBox(worldBoundingBox_, Color(0.25f, 0.25f, 0.25f), depthTest);
 
-        for (auto& i : children_)
+        for (auto& child : children_)
         {
-            if (i)
-                i->DrawDebugGeometry(debug, depthTest);
+            if (child)
+                child->DrawDebugGeometry(debug, depthTest);
         }
     }
 }
@@ -251,10 +251,10 @@ void Octant::GetDrawablesInternal(OctreeQuery& query, bool inside) const
         query.TestDrawables(start, end, inside);
     }
 
-    for (auto i : children_)
+    for (auto child : children_)
     {
-        if (i)
-            i->GetDrawablesInternal(query, inside);
+        if (child)
+            child->GetDrawablesInternal(query, inside);
     }
 }
 
@@ -278,10 +278,10 @@ void Octant::GetDrawablesInternal(RayOctreeQuery& query) const
         }
     }
 
-    for (auto i : children_)
+    for (auto child : children_)
     {
-        if (i)
-            i->GetDrawablesInternal(query);
+        if (child)
+            child->GetDrawablesInternal(query);
     }
 }
 
@@ -305,10 +305,10 @@ void Octant::GetDrawablesOnlyInternal(RayOctreeQuery& query, PODVector<Drawable*
         }
     }
 
-    for (auto i : children_)
+    for (auto child : children_)
     {
-        if (i)
-            i->GetDrawablesOnlyInternal(query, drawables);
+        if (child)
+            child->GetDrawablesOnlyInternal(query, drawables);
     }
 }
 

+ 5 - 5
Source/Urho3D/Graphics/OpenGL/OGLShaderProgram.cpp

@@ -65,8 +65,8 @@ ShaderProgram::ShaderProgram(Graphics* graphics, ShaderVariation* vertexShader,
     usedVertexAttributes_(0),
     frameNumber_(0)
 {
-    for (bool& i : useTextureUnit_)
-        i = false;
+    for (bool& useTextureUnit : useTextureUnits_)
+        useTextureUnit = false;
     for (auto& parameterSource : parameterSources_)
         parameterSource = (const void*)M_MAX_UNSIGNED;
 }
@@ -107,8 +107,8 @@ void ShaderProgram::Release()
         vertexAttributes_.Clear();
         usedVertexAttributes_ = 0;
 
-        for (bool& i : useTextureUnit_)
-            i = false;
+        for (bool& useTextureUnit : useTextureUnits_)
+            useTextureUnit = false;
         for (unsigned i = 0; i < MAX_SHADER_PARAMETER_GROUPS; ++i)
             constantBuffers_[i].Reset();
     }
@@ -311,7 +311,7 @@ bool ShaderProgram::Link()
 
             if (unit < MAX_TEXTURE_UNITS)
             {
-                useTextureUnit_[unit] = true;
+                useTextureUnits_[unit] = true;
                 glUniform1iv(location, 1, reinterpret_cast<int*>(&unit));
             }
         }

+ 2 - 2
Source/Urho3D/Graphics/OpenGL/OGLShaderProgram.h

@@ -59,7 +59,7 @@ public:
     bool HasParameter(StringHash param) const;
 
     /// Return whether uses a texture unit.
-    bool HasTextureUnit(TextureUnit unit) const { return useTextureUnit_[unit]; }
+    bool HasTextureUnit(TextureUnit unit) const { return useTextureUnits_[unit]; }
 
     /// Return the info for a shader parameter, or null if does not exist.
     const ShaderParameter* GetParameter(StringHash param) const;
@@ -94,7 +94,7 @@ private:
     /// Shader parameters.
     HashMap<StringHash, ShaderParameter> shaderParameters_;
     /// Texture unit use.
-    bool useTextureUnit_[MAX_TEXTURE_UNITS];
+    bool useTextureUnits_[MAX_TEXTURE_UNITS];
     /// Vertex attributes.
     HashMap<Pair<unsigned char, unsigned char>, unsigned> vertexAttributes_;
     /// Used vertex attribute location bitmask.

+ 3 - 3
Source/Urho3D/Graphics/OpenGL/OGLTexture.cpp

@@ -99,10 +99,10 @@ void Texture::UpdateParameters()
 #endif
 
     // Wrapping
-    glTexParameteri(target_, GL_TEXTURE_WRAP_S, GetWrapMode(addressMode_[COORD_U]));
-    glTexParameteri(target_, GL_TEXTURE_WRAP_T, GetWrapMode(addressMode_[COORD_V]));
+    glTexParameteri(target_, GL_TEXTURE_WRAP_S, GetWrapMode(addressModes_[COORD_U]));
+    glTexParameteri(target_, GL_TEXTURE_WRAP_T, GetWrapMode(addressModes_[COORD_V]));
 #ifndef GL_ES_VERSION_2_0
-    glTexParameteri(target_, GL_TEXTURE_WRAP_R, GetWrapMode(addressMode_[COORD_W]));
+    glTexParameteri(target_, GL_TEXTURE_WRAP_R, GetWrapMode(addressModes_[COORD_W]));
 #endif
 
     TextureFilterMode filterMode = filterMode_;

+ 2 - 2
Source/Urho3D/Graphics/OpenGL/OGLTextureCube.cpp

@@ -360,8 +360,8 @@ bool TextureCube::SetData(CubeMapFace face, Image* image, bool useAlpha)
 
     faceMemoryUse_[face] = memoryUse;
     unsigned totalMemoryUse = sizeof(TextureCube);
-    for (unsigned int i : faceMemoryUse_)
-        totalMemoryUse += i;
+    for (unsigned memoryUse : faceMemoryUse_)
+        totalMemoryUse += memoryUse;
     SetMemoryUse(totalMemoryUse);
     return true;
 }

+ 3 - 3
Source/Urho3D/Graphics/ShaderVariation.cpp

@@ -37,9 +37,9 @@ ShaderVariation::ShaderVariation(Shader* owner, ShaderType type) :
     type_(type),
     elementHash_(0)
 {
-    for (bool& i : useTextureUnit_)
-        i = false;
-    for (unsigned int& constantBufferSize : constantBufferSizes_)
+    for (bool& useTextureUnit : useTextureUnits_)
+        useTextureUnit = false;
+    for (unsigned& constantBufferSize : constantBufferSizes_)
         constantBufferSize = 0;
 }
 

+ 2 - 2
Source/Urho3D/Graphics/ShaderVariation.h

@@ -111,7 +111,7 @@ public:
     bool HasParameter(StringHash param) const { return parameters_.Contains(param); }
 
     /// Return whether uses a texture unit (only for pixel shaders.) Not applicable on OpenGL, where this information is contained in ShaderProgram instead.
-    bool HasTextureUnit(TextureUnit unit) const { return useTextureUnit_[unit]; }
+    bool HasTextureUnit(TextureUnit unit) const { return useTextureUnits_[unit]; }
 
     /// Return all parameter definitions. Not applicable on OpenGL, where this information is contained in ShaderProgram instead.
     const HashMap<StringHash, ShaderParameter>& GetParameters() const { return parameters_; }
@@ -158,7 +158,7 @@ private:
     /// Shader parameters.
     HashMap<StringHash, ShaderParameter> parameters_;
     /// Texture unit use flags.
-    bool useTextureUnit_[MAX_TEXTURE_UNITS];
+    bool useTextureUnits_[MAX_TEXTURE_UNITS];
     /// Constant buffer sizes. 0 if a constant buffer slot is not in use.
     unsigned constantBufferSizes_[MAX_SHADER_PARAMETER_GROUPS];
     /// Shader bytecode. Needed for inspecting the input signature and parameters. Not used on OpenGL.

+ 3 - 3
Source/Urho3D/Graphics/Texture.cpp

@@ -78,8 +78,8 @@ Texture::Texture(Context* context) :
     resolveDirty_(false),
     levelsDirty_(false)
 {
-    for (auto& i : addressMode_)
-        i = ADDRESS_WRAP;
+    for (auto& addressMode : addressModes_)
+        addressMode = ADDRESS_WRAP;
     for (int i = 0; i < MAX_TEXTURE_QUALITY_LEVELS; ++i)
         mipsToSkip_[i] = (unsigned)(MAX_TEXTURE_QUALITY_LEVELS - 1 - i);
 }
@@ -104,7 +104,7 @@ void Texture::SetFilterMode(TextureFilterMode mode)
 
 void Texture::SetAddressMode(TextureCoordinate coord, TextureAddressMode mode)
 {
-    addressMode_[coord] = mode;
+    addressModes_[coord] = mode;
     parametersDirty_ = true;
 }
 

+ 2 - 2
Source/Urho3D/Graphics/Texture.h

@@ -89,7 +89,7 @@ public:
     TextureFilterMode GetFilterMode() const { return filterMode_; }
 
     /// Return addressing mode by texture coordinate.
-    TextureAddressMode GetAddressMode(TextureCoordinate coord) const { return addressMode_[coord]; }
+    TextureAddressMode GetAddressMode(TextureCoordinate coord) const { return addressModes_[coord]; }
 
     /// Return texture max. anisotropy level. Value 0 means to use the default value from Renderer.
     unsigned GetAnisotropy() const { return anisotropy_; }
@@ -225,7 +225,7 @@ protected:
     /// Filtering mode.
     TextureFilterMode filterMode_;
     /// Addressing mode.
-    TextureAddressMode addressMode_[MAX_COORDS];
+    TextureAddressMode addressModes_[MAX_COORDS];
     /// Texture anisotropy level.
     unsigned anisotropy_;
     /// Mip levels to skip when loading per texture quality setting.

+ 2 - 2
Source/Urho3D/Graphics/Texture2D.cpp

@@ -140,8 +140,8 @@ bool Texture2D::SetSize(int width, int height, unsigned format, TextureUsage usa
         renderSurface_ = new RenderSurface(this);
 
         // Clamp mode addressing by default and nearest filtering
-        addressMode_[COORD_U] = ADDRESS_CLAMP;
-        addressMode_[COORD_V] = ADDRESS_CLAMP;
+        addressModes_[COORD_U] = ADDRESS_CLAMP;
+        addressModes_[COORD_V] = ADDRESS_CLAMP;
         filterMode_ = FILTER_NEAREST;
     }
 

+ 5 - 5
Source/Urho3D/Graphics/TextureCube.cpp

@@ -66,12 +66,12 @@ TextureCube::TextureCube(Context* context) :
 #endif
 
     // Default to clamp mode addressing
-    addressMode_[COORD_U] = ADDRESS_CLAMP;
-    addressMode_[COORD_V] = ADDRESS_CLAMP;
-    addressMode_[COORD_W] = ADDRESS_CLAMP;
+    addressModes_[COORD_U] = ADDRESS_CLAMP;
+    addressModes_[COORD_V] = ADDRESS_CLAMP;
+    addressModes_[COORD_W] = ADDRESS_CLAMP;
 
-    for (unsigned int& i : faceMemoryUse_)
-        i = 0;
+    for (unsigned& memoryUse : faceMemoryUse_)
+        memoryUse = 0;
 }
 
 TextureCube::~TextureCube()

+ 2 - 3
Source/Urho3D/Math/Ray.cpp

@@ -153,10 +153,9 @@ float Ray::HitDistance(const Frustum& frustum, bool solidInside) const
     float minInside = M_INFINITY;
     bool allInside = true;
 
-    for (const auto& i : frustum.planes_)
+    for (const auto& plane : frustum.planes_)
     {
-        const Plane& plane = i;
-        float distance = HitDistance(i);
+        float distance = HitDistance(plane);
 
         if (plane.Distance(origin_) < 0.0f)
         {

+ 2 - 2
Source/Urho3D/Navigation/NavigationMesh.cpp

@@ -1170,8 +1170,8 @@ void NavigationMesh::GetTileGeometry(NavBuildData* build, Vector<NavigationGeome
                             4, 0, 3, 4, 3, 7, 1, 0, 4, 1, 4, 5
                         };
 
-                        for (unsigned int indice : indices)
-                            build->indices_.Push(indice + destVertexStart);
+                        for (unsigned index : indices)
+                            build->indices_.Push(index + destVertexStart);
                     }
                     break;
 

+ 2 - 2
Source/Urho3D/UI/BorderImage.cpp

@@ -129,8 +129,8 @@ void BorderImage::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vert
     const IntVector2& offset)
 {
     bool allOpaque = true;
-    if (GetDerivedOpacity() < 1.0f || color_[C_TOPLEFT].a_ < 1.0f || color_[C_TOPRIGHT].a_ < 1.0f ||
-        color_[C_BOTTOMLEFT].a_ < 1.0f || color_[C_BOTTOMRIGHT].a_ < 1.0f)
+    if (GetDerivedOpacity() < 1.0f || colors_[C_TOPLEFT].a_ < 1.0f || colors_[C_TOPRIGHT].a_ < 1.0f ||
+        colors_[C_BOTTOMLEFT].a_ < 1.0f || colors_[C_BOTTOMRIGHT].a_ < 1.0f)
         allOpaque = false;
 
     UIBatch

+ 6 - 6
Source/Urho3D/UI/Sprite.cpp

@@ -73,10 +73,10 @@ void Sprite::RegisterObject(Context* context)
     URHO3D_ACCESSOR_ATTRIBUTE("Priority", GetPriority, SetPriority, int, 0, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Opacity", GetOpacity, SetOpacity, float, 1.0f, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Color", GetColorAttr, SetColor, Color, Color::WHITE, AM_FILE);
-    URHO3D_ATTRIBUTE("Top Left Color", Color, color_[0], Color::WHITE, AM_FILE);
-    URHO3D_ATTRIBUTE("Top Right Color", Color, color_[1], Color::WHITE, AM_FILE);
-    URHO3D_ATTRIBUTE("Bottom Left Color", Color, color_[2], Color::WHITE, AM_FILE);
-    URHO3D_ATTRIBUTE("Bottom Right Color", Color, color_[3], Color::WHITE, AM_FILE);
+    URHO3D_ATTRIBUTE("Top Left Color", Color, colors_[0], Color::WHITE, AM_FILE);
+    URHO3D_ATTRIBUTE("Top Right Color", Color, colors_[1], Color::WHITE, AM_FILE);
+    URHO3D_ATTRIBUTE("Bottom Left Color", Color, colors_[2], Color::WHITE, AM_FILE);
+    URHO3D_ATTRIBUTE("Bottom Right Color", Color, colors_[3], Color::WHITE, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Is Visible", IsVisible, SetVisible, bool, true, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Use Derived Opacity", GetUseDerivedOpacity, SetUseDerivedOpacity, bool, true, AM_FILE);
     URHO3D_ATTRIBUTE("Variables", VariantMap, vars_, Variant::emptyVariantMap, AM_FILE);
@@ -112,8 +112,8 @@ IntVector2 Sprite::ElementToScreen(const IntVector2& position)
 void Sprite::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor)
 {
     bool allOpaque = true;
-    if (GetDerivedOpacity() < 1.0f || color_[C_TOPLEFT].a_ < 1.0f || color_[C_TOPRIGHT].a_ < 1.0f ||
-        color_[C_BOTTOMLEFT].a_ < 1.0f || color_[C_BOTTOMRIGHT].a_ < 1.0f)
+    if (GetDerivedOpacity() < 1.0f || colors_[C_TOPLEFT].a_ < 1.0f || colors_[C_TOPRIGHT].a_ < 1.0f ||
+        colors_[C_BOTTOMLEFT].a_ < 1.0f || colors_[C_BOTTOMRIGHT].a_ < 1.0f)
         allOpaque = false;
 
     const IntVector2& size = GetSize();

+ 4 - 4
Source/Urho3D/UI/Text3D.cpp

@@ -93,10 +93,10 @@ void Text3D::RegisterObject(Context* context)
         VA_TOP, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Opacity", GetOpacity, SetOpacity, float, 1.0f, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Color", GetColorAttr, SetColor, Color, Color::WHITE, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Top Left Color", Color, text_.color_[0], Color::WHITE, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Top Right Color", Color, text_.color_[1], Color::WHITE, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Bottom Left Color", Color, text_.color_[2], Color::WHITE, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Bottom Right Color", Color, text_.color_[3], Color::WHITE, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Top Left Color", Color, text_.colors_[0], Color::WHITE, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Top Right Color", Color, text_.colors_[1], Color::WHITE, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Bottom Left Color", Color, text_.colors_[2], Color::WHITE, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Bottom Right Color", Color, text_.colors_[3], Color::WHITE, AM_DEFAULT);
     URHO3D_ENUM_ATTRIBUTE("Text Effect", text_.textEffect_, textEffects, TE_NONE, AM_DEFAULT);
     URHO3D_ATTRIBUTE("Shadow Offset", IntVector2, text_.shadowOffset_, IntVector2(1, 1), AM_DEFAULT);
     URHO3D_ATTRIBUTE("Stroke Thickness", int, text_.strokeThickness_, 1, AM_DEFAULT);

+ 1 - 1
Source/Urho3D/UI/Text3D.h

@@ -170,7 +170,7 @@ public:
     String GetTextAttr() const;
 
     /// Get color attribute. Uses just the top-left color.
-    const Color& GetColorAttr() const { return text_.color_[0]; }
+    const Color& GetColorAttr() const { return text_.colors_[0]; }
 
 protected:
     /// Handle node being assigned.

+ 10 - 10
Source/Urho3D/UI/UIElement.cpp

@@ -177,10 +177,10 @@ void UIElement::RegisterObject(Context* context)
     URHO3D_ACCESSOR_ATTRIBUTE("Priority", GetPriority, SetPriority, int, 0, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Opacity", GetOpacity, SetOpacity, float, 1.0f, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Color", GetColorAttr, SetColor, Color, Color::WHITE, AM_FILE);
-    URHO3D_ATTRIBUTE("Top Left Color", Color, color_[0], Color::WHITE, AM_FILE);
-    URHO3D_ATTRIBUTE("Top Right Color", Color, color_[1], Color::WHITE, AM_FILE);
-    URHO3D_ATTRIBUTE("Bottom Left Color", Color, color_[2], Color::WHITE, AM_FILE);
-    URHO3D_ATTRIBUTE("Bottom Right Color", Color, color_[3], Color::WHITE, AM_FILE);
+    URHO3D_ATTRIBUTE("Top Left Color", Color, colors_[0], Color::WHITE, AM_FILE);
+    URHO3D_ATTRIBUTE("Top Right Color", Color, colors_[1], Color::WHITE, AM_FILE);
+    URHO3D_ATTRIBUTE("Bottom Left Color", Color, colors_[2], Color::WHITE, AM_FILE);
+    URHO3D_ATTRIBUTE("Bottom Right Color", Color, colors_[3], Color::WHITE, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Is Enabled", IsEnabled, SetEnabled, bool, false, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Is Editable", IsEditable, SetEditable, bool, true, AM_FILE);
     URHO3D_ACCESSOR_ATTRIBUTE("Is Selected", IsSelected, SetSelected, bool, false, AM_FILE);
@@ -208,7 +208,7 @@ void UIElement::ApplyAttributes()
 
     for (unsigned i = 1; i < MAX_UIELEMENT_CORNERS; ++i)
     {
-        if (color_[i] != color_[0])
+        if (colors_[i] != colors_[0])
             colorGradient_ = true;
     }
 }
@@ -866,21 +866,21 @@ void UIElement::SetClipBorder(const IntRect& rect)
 
 void UIElement::SetColor(const Color& color)
 {
-    for (auto& i : color_)
-        i = color;
+    for (auto& cornerColor : colors_)
+        cornerColor = color;
     colorGradient_ = false;
     derivedColorDirty_ = true;
 }
 
 void UIElement::SetColor(Corner corner, const Color& color)
 {
-    color_[corner] = color;
+    colors_[corner] = color;
     colorGradient_ = false;
     derivedColorDirty_ = true;
 
     for (unsigned i = 0; i < MAX_UIELEMENT_CORNERS; ++i)
     {
-        if (i != corner && color_[i] != color_[corner])
+        if (i != corner && colors_[i] != colors_[corner])
             colorGradient_ = true;
     }
 }
@@ -1719,7 +1719,7 @@ const Color& UIElement::GetDerivedColor() const
 {
     if (derivedColorDirty_)
     {
-        derivedColor_ = color_[C_TOPLEFT];
+        derivedColor_ = colors_[C_TOPLEFT];
         derivedColor_.a_ *= GetDerivedOpacity();
         derivedColorDirty_ = false;
     }

+ 3 - 3
Source/Urho3D/UI/UIElement.h

@@ -468,7 +468,7 @@ public:
     const IntRect& GetClipBorder() const { return clipBorder_; }
 
     /// Return corner color.
-    const Color& GetColor(Corner corner) const { return color_[corner]; }
+    const Color& GetColor(Corner corner) const { return colors_[corner]; }
 
     /// Return priority.
     int GetPriority() const { return priority_; }
@@ -627,7 +627,7 @@ public:
     void GetBatchesWithOffset(IntVector2& offset, PODVector<UIBatch>& batches, PODVector<float>& vertexData, IntRect currentScissor);
 
     /// Return color attribute. Uses just the top-left color.
-    const Color& GetColorAttr() const { return color_[0]; }
+    const Color& GetColorAttr() const { return colors_[0]; }
 
     /// Return traversal mode for rendering.
     TraversalMode GetTraversalMode() const { return traversalMode_; }
@@ -673,7 +673,7 @@ protected:
     /// Child element clipping border.
     IntRect clipBorder_;
     /// Colors.
-    Color color_[MAX_UIELEMENT_CORNERS];
+    Color colors_[MAX_UIELEMENT_CORNERS];
     /// User variables.
     VariantMap vars_;
     /// Priority.