Browse Source

Clang-Tidy - hicpp-member-init.

Yao Wei Tjong 姚伟忠 7 years ago
parent
commit
6d08bcd8c0
100 changed files with 584 additions and 947 deletions
  1. 1 1
      Source/Samples/17_SceneReplication/SceneReplication.h
  2. 1 2
      Source/Samples/19_VehicleDemo/Vehicle.cpp
  3. 22 12
      Source/Samples/19_VehicleDemo/Vehicle.h
  4. 6 6
      Source/Samples/26_ConsoleInput/ConsoleInput.h
  5. 2 2
      Source/Samples/32_Urho2DConstraints/Urho2DConstraints.h
  6. 1 4
      Source/Samples/39_CrowdNavigation/CrowdNavigation.cpp
  7. 4 4
      Source/Samples/39_CrowdNavigation/CrowdNavigation.h
  8. 1 3
      Source/Samples/45_InverseKinematics/InverseKinematics.cpp
  9. 13 11
      Source/Samples/45_InverseKinematics/InverseKinematics.h
  10. 22 4
      Source/Samples/46_RaycastVehicle/Vehicle.cpp
  11. 0 2
      Source/Samples/49_Urho2DIsometricDemo/Character2D.cpp
  12. 0 4
      Source/Samples/49_Urho2DIsometricDemo/Urho2DIsometricDemo.cpp
  13. 0 2
      Source/Samples/50_Urho2DPlatformer/Character2D.cpp
  14. 1 5
      Source/Samples/50_Urho2DPlatformer/Urho2DPlatformer.cpp
  15. 2 4
      Source/Samples/50_Urho2DPlatformer/Urho2DPlatformer.h
  16. 0 2
      Source/Samples/Utilities2D/Mover.cpp
  17. 0 3
      Source/Samples/Utilities2D/Sample2D.cpp
  18. 1 3
      Source/Samples/Utilities2D/Sample2D.h
  19. 8 13
      Source/Tools/AssetImporter/AssetImporter.cpp
  20. 2 7
      Source/Tools/OgreImporter/OgreImporter.cpp
  21. 25 12
      Source/Tools/OgreImporter/OgreImporterUtils.h
  22. 3 3
      Source/Tools/PackageTool/PackageTool.cpp
  23. 9 19
      Source/Tools/SpritePacker/SpritePacker.cpp
  24. 2 2
      Source/Urho3D/AngelScript/Addons.cpp
  25. 1 1
      Source/Urho3D/AngelScript/Addons.h
  26. 1 4
      Source/Urho3D/AngelScript/ScriptFile.cpp
  27. 4 4
      Source/Urho3D/AngelScript/ScriptFile.h
  28. 1 5
      Source/Urho3D/AngelScript/ScriptInstance.cpp
  29. 4 4
      Source/Urho3D/AngelScript/ScriptInstance.h
  30. 1 4
      Source/Urho3D/Audio/Audio.cpp
  31. 7 7
      Source/Urho3D/Audio/Audio.h
  32. 1 1
      Source/Urho3D/Audio/SoundSource.h
  33. 4 4
      Source/Urho3D/Core/ProcessUtils.cpp
  34. 3 5
      Source/Urho3D/Core/Timer.cpp
  35. 2 2
      Source/Urho3D/Core/Timer.h
  36. 1 1
      Source/Urho3D/Engine/Console.h
  37. 2 2
      Source/Urho3D/Graphics/Camera.h
  38. 2 2
      Source/Urho3D/Graphics/ConstantBuffer.h
  39. 0 31
      Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp
  40. 3 5
      Source/Urho3D/Graphics/Direct3D11/D3D11RenderSurface.cpp
  41. 0 30
      Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.cpp
  42. 2 5
      Source/Urho3D/Graphics/Direct3D9/D3D9RenderSurface.cpp
  43. 2 13
      Source/Urho3D/Graphics/Drawable.cpp
  44. 6 6
      Source/Urho3D/Graphics/Drawable.h
  45. 1 3
      Source/Urho3D/Graphics/GPUObject.cpp
  46. 3 3
      Source/Urho3D/Graphics/GPUObject.h
  47. 5 10
      Source/Urho3D/Graphics/Graphics.cpp
  48. 64 64
      Source/Urho3D/Graphics/Graphics.h
  49. 2 10
      Source/Urho3D/Graphics/Material.cpp
  50. 13 13
      Source/Urho3D/Graphics/Material.h
  51. 1 10
      Source/Urho3D/Graphics/OcclusionBuffer.cpp
  52. 15 15
      Source/Urho3D/Graphics/OcclusionBuffer.h
  53. 0 4
      Source/Urho3D/Graphics/Octree.cpp
  54. 2 4
      Source/Urho3D/Graphics/Octree.h
  55. 0 31
      Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp
  56. 0 53
      Source/Urho3D/Graphics/OpenGL/OGLGraphicsImpl.cpp
  57. 21 21
      Source/Urho3D/Graphics/OpenGL/OGLGraphicsImpl.h
  58. 2 4
      Source/Urho3D/Graphics/OpenGL/OGLRenderSurface.cpp
  59. 2 6
      Source/Urho3D/Graphics/OpenGL/OGLShaderProgram.cpp
  60. 4 4
      Source/Urho3D/Graphics/OpenGL/OGLShaderProgram.h
  61. 7 0
      Source/Urho3D/Graphics/OpenGL/OGLShaderVariation.cpp
  62. 3 3
      Source/Urho3D/Graphics/RenderSurface.h
  63. 1 35
      Source/Urho3D/Graphics/Renderer.cpp
  64. 36 36
      Source/Urho3D/Graphics/Renderer.h
  65. 4 9
      Source/Urho3D/Graphics/ShaderVariation.cpp
  66. 18 18
      Source/Urho3D/Graphics/ShaderVariation.h
  67. 1 3
      Source/Urho3D/Graphics/StaticModelGroup.cpp
  68. 3 3
      Source/Urho3D/Graphics/StaticModelGroup.h
  69. 1 24
      Source/Urho3D/Graphics/Texture.cpp
  70. 24 27
      Source/Urho3D/Graphics/Texture.h
  71. 1 4
      Source/Urho3D/Graphics/Texture2DArray.cpp
  72. 1 1
      Source/Urho3D/Graphics/Texture2DArray.h
  73. 0 2
      Source/Urho3D/Graphics/Texture3D.cpp
  74. 0 3
      Source/Urho3D/Graphics/TextureCube.cpp
  75. 1 1
      Source/Urho3D/Graphics/TextureCube.h
  76. 1 10
      Source/Urho3D/Graphics/VertexBuffer.cpp
  77. 11 11
      Source/Urho3D/Graphics/VertexBuffer.h
  78. 1 14
      Source/Urho3D/Graphics/View.cpp
  79. 44 44
      Source/Urho3D/Graphics/View.h
  80. 11 14
      Source/Urho3D/IO/FileSystem.cpp
  81. 2 2
      Source/Urho3D/IO/FileSystem.h
  82. 1 3
      Source/Urho3D/IO/NamedPipe.cpp
  83. 1 1
      Source/Urho3D/IO/PackageFile.cpp
  84. 2 6
      Source/Urho3D/LuaScript/LuaScriptInstance.cpp
  85. 4 4
      Source/Urho3D/LuaScript/LuaScriptInstance.h
  86. 2 2
      Source/Urho3D/Math/AreaAllocator.h
  87. 3 7
      Source/Urho3D/Navigation/CrowdManager.cpp
  88. 6 6
      Source/Urho3D/Navigation/CrowdManager.h
  89. 11 14
      Source/Urho3D/Navigation/DynamicNavigationMesh.cpp
  90. 4 4
      Source/Urho3D/Navigation/DynamicNavigationMesh.h
  91. 8 8
      Source/Urho3D/Navigation/NavigationMesh.cpp
  92. 3 5
      Source/Urho3D/Network/HttpRequest.cpp
  93. 2 2
      Source/Urho3D/Physics/CollisionShape.h
  94. 0 11
      Source/Urho3D/Physics/PhysicsWorld.cpp
  95. 14 13
      Source/Urho3D/Physics/PhysicsWorld.h
  96. 4 13
      Source/Urho3D/Resource/Image.cpp
  97. 18 32
      Source/Urho3D/Resource/Image.h
  98. 8 8
      Source/Urho3D/Resource/PListFile.cpp
  99. 0 6
      Source/Urho3D/UI/FontFace.cpp
  100. 14 17
      Source/Urho3D/UI/FontFace.h

+ 1 - 1
Source/Samples/17_SceneReplication/SceneReplication.h

@@ -113,5 +113,5 @@ private:
     /// Instructions text.
     /// Instructions text.
     SharedPtr<Text> instructionsText_;
     SharedPtr<Text> instructionsText_;
     /// ID of own controllable object (client only.)
     /// ID of own controllable object (client only.)
-    unsigned clientObjectID_;
+    unsigned clientObjectID_{};
 };
 };

+ 1 - 2
Source/Samples/19_VehicleDemo/Vehicle.cpp

@@ -35,8 +35,7 @@
 #include "Vehicle.h"
 #include "Vehicle.h"
 
 
 Vehicle::Vehicle(Context* context) :
 Vehicle::Vehicle(Context* context) :
-    LogicComponent(context),
-    steering_(0.0f)
+    LogicComponent(context)
 {
 {
     // Only the physics update event is needed: unsubscribe from the rest for optimization
     // Only the physics update event is needed: unsubscribe from the rest for optimization
     SetUpdateEventMask(USE_FIXEDUPDATE);
     SetUpdateEventMask(USE_FIXEDUPDATE);

+ 22 - 12
Source/Samples/19_VehicleDemo/Vehicle.h

@@ -75,30 +75,40 @@ private:
     /// Acquire wheel components from wheel scene nodes.
     /// Acquire wheel components from wheel scene nodes.
     void GetWheelComponents();
     void GetWheelComponents();
 
 
-
-    // Wheel scene nodes.
+    /// Wheel scene front-left node.
     WeakPtr<Node> frontLeft_;
     WeakPtr<Node> frontLeft_;
+    /// Wheel scene front-right node.
     WeakPtr<Node> frontRight_;
     WeakPtr<Node> frontRight_;
+    /// Wheel scene rear-left node.
     WeakPtr<Node> rearLeft_;
     WeakPtr<Node> rearLeft_;
+    /// Wheel scene rear-right node.
     WeakPtr<Node> rearRight_;
     WeakPtr<Node> rearRight_;
 
 
-    // Steering axle constraints.
+    /// Steering front-left axle constraint.
     WeakPtr<Constraint> frontLeftAxis_;
     WeakPtr<Constraint> frontLeftAxis_;
+    /// Steering front-right axle constraint.
     WeakPtr<Constraint> frontRightAxis_;
     WeakPtr<Constraint> frontRightAxis_;
 
 
-    // Hull and wheel rigid bodies.
+    /// Hull and wheel hull rigid bodies.
     WeakPtr<RigidBody> hullBody_;
     WeakPtr<RigidBody> hullBody_;
+    /// Hull and wheel front-left rigid bodies.
     WeakPtr<RigidBody> frontLeftBody_;
     WeakPtr<RigidBody> frontLeftBody_;
+    /// Hull and wheel front-right rigid bodies.
     WeakPtr<RigidBody> frontRightBody_;
     WeakPtr<RigidBody> frontRightBody_;
+    /// Hull and wheel rear-left rigid bodies.
     WeakPtr<RigidBody> rearLeftBody_;
     WeakPtr<RigidBody> rearLeftBody_;
+    /// Hull and wheel rear-right rigid bodies.
     WeakPtr<RigidBody> rearRightBody_;
     WeakPtr<RigidBody> rearRightBody_;
 
 
-    // IDs of the wheel scene nodes for serialization.
-    unsigned frontLeftID_;
-    unsigned frontRightID_;
-    unsigned rearLeftID_;
-    unsigned rearRightID_;
-
-    /// Current left/right steering amount (-1 to 1.)
-    float steering_;
+    /// ID of the front-left wheel scene node for serialization.
+    unsigned frontLeftID_{};
+    /// ID of the front-right wheel scene node for serialization.
+    unsigned frontRightID_{};
+    /// ID of the rear-left wheel scene node for serialization.
+    unsigned rearLeftID_{};
+    /// ID of the rear-right wheel scene node for serialization.
+    unsigned rearRightID_{};
+
+    /// Current left/right steering amount (-1 to 1).
+    float steering_{};
 };
 };

+ 6 - 6
Source/Samples/26_ConsoleInput/ConsoleInput.h

@@ -72,15 +72,15 @@ private:
     void Print(const String& output);
     void Print(const String& output);
 
 
     /// Game on flag.
     /// Game on flag.
-    bool gameOn_;
+    bool gameOn_{};
     /// Food dispensed flag.
     /// Food dispensed flag.
-    bool foodAvailable_;
+    bool foodAvailable_{};
     /// Whether ate on the previous turn.
     /// Whether ate on the previous turn.
-    bool eatenLastTurn_;
+    bool eatenLastTurn_{};
     /// Number of turns survived.
     /// Number of turns survived.
-    int numTurns_;
+    int numTurns_{};
     /// Player's hunger level.
     /// Player's hunger level.
-    int hunger_;
+    int hunger_{};
     /// Threat of Urho level.
     /// Threat of Urho level.
-    int urhoThreat_;
+    int urhoThreat_{};
 };
 };

+ 2 - 2
Source/Samples/32_Urho2DConstraints/Urho2DConstraints.h

@@ -114,7 +114,7 @@ private:
     /// Get mouse position in 2D world coordinates.
     /// Get mouse position in 2D world coordinates.
     Vector2 GetMousePositionXY();
     Vector2 GetMousePositionXY();
     /// Flag for drawing debug geometry.
     /// Flag for drawing debug geometry.
-    bool drawDebug_;
+    bool drawDebug_{};
     /// Camera object.
     /// Camera object.
-    Camera* camera_;
+    Camera* camera_{};
 };
 };

+ 1 - 4
Source/Samples/39_CrowdNavigation/CrowdNavigation.cpp

@@ -52,10 +52,7 @@
 URHO3D_DEFINE_APPLICATION_MAIN(CrowdNavigation)
 URHO3D_DEFINE_APPLICATION_MAIN(CrowdNavigation)
 
 
 CrowdNavigation::CrowdNavigation(Context* context) :
 CrowdNavigation::CrowdNavigation(Context* context) :
-    Sample(context),
-    streamingDistance_(2),
-    drawDebug_(false),
-    instructionText_(nullptr)
+    Sample(context)
 {
 {
 }
 }
 
 

+ 4 - 4
Source/Samples/39_CrowdNavigation/CrowdNavigation.h

@@ -170,15 +170,15 @@ private:
     void HandleCrowdAgentFormation(StringHash eventType, VariantMap& eventData);
     void HandleCrowdAgentFormation(StringHash eventType, VariantMap& eventData);
 
 
     /// Flag for using navigation mesh streaming.
     /// Flag for using navigation mesh streaming.
-    bool useStreaming_;
+    bool useStreaming_{};
     /// Streaming distance.
     /// Streaming distance.
-    int streamingDistance_;
+    int streamingDistance_{2};
     /// Tile data.
     /// Tile data.
     HashMap<IntVector2, PODVector<unsigned char> > tileData_;
     HashMap<IntVector2, PODVector<unsigned char> > tileData_;
     /// Added tiles.
     /// Added tiles.
     HashSet<IntVector2> addedTiles_;
     HashSet<IntVector2> addedTiles_;
     /// Flag for drawing debug geometry.
     /// Flag for drawing debug geometry.
-    bool drawDebug_;
+    bool drawDebug_{};
     /// Instruction text UI-element.
     /// Instruction text UI-element.
-    Text* instructionText_;
+    Text* instructionText_{};
 };
 };

+ 1 - 3
Source/Samples/45_InverseKinematics/InverseKinematics.cpp

@@ -50,9 +50,7 @@
 URHO3D_DEFINE_APPLICATION_MAIN(InverseKinematics)
 URHO3D_DEFINE_APPLICATION_MAIN(InverseKinematics)
 
 
 InverseKinematics::InverseKinematics(Context* context) :
 InverseKinematics::InverseKinematics(Context* context) :
-    Sample(context),
-    floorPitch_(0.0f),
-    floorRoll_(0.0f)
+    Sample(context)
 {
 {
 }
 }
 
 

+ 13 - 11
Source/Samples/45_InverseKinematics/InverseKinematics.h

@@ -34,7 +34,7 @@ class Scene;
 }
 }
 
 
 /// Inverse Kinematics demo.
 /// Inverse Kinematics demo.
-/// This sample demonstrates how to adjust the position of animated feet so they match the ground's angle using IK
+/// This sample demonstrates how to adjust the position of animated feet so they match the ground's angle using IK.
 class InverseKinematics : public Sample
 class InverseKinematics : public Sample
 {
 {
     URHO3D_OBJECT(InverseKinematics, Sample);
     URHO3D_OBJECT(InverseKinematics, Sample);
@@ -49,20 +49,22 @@ public:
 protected:
 protected:
     /// Animation controller of Jack.
     /// Animation controller of Jack.
     SharedPtr<Urho3D::AnimationController> jackAnimCtrl_;
     SharedPtr<Urho3D::AnimationController> jackAnimCtrl_;
-    /// Inverse kinematic effectors and solver
+    /// Inverse kinematic left effector.
     SharedPtr<Urho3D::IKEffector> leftEffector_;
     SharedPtr<Urho3D::IKEffector> leftEffector_;
+    /// Inverse kinematic right effector.
     SharedPtr<Urho3D::IKEffector> rightEffector_;
     SharedPtr<Urho3D::IKEffector> rightEffector_;
+    /// Inverse kinematic solver.
     SharedPtr<Urho3D::IKSolver> solver_;
     SharedPtr<Urho3D::IKSolver> solver_;
-    /// Need references to these nodes to calculate foot angles and offsets
+    /// Need references to these nodes to calculate foot angles and offsets.
     SharedPtr<Urho3D::Node> leftFoot_;
     SharedPtr<Urho3D::Node> leftFoot_;
     SharedPtr<Urho3D::Node> rightFoot_;
     SharedPtr<Urho3D::Node> rightFoot_;
     SharedPtr<Urho3D::Node> jackNode_;
     SharedPtr<Urho3D::Node> jackNode_;
-    /// So we can rotate the floor
+    /// So we can rotate the floor.
     SharedPtr<Urho3D::Node> floorNode_;
     SharedPtr<Urho3D::Node> floorNode_;
-    float floorPitch_;
-    float floorRoll_;
-    /// Whether or not to draw debug geometry
-    bool drawDebug_;
+    float floorPitch_{};
+    float floorRoll_{};
+    /// Whether or not to draw debug geometry.
+    bool drawDebug_{};
 
 
 private:
 private:
     /// Construct the scene content.
     /// Construct the scene content.
@@ -77,10 +79,10 @@ private:
     void SubscribeToEvents();
     void SubscribeToEvents();
     /// Handle the logic update event.
     /// Handle the logic update event.
     void HandleUpdate(StringHash eventType, VariantMap& eventData);
     void HandleUpdate(StringHash eventType, VariantMap& eventData);
-    /// Draw debug geometry
+    /// Draw debug geometry.
     void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
     void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
-    /// Process IK logic
+    /// Process IK logic.
     void HandleSceneDrawableUpdateFinished(StringHash eventType, VariantMap& eventData);
     void HandleSceneDrawableUpdateFinished(StringHash eventType, VariantMap& eventData);
-
+    /// Camera node.
     SharedPtr<Node> cameraRotateNode_;
     SharedPtr<Node> cameraRotateNode_;
 };
 };

+ 22 - 4
Source/Samples/46_RaycastVehicle/Vehicle.cpp

@@ -1,3 +1,25 @@
+//
+// Copyright (c) 2008-2018 the Urho3D project.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
 #include "Vehicle.h"
 #include "Vehicle.h"
 #include <Urho3D/Core/Context.h>
 #include <Urho3D/Core/Context.h>
 #include <Urho3D/Graphics/DebugRenderer.h>
 #include <Urho3D/Graphics/DebugRenderer.h>
@@ -11,18 +33,14 @@
 #include <Urho3D/Physics/CollisionShape.h>
 #include <Urho3D/Physics/CollisionShape.h>
 #include <Urho3D/Physics/Constraint.h>
 #include <Urho3D/Physics/Constraint.h>
 #include <Urho3D/Physics/PhysicsEvents.h>
 #include <Urho3D/Physics/PhysicsEvents.h>
-#include <Urho3D/Physics/PhysicsUtils.h>
 #include <Urho3D/Physics/PhysicsWorld.h>
 #include <Urho3D/Physics/PhysicsWorld.h>
 #include <Urho3D/Physics/RaycastVehicle.h>
 #include <Urho3D/Physics/RaycastVehicle.h>
-#include <Urho3D/Physics/RigidBody.h>
 #include <Urho3D/Resource/ResourceCache.h>
 #include <Urho3D/Resource/ResourceCache.h>
 #include <Urho3D/Scene/Scene.h>
 #include <Urho3D/Scene/Scene.h>
-#include <Urho3D/Urho3D.h>
 
 
 using namespace Urho3D;
 using namespace Urho3D;
 
 
 const float CHASSIS_WIDTH = 2.6f;
 const float CHASSIS_WIDTH = 2.6f;
-const float WHEEL_WIDTH = 0.4f;
 
 
 void Vehicle::RegisterObject(Context* context)
 void Vehicle::RegisterObject(Context* context)
 {
 {

+ 0 - 2
Source/Samples/49_Urho2DIsometricDemo/Character2D.cpp

@@ -20,8 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-#include <Urho3D/Urho3D.h>
-
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Core/Context.h>
 #include <Urho3D/Core/Context.h>

+ 0 - 4
Source/Samples/49_Urho2DIsometricDemo/Urho2DIsometricDemo.cpp

@@ -20,8 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-#include <Urho3D/Urho3D.h>
-
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/UI/Button.h>
 #include <Urho3D/UI/Button.h>
@@ -32,7 +30,6 @@
 #include <Urho3D/Urho2D/CollisionPolygon2D.h>
 #include <Urho3D/Urho2D/CollisionPolygon2D.h>
 #include <Urho3D/Core/CoreEvents.h>
 #include <Urho3D/Core/CoreEvents.h>
 #include <Urho3D/Graphics/DebugRenderer.h>
 #include <Urho3D/Graphics/DebugRenderer.h>
-#include <Urho3D/Urho2D/Drawable2D.h>
 #include <Urho3D/Engine/Engine.h>
 #include <Urho3D/Engine/Engine.h>
 #include <Urho3D/UI/Font.h>
 #include <Urho3D/UI/Font.h>
 #include <Urho3D/Graphics/Graphics.h>
 #include <Urho3D/Graphics/Graphics.h>
@@ -51,7 +48,6 @@
 #include <Urho3D/UI/UIEvents.h>
 #include <Urho3D/UI/UIEvents.h>
 #include <Urho3D/Graphics/Zone.h>
 #include <Urho3D/Graphics/Zone.h>
 #include <Urho3D/Urho2D/PhysicsEvents2D.h>
 #include <Urho3D/Urho2D/PhysicsEvents2D.h>
-#include <Urho3D/Urho2D/PhysicsWorld2D.h>
 
 
 #include <Urho3D/DebugNew.h>
 #include <Urho3D/DebugNew.h>
 
 

+ 0 - 2
Source/Samples/50_Urho2DPlatformer/Character2D.cpp

@@ -20,8 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-#include <Urho3D/Urho3D.h>
-
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Core/Context.h>
 #include <Urho3D/Core/Context.h>

+ 1 - 5
Source/Samples/50_Urho2DPlatformer/Urho2DPlatformer.cpp

@@ -20,8 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-#include <Urho3D/Urho3D.h>
-
 #include <Urho3D/Audio/Audio.h>
 #include <Urho3D/Audio/Audio.h>
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
@@ -33,7 +31,6 @@
 #include <Urho3D/Urho2D/CollisionPolygon2D.h>
 #include <Urho3D/Urho2D/CollisionPolygon2D.h>
 #include <Urho3D/Core/CoreEvents.h>
 #include <Urho3D/Core/CoreEvents.h>
 #include <Urho3D/Graphics/DebugRenderer.h>
 #include <Urho3D/Graphics/DebugRenderer.h>
-#include <Urho3D/Urho2D/Drawable2D.h>
 #include <Urho3D/Engine/Engine.h>
 #include <Urho3D/Engine/Engine.h>
 #include <Urho3D/UI/Font.h>
 #include <Urho3D/UI/Font.h>
 #include <Urho3D/Graphics/Graphics.h>
 #include <Urho3D/Graphics/Graphics.h>
@@ -67,8 +64,7 @@
 URHO3D_DEFINE_APPLICATION_MAIN(Urho2DPlatformer)
 URHO3D_DEFINE_APPLICATION_MAIN(Urho2DPlatformer)
 
 
 Urho2DPlatformer::Urho2DPlatformer(Context* context) :
 Urho2DPlatformer::Urho2DPlatformer(Context* context) :
-    Sample(context),
-    drawDebug_(false)
+    Sample(context)
 {
 {
     // Register factory for the Character2D component so it can be created via CreateComponent
     // Register factory for the Character2D component so it can be created via CreateComponent
     Character2D::RegisterObject(context);
     Character2D::RegisterObject(context);

+ 2 - 4
Source/Samples/50_Urho2DPlatformer/Urho2DPlatformer.h

@@ -54,8 +54,6 @@ public:
 private:
 private:
     /// Construct the scene content.
     /// Construct the scene content.
     void CreateScene();
     void CreateScene();
-    /// Construct an instruction text to the UI.
-    void CreateInstructions();
     /// Subscribe to application-wide logic update events.
     /// Subscribe to application-wide logic update events.
     void SubscribeToEvents();
     void SubscribeToEvents();
     /// Handle the logic update event.
     /// Handle the logic update event.
@@ -78,9 +76,9 @@ private:
     /// The controllable character component.
     /// The controllable character component.
     WeakPtr<Character2D> character2D_;
     WeakPtr<Character2D> character2D_;
     /// Flag for drawing debug geometry.
     /// Flag for drawing debug geometry.
-    bool drawDebug_;
+    bool drawDebug_{};
     /// Scaling factor based on tiles' aspect ratio.
     /// Scaling factor based on tiles' aspect ratio.
-    float moveSpeedScale_;
+    float moveSpeedScale_{};
 
 
     /// Sample2D utility object.
     /// Sample2D utility object.
     SharedPtr<Sample2D> sample2D_;
     SharedPtr<Sample2D> sample2D_;

+ 0 - 2
Source/Samples/Utilities2D/Mover.cpp

@@ -20,8 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-#include <Urho3D/Urho3D.h>
-
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Core/Context.h>
 #include <Urho3D/Core/Context.h>

+ 0 - 3
Source/Samples/Utilities2D/Sample2D.cpp

@@ -20,8 +20,6 @@
 // THE SOFTWARE.
 // THE SOFTWARE.
 //
 //
 
 
-#include <Urho3D/Urho3D.h>
-
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimatedSprite2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/Urho2D/AnimationSet2D.h>
 #include <Urho3D/UI/BorderImage.h>
 #include <Urho3D/UI/BorderImage.h>
@@ -40,7 +38,6 @@
 #include <Urho3D/Input/Input.h>
 #include <Urho3D/Input/Input.h>
 #include <Urho3D/Urho2D/ParticleEffect2D.h>
 #include <Urho3D/Urho2D/ParticleEffect2D.h>
 #include <Urho3D/Urho2D/ParticleEmitter2D.h>
 #include <Urho3D/Urho2D/ParticleEmitter2D.h>
-#include <Urho3D/Math/Random.h>
 #include <Urho3D/Resource/ResourceCache.h>
 #include <Urho3D/Resource/ResourceCache.h>
 #include <Urho3D/Urho2D/RigidBody2D.h>
 #include <Urho3D/Urho2D/RigidBody2D.h>
 #include <Urho3D/Scene/Scene.h>
 #include <Urho3D/Scene/Scene.h>

+ 1 - 3
Source/Samples/Utilities2D/Sample2D.h

@@ -40,8 +40,6 @@ using namespace Urho3D;
 const float CAMERA_MIN_DIST = 0.1f;
 const float CAMERA_MIN_DIST = 0.1f;
 const float CAMERA_MAX_DIST = 6.0f;
 const float CAMERA_MAX_DIST = 6.0f;
 
 
-const float MOVE_SPEED_SCALE = 1.0f; // Scaling factor based on tiles' aspect ratio
-
 /// Convenient functions for Urho2D samples:
 /// Convenient functions for Urho2D samples:
 ///    - Generate collision shapes from a tmx file objects
 ///    - Generate collision shapes from a tmx file objects
 ///    - Create Spriter Imp character
 ///    - Create Spriter Imp character
@@ -110,7 +108,7 @@ public:
     /// Filename used in load/save functions.
     /// Filename used in load/save functions.
     String demoFilename_;
     String demoFilename_;
     /// The scene.
     /// The scene.
-    Scene* scene_;
+    Scene* scene_{};
 
 
 protected:
 protected:
     /// Return XML patch instructions for screen joystick layout.
     /// Return XML patch instructions for screen joystick layout.

+ 8 - 13
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -60,15 +60,8 @@ using namespace Urho3D;
 
 
 struct OutModel
 struct OutModel
 {
 {
-    OutModel() :
-        rootBone_(nullptr),
-        totalVertices_(0),
-        totalIndices_(0)
-    {
-    }
-
     String outName_;
     String outName_;
-    aiNode* rootNode_;
+    aiNode* rootNode_{};
     HashSet<unsigned> meshIndices_;
     HashSet<unsigned> meshIndices_;
     PODVector<aiMesh*> meshes_;
     PODVector<aiMesh*> meshes_;
     PODVector<aiNode*> meshNodes_;
     PODVector<aiNode*> meshNodes_;
@@ -77,15 +70,15 @@ struct OutModel
     PODVector<aiAnimation*> animations_;
     PODVector<aiAnimation*> animations_;
     PODVector<float> boneRadii_;
     PODVector<float> boneRadii_;
     PODVector<BoundingBox> boneHitboxes_;
     PODVector<BoundingBox> boneHitboxes_;
-    aiNode* rootBone_;
-    unsigned totalVertices_;
-    unsigned totalIndices_;
+    aiNode* rootBone_{};
+    unsigned totalVertices_{};
+    unsigned totalIndices_{};
 };
 };
 
 
 struct OutScene
 struct OutScene
 {
 {
     String outName_;
     String outName_;
-    aiNode* rootNode_;
+    aiNode* rootNode_{};
     Vector<OutModel> models_;
     Vector<OutModel> models_;
     PODVector<aiNode*> nodes_;
     PODVector<aiNode*> nodes_;
     PODVector<unsigned> nodeModelIndices_;
     PODVector<unsigned> nodeModelIndices_;
@@ -1695,7 +1688,9 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
     {
     {
         const OutModel& model = scene.models_[scene.nodeModelIndices_[i]];
         const OutModel& model = scene.models_[scene.nodeModelIndices_[i]];
         Node* modelNode = CreateSceneNode(outScene, scene.nodes_[i], nodeMapping);
         Node* modelNode = CreateSceneNode(outScene, scene.nodes_[i], nodeMapping);
-        StaticModel* staticModel = model.bones_.Empty() ? modelNode->CreateComponent<StaticModel>() : modelNode->CreateComponent<AnimatedModel>();
+        auto* staticModel =
+            static_cast<StaticModel*>(
+                model.bones_.Empty() ? modelNode->CreateComponent<StaticModel>() : modelNode->CreateComponent<AnimatedModel>());
 
 
         // Create a dummy model so that the reference can be stored
         // Create a dummy model so that the reference can be stored
         String modelName = (useSubdirs_ ? "Models/" : "") + GetFileNameAndExtension(model.outName_);
         String modelName = (useSubdirs_ ? "Models/" : "") + GetFileNameAndExtension(model.outName_);

+ 2 - 7
Source/Tools/OgreImporter/OgreImporter.cpp

@@ -468,9 +468,7 @@ void LoadMesh(const String& inputFileName, bool generateTangents, bool splitSubM
                     unsigned bone = boneAssignment.GetInt("boneindex");
                     unsigned bone = boneAssignment.GetInt("boneindex");
                     float weight = boneAssignment.GetFloat("weight");
                     float weight = boneAssignment.GetFloat("weight");
 
 
-                    BoneWeightAssignment assign;
-                    assign.boneIndex_ = bone;
-                    assign.weight_ = weight;
+                    BoneWeightAssignment assign{static_cast<unsigned char>(bone), weight};
                     // Source data might have 0 weights. Disregard these
                     // Source data might have 0 weights. Disregard these
                     if (assign.weight_ > 0.0f)
                     if (assign.weight_ > 0.0f)
                     {
                     {
@@ -1079,10 +1077,7 @@ void OptimizeIndices(ModelSubGeometryLodLevel* subGeom, ModelVertexBuffer* vb, M
 
 
     for (unsigned i = subGeom->indexStart_; i < subGeom->indexStart_ + subGeom->indexCount_; i += 3)
     for (unsigned i = subGeom->indexStart_; i < subGeom->indexStart_ + subGeom->indexCount_; i += 3)
     {
     {
-        Triangle triangle;
-        triangle.v0_ = ib->indices_[i];
-        triangle.v1_ = ib->indices_[i + 1];
-        triangle.v2_ = ib->indices_[i + 2];
+        Triangle triangle{ib->indices_[i], ib->indices_[i + 1], ib->indices_[i + 2]};
         vb->vertices_[triangle.v0_].useCount_++;
         vb->vertices_[triangle.v0_].useCount_++;
         vb->vertices_[triangle.v1_].useCount_++;
         vb->vertices_[triangle.v1_].useCount_++;
         vb->vertices_[triangle.v2_].useCount_++;
         vb->vertices_[triangle.v2_].useCount_++;

+ 25 - 12
Source/Tools/OgreImporter/OgreImporterUtils.h

@@ -33,6 +33,13 @@ using namespace Urho3D;
 
 
 struct Triangle
 struct Triangle
 {
 {
+    Triangle(unsigned v0, unsigned v1, unsigned v2) :
+        v0_{v0},
+        v1_{v1},
+        v2_{v2}
+    {
+    }
+
     unsigned v0_;
     unsigned v0_;
     unsigned v1_;
     unsigned v1_;
     unsigned v2_;
     unsigned v2_;
@@ -64,6 +71,12 @@ struct ModelAnimation
 
 
 struct BoneWeightAssignment
 struct BoneWeightAssignment
 {
 {
+    BoneWeightAssignment(unsigned char boneIndex, float weight) :
+        boneIndex_{boneIndex},
+        weight_{weight}
+    {
+    }
+
     unsigned char boneIndex_;
     unsigned char boneIndex_;
     float weight_;
     float weight_;
 };
 };
@@ -96,7 +109,7 @@ struct ModelVertex
     float blendWeights_[4];
     float blendWeights_[4];
     unsigned char blendIndices_[4];
     unsigned char blendIndices_[4];
     bool hasBlendWeights_;
     bool hasBlendWeights_;
-    
+
     unsigned useCount_;
     unsigned useCount_;
     int cachePosition_;
     int cachePosition_;
     float score_;
     float score_;
@@ -108,18 +121,18 @@ struct ModelVertexBuffer
     unsigned morphStart_;
     unsigned morphStart_;
     unsigned morphCount_;
     unsigned morphCount_;
     Vector<ModelVertex> vertices_;
     Vector<ModelVertex> vertices_;
-    
+
     ModelVertexBuffer() :
     ModelVertexBuffer() :
         elementMask_(0),
         elementMask_(0),
         morphStart_(0),
         morphStart_(0),
         morphCount_(0)
         morphCount_(0)
     {
     {
     }
     }
-    
+
     void WriteData(Serializer& dest)
     void WriteData(Serializer& dest)
     {
     {
         dest.WriteUInt(vertices_.Size());
         dest.WriteUInt(vertices_.Size());
-        
+
         PODVector<VertexElement> elements = VertexBuffer::GetElements(elementMask_);
         PODVector<VertexElement> elements = VertexBuffer::GetElements(elementMask_);
         dest.WriteUInt(elements.Size());
         dest.WriteUInt(elements.Size());
         for (unsigned j = 0; j < elements.Size(); ++j)
         for (unsigned j = 0; j < elements.Size(); ++j)
@@ -132,7 +145,7 @@ struct ModelVertexBuffer
 
 
         dest.WriteUInt(morphStart_);
         dest.WriteUInt(morphStart_);
         dest.WriteUInt(morphCount_);
         dest.WriteUInt(morphCount_);
-        
+
         for (unsigned i = 0; i < vertices_.Size(); ++i)
         for (unsigned i = 0; i < vertices_.Size(); ++i)
         {
         {
             if (elementMask_ & MASK_POSITION)
             if (elementMask_ & MASK_POSITION)
@@ -170,7 +183,7 @@ struct ModelMorph
 {
 {
     String name_;
     String name_;
     Vector<ModelMorphBuffer> buffers_;
     Vector<ModelMorphBuffer> buffers_;
-    
+
     void WriteData(Serializer& dest)
     void WriteData(Serializer& dest)
     {
     {
         dest.WriteString(name_);
         dest.WriteString(name_);
@@ -181,7 +194,7 @@ struct ModelMorph
             dest.WriteUInt(buffers_[i].elementMask_);
             dest.WriteUInt(buffers_[i].elementMask_);
             dest.WriteUInt(buffers_[i].vertices_.Size());
             dest.WriteUInt(buffers_[i].vertices_.Size());
             unsigned elementMask = buffers_[i].elementMask_;
             unsigned elementMask = buffers_[i].elementMask_;
-            
+
             for (Vector<Pair<unsigned, ModelVertex> >::Iterator j = buffers_[i].vertices_.Begin();
             for (Vector<Pair<unsigned, ModelVertex> >::Iterator j = buffers_[i].vertices_.Begin();
                 j != buffers_[i].vertices_.End(); ++j)
                 j != buffers_[i].vertices_.End(); ++j)
             {
             {
@@ -201,17 +214,17 @@ struct ModelIndexBuffer
 {
 {
     unsigned indexSize_;
     unsigned indexSize_;
     PODVector<unsigned> indices_;
     PODVector<unsigned> indices_;
-    
+
     ModelIndexBuffer() :
     ModelIndexBuffer() :
         indexSize_(sizeof(unsigned short))
         indexSize_(sizeof(unsigned short))
     {
     {
     }
     }
-    
+
     void WriteData(Serializer& dest)
     void WriteData(Serializer& dest)
     {
     {
         dest.WriteUInt(indices_.Size());
         dest.WriteUInt(indices_.Size());
         dest.WriteUInt(indexSize_);
         dest.WriteUInt(indexSize_);
-        
+
         for (unsigned i = 0; i < indices_.Size(); ++i)
         for (unsigned i = 0; i < indices_.Size(); ++i)
         {
         {
             if (indexSize_ == sizeof(unsigned short))
             if (indexSize_ == sizeof(unsigned short))
@@ -232,8 +245,8 @@ struct ModelSubGeometryLodLevel
     unsigned indexCount_;
     unsigned indexCount_;
     HashMap<unsigned, PODVector<BoneWeightAssignment> > boneWeights_;
     HashMap<unsigned, PODVector<BoneWeightAssignment> > boneWeights_;
     PODVector<unsigned> boneMapping_;
     PODVector<unsigned> boneMapping_;
-    
-    ModelSubGeometryLodLevel() : 
+
+    ModelSubGeometryLodLevel() :
         distance_(0.0f),
         distance_(0.0f),
         primitiveType_(TRIANGLE_LIST),
         primitiveType_(TRIANGLE_LIST),
         indexBuffer_(0),
         indexBuffer_(0),

+ 3 - 3
Source/Tools/PackageTool/PackageTool.cpp

@@ -43,9 +43,9 @@ static const unsigned COMPRESSED_BLOCK_SIZE = 32768;
 struct FileEntry
 struct FileEntry
 {
 {
     String name_;
     String name_;
-    unsigned offset_;
-    unsigned size_;
-    unsigned checksum_;
+    unsigned offset_{};
+    unsigned size_{};
+    unsigned checksum_{};
 };
 };
 
 
 SharedPtr<Context> context_(new Context());
 SharedPtr<Context> context_(new Context());

+ 9 - 19
Source/Tools/SpritePacker/SpritePacker.cpp

@@ -54,28 +54,18 @@ class PackerInfo : public RefCounted
 public:
 public:
     String path;
     String path;
     String name;
     String name;
-    int x;
-    int y;
-    int offsetX;
-    int offsetY;
-    int width;
-    int height;
-    int frameWidth;
-    int frameHeight;
-    int frameX;
-    int frameY;
+    int x{};
+    int y{};
+    int offsetX{};
+    int offsetY{};
+    int width{};
+    int height{};
+    int frameWidth{};
+    int frameHeight{};
 
 
     PackerInfo(const String& path_, const String& name_) :
     PackerInfo(const String& path_, const String& name_) :
         path(path_),
         path(path_),
-        name(name_),
-        x(0),
-        y(0),
-        offsetX(0),
-        offsetY(0),
-        frameWidth(0),
-        frameHeight(0),
-        frameX(0),
-        frameY(0)
+        name(name_)
     {
     {
     }
     }
 
 

+ 2 - 2
Source/Urho3D/AngelScript/Addons.cpp

@@ -2043,13 +2043,13 @@ void ScriptDictionaryListFactory_Generic(asIScriptGeneric *gen)
     *(CScriptDictionary**)gen->GetAddressOfReturnLocation() = CScriptDictionary::Create(buffer);
     *(CScriptDictionary**)gen->GetAddressOfReturnLocation() = CScriptDictionary::Create(buffer);
 }
 }
 
 
-CScriptDictValue::CScriptDictValue()
+CScriptDictValue::CScriptDictValue()    // NOLINT(hicpp-member-init)
 {
 {
     m_valueObj = nullptr;
     m_valueObj = nullptr;
     m_typeId   = 0;
     m_typeId   = 0;
 }
 }
 
 
-CScriptDictValue::CScriptDictValue(asIScriptEngine *engine, void *value, int typeId)
+CScriptDictValue::CScriptDictValue(asIScriptEngine *engine, void *value, int typeId)    // NOLINT(hicpp-member-init)
 {
 {
     m_valueObj = nullptr;
     m_valueObj = nullptr;
     m_typeId   = 0;
     m_typeId   = 0;

+ 1 - 1
Source/Urho3D/AngelScript/Addons.h

@@ -122,7 +122,7 @@ protected:
     asITypeInfo      *objType;
     asITypeInfo      *objType;
     SArrayBuffer     *buffer;
     SArrayBuffer     *buffer;
     size_t            elementSize;
     size_t            elementSize;
-    int               subTypeId;
+    int               subTypeId{};
 
 
     // Constructors
     // Constructors
     CScriptArray(asITypeInfo *ot, void *buf); // Called from script when initialized with list
     CScriptArray(asITypeInfo *ot, void *buf); // Called from script when initialized with list

+ 1 - 4
Source/Urho3D/AngelScript/ScriptFile.cpp

@@ -95,10 +95,7 @@ private:
 
 
 ScriptFile::ScriptFile(Context* context) :
 ScriptFile::ScriptFile(Context* context) :
     Resource(context),
     Resource(context),
-    script_(GetSubsystem<Script>()),
-    scriptModule_(nullptr),
-    compiled_(false),
-    subscribed_(false)
+    script_(GetSubsystem<Script>())
 {
 {
 }
 }
 
 

+ 4 - 4
Source/Urho3D/AngelScript/ScriptFile.h

@@ -128,11 +128,11 @@ private:
     /// Script subsystem.
     /// Script subsystem.
     SharedPtr<Script> script_;
     SharedPtr<Script> script_;
     /// Script module.
     /// Script module.
-    asIScriptModule* scriptModule_;
+    asIScriptModule* scriptModule_{};
     /// Compiled flag.
     /// Compiled flag.
-    bool compiled_;
+    bool compiled_{};
     /// Subscribed to application update event flag.
     /// Subscribed to application update event flag.
-    bool subscribed_;
+    bool subscribed_{};
     /// Encountered include files during script file loading.
     /// Encountered include files during script file loading.
     HashSet<String> includeFiles_;
     HashSet<String> includeFiles_;
     /// Search cache for checking whether script classes implement "ScriptObject" interface.
     /// Search cache for checking whether script classes implement "ScriptObject" interface.
@@ -148,7 +148,7 @@ private:
     /// Byte code for asynchronous loading.
     /// Byte code for asynchronous loading.
     SharedArrayPtr<unsigned char> loadByteCode_;
     SharedArrayPtr<unsigned char> loadByteCode_;
     /// Byte code size for asynchronous loading.
     /// Byte code size for asynchronous loading.
-    unsigned loadByteCodeSize_;
+    unsigned loadByteCodeSize_{};
 };
 };
 
 
 /// Helper class for forwarding events to script objects that are not part of a scene.
 /// Helper class for forwarding events to script objects that are not part of a scene.

+ 1 - 5
Source/Urho3D/AngelScript/ScriptInstance.cpp

@@ -63,12 +63,8 @@ static const char* methodDeclarations[] = {
 };
 };
 
 
 ScriptInstance::ScriptInstance(Context* context) :
 ScriptInstance::ScriptInstance(Context* context) :
-    Component(context),
-    scriptObject_(nullptr),
-    subscribed_(false),
-    subscribedPostFixed_(false)
+    Component(context)
 {
 {
-    ClearScriptMethods();
     ClearScriptAttributes();
     ClearScriptAttributes();
 }
 }
 
 

+ 4 - 4
Source/Urho3D/AngelScript/ScriptInstance.h

@@ -191,11 +191,11 @@ private:
     /// Script file.
     /// Script file.
     WeakPtr<ScriptFile> scriptFile_;
     WeakPtr<ScriptFile> scriptFile_;
     /// Script object.
     /// Script object.
-    asIScriptObject* scriptObject_;
+    asIScriptObject* scriptObject_{};
     /// Class name.
     /// Class name.
     String className_;
     String className_;
     /// Pointers to supported inbuilt methods.
     /// Pointers to supported inbuilt methods.
-    asIScriptFunction* methods_[MAX_SCRIPT_METHODS];
+    asIScriptFunction* methods_[MAX_SCRIPT_METHODS]{};
     /// Delayed method calls.
     /// Delayed method calls.
     Vector<DelayedCall> delayedCalls_;
     Vector<DelayedCall> delayedCalls_;
     /// Attributes, including script object variables.
     /// Attributes, including script object variables.
@@ -205,9 +205,9 @@ private:
     /// Storage for attributes while script object is being hot-reloaded.
     /// Storage for attributes while script object is being hot-reloaded.
     HashMap<String, Variant> storedAttributes_;
     HashMap<String, Variant> storedAttributes_;
     /// Subscribed to scene update events flag.
     /// Subscribed to scene update events flag.
-    bool subscribed_;
+    bool subscribed_{};
     /// Subscribed to scene post and fixed update events flag.
     /// Subscribed to scene post and fixed update events flag.
-    bool subscribedPostFixed_;
+    bool subscribedPostFixed_{};
 };
 };
 
 
 /// Return the active AngelScript context. Provided as a wrapper to the AngelScript API function to avoid undefined symbol error in shared library Urho3D builds.
 /// Return the active AngelScript context. Provided as a wrapper to the AngelScript API function to avoid undefined symbol error in shared library Urho3D builds.

+ 1 - 4
Source/Urho3D/Audio/Audio.cpp

@@ -53,10 +53,7 @@ static const StringHash SOUND_MASTER_HASH("Master");
 static void SDLAudioCallback(void* userdata, Uint8* stream, int len);
 static void SDLAudioCallback(void* userdata, Uint8* stream, int len);
 
 
 Audio::Audio(Context* context) :
 Audio::Audio(Context* context) :
-    Object(context),
-    deviceID_(0),
-    sampleSize_(0),
-    playing_(false)
+    Object(context)
 {
 {
     context_->RequireSDL(SDL_INIT_AUDIO);
     context_->RequireSDL(SDL_INIT_AUDIO);
 
 

+ 7 - 7
Source/Urho3D/Audio/Audio.h

@@ -128,19 +128,19 @@ private:
     /// Audio thread mutex.
     /// Audio thread mutex.
     Mutex audioMutex_;
     Mutex audioMutex_;
     /// SDL audio device ID.
     /// SDL audio device ID.
-    unsigned deviceID_;
+    unsigned deviceID_{};
     /// Sample size.
     /// Sample size.
-    unsigned sampleSize_;
+    unsigned sampleSize_{};
     /// Clip buffer size in samples.
     /// Clip buffer size in samples.
-    unsigned fragmentSize_;
+    unsigned fragmentSize_{};
     /// Mixing rate.
     /// Mixing rate.
-    int mixRate_;
+    int mixRate_{};
     /// Mixing interpolation flag.
     /// Mixing interpolation flag.
-    bool interpolation_;
+    bool interpolation_{};
     /// Stereo flag.
     /// Stereo flag.
-    bool stereo_;
+    bool stereo_{};
     /// Playing flag.
     /// Playing flag.
-    bool playing_;
+    bool playing_{};
     /// Master gain by sound source type.
     /// Master gain by sound source type.
     HashMap<StringHash, Variant> masterGain_;
     HashMap<StringHash, Variant> masterGain_;
     /// Paused sound types.
     /// Paused sound types.

+ 1 - 1
Source/Urho3D/Audio/SoundSource.h

@@ -141,7 +141,7 @@ protected:
     /// Stereo panning.
     /// Stereo panning.
     float panning_;
     float panning_;
     /// Effective master gain.
     /// Effective master gain.
-    float masterGain_;
+    float masterGain_{};
     /// Whether finished event should be sent on playback stop.
     /// Whether finished event should be sent on playback stop.
     bool sendFinishedEvent_;
     bool sendFinishedEvent_;
     /// Automatic removal mode.
     /// Automatic removal mode.

+ 4 - 4
Source/Urho3D/Core/ProcessUtils.cpp

@@ -446,7 +446,7 @@ unsigned GetNumPhysicalCPUs()
     return SDL_TVOS_GetActiveProcessorCount();
     return SDL_TVOS_GetActiveProcessorCount();
 #endif
 #endif
 #elif defined(__linux__)
 #elif defined(__linux__)
-    struct CpuCoreCount data;
+    struct CpuCoreCount data{};
     GetCPUData(&data);
     GetCPUData(&data);
     return data.numPhysicalCores_;
     return data.numPhysicalCores_;
 #elif defined(__EMSCRIPTEN__)
 #elif defined(__EMSCRIPTEN__)
@@ -479,7 +479,7 @@ unsigned GetNumLogicalCPUs()
     return SDL_TVOS_GetActiveProcessorCount();
     return SDL_TVOS_GetActiveProcessorCount();
 #endif
 #endif
 #elif defined(__linux__)
 #elif defined(__linux__)
-    struct CpuCoreCount data;
+    struct CpuCoreCount data{};
     GetCPUData(&data);
     GetCPUData(&data);
     return data.numLogicalCores_;
     return data.numLogicalCores_;
 #elif defined(__EMSCRIPTEN__)
 #elif defined(__EMSCRIPTEN__)
@@ -521,7 +521,7 @@ String GetMiniDumpDir()
 unsigned long long GetTotalMemory()
 unsigned long long GetTotalMemory()
 {
 {
 #if defined(__linux__) && !defined(__ANDROID__)
 #if defined(__linux__) && !defined(__ANDROID__)
-    struct sysinfo s;
+    struct sysinfo s{};
     if (sysinfo(&s) != -1)
     if (sysinfo(&s) != -1)
         return s.totalram;
         return s.totalram;
 #elif defined(_WIN32)
 #elif defined(_WIN32)
@@ -607,7 +607,7 @@ static void GetOS(RTL_OSVERSIONINFOW *r)
 String GetOSVersion()
 String GetOSVersion()
 {
 {
 #if defined(__linux__) && !defined(__ANDROID__)
 #if defined(__linux__) && !defined(__ANDROID__)
-    struct utsname u;
+    struct utsname u{};
     if (uname(&u) == 0)
     if (uname(&u) == 0)
         return String(u.sysname) + " " + u.release;
         return String(u.sysname) + " " + u.release;
 #elif defined(_WIN32) && defined(HAVE_RTL_OSVERSIONINFOW) && !defined(MINI_URHO)
 #elif defined(_WIN32) && defined(HAVE_RTL_OSVERSIONINFOW) && !defined(MINI_URHO)

+ 3 - 5
Source/Urho3D/Core/Timer.cpp

@@ -76,7 +76,7 @@ static unsigned Tick()
 #elif __EMSCRIPTEN__
 #elif __EMSCRIPTEN__
     return (unsigned)emscripten_get_now();
     return (unsigned)emscripten_get_now();
 #else
 #else
-    struct timeval time;
+    struct timeval time{};
     gettimeofday(&time, nullptr);
     gettimeofday(&time, nullptr);
     return (unsigned)(time.tv_sec * 1000 + time.tv_usec / 1000);
     return (unsigned)(time.tv_sec * 1000 + time.tv_usec / 1000);
 #endif
 #endif
@@ -96,7 +96,7 @@ static long long HiresTick()
 #elif __EMSCRIPTEN__
 #elif __EMSCRIPTEN__
     return (unsigned)(emscripten_get_now()*1000.0);
     return (unsigned)(emscripten_get_now()*1000.0);
 #else
 #else
-    struct timeval time;
+    struct timeval time{};
     gettimeofday(&time, nullptr);
     gettimeofday(&time, nullptr);
     return time.tv_sec * 1000000LL + time.tv_usec;
     return time.tv_sec * 1000000LL + time.tv_usec;
 #endif
 #endif
@@ -182,9 +182,7 @@ void Time::Sleep(unsigned mSec)
 #ifdef _WIN32
 #ifdef _WIN32
     ::Sleep(mSec);
     ::Sleep(mSec);
 #else
 #else
-    timespec time;
-    time.tv_sec = mSec / 1000;
-    time.tv_nsec = (mSec % 1000) * 1000000;
+    timespec time{static_cast<time_t>(mSec / 1000), static_cast<long>((mSec % 1000) * 1000000)};
     nanosleep(&time, nullptr);
     nanosleep(&time, nullptr);
 #endif
 #endif
 }
 }

+ 2 - 2
Source/Urho3D/Core/Timer.h

@@ -41,7 +41,7 @@ public:
 
 
 private:
 private:
     /// Starting clock value in milliseconds.
     /// Starting clock value in milliseconds.
-    unsigned startTime_;
+    unsigned startTime_{};
 };
 };
 
 
 /// High-resolution operating system timer used in profiling.
 /// High-resolution operating system timer used in profiling.
@@ -66,7 +66,7 @@ public:
 
 
 private:
 private:
     /// Starting clock value in CPU ticks.
     /// Starting clock value in CPU ticks.
-    long long startTime_;
+    long long startTime_{};
 
 
     /// High-resolution timer support flag.
     /// High-resolution timer support flag.
     static bool supported;
     static bool supported;

+ 1 - 1
Source/Urho3D/Engine/Console.h

@@ -163,7 +163,7 @@ private:
     /// Current row being edited.
     /// Current row being edited.
     String currentRow_;
     String currentRow_;
     /// Maximum displayed rows.
     /// Maximum displayed rows.
-    unsigned displayedRows_;
+    unsigned displayedRows_{};
     /// Command history maximum rows.
     /// Command history maximum rows.
     unsigned historyRows_;
     unsigned historyRows_;
     /// Command history current position.
     /// Command history current position.

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

@@ -235,9 +235,9 @@ private:
     /// Orthographic mode flag.
     /// Orthographic mode flag.
     bool orthographic_;
     bool orthographic_;
     /// Cached actual near clip distance.
     /// Cached actual near clip distance.
-    mutable float projNearClip_;
+    mutable float projNearClip_{};
     /// Cached actual far clip distance.
     /// Cached actual far clip distance.
-    mutable float projFarClip_;
+    mutable float projFarClip_{};
     /// Near clip distance.
     /// Near clip distance.
     float nearClip_;
     float nearClip_;
     /// Far clip distance.
     /// Far clip distance.

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

@@ -65,9 +65,9 @@ private:
     /// Shadow data.
     /// Shadow data.
     SharedArrayPtr<unsigned char> shadowData_;
     SharedArrayPtr<unsigned char> shadowData_;
     /// Buffer byte size.
     /// Buffer byte size.
-    unsigned size_;
+    unsigned size_{};
     /// Dirty flag.
     /// Dirty flag.
-    bool dirty_;
+    bool dirty_{};
 };
 };
 
 
 }
 }

+ 0 - 31
Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -199,38 +199,7 @@ bool Graphics::gl3Support = false;
 Graphics::Graphics(Context* context) :
 Graphics::Graphics(Context* context) :
     Object(context),
     Object(context),
     impl_(new GraphicsImpl()),
     impl_(new GraphicsImpl()),
-    window_(nullptr),
-    externalWindow_(nullptr),
-    width_(0),
-    height_(0),
     position_(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED),
     position_(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED),
-    multiSample_(1),
-    fullscreen_(false),
-    borderless_(false),
-    resizable_(false),
-    highDPI_(false),
-    vsync_(false),
-    monitor_(0),
-    refreshRate_(0),
-    tripleBuffer_(false),
-    flushGPU_(false),
-    forceGL2_(false),
-    sRGB_(false),
-    anisotropySupport_(false),
-    dxtTextureSupport_(false),
-    etcTextureSupport_(false),
-    pvrtcTextureSupport_(false),
-    hardwareShadowSupport_(false),
-    lightPrepassSupport_(false),
-    deferredSupport_(false),
-    instancingSupport_(false),
-    sRGBSupport_(false),
-    sRGBWriteSupport_(false),
-    numPrimitives_(0),
-    numBatches_(0),
-    maxScratchBufferRequest_(0),
-    defaultTextureFilterMode_(FILTER_TRILINEAR),
-    defaultTextureAnisotropy_(4),
     shaderPath_("Shaders/HLSL/"),
     shaderPath_("Shaders/HLSL/"),
     shaderExtension_(".hlsl"),
     shaderExtension_(".hlsl"),
     orientations_("LandscapeLeft LandscapeRight"),
     orientations_("LandscapeLeft LandscapeRight"),

+ 3 - 5
Source/Urho3D/Graphics/Direct3D11/D3D11RenderSurface.cpp

@@ -34,12 +34,10 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-RenderSurface::RenderSurface(Texture* parentTexture) :
+RenderSurface::RenderSurface(Texture* parentTexture) :      // NOLINT(hicpp-member-init)
     parentTexture_(parentTexture),
     parentTexture_(parentTexture),
     renderTargetView_(nullptr),
     renderTargetView_(nullptr),
-    readOnlyView_(nullptr),
-    updateMode_(SURFACE_UPDATEVISIBLE),
-    updateQueued_(false)
+    readOnlyView_(nullptr)
 {
 {
 }
 }
 
 
@@ -53,7 +51,7 @@ void RenderSurface::Release()
             if (graphics->GetRenderTarget(i) == this)
             if (graphics->GetRenderTarget(i) == this)
                 graphics->ResetRenderTarget(i);
                 graphics->ResetRenderTarget(i);
         }
         }
-        
+
         if (graphics->GetDepthStencil() == this)
         if (graphics->GetDepthStencil() == this)
             graphics->ResetDepthStencil();
             graphics->ResetDepthStencil();
     }
     }

+ 0 - 30
Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -253,37 +253,7 @@ bool Graphics::gl3Support = false;
 Graphics::Graphics(Context* context) :
 Graphics::Graphics(Context* context) :
     Object(context),
     Object(context),
     impl_(new GraphicsImpl()),
     impl_(new GraphicsImpl()),
-    window_(nullptr),
-    externalWindow_(nullptr),
-    width_(0),
-    height_(0),
     position_(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED),
     position_(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED),
-    multiSample_(1),
-    fullscreen_(false),
-    borderless_(false),
-    resizable_(false),
-    highDPI_(false),
-    vsync_(false),
-    monitor_(0),
-    refreshRate_(0),
-    tripleBuffer_(false),
-    flushGPU_(false),
-    sRGB_(false),
-    anisotropySupport_(false),
-    dxtTextureSupport_(false),
-    etcTextureSupport_(false),
-    pvrtcTextureSupport_(false),
-    hardwareShadowSupport_(false),
-    lightPrepassSupport_(false),
-    deferredSupport_(false),
-    instancingSupport_(false),
-    sRGBSupport_(false),
-    sRGBWriteSupport_(false),
-    numPrimitives_(0),
-    numBatches_(0),
-    maxScratchBufferRequest_(0),
-    defaultTextureFilterMode_(FILTER_TRILINEAR),
-    defaultTextureAnisotropy_(4),
     shaderPath_("Shaders/HLSL/"),
     shaderPath_("Shaders/HLSL/"),
     shaderExtension_(".hlsl"),
     shaderExtension_(".hlsl"),
     orientations_("LandscapeLeft LandscapeRight"),
     orientations_("LandscapeLeft LandscapeRight"),

+ 2 - 5
Source/Urho3D/Graphics/Direct3D9/D3D9RenderSurface.cpp

@@ -34,12 +34,9 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-RenderSurface::RenderSurface(Texture* parentTexture) :
+RenderSurface::RenderSurface(Texture* parentTexture) :      // NOLINT(hicpp-member-init)
     parentTexture_(parentTexture),
     parentTexture_(parentTexture),
-    surface_(nullptr),
-    updateMode_(SURFACE_UPDATEVISIBLE),
-    updateQueued_(false),
-    resolveDirty_(false)
+    surface_(nullptr)
 {
 {
 }
 }
 
 

+ 2 - 13
Source/Urho3D/Graphics/Drawable.cpp

@@ -47,20 +47,9 @@ namespace Urho3D
 
 
 const char* GEOMETRY_CATEGORY = "Geometry";
 const char* GEOMETRY_CATEGORY = "Geometry";
 
 
-SourceBatch::SourceBatch() :
-    distance_(0.0f),
-    geometry_(nullptr),
-    worldTransform_(&Matrix3x4::IDENTITY),
-    numWorldTransforms_(1),
-    instancingData_(nullptr),
-    geometryType_(GEOM_STATIC)
-{
-}
+SourceBatch::SourceBatch() = default;
 
 
-SourceBatch::SourceBatch(const SourceBatch& batch)
-{
-    *this = batch;
-}
+SourceBatch::SourceBatch(const SourceBatch& batch) = default;
 
 
 SourceBatch::~SourceBatch() = default;
 SourceBatch::~SourceBatch() = default;
 
 

+ 6 - 6
Source/Urho3D/Graphics/Drawable.h

@@ -89,19 +89,19 @@ struct URHO3D_API SourceBatch
     SourceBatch& operator =(const SourceBatch& rhs);
     SourceBatch& operator =(const SourceBatch& rhs);
 
 
     /// Distance from camera.
     /// Distance from camera.
-    float distance_;
+    float distance_{};
     /// Geometry.
     /// Geometry.
-    Geometry* geometry_;
+    Geometry* geometry_{};
     /// Material.
     /// Material.
     SharedPtr<Material> material_;
     SharedPtr<Material> material_;
     /// World transform(s). For a skinned model, these are the bone transforms.
     /// World transform(s). For a skinned model, these are the bone transforms.
-    const Matrix3x4* worldTransform_;
+    const Matrix3x4* worldTransform_{&Matrix3x4::IDENTITY};
     /// Number of world transforms.
     /// Number of world transforms.
-    unsigned numWorldTransforms_;
+    unsigned numWorldTransforms_{1};
     /// Per-instance data. If not null, must contain enough data to fill instancing buffer.
     /// Per-instance data. If not null, must contain enough data to fill instancing buffer.
-    void* instancingData_;
+    void* instancingData_{};
     /// %Geometry type.
     /// %Geometry type.
-    GeometryType geometryType_;
+    GeometryType geometryType_{GEOM_STATIC};
 };
 };
 
 
 /// Base class for visible components.
 /// Base class for visible components.

+ 1 - 3
Source/Urho3D/Graphics/GPUObject.cpp

@@ -31,9 +31,7 @@ namespace Urho3D
 {
 {
 
 
 GPUObject::GPUObject(Graphics* graphics) :
 GPUObject::GPUObject(Graphics* graphics) :
-    graphics_(graphics),
-    dataLost_(false),
-    dataPending_(false)
+    graphics_(graphics)
 {
 {
 #ifdef URHO3D_OPENGL
 #ifdef URHO3D_OPENGL
     object_.name_ = 0;
     object_.name_ = 0;

+ 3 - 3
Source/Urho3D/Graphics/GPUObject.h

@@ -72,11 +72,11 @@ protected:
     /// Graphics subsystem.
     /// Graphics subsystem.
     WeakPtr<Graphics> graphics_;
     WeakPtr<Graphics> graphics_;
     /// Object pointer or name.
     /// Object pointer or name.
-    GPUObjectHandle object_;
+    GPUObjectHandle object_{};
     /// Data lost flag.
     /// Data lost flag.
-    bool dataLost_;
+    bool dataLost_{};
     /// Data pending flag.
     /// Data pending flag.
-    bool dataPending_;
+    bool dataPending_{};
 };
 };
 
 
 }
 }

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

@@ -44,7 +44,9 @@
 #include "../Graphics/Technique.h"
 #include "../Graphics/Technique.h"
 #include "../Graphics/Terrain.h"
 #include "../Graphics/Terrain.h"
 #include "../Graphics/TerrainPatch.h"
 #include "../Graphics/TerrainPatch.h"
+#ifdef _WIN32
 #include "../Graphics/Texture2D.h"
 #include "../Graphics/Texture2D.h"
+#endif
 #include "../Graphics/Texture2DArray.h"
 #include "../Graphics/Texture2DArray.h"
 #include "../Graphics/Texture3D.h"
 #include "../Graphics/Texture3D.h"
 #include "../Graphics/TextureCube.h"
 #include "../Graphics/TextureCube.h"
@@ -53,7 +55,6 @@
 #include "../IO/Log.h"
 #include "../IO/Log.h"
 
 
 #include <SDL/SDL.h>
 #include <SDL/SDL.h>
-#include <SDL/SDL_syswm.h>
 
 
 #include "../DebugNew.h"
 #include "../DebugNew.h"
 
 
@@ -229,18 +230,12 @@ int Graphics::GetMonitorCount() const
 
 
 int Graphics::GetCurrentMonitor() const
 int Graphics::GetCurrentMonitor() const
 {
 {
-    if (!window_)
-        return 0;
-
-    return SDL_GetWindowDisplayIndex(window_);
+    return window_ ? SDL_GetWindowDisplayIndex(window_) : 0;
 }
 }
 
 
 bool Graphics::GetMaximized() const
 bool Graphics::GetMaximized() const
 {
 {
-    if (!window_)
-        return false;
-
-    return SDL_GetWindowFlags(window_) & SDL_WINDOW_MAXIMIZED;
+    return window_? static_cast<bool>(SDL_GetWindowFlags(window_) & SDL_WINDOW_MAXIMIZED) : false;
 }
 }
 
 
 Vector3 Graphics::GetDisplayDPI(int monitor) const
 Vector3 Graphics::GetDisplayDPI(int monitor) const
@@ -379,7 +374,7 @@ void Graphics::CleanupScratchBuffers()
     {
     {
         if (!i->reserved_ && i->size_ > maxScratchBufferRequest_ * 2 && i->size_ >= 1024 * 1024)
         if (!i->reserved_ && i->size_ > maxScratchBufferRequest_ * 2 && i->size_ >= 1024 * 1024)
         {
         {
-            i->data_ = maxScratchBufferRequest_ > 0 ? new unsigned char[maxScratchBufferRequest_] : nullptr;
+            i->data_ = maxScratchBufferRequest_ > 0 ? (new unsigned char[maxScratchBufferRequest_]) : nullptr;
             i->size_ = maxScratchBufferRequest_;
             i->size_ = maxScratchBufferRequest_;
 
 
             URHO3D_LOGDEBUG("Resized scratch buffer to size " + String(maxScratchBufferRequest_));
             URHO3D_LOGDEBUG("Resized scratch buffer to size " + String(maxScratchBufferRequest_));

+ 64 - 64
Source/Urho3D/Graphics/Graphics.h

@@ -632,151 +632,151 @@ private:
     /// Implementation.
     /// Implementation.
     GraphicsImpl* impl_;
     GraphicsImpl* impl_;
     /// SDL window.
     /// SDL window.
-    SDL_Window* window_;
+    SDL_Window* window_{};
     /// Window title.
     /// Window title.
     String windowTitle_;
     String windowTitle_;
     /// Window icon image.
     /// Window icon image.
     WeakPtr<Image> windowIcon_;
     WeakPtr<Image> windowIcon_;
     /// External window, null if not in use (default.)
     /// External window, null if not in use (default.)
-    void* externalWindow_;
+    void* externalWindow_{};
     /// Window width in pixels.
     /// Window width in pixels.
-    int width_;
+    int width_{};
     /// Window height in pixels.
     /// Window height in pixels.
-    int height_;
+    int height_{};
     /// Window position.
     /// Window position.
     IntVector2 position_;
     IntVector2 position_;
     /// Multisampling mode.
     /// Multisampling mode.
-    int multiSample_;
+    int multiSample_{1};
     /// Fullscreen flag.
     /// Fullscreen flag.
-    bool fullscreen_;
+    bool fullscreen_{};
     /// Borderless flag.
     /// Borderless flag.
-    bool borderless_;
+    bool borderless_{};
     /// Resizable flag.
     /// Resizable flag.
-    bool resizable_;
+    bool resizable_{};
     /// High DPI flag.
     /// High DPI flag.
-    bool highDPI_;
+    bool highDPI_{};
     /// Vertical sync flag.
     /// Vertical sync flag.
-    bool vsync_;
+    bool vsync_{};
     /// Refresh rate in Hz. Only used in fullscreen, 0 when windowed
     /// Refresh rate in Hz. Only used in fullscreen, 0 when windowed
-    int refreshRate_;
+    int refreshRate_{};
     /// Monitor index. Only used in fullscreen, 0 when windowed
     /// Monitor index. Only used in fullscreen, 0 when windowed
-    int monitor_;
+    int monitor_{};
     /// Triple buffering flag.
     /// Triple buffering flag.
-    bool tripleBuffer_;
+    bool tripleBuffer_{};
     /// Flush GPU command buffer flag.
     /// Flush GPU command buffer flag.
-    bool flushGPU_;
+    bool flushGPU_{};
     /// Force OpenGL 2 flag. Only used on OpenGL.
     /// Force OpenGL 2 flag. Only used on OpenGL.
-    bool forceGL2_;
+    bool forceGL2_{};
     /// sRGB conversion on write flag for the main window.
     /// sRGB conversion on write flag for the main window.
-    bool sRGB_;
+    bool sRGB_{};
     /// Light pre-pass rendering support flag.
     /// Light pre-pass rendering support flag.
-    bool lightPrepassSupport_;
+    bool lightPrepassSupport_{};
     /// Deferred rendering support flag.
     /// Deferred rendering support flag.
-    bool deferredSupport_;
+    bool deferredSupport_{};
     /// Anisotropic filtering support flag.
     /// Anisotropic filtering support flag.
-    bool anisotropySupport_;
+    bool anisotropySupport_{};
     /// DXT format support flag.
     /// DXT format support flag.
-    bool dxtTextureSupport_;
+    bool dxtTextureSupport_{};
     /// ETC1 format support flag.
     /// ETC1 format support flag.
-    bool etcTextureSupport_;
+    bool etcTextureSupport_{};
     /// PVRTC formats support flag.
     /// PVRTC formats support flag.
-    bool pvrtcTextureSupport_;
+    bool pvrtcTextureSupport_{};
     /// Hardware shadow map depth compare support flag.
     /// Hardware shadow map depth compare support flag.
-    bool hardwareShadowSupport_;
+    bool hardwareShadowSupport_{};
     /// Instancing support flag.
     /// Instancing support flag.
-    bool instancingSupport_;
+    bool instancingSupport_{};
     /// sRGB conversion on read support flag.
     /// sRGB conversion on read support flag.
-    bool sRGBSupport_;
+    bool sRGBSupport_{};
     /// sRGB conversion on write support flag.
     /// sRGB conversion on write support flag.
-    bool sRGBWriteSupport_;
+    bool sRGBWriteSupport_{};
     /// Number of primitives this frame.
     /// Number of primitives this frame.
-    unsigned numPrimitives_;
+    unsigned numPrimitives_{};
     /// Number of batches this frame.
     /// Number of batches this frame.
-    unsigned numBatches_;
+    unsigned numBatches_{};
     /// Largest scratch buffer request this frame.
     /// Largest scratch buffer request this frame.
-    unsigned maxScratchBufferRequest_;
+    unsigned maxScratchBufferRequest_{};
     /// GPU objects.
     /// GPU objects.
     PODVector<GPUObject*> gpuObjects_;
     PODVector<GPUObject*> gpuObjects_;
     /// Scratch buffers.
     /// Scratch buffers.
     Vector<ScratchBuffer> scratchBuffers_;
     Vector<ScratchBuffer> scratchBuffers_;
     /// Shadow map dummy color texture format.
     /// Shadow map dummy color texture format.
-    unsigned dummyColorFormat_;
+    unsigned dummyColorFormat_{};
     /// Shadow map depth texture format.
     /// Shadow map depth texture format.
-    unsigned shadowMapFormat_;
+    unsigned shadowMapFormat_{};
     /// Shadow map 24-bit depth texture format.
     /// Shadow map 24-bit depth texture format.
-    unsigned hiresShadowMapFormat_;
+    unsigned hiresShadowMapFormat_{};
     /// Vertex buffers in use.
     /// Vertex buffers in use.
-    VertexBuffer* vertexBuffers_[MAX_VERTEX_STREAMS];
+    VertexBuffer* vertexBuffers_[MAX_VERTEX_STREAMS]{};
     /// Index buffer in use.
     /// Index buffer in use.
-    IndexBuffer* indexBuffer_;
+    IndexBuffer* indexBuffer_{};
     /// Current vertex declaration hash.
     /// Current vertex declaration hash.
-    unsigned long long vertexDeclarationHash_;
+    unsigned long long vertexDeclarationHash_{};
     /// Current primitive type.
     /// Current primitive type.
-    unsigned primitiveType_;
+    unsigned primitiveType_{};
     /// Vertex shader in use.
     /// Vertex shader in use.
-    ShaderVariation* vertexShader_;
+    ShaderVariation* vertexShader_{};
     /// Pixel shader in use.
     /// Pixel shader in use.
-    ShaderVariation* pixelShader_;
+    ShaderVariation* pixelShader_{};
     /// Textures in use.
     /// Textures in use.
-    Texture* textures_[MAX_TEXTURE_UNITS];
+    Texture* textures_[MAX_TEXTURE_UNITS]{};
     /// Texture unit mappings.
     /// Texture unit mappings.
     HashMap<String, TextureUnit> textureUnits_;
     HashMap<String, TextureUnit> textureUnits_;
     /// Rendertargets in use.
     /// Rendertargets in use.
-    RenderSurface* renderTargets_[MAX_RENDERTARGETS];
+    RenderSurface* renderTargets_[MAX_RENDERTARGETS]{};
     /// Depth-stencil surface in use.
     /// Depth-stencil surface in use.
-    RenderSurface* depthStencil_;
+    RenderSurface* depthStencil_{};
     /// Viewport coordinates.
     /// Viewport coordinates.
     IntRect viewport_;
     IntRect viewport_;
     /// Default texture filtering mode.
     /// Default texture filtering mode.
-    TextureFilterMode defaultTextureFilterMode_;
+    TextureFilterMode defaultTextureFilterMode_{FILTER_TRILINEAR};
     /// Default texture max. anisotropy level.
     /// Default texture max. anisotropy level.
-    unsigned defaultTextureAnisotropy_;
+    unsigned defaultTextureAnisotropy_{4};
     /// Blending mode.
     /// Blending mode.
-    BlendMode blendMode_;
+    BlendMode blendMode_{};
     /// Alpha-to-coverage enable.
     /// Alpha-to-coverage enable.
-    bool alphaToCoverage_;
+    bool alphaToCoverage_{};
     /// Color write enable.
     /// Color write enable.
-    bool colorWrite_;
+    bool colorWrite_{};
     /// Hardware culling mode.
     /// Hardware culling mode.
-    CullMode cullMode_;
+    CullMode cullMode_{};
     /// Depth constant bias.
     /// Depth constant bias.
-    float constantDepthBias_;
+    float constantDepthBias_{};
     /// Depth slope scaled bias.
     /// Depth slope scaled bias.
-    float slopeScaledDepthBias_;
+    float slopeScaledDepthBias_{};
     /// Depth compare mode.
     /// Depth compare mode.
-    CompareMode depthTestMode_;
+    CompareMode depthTestMode_{};
     /// Depth write enable flag.
     /// Depth write enable flag.
-    bool depthWrite_;
+    bool depthWrite_{};
     /// Line antialiasing enable flag.
     /// Line antialiasing enable flag.
-    bool lineAntiAlias_;
+    bool lineAntiAlias_{};
     /// Polygon fill mode.
     /// Polygon fill mode.
-    FillMode fillMode_;
+    FillMode fillMode_{};
     /// Scissor test enable flag.
     /// Scissor test enable flag.
-    bool scissorTest_;
+    bool scissorTest_{};
     /// Scissor test rectangle.
     /// Scissor test rectangle.
     IntRect scissorRect_;
     IntRect scissorRect_;
     /// Stencil test compare mode.
     /// Stencil test compare mode.
-    CompareMode stencilTestMode_;
+    CompareMode stencilTestMode_{};
     /// Stencil operation on pass.
     /// Stencil operation on pass.
-    StencilOp stencilPass_;
+    StencilOp stencilPass_{};
     /// Stencil operation on fail.
     /// Stencil operation on fail.
-    StencilOp stencilFail_;
+    StencilOp stencilFail_{};
     /// Stencil operation on depth fail.
     /// Stencil operation on depth fail.
-    StencilOp stencilZFail_;
+    StencilOp stencilZFail_{};
     /// Stencil test reference value.
     /// Stencil test reference value.
-    unsigned stencilRef_;
+    unsigned stencilRef_{};
     /// Stencil compare bitmask.
     /// Stencil compare bitmask.
-    unsigned stencilCompareMask_;
+    unsigned stencilCompareMask_{};
     /// Stencil write bitmask.
     /// Stencil write bitmask.
-    unsigned stencilWriteMask_;
+    unsigned stencilWriteMask_{};
     /// Current custom clip plane in post-projection space.
     /// Current custom clip plane in post-projection space.
     Vector4 clipPlane_;
     Vector4 clipPlane_;
     /// Stencil test enable flag.
     /// Stencil test enable flag.
-    bool stencilTest_;
+    bool stencilTest_{};
     /// Custom clip plane enable flag.
     /// Custom clip plane enable flag.
-    bool useClipPlane_;
+    bool useClipPlane_{};
     /// Remembered shader parameter sources.
     /// Remembered shader parameter sources.
-    const void* shaderParameterSources_[MAX_SHADER_PARAMETER_GROUPS];
+    const void* shaderParameterSources_[MAX_SHADER_PARAMETER_GROUPS]{};
     /// Base directory for shaders.
     /// Base directory for shaders.
     String shaderPath_;
     String shaderPath_;
     /// Cache directory for Direct3D binary shaders.
     /// Cache directory for Direct3D binary shaders.

+ 2 - 10
Source/Urho3D/Graphics/Material.cpp

@@ -74,7 +74,7 @@ static const char* textureUnitNames[] =
     "lightramp",
     "lightramp",
     "lightshape",
     "lightshape",
     "shadowmap",
     "shadowmap",
-    0
+    nullptr
 #endif
 #endif
 };
 };
 
 
@@ -196,15 +196,7 @@ void ShaderParameterAnimationInfo::ApplyValue(const Variant& newValue)
 }
 }
 
 
 Material::Material(Context* context) :
 Material::Material(Context* context) :
-    Resource(context),
-    auxViewFrameNumber_(0),
-    shaderParameterHash_(0),
-    alphaToCoverage_(false),
-    lineAntiAlias_(false),
-    occlusion_(true),
-    specular_(false),
-    subscribed_(false),
-    batchedParameterUpdate_(false)
+    Resource(context)
 {
 {
     ResetToDefaults();
     ResetToDefaults();
 }
 }

+ 13 - 13
Source/Urho3D/Graphics/Material.h

@@ -294,31 +294,31 @@ private:
     /// Pixel shader defines.
     /// Pixel shader defines.
     String pixelShaderDefines_;
     String pixelShaderDefines_;
     /// Normal culling mode.
     /// Normal culling mode.
-    CullMode cullMode_;
+    CullMode cullMode_{};
     /// Culling mode for shadow rendering.
     /// Culling mode for shadow rendering.
-    CullMode shadowCullMode_;
+    CullMode shadowCullMode_{};
     /// Polygon fill mode.
     /// Polygon fill mode.
-    FillMode fillMode_;
+    FillMode fillMode_{};
     /// Depth bias parameters.
     /// Depth bias parameters.
-    BiasParameters depthBias_;
+    BiasParameters depthBias_{};
     /// Render order value.
     /// Render order value.
-    unsigned char renderOrder_;
+    unsigned char renderOrder_{};
     /// Last auxiliary view rendered frame number.
     /// Last auxiliary view rendered frame number.
-    unsigned auxViewFrameNumber_;
+    unsigned auxViewFrameNumber_{};
     /// Shader parameter hash value.
     /// Shader parameter hash value.
-    unsigned shaderParameterHash_;
+    unsigned shaderParameterHash_{};
     /// Alpha-to-coverage flag.
     /// Alpha-to-coverage flag.
-    bool alphaToCoverage_;
+    bool alphaToCoverage_{};
     /// Line antialiasing flag.
     /// Line antialiasing flag.
-    bool lineAntiAlias_;
+    bool lineAntiAlias_{};
     /// Render occlusion flag.
     /// Render occlusion flag.
-    bool occlusion_;
+    bool occlusion_{true};
     /// Specular lighting flag.
     /// Specular lighting flag.
-    bool specular_;
+    bool specular_{};
     /// Flag for whether is subscribed to animation updates.
     /// Flag for whether is subscribed to animation updates.
-    bool subscribed_;
+    bool subscribed_{};
     /// Flag to suppress parameter hash and memory use recalculation when setting multiple shader parameters (loading or resetting the material.)
     /// Flag to suppress parameter hash and memory use recalculation when setting multiple shader parameters (loading or resetting the material.)
-    bool batchedParameterUpdate_;
+    bool batchedParameterUpdate_{};
     /// XML file used while loading.
     /// XML file used while loading.
     SharedPtr<XMLFile> loadXMLFile_;
     SharedPtr<XMLFile> loadXMLFile_;
     /// JSON file used while loading.
     /// JSON file used while loading.

+ 1 - 10
Source/Urho3D/Graphics/OcclusionBuffer.cpp

@@ -48,16 +48,7 @@ void DrawOcclusionBatchWork(const WorkItem* item, unsigned threadIndex)
 }
 }
 
 
 OcclusionBuffer::OcclusionBuffer(Context* context) :
 OcclusionBuffer::OcclusionBuffer(Context* context) :
-    Object(context),
-    width_(0),
-    height_(0),
-    numTriangles_(0),
-    maxTriangles_(OCCLUSION_DEFAULT_MAX_TRIANGLES),
-    cullMode_(CULL_CCW),
-    depthHierarchyDirty_(true),
-    reverseCulling_(false),
-    nearClip_(0.0f),
-    farClip_(0.0f)
+    Object(context)
 {
 {
 }
 }
 
 

+ 15 - 15
Source/Urho3D/Graphics/OcclusionBuffer.h

@@ -184,19 +184,19 @@ private:
     /// Submitted render jobs.
     /// Submitted render jobs.
     PODVector<OcclusionBatch> batches_;
     PODVector<OcclusionBatch> batches_;
     /// Buffer width.
     /// Buffer width.
-    int width_;
+    int width_{};
     /// Buffer height.
     /// Buffer height.
-    int height_;
+    int height_{};
     /// Number of rendered triangles.
     /// Number of rendered triangles.
-    unsigned numTriangles_;
+    unsigned numTriangles_{};
     /// Maximum number of triangles.
     /// Maximum number of triangles.
-    unsigned maxTriangles_;
+    unsigned maxTriangles_{OCCLUSION_DEFAULT_MAX_TRIANGLES};
     /// Culling mode.
     /// Culling mode.
-    CullMode cullMode_;
+    CullMode cullMode_{CULL_CCW};
     /// Depth hierarchy needs update flag.
     /// Depth hierarchy needs update flag.
-    bool depthHierarchyDirty_;
+    bool depthHierarchyDirty_{true};
     /// Culling reverse flag.
     /// Culling reverse flag.
-    bool reverseCulling_;
+    bool reverseCulling_{};
     /// View transform matrix.
     /// View transform matrix.
     Matrix3x4 view_;
     Matrix3x4 view_;
     /// Projection matrix.
     /// Projection matrix.
@@ -206,21 +206,21 @@ private:
     /// Last used timer.
     /// Last used timer.
     Timer useTimer_;
     Timer useTimer_;
     /// Near clip distance.
     /// Near clip distance.
-    float nearClip_;
+    float nearClip_{};
     /// Far clip distance.
     /// Far clip distance.
-    float farClip_;
+    float farClip_{};
     /// X scaling for viewport transform.
     /// X scaling for viewport transform.
-    float scaleX_;
+    float scaleX_{};
     /// Y scaling for viewport transform.
     /// Y scaling for viewport transform.
-    float scaleY_;
+    float scaleY_{};
     /// X offset for viewport transform.
     /// X offset for viewport transform.
-    float offsetX_;
+    float offsetX_{};
     /// Y offset for viewport transform.
     /// Y offset for viewport transform.
-    float offsetY_;
+    float offsetY_{};
     /// Combined X projection and viewport transform.
     /// Combined X projection and viewport transform.
-    float projOffsetScaleX_;
+    float projOffsetScaleX_{};
     /// Combined Y projection and viewport transform.
     /// Combined Y projection and viewport transform.
-    float projOffsetScaleY_;
+    float projOffsetScaleY_{};
 };
 };
 
 
 }
 }

+ 0 - 4
Source/Urho3D/Graphics/Octree.cpp

@@ -70,15 +70,11 @@ inline bool CompareRayQueryResults(const RayQueryResult& lhs, const RayQueryResu
 
 
 Octant::Octant(const BoundingBox& box, unsigned level, Octant* parent, Octree* root, unsigned index) :
 Octant::Octant(const BoundingBox& box, unsigned level, Octant* parent, Octree* root, unsigned index) :
     level_(level),
     level_(level),
-    numDrawables_(0),
     parent_(parent),
     parent_(parent),
     root_(root),
     root_(root),
     index_(index)
     index_(index)
 {
 {
     Initialize(box);
     Initialize(box);
-
-    for (auto& child : children_)
-        child = nullptr;
 }
 }
 
 
 Octant::~Octant()
 Octant::~Octant()

+ 2 - 4
Source/Urho3D/Graphics/Octree.h

@@ -139,7 +139,7 @@ protected:
     /// Drawable objects.
     /// Drawable objects.
     PODVector<Drawable*> drawables_;
     PODVector<Drawable*> drawables_;
     /// Child octants.
     /// Child octants.
-    Octant* children_[NUM_OCTANTS];
+    Octant* children_[NUM_OCTANTS]{};
     /// World bounding box center.
     /// World bounding box center.
     Vector3 center_;
     Vector3 center_;
     /// World bounding box half size.
     /// World bounding box half size.
@@ -147,7 +147,7 @@ protected:
     /// Subdivision level.
     /// Subdivision level.
     unsigned level_;
     unsigned level_;
     /// Number of drawable objects in this octant and child octants.
     /// Number of drawable objects in this octant and child octants.
-    unsigned numDrawables_;
+    unsigned numDrawables_{};
     /// Parent octant.
     /// Parent octant.
     Octant* parent_;
     Octant* parent_;
     /// Octree root.
     /// Octree root.
@@ -159,8 +159,6 @@ protected:
 /// %Octree component. Should be added only to the root scene node
 /// %Octree component. Should be added only to the root scene node
 class URHO3D_API Octree : public Component, public Octant
 class URHO3D_API Octree : public Component, public Octant
 {
 {
-    friend void RaycastDrawablesWork(const WorkItem* item, unsigned threadIndex);
-
     URHO3D_OBJECT(Octree, Component);
     URHO3D_OBJECT(Octree, Component);
 
 
 public:
 public:

+ 0 - 31
Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

@@ -223,40 +223,9 @@ bool Graphics::gl3Support = false;
 Graphics::Graphics(Context* context) :
 Graphics::Graphics(Context* context) :
     Object(context),
     Object(context),
     impl_(new GraphicsImpl()),
     impl_(new GraphicsImpl()),
-    window_(nullptr),
-    externalWindow_(nullptr),
-    width_(0),
-    height_(0),
     position_(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED),
     position_(SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED),
-    multiSample_(1),
-    fullscreen_(false),
-    borderless_(false),
-    resizable_(false),
-    highDPI_(false),
-    vsync_(false),
-    monitor_(0),
-    refreshRate_(0),
-    tripleBuffer_(false),
-    sRGB_(false),
-    forceGL2_(false),
-    instancingSupport_(false),
-    lightPrepassSupport_(false),
-    deferredSupport_(false),
-    anisotropySupport_(false),
-    dxtTextureSupport_(false),
-    etcTextureSupport_(false),
-    pvrtcTextureSupport_(false),
-    hardwareShadowSupport_(false),
-    sRGBSupport_(false),
-    sRGBWriteSupport_(false),
-    numPrimitives_(0),
-    numBatches_(0),
-    maxScratchBufferRequest_(0),
-    dummyColorFormat_(0),
     shadowMapFormat_(GL_DEPTH_COMPONENT16),
     shadowMapFormat_(GL_DEPTH_COMPONENT16),
     hiresShadowMapFormat_(GL_DEPTH_COMPONENT24),
     hiresShadowMapFormat_(GL_DEPTH_COMPONENT24),
-    defaultTextureFilterMode_(FILTER_TRILINEAR),
-    defaultTextureAnisotropy_(4),
     shaderPath_("Shaders/GLSL/"),
     shaderPath_("Shaders/GLSL/"),
     shaderExtension_(".glsl"),
     shaderExtension_(".glsl"),
     orientations_("LandscapeLeft LandscapeRight"),
     orientations_("LandscapeLeft LandscapeRight"),

+ 0 - 53
Source/Urho3D/Graphics/OpenGL/OGLGraphicsImpl.cpp

@@ -1,53 +0,0 @@
-//
-// Copyright (c) 2008-2018 the Urho3D project.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-#include "../../Precompiled.h"
-
-#include "../../Graphics/Graphics.h"
-#include "../../Graphics/GraphicsImpl.h"
-
-#include "../../DebugNew.h"
-
-namespace Urho3D
-{
-
-GraphicsImpl::GraphicsImpl() :
-    context_(nullptr),
-    systemFBO_(0),
-    activeTexture_(0),
-    enabledVertexAttributes_(0),
-    usedVertexAttributes_(0),
-    instancingVertexAttributes_(0),
-    vertexAttributes_(nullptr),
-    boundFBO_(0),
-    boundVBO_(0),
-    boundUBO_(0),
-    resolveSrcFBO_(0),
-    resolveDestFBO_(0),
-    pixelFormat_(0),
-    fboDirty_(false),
-    vertexBuffersDirty_(false),
-    shaderProgram_(nullptr)
-{
-}
-
-}

+ 21 - 21
Source/Urho3D/Graphics/OpenGL/OGLGraphicsImpl.h

@@ -106,62 +106,62 @@ class URHO3D_API GraphicsImpl
 
 
 public:
 public:
     /// Construct.
     /// Construct.
-    GraphicsImpl();
+    GraphicsImpl() = default;
 
 
     /// Return the GL Context.
     /// Return the GL Context.
     const SDL_GLContext& GetGLContext() { return context_; }
     const SDL_GLContext& GetGLContext() { return context_; }
 
 
 private:
 private:
     /// SDL OpenGL context.
     /// SDL OpenGL context.
-    SDL_GLContext context_;
+    SDL_GLContext context_{};
     /// iOS/tvOS system framebuffer handle.
     /// iOS/tvOS system framebuffer handle.
-    unsigned systemFBO_;
+    unsigned systemFBO_{};
     /// Active texture unit.
     /// Active texture unit.
-    unsigned activeTexture_;
+    unsigned activeTexture_{};
     /// Enabled vertex attributes bitmask.
     /// Enabled vertex attributes bitmask.
-    unsigned enabledVertexAttributes_;
+    unsigned enabledVertexAttributes_{};
     /// Vertex attributes bitmask used by the current shader program.
     /// Vertex attributes bitmask used by the current shader program.
-    unsigned usedVertexAttributes_;
+    unsigned usedVertexAttributes_{};
     /// Vertex attribute instancing bitmask for keeping track of divisors.
     /// Vertex attribute instancing bitmask for keeping track of divisors.
-    unsigned instancingVertexAttributes_;
+    unsigned instancingVertexAttributes_{};
     /// Current mapping of vertex attribute locations by semantic. The map is owned by the shader program, so care must be taken to switch a null shader program when it's destroyed.
     /// Current mapping of vertex attribute locations by semantic. The map is owned by the shader program, so care must be taken to switch a null shader program when it's destroyed.
-    const HashMap<Pair<unsigned char, unsigned char>, unsigned>* vertexAttributes_;
+    const HashMap<Pair<unsigned char, unsigned char>, unsigned>* vertexAttributes_{};
     /// Currently bound frame buffer object.
     /// Currently bound frame buffer object.
-    unsigned boundFBO_;
+    unsigned boundFBO_{};
     /// Currently bound vertex buffer object.
     /// Currently bound vertex buffer object.
-    unsigned boundVBO_;
+    unsigned boundVBO_{};
     /// Currently bound uniform buffer object.
     /// Currently bound uniform buffer object.
-    unsigned boundUBO_;
+    unsigned boundUBO_{};
     /// Read frame buffer for multisampled texture resolves.
     /// Read frame buffer for multisampled texture resolves.
-    unsigned resolveSrcFBO_;
+    unsigned resolveSrcFBO_{};
     /// Write frame buffer for multisampled texture resolves.
     /// Write frame buffer for multisampled texture resolves.
-    unsigned resolveDestFBO_;
+    unsigned resolveDestFBO_{};
     /// Current pixel format.
     /// Current pixel format.
-    int pixelFormat_;
+    int pixelFormat_{};
     /// Map for FBO's per resolution and format.
     /// Map for FBO's per resolution and format.
     HashMap<unsigned long long, FrameBufferObject> frameBuffers_;
     HashMap<unsigned long long, FrameBufferObject> frameBuffers_;
     /// OpenGL texture types in use.
     /// OpenGL texture types in use.
-    unsigned textureTypes_[MAX_TEXTURE_UNITS];
+    unsigned textureTypes_[MAX_TEXTURE_UNITS]{};
     /// Constant buffer search map.
     /// Constant buffer search map.
     ConstantBufferMap allConstantBuffers_;
     ConstantBufferMap allConstantBuffers_;
     /// Currently bound constant buffers.
     /// Currently bound constant buffers.
-    ConstantBuffer* constantBuffers_[MAX_SHADER_PARAMETER_GROUPS * 2];
+    ConstantBuffer* constantBuffers_[MAX_SHADER_PARAMETER_GROUPS * 2]{};
     /// Dirty constant buffers.
     /// Dirty constant buffers.
     PODVector<ConstantBuffer*> dirtyConstantBuffers_;
     PODVector<ConstantBuffer*> dirtyConstantBuffers_;
     /// Last used instance data offset.
     /// Last used instance data offset.
-    unsigned lastInstanceOffset_;
+    unsigned lastInstanceOffset_{};
     /// Map for additional depth textures, to emulate Direct3D9 ability to mix render texture and backbuffer rendering.
     /// Map for additional depth textures, to emulate Direct3D9 ability to mix render texture and backbuffer rendering.
     HashMap<int, SharedPtr<Texture2D> > depthTextures_;
     HashMap<int, SharedPtr<Texture2D> > depthTextures_;
     /// Shader program in use.
     /// Shader program in use.
-    ShaderProgram* shaderProgram_;
+    ShaderProgram* shaderProgram_{};
     /// Linked shader programs.
     /// Linked shader programs.
     ShaderProgramMap shaderPrograms_;
     ShaderProgramMap shaderPrograms_;
     /// Need FBO commit flag.
     /// Need FBO commit flag.
-    bool fboDirty_;
+    bool fboDirty_{};
     /// Need vertex attribute pointer update flag.
     /// Need vertex attribute pointer update flag.
-    bool vertexBuffersDirty_;
+    bool vertexBuffersDirty_{};
     /// sRGB write mode flag.
     /// sRGB write mode flag.
-    bool sRGBWrite_;
+    bool sRGBWrite_{};
 };
 };
 
 
 }
 }

+ 2 - 4
Source/Urho3D/Graphics/OpenGL/OGLRenderSurface.cpp

@@ -42,12 +42,10 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-RenderSurface::RenderSurface(Texture* parentTexture) :
+RenderSurface::RenderSurface(Texture* parentTexture) :      // NOLINT(hicpp-member-init)
     parentTexture_(parentTexture),
     parentTexture_(parentTexture),
     target_(GL_TEXTURE_2D),
     target_(GL_TEXTURE_2D),
-    renderBuffer_(0),
-    updateMode_(SURFACE_UPDATEVISIBLE),
-    updateQueued_(false)
+    renderBuffer_(0)
 {
 {
 }
 }
 
 

+ 2 - 6
Source/Urho3D/Graphics/OpenGL/OGLShaderProgram.cpp

@@ -61,12 +61,8 @@ const void* ShaderProgram::globalParameterSources[MAX_SHADER_PARAMETER_GROUPS];
 ShaderProgram::ShaderProgram(Graphics* graphics, ShaderVariation* vertexShader, ShaderVariation* pixelShader) :
 ShaderProgram::ShaderProgram(Graphics* graphics, ShaderVariation* vertexShader, ShaderVariation* pixelShader) :
     GPUObject(graphics),
     GPUObject(graphics),
     vertexShader_(vertexShader),
     vertexShader_(vertexShader),
-    pixelShader_(pixelShader),
-    usedVertexAttributes_(0),
-    frameNumber_(0)
+    pixelShader_(pixelShader)
 {
 {
-    for (bool& useTextureUnit : useTextureUnits_)
-        useTextureUnit = false;
     for (auto& parameterSource : parameterSources_)
     for (auto& parameterSource : parameterSources_)
         parameterSource = (const void*)M_MAX_UNSIGNED;
         parameterSource = (const void*)M_MAX_UNSIGNED;
 }
 }
@@ -277,7 +273,7 @@ bool ShaderProgram::Link()
         {
         {
             // Store constant uniform
             // Store constant uniform
             String paramName = name.Substring(1);
             String paramName = name.Substring(1);
-            ShaderParameter parameter{paramName, type, location};
+            ShaderParameter parameter{paramName, type, location};
             bool store = location >= 0;
             bool store = location >= 0;
 
 
 #ifndef GL_ES_VERSION_2_0
 #ifndef GL_ES_VERSION_2_0

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

@@ -94,19 +94,19 @@ private:
     /// Shader parameters.
     /// Shader parameters.
     HashMap<StringHash, ShaderParameter> shaderParameters_;
     HashMap<StringHash, ShaderParameter> shaderParameters_;
     /// Texture unit use.
     /// Texture unit use.
-    bool useTextureUnits_[MAX_TEXTURE_UNITS];
+    bool useTextureUnits_[MAX_TEXTURE_UNITS]{};
     /// Vertex attributes.
     /// Vertex attributes.
     HashMap<Pair<unsigned char, unsigned char>, unsigned> vertexAttributes_;
     HashMap<Pair<unsigned char, unsigned char>, unsigned> vertexAttributes_;
     /// Used vertex attribute location bitmask.
     /// Used vertex attribute location bitmask.
-    unsigned usedVertexAttributes_;
+    unsigned usedVertexAttributes_{};
     /// Constant buffers by binding index.
     /// Constant buffers by binding index.
     SharedPtr<ConstantBuffer> constantBuffers_[MAX_SHADER_PARAMETER_GROUPS * 2];
     SharedPtr<ConstantBuffer> constantBuffers_[MAX_SHADER_PARAMETER_GROUPS * 2];
     /// Remembered shader parameter sources for individual uniform mode.
     /// Remembered shader parameter sources for individual uniform mode.
-    const void* parameterSources_[MAX_SHADER_PARAMETER_GROUPS];
+    const void* parameterSources_[MAX_SHADER_PARAMETER_GROUPS]{};
     /// Shader link error string.
     /// Shader link error string.
     String linkerOutput_;
     String linkerOutput_;
     /// Shader parameter source framenumber.
     /// Shader parameter source framenumber.
-    unsigned frameNumber_;
+    unsigned frameNumber_{};
 
 
     /// Global shader parameter source framenumber.
     /// Global shader parameter source framenumber.
     static unsigned globalFrameNumber;
     static unsigned globalFrameNumber;

+ 7 - 0
Source/Urho3D/Graphics/OpenGL/OGLShaderVariation.cpp

@@ -192,4 +192,11 @@ void ShaderVariation::SetDefines(const String& defines)
     defines_ = defines;
     defines_ = defines;
 }
 }
 
 
+// These methods are no-ops for OpenGL
+bool ShaderVariation::LoadByteCode(const String& binaryShaderName) { return false; }
+bool ShaderVariation::Compile() { return false; }
+void ShaderVariation::ParseParameters(unsigned char* bufData, unsigned bufSize) {}
+void ShaderVariation::SaveByteCode(const String& binaryShaderName) {}
+void ShaderVariation::CalculateConstantBufferSizes() {}
+
 }
 }

+ 3 - 3
Source/Urho3D/Graphics/RenderSurface.h

@@ -151,11 +151,11 @@ private:
     /// Linked depth buffer.
     /// Linked depth buffer.
     WeakPtr<RenderSurface> linkedDepthStencil_;
     WeakPtr<RenderSurface> linkedDepthStencil_;
     /// Update mode for viewports.
     /// Update mode for viewports.
-    RenderSurfaceUpdateMode updateMode_;
+    RenderSurfaceUpdateMode updateMode_{SURFACE_UPDATEVISIBLE};
     /// Update queued flag.
     /// Update queued flag.
-    bool updateQueued_;
+    bool updateQueued_{};
     /// Multisampled resolve dirty flag.
     /// Multisampled resolve dirty flag.
-    bool resolveDirty_;
+    bool resolveDirty_{};
 };
 };
 
 
 }
 }

+ 1 - 35
Source/Urho3D/Graphics/Renderer.cpp

@@ -267,40 +267,7 @@ inline PODVector<VertexElement> CreateInstancingBufferElements(unsigned numExtra
 
 
 Renderer::Renderer(Context* context) :
 Renderer::Renderer(Context* context) :
     Object(context),
     Object(context),
-    defaultZone_(new Zone(context)),
-    shadowMapFilterInstance_(nullptr),
-    shadowMapFilter_(nullptr),
-    textureAnisotropy_(4),
-    textureFilterMode_(FILTER_TRILINEAR),
-    textureQuality_(QUALITY_HIGH),
-    materialQuality_(QUALITY_HIGH),
-    shadowMapSize_(1024),
-    shadowQuality_(SHADOWQUALITY_PCF_16BIT),
-    shadowSoftness_(1.0f),
-    vsmShadowParams_(0.0000001f, 0.9f),
-    vsmMultiSample_(1),
-    maxShadowMaps_(1),
-    minInstances_(2),
-    maxSortedInstances_(1000),
-    maxOccluderTriangles_(5000),
-    occlusionBufferSize_(256),
-    occluderSizeThreshold_(0.025f),
-    mobileShadowBiasMul_(1.0f),
-    mobileShadowBiasAdd_(0.0f),
-    mobileNormalOffsetMul_(1.0f),
-    numOcclusionBuffers_(0),
-    numShadowCameras_(0),
-    shadersChangedFrameNumber_(M_MAX_UNSIGNED),
-    hdrRendering_(false),
-    specularLighting_(true),
-    drawShadows_(true),
-    reuseShadowMaps_(true),
-    dynamicInstancing_(true),
-    numExtraInstancingBufferElements_(0),
-    threadedOcclusion_(false),
-    shadersDirty_(true),
-    initialized_(false),
-    resetViews_(false)
+    defaultZone_(new Zone(context))
 {
 {
     SubscribeToEvent(E_SCREENMODE, URHO3D_HANDLER(Renderer, HandleScreenMode));
     SubscribeToEvent(E_SCREENMODE, URHO3D_HANDLER(Renderer, HandleScreenMode));
 
 
@@ -1639,7 +1606,6 @@ void Renderer::Initialize()
     ResetShadowMaps();
     ResetShadowMaps();
     ResetBuffers();
     ResetBuffers();
 
 
-    shadersDirty_ = true;
     initialized_ = true;
     initialized_ = true;
 
 
     SubscribeToEvent(E_RENDERUPDATE, URHO3D_HANDLER(Renderer, HandleRenderUpdate));
     SubscribeToEvent(E_RENDERUPDATE, URHO3D_HANDLER(Renderer, HandleRenderUpdate));

+ 36 - 36
Source/Urho3D/Graphics/Renderer.h

@@ -505,9 +505,9 @@ private:
     /// Shadow map allocations by resolution.
     /// Shadow map allocations by resolution.
     HashMap<int, PODVector<Light*> > shadowMapAllocations_;
     HashMap<int, PODVector<Light*> > shadowMapAllocations_;
     /// Instance of shadow map filter
     /// Instance of shadow map filter
-    Object* shadowMapFilterInstance_;
+    Object* shadowMapFilterInstance_{};
     /// Function pointer of shadow map filter
     /// Function pointer of shadow map filter
-    ShadowMapFilter shadowMapFilter_;
+    ShadowMapFilter shadowMapFilter_{};
     /// Screen buffers by resolution and format.
     /// Screen buffers by resolution and format.
     HashMap<long long, Vector<SharedPtr<Texture> > > screenBuffers_;
     HashMap<long long, Vector<SharedPtr<Texture> > > screenBuffers_;
     /// Current screen buffer allocations by resolution and format.
     /// Current screen buffer allocations by resolution and format.
@@ -535,73 +535,73 @@ private:
     /// Frame info for rendering.
     /// Frame info for rendering.
     FrameInfo frame_;
     FrameInfo frame_;
     /// Texture anisotropy level.
     /// Texture anisotropy level.
-    int textureAnisotropy_;
+    int textureAnisotropy_{4};
     /// Texture filtering mode.
     /// Texture filtering mode.
-    TextureFilterMode textureFilterMode_;
+    TextureFilterMode textureFilterMode_{FILTER_TRILINEAR};
     /// Texture quality level.
     /// Texture quality level.
-    int textureQuality_;
+    int textureQuality_{QUALITY_HIGH};
     /// Material quality level.
     /// Material quality level.
-    int materialQuality_;
+    int materialQuality_{QUALITY_HIGH};
     /// Shadow map resolution.
     /// Shadow map resolution.
-    int shadowMapSize_;
+    int shadowMapSize_{1024};
     /// Shadow quality.
     /// Shadow quality.
-    ShadowQuality shadowQuality_;
+    ShadowQuality shadowQuality_{SHADOWQUALITY_PCF_16BIT};
     /// Shadow softness, only works when SHADOWQUALITY_BLUR_VSM is used.
     /// Shadow softness, only works when SHADOWQUALITY_BLUR_VSM is used.
-    float shadowSoftness_;
+    float shadowSoftness_{1.0f};
     /// Shadow parameters when VSM is used, they help to reduce light bleeding.
     /// Shadow parameters when VSM is used, they help to reduce light bleeding.
-    Vector2 vsmShadowParams_;
+    Vector2 vsmShadowParams_{0.0000001f, 0.9f};
     /// Multisample level for VSM shadows.
     /// Multisample level for VSM shadows.
-    int vsmMultiSample_;
+    int vsmMultiSample_{1};
     /// Maximum number of shadow maps per resolution.
     /// Maximum number of shadow maps per resolution.
-    int maxShadowMaps_;
+    int maxShadowMaps_{1};
     /// Minimum number of instances required in a batch group to render as instanced.
     /// Minimum number of instances required in a batch group to render as instanced.
-    int minInstances_;
+    int minInstances_{2};
     /// Maximum sorted instances per batch group.
     /// Maximum sorted instances per batch group.
-    int maxSortedInstances_;
+    int maxSortedInstances_{1000};
     /// Maximum occluder triangles.
     /// Maximum occluder triangles.
-    int maxOccluderTriangles_;
+    int maxOccluderTriangles_{5000};
     /// Occlusion buffer width.
     /// Occlusion buffer width.
-    int occlusionBufferSize_;
+    int occlusionBufferSize_{256};
     /// Occluder screen size threshold.
     /// Occluder screen size threshold.
-    float occluderSizeThreshold_;
+    float occluderSizeThreshold_{0.025f};
     /// Mobile platform shadow depth bias multiplier.
     /// Mobile platform shadow depth bias multiplier.
-    float mobileShadowBiasMul_;
+    float mobileShadowBiasMul_{1.0f};
     /// Mobile platform shadow depth bias addition.
     /// Mobile platform shadow depth bias addition.
-    float mobileShadowBiasAdd_;
+    float mobileShadowBiasAdd_{};
     /// Mobile platform shadow normal offset multiplier.
     /// Mobile platform shadow normal offset multiplier.
-    float mobileNormalOffsetMul_;
+    float mobileNormalOffsetMul_{1.0f};
     /// Number of occlusion buffers in use.
     /// Number of occlusion buffers in use.
-    unsigned numOcclusionBuffers_;
+    unsigned numOcclusionBuffers_{};
     /// Number of temporary shadow cameras in use.
     /// Number of temporary shadow cameras in use.
-    unsigned numShadowCameras_;
+    unsigned numShadowCameras_{};
     /// Number of primitives (3D geometry only.)
     /// Number of primitives (3D geometry only.)
-    unsigned numPrimitives_;
+    unsigned numPrimitives_{};
     /// Number of batches (3D geometry only.)
     /// Number of batches (3D geometry only.)
-    unsigned numBatches_;
+    unsigned numBatches_{};
     /// Frame number on which shaders last changed.
     /// Frame number on which shaders last changed.
-    unsigned shadersChangedFrameNumber_;
+    unsigned shadersChangedFrameNumber_{M_MAX_UNSIGNED};
     /// Current stencil value for light optimization.
     /// Current stencil value for light optimization.
-    unsigned char lightStencilValue_;
+    unsigned char lightStencilValue_{};
     /// HDR rendering flag.
     /// HDR rendering flag.
-    bool hdrRendering_;
+    bool hdrRendering_{};
     /// Specular lighting flag.
     /// Specular lighting flag.
-    bool specularLighting_;
+    bool specularLighting_{true};
     /// Draw shadows flag.
     /// Draw shadows flag.
-    bool drawShadows_;
+    bool drawShadows_{true};
     /// Shadow map reuse flag.
     /// Shadow map reuse flag.
-    bool reuseShadowMaps_;
+    bool reuseShadowMaps_{true};
     /// Dynamic instancing flag.
     /// Dynamic instancing flag.
-    bool dynamicInstancing_;
+    bool dynamicInstancing_{true};
     /// Number of extra instancing data elements.
     /// Number of extra instancing data elements.
-    int numExtraInstancingBufferElements_;
+    int numExtraInstancingBufferElements_{};
     /// Threaded occlusion rendering flag.
     /// Threaded occlusion rendering flag.
-    bool threadedOcclusion_;
+    bool threadedOcclusion_{};
     /// Shaders need reloading flag.
     /// Shaders need reloading flag.
-    bool shadersDirty_;
+    bool shadersDirty_{true};
     /// Initialized flag.
     /// Initialized flag.
-    bool initialized_;
+    bool initialized_{};
     /// Flag for views needing reset.
     /// Flag for views needing reset.
-    bool resetViews_;
+    bool resetViews_{};
 };
 };
 
 
 }
 }

+ 4 - 9
Source/Urho3D/Graphics/ShaderVariation.cpp

@@ -31,14 +31,14 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-ShaderParameter::ShaderParameter(const String& name, unsigned glType, int location) :
+ShaderParameter::ShaderParameter(const String& name, unsigned glType, int location) :   // NOLINT(hicpp-member-init)
     name_{name},
     name_{name},
     glType_{glType},
     glType_{glType},
     location_{location}
     location_{location}
 {
 {
 }
 }
 
 
-ShaderParameter::ShaderParameter(ShaderType type, const String& name, unsigned offset, unsigned size, unsigned buffer) :
+ShaderParameter::ShaderParameter(ShaderType type, const String& name, unsigned offset, unsigned size, unsigned buffer) :    // NOLINT(hicpp-member-init)
     type_{type},
     type_{type},
     name_{name},
     name_{name},
     offset_{offset},
     offset_{offset},
@@ -47,7 +47,7 @@ ShaderParameter::ShaderParameter(ShaderType type, const String& name, unsigned o
 {
 {
 }
 }
 
 
-ShaderParameter::ShaderParameter(ShaderType type, const String& name, unsigned reg, unsigned regCount) :
+ShaderParameter::ShaderParameter(ShaderType type, const String& name, unsigned reg, unsigned regCount) :    // NOLINT(hicpp-member-init)
     type_{type},
     type_{type},
     name_{name},
     name_{name},
     register_{reg},
     register_{reg},
@@ -58,13 +58,8 @@ ShaderParameter::ShaderParameter(ShaderType type, const String& name, unsigned r
 ShaderVariation::ShaderVariation(Shader* owner, ShaderType type) :
 ShaderVariation::ShaderVariation(Shader* owner, ShaderType type) :
     GPUObject(owner->GetSubsystem<Graphics>()),
     GPUObject(owner->GetSubsystem<Graphics>()),
     owner_(owner),
     owner_(owner),
-    type_(type),
-    elementHash_(0)
+    type_(type)
 {
 {
-    for (bool& useTextureUnit : useTextureUnits_)
-        useTextureUnit = false;
-    for (unsigned& constantBufferSize : constantBufferSizes_)
-        constantBufferSize = 0;
 }
 }
 
 
 ShaderVariation::~ShaderVariation()
 ShaderVariation::~ShaderVariation()

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

@@ -38,23 +38,23 @@ class Shader;
 struct ShaderParameter
 struct ShaderParameter
 {
 {
     /// Construct with defaults.
     /// Construct with defaults.
-    ShaderParameter() = default;
-    /// Construct with name, glType and location, leaving the remaining attributes zero-initialized (used only in OpenGL).
-    ShaderParameter(const String& name, unsigned glType, int location);
-    /// Construct with type, name, offset, size, and buffer, leaving the remaining attributes zero-initialized (used only in Direct3D11).
-    ShaderParameter(ShaderType type, const String& name, unsigned offset, unsigned size, unsigned buffer);
-    /// Construct with type, name, register, and register count, leaving the remaining attributes zero-initialized (used only in Direct3D9).
-    ShaderParameter(ShaderType type, const String& name, unsigned reg, unsigned regCount);
-
-    /// %Shader type.
-    ShaderType type_{};
+    ShaderParameter() = default;
+    /// Construct with name, glType and location, leaving the remaining attributes zero-initialized (used only in OpenGL).
+    ShaderParameter(const String& name, unsigned glType, int location);
+    /// Construct with type, name, offset, size, and buffer, leaving the remaining attributes zero-initialized (used only in Direct3D11).
+    ShaderParameter(ShaderType type, const String& name, unsigned offset, unsigned size, unsigned buffer);
+    /// Construct with type, name, register, and register count, leaving the remaining attributes zero-initialized (used only in Direct3D9).
+    ShaderParameter(ShaderType type, const String& name, unsigned reg, unsigned regCount);
+
+    /// %Shader type.
+    ShaderType type_{};
     /// Name of the parameter.
     /// Name of the parameter.
-    String name_{};
+    String name_{};
 
 
     union
     union
     {
     {
         /// Offset in constant buffer.
         /// Offset in constant buffer.
-        unsigned offset_{};
+        unsigned offset_;
         /// OpenGL uniform location.
         /// OpenGL uniform location.
         int location_;
         int location_;
         /// Direct3D9 register index.
         /// Direct3D9 register index.
@@ -64,7 +64,7 @@ struct ShaderParameter
     union
     union
     {
     {
         /// Parameter size. Used only on Direct3D11 to calculate constant buffer size.
         /// Parameter size. Used only on Direct3D11 to calculate constant buffer size.
-        unsigned size_{};
+        unsigned size_;
         /// Parameter OpenGL type.
         /// Parameter OpenGL type.
         unsigned glType_;
         unsigned glType_;
         /// Number of registers on Direct3D9.
         /// Number of registers on Direct3D9.
@@ -72,9 +72,9 @@ struct ShaderParameter
     };
     };
 
 
     /// Constant buffer index. Only used on Direct3D11.
     /// Constant buffer index. Only used on Direct3D11.
-    unsigned buffer_{};
+    unsigned buffer_{};
     /// Constant buffer pointer. Defined only in shader programs.
     /// Constant buffer pointer. Defined only in shader programs.
-    ConstantBuffer* bufferPtr_{};
+    ConstantBuffer* bufferPtr_{};
 };
 };
 
 
 /// Vertex or pixel shader on the GPU.
 /// Vertex or pixel shader on the GPU.
@@ -157,13 +157,13 @@ private:
     /// Shader type.
     /// Shader type.
     ShaderType type_;
     ShaderType type_;
     /// Vertex element hash for vertex shaders. Zero for pixel shaders. Note that hashing is different than vertex buffers.
     /// Vertex element hash for vertex shaders. Zero for pixel shaders. Note that hashing is different than vertex buffers.
-    unsigned long long elementHash_;
+    unsigned long long elementHash_{};
     /// Shader parameters.
     /// Shader parameters.
     HashMap<StringHash, ShaderParameter> parameters_;
     HashMap<StringHash, ShaderParameter> parameters_;
     /// Texture unit use flags.
     /// Texture unit use flags.
-    bool useTextureUnits_[MAX_TEXTURE_UNITS];
+    bool useTextureUnits_[MAX_TEXTURE_UNITS]{};
     /// Constant buffer sizes. 0 if a constant buffer slot is not in use.
     /// Constant buffer sizes. 0 if a constant buffer slot is not in use.
-    unsigned constantBufferSizes_[MAX_SHADER_PARAMETER_GROUPS];
+    unsigned constantBufferSizes_[MAX_SHADER_PARAMETER_GROUPS]{};
     /// Shader bytecode. Needed for inspecting the input signature and parameters. Not used on OpenGL.
     /// Shader bytecode. Needed for inspecting the input signature and parameters. Not used on OpenGL.
     PODVector<unsigned char> byteCode_;
     PODVector<unsigned char> byteCode_;
     /// Shader name.
     /// Shader name.

+ 1 - 3
Source/Urho3D/Graphics/StaticModelGroup.cpp

@@ -47,9 +47,7 @@ static const StringVector instanceNodesStructureElementNames =
 };
 };
 
 
 StaticModelGroup::StaticModelGroup(Context* context) :
 StaticModelGroup::StaticModelGroup(Context* context) :
-    StaticModel(context),
-    nodesDirty_(false),
-    nodeIDsDirty_(false)
+    StaticModel(context)
 {
 {
     // Initialize the default node IDs attribute
     // Initialize the default node IDs attribute
     UpdateNodeIDs();
     UpdateNodeIDs();

+ 3 - 3
Source/Urho3D/Graphics/StaticModelGroup.h

@@ -89,11 +89,11 @@ private:
     /// IDs of instance nodes for serialization.
     /// IDs of instance nodes for serialization.
     mutable VariantVector nodeIDsAttr_;
     mutable VariantVector nodeIDsAttr_;
     /// Number of valid instance node transforms.
     /// Number of valid instance node transforms.
-    unsigned numWorldTransforms_;
+    unsigned numWorldTransforms_{};
     /// Whether node IDs have been set and nodes should be searched for during ApplyAttributes.
     /// Whether node IDs have been set and nodes should be searched for during ApplyAttributes.
-    mutable bool nodesDirty_;
+    mutable bool nodesDirty_{};
     /// Whether nodes have been manipulated by the API and node ID attribute should be refreshed.
     /// Whether nodes have been manipulated by the API and node ID attribute should be refreshed.
-    mutable bool nodeIDsDirty_;
+    mutable bool nodeIDsDirty_{};
 };
 };
 
 
 }
 }

+ 1 - 24
Source/Urho3D/Graphics/Texture.cpp

@@ -57,31 +57,8 @@ static const char* filterModeNames[] =
 
 
 Texture::Texture(Context* context) :
 Texture::Texture(Context* context) :
     ResourceWithMetadata(context),
     ResourceWithMetadata(context),
-    GPUObject(GetSubsystem<Graphics>()),
-    shaderResourceView_(nullptr),
-    sampler_(nullptr),
-    resolveTexture_(nullptr),
-    format_(0),
-    usage_(TEXTURE_STATIC),
-    levels_(0),
-    requestedLevels_(0),
-    width_(0),
-    height_(0),
-    depth_(0),
-    shadowCompare_(false),
-    filterMode_(FILTER_DEFAULT),
-    anisotropy_(0),
-    multiSample_(1),
-    sRGB_(false),
-    parametersDirty_(true),
-    autoResolve_(false),
-    resolveDirty_(false),
-    levelsDirty_(false)
+    GPUObject(GetSubsystem<Graphics>())
 {
 {
-    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);
 }
 }
 
 
 Texture::~Texture() = default;
 Texture::~Texture() = default;

+ 24 - 27
Source/Urho3D/Graphics/Texture.h

@@ -195,57 +195,54 @@ protected:
     /// Create the GPU texture. Implemented in subclasses.
     /// Create the GPU texture. Implemented in subclasses.
     virtual bool Create() { return true; }
     virtual bool Create() { return true; }
 
 
-    union
-    {
-        /// Direct3D11 shader resource view.
-        void* shaderResourceView_;
-        /// OpenGL target.
-        unsigned target_;
-    };
+    /// OpenGL target.
+    unsigned target_{};
 
 
+    /// Direct3D11 shader resource view.
+    void* shaderResourceView_{};
     /// Direct3D11 sampler state object.
     /// Direct3D11 sampler state object.
-    void* sampler_;
+    void* sampler_{};
     /// Direct3D11 resolve texture object when multisample with autoresolve is used.
     /// Direct3D11 resolve texture object when multisample with autoresolve is used.
-    void* resolveTexture_;
+    void* resolveTexture_{};
 
 
     /// Texture format.
     /// Texture format.
-    unsigned format_;
+    unsigned format_{};
     /// Texture usage type.
     /// Texture usage type.
-    TextureUsage usage_;
+    TextureUsage usage_{TEXTURE_STATIC};
     /// Current mip levels.
     /// Current mip levels.
-    unsigned levels_;
+    unsigned levels_{};
     /// Requested mip levels.
     /// Requested mip levels.
-    unsigned requestedLevels_;
+    unsigned requestedLevels_{};
     /// Texture width.
     /// Texture width.
-    int width_;
+    int width_{};
     /// Texture height.
     /// Texture height.
-    int height_;
+    int height_{};
     /// Texture depth.
     /// Texture depth.
-    int depth_;
+    int depth_{};
     /// Shadow compare mode.
     /// Shadow compare mode.
-    bool shadowCompare_;
+    bool shadowCompare_{};
     /// Filtering mode.
     /// Filtering mode.
-    TextureFilterMode filterMode_;
+    TextureFilterMode filterMode_{FILTER_DEFAULT};
     /// Addressing mode.
     /// Addressing mode.
-    TextureAddressMode addressModes_[MAX_COORDS];
+    TextureAddressMode addressModes_[MAX_COORDS]{ADDRESS_WRAP, ADDRESS_WRAP, ADDRESS_WRAP};
     /// Texture anisotropy level.
     /// Texture anisotropy level.
-    unsigned anisotropy_;
+    unsigned anisotropy_{};
     /// Mip levels to skip when loading per texture quality setting.
     /// Mip levels to skip when loading per texture quality setting.
-    unsigned mipsToSkip_[MAX_TEXTURE_QUALITY_LEVELS];
+    unsigned mipsToSkip_[MAX_TEXTURE_QUALITY_LEVELS]{2, 1, 0};
     /// Border color.
     /// Border color.
     Color borderColor_;
     Color borderColor_;
     /// Multisampling level.
     /// Multisampling level.
-    int multiSample_;
+    int multiSample_{1};
     /// sRGB sampling and writing mode flag.
     /// sRGB sampling and writing mode flag.
-    bool sRGB_;
+    bool sRGB_{};
     /// Parameters dirty flag.
     /// Parameters dirty flag.
-    bool parametersDirty_;
+    bool parametersDirty_{true};
     /// Multisampling autoresolve flag.
     /// Multisampling autoresolve flag.
-    bool autoResolve_;
+    bool autoResolve_{};
     /// Multisampling resolve needed -flag.
     /// Multisampling resolve needed -flag.
-    bool resolveDirty_;
+    bool resolveDirty_{};
     /// Mipmap levels regeneration needed -flag.
     /// Mipmap levels regeneration needed -flag.
-    bool levelsDirty_;
+    bool levelsDirty_{};
     /// Backup texture.
     /// Backup texture.
     SharedPtr<Texture> backupTexture_;
     SharedPtr<Texture> backupTexture_;
 };
 };

+ 1 - 4
Source/Urho3D/Graphics/Texture2DArray.cpp

@@ -44,14 +44,11 @@ namespace Urho3D
 {
 {
 
 
 Texture2DArray::Texture2DArray(Context* context) :
 Texture2DArray::Texture2DArray(Context* context) :
-    Texture(context),
-    layers_(0)
+    Texture(context)
 {
 {
 #ifdef URHO3D_OPENGL
 #ifdef URHO3D_OPENGL
 #ifndef GL_ES_VERSION_2_0
 #ifndef GL_ES_VERSION_2_0
     target_ = GL_TEXTURE_2D_ARRAY;
     target_ = GL_TEXTURE_2D_ARRAY;
-#else
-    target_ = 0;
 #endif
 #endif
 #endif
 #endif
 }
 }

+ 1 - 1
Source/Urho3D/Graphics/Texture2DArray.h

@@ -83,7 +83,7 @@ private:
     void HandleRenderSurfaceUpdate(StringHash eventType, VariantMap& eventData);
     void HandleRenderSurfaceUpdate(StringHash eventType, VariantMap& eventData);
 
 
     /// Texture array layers number.
     /// Texture array layers number.
-    unsigned layers_;
+    unsigned layers_{};
     /// Render surface.
     /// Render surface.
     SharedPtr<RenderSurface> renderSurface_;
     SharedPtr<RenderSurface> renderSurface_;
     /// Memory use per layer.
     /// Memory use per layer.

+ 0 - 2
Source/Urho3D/Graphics/Texture3D.cpp

@@ -45,8 +45,6 @@ Texture3D::Texture3D(Context* context) :
 #ifdef URHO3D_OPENGL
 #ifdef URHO3D_OPENGL
 #ifndef GL_ES_VERSION_2_0
 #ifndef GL_ES_VERSION_2_0
     target_ = GL_TEXTURE_3D;
     target_ = GL_TEXTURE_3D;
-#else
-    target_ = 0;
 #endif
 #endif
 #endif
 #endif
 }
 }

+ 0 - 3
Source/Urho3D/Graphics/TextureCube.cpp

@@ -69,9 +69,6 @@ TextureCube::TextureCube(Context* context) :
     addressModes_[COORD_U] = ADDRESS_CLAMP;
     addressModes_[COORD_U] = ADDRESS_CLAMP;
     addressModes_[COORD_V] = ADDRESS_CLAMP;
     addressModes_[COORD_V] = ADDRESS_CLAMP;
     addressModes_[COORD_W] = ADDRESS_CLAMP;
     addressModes_[COORD_W] = ADDRESS_CLAMP;
-
-    for (unsigned& memoryUse : faceMemoryUse_)
-        memoryUse = 0;
 }
 }
 
 
 TextureCube::~TextureCube()
 TextureCube::~TextureCube()

+ 1 - 1
Source/Urho3D/Graphics/TextureCube.h

@@ -84,7 +84,7 @@ private:
     /// Render surfaces.
     /// Render surfaces.
     SharedPtr<RenderSurface> renderSurfaces_[MAX_CUBEMAP_FACES];
     SharedPtr<RenderSurface> renderSurfaces_[MAX_CUBEMAP_FACES];
     /// Memory use per face.
     /// Memory use per face.
-    unsigned faceMemoryUse_[MAX_CUBEMAP_FACES];
+    unsigned faceMemoryUse_[MAX_CUBEMAP_FACES]{};
     /// Face image files acquired during BeginLoad.
     /// Face image files acquired during BeginLoad.
     Vector<SharedPtr<Image> > loadImages_;
     Vector<SharedPtr<Image> > loadImages_;
     /// Parameter file acquired during BeginLoad.
     /// Parameter file acquired during BeginLoad.

+ 1 - 10
Source/Urho3D/Graphics/VertexBuffer.cpp

@@ -35,16 +35,7 @@ namespace Urho3D
 
 
 VertexBuffer::VertexBuffer(Context* context, bool forceHeadless) :
 VertexBuffer::VertexBuffer(Context* context, bool forceHeadless) :
     Object(context),
     Object(context),
-    GPUObject(forceHeadless ? nullptr : GetSubsystem<Graphics>()),
-    vertexCount_(0),
-    elementMask_(0),
-    lockState_(LOCK_NONE),
-    lockStart_(0),
-    lockCount_(0),
-    lockScratchData_(nullptr),
-    shadowed_(false),
-    dynamic_(false),
-    discardLock_(false)
+    GPUObject(forceHeadless ? nullptr : GetSubsystem<Graphics>())
 {
 {
     UpdateOffsets();
     UpdateOffsets();
 
 

+ 11 - 11
Source/Urho3D/Graphics/VertexBuffer.h

@@ -147,29 +147,29 @@ private:
     /// Shadow data.
     /// Shadow data.
     SharedArrayPtr<unsigned char> shadowData_;
     SharedArrayPtr<unsigned char> shadowData_;
     /// Number of vertices.
     /// Number of vertices.
-    unsigned vertexCount_;
+    unsigned vertexCount_{};
     /// Vertex size.
     /// Vertex size.
-    unsigned vertexSize_;
+    unsigned vertexSize_{};
     /// Vertex elements.
     /// Vertex elements.
     PODVector<VertexElement> elements_;
     PODVector<VertexElement> elements_;
     /// Vertex element hash.
     /// Vertex element hash.
-    unsigned long long elementHash_;
+    unsigned long long elementHash_{};
     /// Vertex element legacy bitmask.
     /// Vertex element legacy bitmask.
-    unsigned elementMask_;
+    unsigned elementMask_{};
     /// Buffer locking state.
     /// Buffer locking state.
-    LockState lockState_;
+    LockState lockState_{LOCK_NONE};
     /// Lock start vertex.
     /// Lock start vertex.
-    unsigned lockStart_;
+    unsigned lockStart_{};
     /// Lock number of vertices.
     /// Lock number of vertices.
-    unsigned lockCount_;
+    unsigned lockCount_{};
     /// Scratch buffer for fallback locking.
     /// Scratch buffer for fallback locking.
-    void* lockScratchData_;
+    void* lockScratchData_{};
     /// Dynamic flag.
     /// Dynamic flag.
-    bool dynamic_;
+    bool dynamic_{};
     /// Shadowed flag.
     /// Shadowed flag.
-    bool shadowed_;
+    bool shadowed_{};
     /// Discard lock flag. Used by OpenGL only.
     /// Discard lock flag. Used by OpenGL only.
-    bool discardLock_;
+    bool discardLock_{};
 };
 };
 
 
 }
 }

+ 1 - 14
Source/Urho3D/Graphics/View.cpp

@@ -282,27 +282,14 @@ StringHash ParseTextureTypeXml(ResourceCache* cache, const String& filename);
 View::View(Context* context) :
 View::View(Context* context) :
     Object(context),
     Object(context),
     graphics_(GetSubsystem<Graphics>()),
     graphics_(GetSubsystem<Graphics>()),
-    renderer_(GetSubsystem<Renderer>()),
-    scene_(nullptr),
-    octree_(nullptr),
-    cullCamera_(nullptr),
-    camera_(nullptr),
-    cameraZone_(nullptr),
-    farClipZone_(nullptr),
-    occlusionBuffer_(nullptr),
-    renderTarget_(nullptr),
-    substituteRenderTarget_(nullptr),
-    passCommand_(nullptr)
+    renderer_(GetSubsystem<Renderer>())
 {
 {
     // Create octree query and scene results vector for each thread
     // Create octree query and scene results vector for each thread
     unsigned numThreads = GetSubsystem<WorkQueue>()->GetNumThreads() + 1; // Worker threads + main thread
     unsigned numThreads = GetSubsystem<WorkQueue>()->GetNumThreads() + 1; // Worker threads + main thread
     tempDrawables_.Resize(numThreads);
     tempDrawables_.Resize(numThreads);
     sceneResults_.Resize(numThreads);
     sceneResults_.Resize(numThreads);
-    frame_.camera_ = nullptr;
 }
 }
 
 
-View::~View() = default;
-
 bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
 bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
 {
 {
     sourceView_ = nullptr;
     sourceView_ = nullptr;

+ 44 - 44
Source/Urho3D/Graphics/View.h

@@ -118,7 +118,7 @@ public:
     /// Construct.
     /// Construct.
     explicit View(Context* context);
     explicit View(Context* context);
     /// Destruct.
     /// Destruct.
-    ~View() override;
+    ~View() override = default;
 
 
     /// Define with rendertarget and viewport. Return true if successful.
     /// Define with rendertarget and viewport. Return true if successful.
     bool Define(RenderSurface* renderTarget, Viewport* viewport);
     bool Define(RenderSurface* renderTarget, Viewport* viewport);
@@ -313,35 +313,35 @@ private:
     /// Renderer subsystem.
     /// Renderer subsystem.
     WeakPtr<Renderer> renderer_;
     WeakPtr<Renderer> renderer_;
     /// Scene to use.
     /// Scene to use.
-    Scene* scene_;
+    Scene* scene_{};
     /// Octree to use.
     /// Octree to use.
-    Octree* octree_;
+    Octree* octree_{};
     /// Viewport (rendering) camera.
     /// Viewport (rendering) camera.
-    Camera* camera_;
+    Camera* camera_{};
     /// Culling camera. Usually same as the viewport camera.
     /// Culling camera. Usually same as the viewport camera.
-    Camera* cullCamera_;
+    Camera* cullCamera_{};
     /// Shared source view. Null if this view is using its own culling.
     /// Shared source view. Null if this view is using its own culling.
     WeakPtr<View> sourceView_;
     WeakPtr<View> sourceView_;
     /// Zone the camera is inside, or default zone if not assigned.
     /// Zone the camera is inside, or default zone if not assigned.
-    Zone* cameraZone_;
+    Zone* cameraZone_{};
     /// Zone at far clip plane.
     /// Zone at far clip plane.
-    Zone* farClipZone_;
+    Zone* farClipZone_{};
     /// Occlusion buffer for the main camera.
     /// Occlusion buffer for the main camera.
-    OcclusionBuffer* occlusionBuffer_;
+    OcclusionBuffer* occlusionBuffer_{};
     /// Destination color rendertarget.
     /// Destination color rendertarget.
-    RenderSurface* renderTarget_;
+    RenderSurface* renderTarget_{};
     /// Substitute rendertarget for deferred rendering. Allocated if necessary.
     /// Substitute rendertarget for deferred rendering. Allocated if necessary.
-    RenderSurface* substituteRenderTarget_;
+    RenderSurface* substituteRenderTarget_{};
     /// Texture(s) for sampling the viewport contents. Allocated if necessary.
     /// Texture(s) for sampling the viewport contents. Allocated if necessary.
-    Texture* viewportTextures_[MAX_VIEWPORT_TEXTURES];
+    Texture* viewportTextures_[MAX_VIEWPORT_TEXTURES]{};
     /// Color rendertarget active for the current renderpath command.
     /// Color rendertarget active for the current renderpath command.
-    RenderSurface* currentRenderTarget_;
+    RenderSurface* currentRenderTarget_{};
     /// Last used custom depth render surface.
     /// Last used custom depth render surface.
-    RenderSurface* lastCustomDepthSurface_;
+    RenderSurface* lastCustomDepthSurface_{};
     /// Texture containing the latest viewport texture.
     /// Texture containing the latest viewport texture.
-    Texture* currentViewportTexture_;
+    Texture* currentViewportTexture_{};
     /// Dummy texture for D3D9 depth only rendering.
     /// Dummy texture for D3D9 depth only rendering.
-    Texture* depthOnlyDummyTexture_;
+    Texture* depthOnlyDummyTexture_{};
     /// Viewport rectangle.
     /// Viewport rectangle.
     IntRect viewRect_;
     IntRect viewRect_;
     /// Viewport size.
     /// Viewport size.
@@ -349,41 +349,41 @@ private:
     /// Destination rendertarget size.
     /// Destination rendertarget size.
     IntVector2 rtSize_;
     IntVector2 rtSize_;
     /// Information of the frame being rendered.
     /// Information of the frame being rendered.
-    FrameInfo frame_;
+    FrameInfo frame_{};
     /// View aspect ratio.
     /// View aspect ratio.
-    float aspectRatio_;
+    float aspectRatio_{};
     /// Minimum Z value of the visible scene.
     /// Minimum Z value of the visible scene.
-    float minZ_;
+    float minZ_{};
     /// Maximum Z value of the visible scene.
     /// Maximum Z value of the visible scene.
-    float maxZ_;
+    float maxZ_{};
     /// Material quality level.
     /// Material quality level.
-    int materialQuality_;
+    int materialQuality_{};
     /// Maximum number of occluder triangles.
     /// Maximum number of occluder triangles.
-    int maxOccluderTriangles_;
+    int maxOccluderTriangles_{};
     /// Minimum number of instances required in a batch group to render as instanced.
     /// Minimum number of instances required in a batch group to render as instanced.
-    int minInstances_;
+    int minInstances_{};
     /// Highest zone priority currently visible.
     /// Highest zone priority currently visible.
-    int highestZonePriority_;
+    int highestZonePriority_{};
     /// Geometries updated flag.
     /// Geometries updated flag.
-    bool geometriesUpdated_;
+    bool geometriesUpdated_{};
     /// Camera zone's override flag.
     /// Camera zone's override flag.
-    bool cameraZoneOverride_;
+    bool cameraZoneOverride_{};
     /// Draw shadows flag.
     /// Draw shadows flag.
-    bool drawShadows_;
+    bool drawShadows_{};
     /// Deferred flag. Inferred from the existence of a light volume command in the renderpath.
     /// Deferred flag. Inferred from the existence of a light volume command in the renderpath.
-    bool deferred_;
+    bool deferred_{};
     /// Deferred ambient pass flag. This means that the destination rendertarget is being written to at the same time as albedo/normal/depth buffers, and needs to be RGBA on OpenGL.
     /// Deferred ambient pass flag. This means that the destination rendertarget is being written to at the same time as albedo/normal/depth buffers, and needs to be RGBA on OpenGL.
-    bool deferredAmbient_;
+    bool deferredAmbient_{};
     /// Forward light base pass optimization flag. If in use, combine the base pass and first light for all opaque objects.
     /// Forward light base pass optimization flag. If in use, combine the base pass and first light for all opaque objects.
-    bool useLitBase_;
+    bool useLitBase_{};
     /// Has scene passes flag. If no scene passes, view can be defined without a valid scene or camera to only perform quad rendering.
     /// Has scene passes flag. If no scene passes, view can be defined without a valid scene or camera to only perform quad rendering.
-    bool hasScenePasses_;
+    bool hasScenePasses_{};
     /// Whether is using a custom readable depth texture without a stencil channel.
     /// Whether is using a custom readable depth texture without a stencil channel.
-    bool noStencil_;
+    bool noStencil_{};
     /// Draw debug geometry flag. Copied from the viewport.
     /// Draw debug geometry flag. Copied from the viewport.
-    bool drawDebug_;
+    bool drawDebug_{};
     /// Renderpath.
     /// Renderpath.
-    RenderPath* renderPath_;
+    RenderPath* renderPath_{};
     /// Per-thread octree query results.
     /// Per-thread octree query results.
     Vector<PODVector<Drawable*> > tempDrawables_;
     Vector<PODVector<Drawable*> > tempDrawables_;
     /// Per-thread geometries, lights and Z range collection results.
     /// Per-thread geometries, lights and Z range collection results.
@@ -401,7 +401,7 @@ private:
     /// Lights.
     /// Lights.
     PODVector<Light*> lights_;
     PODVector<Light*> lights_;
     /// Number of active occluders.
     /// Number of active occluders.
-    unsigned activeOccluders_;
+    unsigned activeOccluders_{};
 
 
     /// Drawables that limit their maximum light count.
     /// Drawables that limit their maximum light count.
     HashSet<Drawable*> maxLightsDrawables_;
     HashSet<Drawable*> maxLightsDrawables_;
@@ -418,25 +418,25 @@ private:
     /// Batch queues by pass index.
     /// Batch queues by pass index.
     HashMap<unsigned, BatchQueue> batchQueues_;
     HashMap<unsigned, BatchQueue> batchQueues_;
     /// Index of the GBuffer pass.
     /// Index of the GBuffer pass.
-    unsigned gBufferPassIndex_;
+    unsigned gBufferPassIndex_{};
     /// Index of the opaque forward base pass.
     /// Index of the opaque forward base pass.
-    unsigned basePassIndex_;
+    unsigned basePassIndex_{};
     /// Index of the alpha pass.
     /// Index of the alpha pass.
-    unsigned alphaPassIndex_;
+    unsigned alphaPassIndex_{};
     /// Index of the forward light pass.
     /// Index of the forward light pass.
-    unsigned lightPassIndex_;
+    unsigned lightPassIndex_{};
     /// Index of the litbase pass.
     /// Index of the litbase pass.
-    unsigned litBasePassIndex_;
+    unsigned litBasePassIndex_{};
     /// Index of the litalpha pass.
     /// Index of the litalpha pass.
-    unsigned litAlphaPassIndex_;
+    unsigned litAlphaPassIndex_{};
     /// Pointer to the light volume command if any.
     /// Pointer to the light volume command if any.
-    const RenderPathCommand* lightVolumeCommand_;
+    const RenderPathCommand* lightVolumeCommand_{};
     /// Pointer to the forwardlights command if any.
     /// Pointer to the forwardlights command if any.
-    const RenderPathCommand* forwardLightsCommand_;
+    const RenderPathCommand* forwardLightsCommand_{};
     /// Pointer to the current commmand if it contains shader parameters to be set for a render pass.
     /// Pointer to the current commmand if it contains shader parameters to be set for a render pass.
-    const RenderPathCommand* passCommand_;
+    const RenderPathCommand* passCommand_{};
     /// Flag for scene being resolved from the backbuffer.
     /// Flag for scene being resolved from the backbuffer.
-    bool usedResolve_;
+    bool usedResolve_{};
 };
 };
 
 
 }
 }

+ 11 - 14
Source/Urho3D/IO/FileSystem.cpp

@@ -205,8 +205,7 @@ class AsyncExecRequest : public Thread
 public:
 public:
     /// Construct.
     /// Construct.
     explicit AsyncExecRequest(unsigned& requestID) :
     explicit AsyncExecRequest(unsigned& requestID) :
-        requestID_(requestID),
-        completed_(false)
+        requestID_(requestID)
     {
     {
         // Increment ID for next request
         // Increment ID for next request
         ++requestID;
         ++requestID;
@@ -225,11 +224,11 @@ public:
 
 
 protected:
 protected:
     /// Request ID.
     /// Request ID.
-    unsigned requestID_;
+    unsigned requestID_{};
     /// Exit code.
     /// Exit code.
-    int exitCode_;
+    int exitCode_{};
     /// Completed flag.
     /// Completed flag.
-    volatile bool completed_;
+    volatile bool completed_{};
 };
 };
 
 
 /// Async system command operation.
 /// Async system command operation.
@@ -284,9 +283,7 @@ private:
 };
 };
 
 
 FileSystem::FileSystem(Context* context) :
 FileSystem::FileSystem(Context* context) :
-    Object(context),
-    nextAsyncExecID_(1),
-    executeConsoleCommands_(false)
+    Object(context)
 {
 {
     SubscribeToEvent(E_BEGINFRAME, URHO3D_HANDLER(FileSystem, HandleBeginFrame));
     SubscribeToEvent(E_BEGINFRAME, URHO3D_HANDLER(FileSystem, HandleBeginFrame));
 
 
@@ -585,7 +582,7 @@ unsigned FileSystem::GetLastModifiedTime(const String& fileName) const
     else
     else
         return 0;
         return 0;
 #else
 #else
-    struct stat st;
+    struct stat st{};
     if (!stat(fileName.CString(), &st))
     if (!stat(fileName.CString(), &st))
         return (unsigned)st.st_mtime;
         return (unsigned)st.st_mtime;
     else
     else
@@ -619,7 +616,7 @@ bool FileSystem::FileExists(const String& fileName) const
     if (attributes == INVALID_FILE_ATTRIBUTES || attributes & FILE_ATTRIBUTE_DIRECTORY)
     if (attributes == INVALID_FILE_ATTRIBUTES || attributes & FILE_ATTRIBUTE_DIRECTORY)
         return false;
         return false;
 #else
 #else
-    struct stat st;
+    struct stat st{};
     if (stat(fixedName.CString(), &st) || st.st_mode & S_IFDIR)
     if (stat(fixedName.CString(), &st) || st.st_mode & S_IFDIR)
         return false;
         return false;
 #endif
 #endif
@@ -673,7 +670,7 @@ bool FileSystem::DirExists(const String& pathName) const
     if (attributes == INVALID_FILE_ATTRIBUTES || !(attributes & FILE_ATTRIBUTE_DIRECTORY))
     if (attributes == INVALID_FILE_ATTRIBUTES || !(attributes & FILE_ATTRIBUTE_DIRECTORY))
         return false;
         return false;
 #else
 #else
-    struct stat st;
+    struct stat st{};
     if (stat(fixedName.CString(), &st) || !(st.st_mode & S_IFDIR))
     if (stat(fixedName.CString(), &st) || !(st.st_mode & S_IFDIR))
         return false;
         return false;
 #endif
 #endif
@@ -781,8 +778,8 @@ bool FileSystem::SetLastModifiedTime(const String& fileName, unsigned newTime)
     newTimes.modtime = newTime;
     newTimes.modtime = newTime;
     return _utime(fileName.CString(), &newTimes) == 0;
     return _utime(fileName.CString(), &newTimes) == 0;
 #else
 #else
-    struct stat oldTime;
-    struct utimbuf newTimes;
+    struct stat oldTime{};
+    struct utimbuf newTimes{};
     if (stat(fileName.CString(), &oldTime) != 0)
     if (stat(fileName.CString(), &oldTime) != 0)
         return false;
         return false;
     newTimes.actime = oldTime.st_atime;
     newTimes.actime = oldTime.st_atime;
@@ -871,7 +868,7 @@ void FileSystem::ScanDirInternal(Vector<String>& result, String path, const Stri
 #else
 #else
     DIR* dir;
     DIR* dir;
     struct dirent* de;
     struct dirent* de;
-    struct stat st;
+    struct stat st{};
     dir = opendir(GetNativePath(path).CString());
     dir = opendir(GetNativePath(path).CString());
     if (dir)
     if (dir)
     {
     {

+ 2 - 2
Source/Urho3D/IO/FileSystem.h

@@ -118,9 +118,9 @@ private:
     /// Async execution queue.
     /// Async execution queue.
     List<AsyncExecRequest*> asyncExecQueue_;
     List<AsyncExecRequest*> asyncExecQueue_;
     /// Next async execution ID.
     /// Next async execution ID.
-    unsigned nextAsyncExecID_;
+    unsigned nextAsyncExecID_{1};
     /// Flag for executing engine console commands as OS-specific system command. Default to true.
     /// Flag for executing engine console commands as OS-specific system command. Default to true.
-    bool executeConsoleCommands_;
+    bool executeConsoleCommands_{};
 };
 };
 
 
 /// Split a full path to path, filename and extension. The extension will be converted to lowercase by default.
 /// Split a full path to path, filename and extension. The extension will be converted to lowercase by default.

+ 1 - 3
Source/Urho3D/IO/NamedPipe.cpp

@@ -366,9 +366,7 @@ bool NamedPipe::IsEof() const
         FD_ZERO(&set);      // NOLINT(modernize-use-bool-literals)
         FD_ZERO(&set);      // NOLINT(modernize-use-bool-literals)
         FD_SET(readHandle_, &set);
         FD_SET(readHandle_, &set);
 
 
-        struct timeval timeout;
-        timeout.tv_sec = 0;
-        timeout.tv_usec = 1000; // 1ms timeout for select
+        struct timeval timeout{0, 1000};    // 1ms timeout for select
 
 
         return select(readHandle_ + 1, &set, nullptr, nullptr, &timeout) <= 0;
         return select(readHandle_ + 1, &set, nullptr, nullptr, &timeout) <= 0;
     }
     }

+ 1 - 1
Source/Urho3D/IO/PackageFile.cpp

@@ -94,7 +94,7 @@ bool PackageFile::Open(const String& fileName, unsigned startOffset)
     for (unsigned i = 0; i < numFiles; ++i)
     for (unsigned i = 0; i < numFiles; ++i)
     {
     {
         String entryName = file->ReadString();
         String entryName = file->ReadString();
-        PackageEntry newEntry;
+        PackageEntry newEntry{};
         newEntry.offset_ = file->ReadUInt() + startOffset;
         newEntry.offset_ = file->ReadUInt() + startOffset;
         totalDataSize_ += (newEntry.size_ = file->ReadUInt());
         totalDataSize_ += (newEntry.size_ = file->ReadUInt());
         newEntry.checksum_ = file->ReadUInt();
         newEntry.checksum_ = file->ReadUInt();

+ 2 - 6
Source/Urho3D/LuaScript/LuaScriptInstance.cpp

@@ -65,16 +65,12 @@ static const char* scriptObjectMethodNames[] = {
 
 
 LuaScriptInstance::LuaScriptInstance(Context* context) :
 LuaScriptInstance::LuaScriptInstance(Context* context) :
     Component(context),
     Component(context),
+    luaScript_(GetSubsystem<LuaScript>()),
+    eventInvoker_(new LuaScriptEventInvoker(this)),
     scriptObjectRef_(LUA_REFNIL)
     scriptObjectRef_(LUA_REFNIL)
 {
 {
-    luaScript_ = GetSubsystem<LuaScript>();
     luaState_ = luaScript_->GetState();
     luaState_ = luaScript_->GetState();
     attributeInfos_ = *context_->GetAttributes(GetTypeStatic());
     attributeInfos_ = *context_->GetAttributes(GetTypeStatic());
-
-    eventInvoker_ = new LuaScriptEventInvoker(this);
-
-    for (auto& scriptObjectMethod : scriptObjectMethods_)
-        scriptObjectMethod = nullptr;
 }
 }
 
 
 LuaScriptInstance::~LuaScriptInstance()
 LuaScriptInstance::~LuaScriptInstance()

+ 4 - 4
Source/Urho3D/LuaScript/LuaScriptInstance.h

@@ -166,9 +166,9 @@ private:
     void ReleaseObject();
     void ReleaseObject();
 
 
     /// Lua Script subsystem.
     /// Lua Script subsystem.
-    LuaScript* luaScript_;
+    LuaScript* luaScript_{};
     /// Lua state.
     /// Lua state.
-    lua_State* luaState_;
+    lua_State* luaState_{};
     /// Event invoker.
     /// Event invoker.
     SharedPtr<LuaScriptEventInvoker> eventInvoker_;
     SharedPtr<LuaScriptEventInvoker> eventInvoker_;
     /// Script file.
     /// Script file.
@@ -178,9 +178,9 @@ private:
     /// Attributes, including script object variables.
     /// Attributes, including script object variables.
     Vector<AttributeInfo> attributeInfos_;
     Vector<AttributeInfo> attributeInfos_;
     /// Lua reference to script object.
     /// Lua reference to script object.
-    int scriptObjectRef_;
+    int scriptObjectRef_{};
     /// Script object method.
     /// Script object method.
-    LuaFunction* scriptObjectMethods_[MAX_LUA_SCRIPT_OBJECT_METHODS];
+    LuaFunction* scriptObjectMethods_[MAX_LUA_SCRIPT_OBJECT_METHODS]{};
 };
 };
 
 
 }
 }

+ 2 - 2
Source/Urho3D/Math/AreaAllocator.h

@@ -65,9 +65,9 @@ private:
     /// Maximum size it allows to grow. It is zero when it is not allowed to grow.
     /// Maximum size it allows to grow. It is zero when it is not allowed to grow.
     IntVector2 maxSize_;
     IntVector2 maxSize_;
     /// The dimension use for next growth. Used internally.
     /// The dimension use for next growth. Used internally.
-    bool doubleWidth_;
+    bool doubleWidth_{true};
     /// Fast mode flag.
     /// Fast mode flag.
-    bool fastMode_;
+    bool fastMode_{true};
 };
 };
 
 
 }
 }

+ 3 - 7
Source/Urho3D/Navigation/CrowdManager.cpp

@@ -76,12 +76,8 @@ void CrowdAgentUpdateCallback(dtCrowdAgent* ag, float dt)
 
 
 CrowdManager::CrowdManager(Context* context) :
 CrowdManager::CrowdManager(Context* context) :
     Component(context),
     Component(context),
-    crowd_(nullptr),
-    navigationMeshId_(0),
     maxAgents_(DEFAULT_MAX_AGENTS),
     maxAgents_(DEFAULT_MAX_AGENTS),
-    maxAgentRadius_(DEFAULT_MAX_AGENT_RADIUS),
-    numQueryFilterTypes_(0),
-    numObstacleAvoidanceTypes_(0)
+    maxAgentRadius_(DEFAULT_MAX_AGENT_RADIUS)
 {
 {
     // The actual buffer is allocated inside dtCrowd, we only track the number of "slots" being configured explicitly
     // The actual buffer is allocated inside dtCrowd, we only track the number of "slots" being configured explicitly
     numAreas_.Reserve(DT_CROWD_MAX_QUERY_FILTER_TYPE);
     numAreas_.Reserve(DT_CROWD_MAX_QUERY_FILTER_TYPE);
@@ -363,7 +359,7 @@ void CrowdManager::SetObstacleAvoidanceTypesAttr(const VariantVector& value)
     {
     {
         if (index + 10 <= value.Size())
         if (index + 10 <= value.Size())
         {
         {
-            dtObstacleAvoidanceParams params;
+            dtObstacleAvoidanceParams params;       // NOLINT(hicpp-member-init)
             params.velBias = value[index++].GetFloat();
             params.velBias = value[index++].GetFloat();
             params.weightDesVel = value[index++].GetFloat();
             params.weightDesVel = value[index++].GetFloat();
             params.weightCurVel = value[index++].GetFloat();
             params.weightCurVel = value[index++].GetFloat();
@@ -620,7 +616,7 @@ int CrowdManager::AddAgent(CrowdAgent* agent, const Vector3& pos)
 {
 {
     if (!crowd_ || !navigationMesh_ || !agent)
     if (!crowd_ || !navigationMesh_ || !agent)
         return -1;
         return -1;
-    dtCrowdAgentParams params;
+    dtCrowdAgentParams params{};
     params.userData = agent;
     params.userData = agent;
     if (agent->radius_ == 0.f)
     if (agent->radius_ == 0.f)
         agent->radius_ = navigationMesh_->GetAgentRadius();
         agent->radius_ = navigationMesh_->GetAgentRadius();

+ 6 - 6
Source/Urho3D/Navigation/CrowdManager.h

@@ -180,21 +180,21 @@ private:
     void HandleComponentAdded(StringHash eventType, VariantMap& eventData);
     void HandleComponentAdded(StringHash eventType, VariantMap& eventData);
 
 
     /// Internal Detour crowd object.
     /// Internal Detour crowd object.
-    dtCrowd* crowd_;
+    dtCrowd* crowd_{};
     /// NavigationMesh for which the crowd was created.
     /// NavigationMesh for which the crowd was created.
     WeakPtr<NavigationMesh> navigationMesh_;
     WeakPtr<NavigationMesh> navigationMesh_;
     /// The NavigationMesh component Id for pending crowd creation.
     /// The NavigationMesh component Id for pending crowd creation.
-    unsigned navigationMeshId_;
+    unsigned navigationMeshId_{};
     /// The maximum number of agents the crowd can manage.
     /// The maximum number of agents the crowd can manage.
-    unsigned maxAgents_;
+    unsigned maxAgents_{};
     /// The maximum radius of any agent that will be added to the crowd.
     /// The maximum radius of any agent that will be added to the crowd.
-    float maxAgentRadius_;
+    float maxAgentRadius_{};
     /// Number of query filter types configured in the crowd. Limit to DT_CROWD_MAX_QUERY_FILTER_TYPE.
     /// Number of query filter types configured in the crowd. Limit to DT_CROWD_MAX_QUERY_FILTER_TYPE.
-    unsigned numQueryFilterTypes_;
+    unsigned numQueryFilterTypes_{};
     /// Number of configured area in each filter type. Limit to DT_MAX_AREAS.
     /// Number of configured area in each filter type. Limit to DT_MAX_AREAS.
     PODVector<unsigned> numAreas_;
     PODVector<unsigned> numAreas_;
     /// Number of obstacle avoidance types configured in the crowd. Limit to DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS.
     /// Number of obstacle avoidance types configured in the crowd. Limit to DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS.
-    unsigned numObstacleAvoidanceTypes_;
+    unsigned numObstacleAvoidanceTypes_{};
 };
 };
 
 
 }
 }

+ 11 - 14
Source/Urho3D/Navigation/DynamicNavigationMesh.cpp

@@ -210,12 +210,9 @@ struct LinearAllocator : public dtTileCacheAlloc
 
 
 DynamicNavigationMesh::DynamicNavigationMesh(Context* context) :
 DynamicNavigationMesh::DynamicNavigationMesh(Context* context) :
     NavigationMesh(context),
     NavigationMesh(context),
-    tileCache_(nullptr),
-    maxObstacles_(1024),
-    maxLayers_(DEFAULT_MAX_LAYERS),
-    drawObstacles_(false)
+    maxLayers_(DEFAULT_MAX_LAYERS)
 {
 {
-    //64 is the largest tile-size that DetourTileCache will tolerate without silently failing
+    // 64 is the largest tile-size that DetourTileCache will tolerate without silently failing
     tileSize_ = 64;
     tileSize_ = 64;
     partitionType_ = NAVMESH_PARTITION_MONOTONE;
     partitionType_ = NAVMESH_PARTITION_MONOTONE;
     allocator_ = new LinearAllocator(32000); //32kb to start
     allocator_ = new LinearAllocator(32000); //32kb to start
@@ -263,7 +260,7 @@ bool DynamicNavigationMesh::Allocate(const BoundingBox& boundingBox, unsigned ma
     unsigned tileBits = LogBaseTwo(maxTiles);
     unsigned tileBits = LogBaseTwo(maxTiles);
     auto maxPolys = (unsigned)(1 << (22 - tileBits));
     auto maxPolys = (unsigned)(1 << (22 - tileBits));
 
 
-    dtNavMeshParams params;
+    dtNavMeshParams params;     // NOLINT(hicpp-member-init)
     rcVcopy(params.orig, &boundingBox_.min_.x_);
     rcVcopy(params.orig, &boundingBox_.min_.x_);
     params.tileWidth = tileEdgeLength;
     params.tileWidth = tileEdgeLength;
     params.tileHeight = tileEdgeLength;
     params.tileHeight = tileEdgeLength;
@@ -284,7 +281,7 @@ bool DynamicNavigationMesh::Allocate(const BoundingBox& boundingBox, unsigned ma
         return false;
         return false;
     }
     }
 
 
-    dtTileCacheParams tileCacheParams;
+    dtTileCacheParams tileCacheParams;      // NOLINT(hicpp-member-init)
     memset(&tileCacheParams, 0, sizeof(tileCacheParams));
     memset(&tileCacheParams, 0, sizeof(tileCacheParams));
     rcVcopy(tileCacheParams.orig, &boundingBox_.min_.x_);
     rcVcopy(tileCacheParams.orig, &boundingBox_.min_.x_);
     tileCacheParams.ch = cellHeight_;
     tileCacheParams.ch = cellHeight_;
@@ -378,7 +375,7 @@ bool DynamicNavigationMesh::Build()
         unsigned tileBits = LogBaseTwo(maxTiles);
         unsigned tileBits = LogBaseTwo(maxTiles);
         auto maxPolys = (unsigned)(1 << (22 - tileBits));
         auto maxPolys = (unsigned)(1 << (22 - tileBits));
 
 
-        dtNavMeshParams params;
+        dtNavMeshParams params;     // NOLINT(hicpp-member-init)
         rcVcopy(params.orig, &boundingBox_.min_.x_);
         rcVcopy(params.orig, &boundingBox_.min_.x_);
         params.tileWidth = tileEdgeLength;
         params.tileWidth = tileEdgeLength;
         params.tileHeight = tileEdgeLength;
         params.tileHeight = tileEdgeLength;
@@ -399,7 +396,7 @@ bool DynamicNavigationMesh::Build()
             return false;
             return false;
         }
         }
 
 
-        dtTileCacheParams tileCacheParams;
+        dtTileCacheParams tileCacheParams;      // NOLINT(hicpp-member-init)
         memset(&tileCacheParams, 0, sizeof(tileCacheParams));
         memset(&tileCacheParams, 0, sizeof(tileCacheParams));
         rcVcopy(tileCacheParams.orig, &boundingBox_.min_.x_);
         rcVcopy(tileCacheParams.orig, &boundingBox_.min_.x_);
         tileCacheParams.ch = cellHeight_;
         tileCacheParams.ch = cellHeight_;
@@ -687,7 +684,7 @@ void DynamicNavigationMesh::SetNavigationDataAttr(const PODVector<unsigned char>
     numTilesX_ = buffer.ReadInt();
     numTilesX_ = buffer.ReadInt();
     numTilesZ_ = buffer.ReadInt();
     numTilesZ_ = buffer.ReadInt();
 
 
-    dtNavMeshParams params;
+    dtNavMeshParams params;     // NOLINT(hicpp-member-init)
     buffer.Read(&params, sizeof(dtNavMeshParams));
     buffer.Read(&params, sizeof(dtNavMeshParams));
 
 
     navMesh_ = dtAllocNavMesh();
     navMesh_ = dtAllocNavMesh();
@@ -704,7 +701,7 @@ void DynamicNavigationMesh::SetNavigationDataAttr(const PODVector<unsigned char>
         return;
         return;
     }
     }
 
 
-    dtTileCacheParams tcParams;
+    dtTileCacheParams tcParams;     // NOLINT(hicpp-member-init)
     buffer.Read(&tcParams, sizeof(tcParams));
     buffer.Read(&tcParams, sizeof(tcParams));
 
 
     tileCache_ = dtAllocTileCache();
     tileCache_ = dtAllocTileCache();
@@ -775,7 +772,7 @@ bool DynamicNavigationMesh::ReadTiles(Deserializer& source, bool silent)
     tileQueue_.Clear();
     tileQueue_.Clear();
     while (!source.IsEof())
     while (!source.IsEof())
     {
     {
-        dtTileCacheLayerHeader header;
+        dtTileCacheLayerHeader header;      // NOLINT(hicpp-member-init)
         source.Read(&header, sizeof(dtTileCacheLayerHeader));
         source.Read(&header, sizeof(dtTileCacheLayerHeader));
         const int dataSize = source.ReadInt();
         const int dataSize = source.ReadInt();
 
 
@@ -830,7 +827,7 @@ int DynamicNavigationMesh::BuildTile(Vector<NavigationGeometryInfo>& geometryLis
 
 
     DynamicNavBuildData build(allocator_.Get());
     DynamicNavBuildData build(allocator_.Get());
 
 
-    rcConfig cfg;
+    rcConfig cfg;   // NOLINT(hicpp-member-init)
     memset(&cfg, 0, sizeof cfg);
     memset(&cfg, 0, sizeof cfg);
     cfg.cs = cellSize_;
     cfg.cs = cellSize_;
     cfg.ch = cellHeight_;
     cfg.ch = cellHeight_;
@@ -953,7 +950,7 @@ int DynamicNavigationMesh::BuildTile(Vector<NavigationGeometryInfo>& geometryLis
     int retCt = 0;
     int retCt = 0;
     for (int i = 0; i < build.heightFieldLayers_->nlayers; ++i)
     for (int i = 0; i < build.heightFieldLayers_->nlayers; ++i)
     {
     {
-        dtTileCacheLayerHeader header;
+        dtTileCacheLayerHeader header;      // NOLINT(hicpp-member-init)
         header.magic = DT_TILECACHE_MAGIC;
         header.magic = DT_TILECACHE_MAGIC;
         header.version = DT_TILECACHE_VERSION;
         header.version = DT_TILECACHE_VERSION;
         header.tx = x;
         header.tx = x;

+ 4 - 4
Source/Urho3D/Navigation/DynamicNavigationMesh.h

@@ -131,7 +131,7 @@ private:
     void ReleaseTileCache();
     void ReleaseTileCache();
 
 
     /// Detour tile cache instance that works with the nav mesh.
     /// Detour tile cache instance that works with the nav mesh.
-    dtTileCache* tileCache_;
+    dtTileCache* tileCache_{};
     /// Used by dtTileCache to allocate blocks of memory.
     /// Used by dtTileCache to allocate blocks of memory.
     UniquePtr<dtTileCacheAlloc> allocator_;
     UniquePtr<dtTileCacheAlloc> allocator_;
     /// Used by dtTileCache to compress the original tiles to use when reconstructing for changes.
     /// Used by dtTileCache to compress the original tiles to use when reconstructing for changes.
@@ -139,11 +139,11 @@ private:
     /// Mesh processor used by Detour, in this case a 'pass-through' processor.
     /// Mesh processor used by Detour, in this case a 'pass-through' processor.
     UniquePtr<dtTileCacheMeshProcess> meshProcessor_;
     UniquePtr<dtTileCacheMeshProcess> meshProcessor_;
     /// Maximum number of obstacle objects allowed.
     /// Maximum number of obstacle objects allowed.
-    unsigned maxObstacles_;
+    unsigned maxObstacles_{1024};
     /// Maximum number of layers that are allowed to be constructed.
     /// Maximum number of layers that are allowed to be constructed.
-    unsigned maxLayers_;
+    unsigned maxLayers_{};
     /// Debug draw Obstacles.
     /// Debug draw Obstacles.
-    bool drawObstacles_;
+    bool drawObstacles_{};
     /// Queue of tiles to be built.
     /// Queue of tiles to be built.
     PODVector<IntVector2> tileQueue_;
     PODVector<IntVector2> tileQueue_;
 };
 };

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

@@ -88,13 +88,13 @@ static const int MAX_POLYS = 2048;
 struct FindPathData
 struct FindPathData
 {
 {
     // Polygons.
     // Polygons.
-    dtPolyRef polys_[MAX_POLYS];
+    dtPolyRef polys_[MAX_POLYS]{};
     // Polygons on the path.
     // Polygons on the path.
-    dtPolyRef pathPolys_[MAX_POLYS];
+    dtPolyRef pathPolys_[MAX_POLYS]{};
     // Points on the path.
     // Points on the path.
     Vector3 pathPoints_[MAX_POLYS];
     Vector3 pathPoints_[MAX_POLYS];
     // Flags on the path.
     // Flags on the path.
-    unsigned char pathFlags_[MAX_POLYS];
+    unsigned char pathFlags_[MAX_POLYS]{};
 };
 };
 
 
 NavigationMesh::NavigationMesh(Context* context) :
 NavigationMesh::NavigationMesh(Context* context) :
@@ -347,7 +347,7 @@ bool NavigationMesh::Allocate(const BoundingBox& boundingBox, unsigned maxTiles)
     unsigned tileBits = LogBaseTwo(maxTiles);
     unsigned tileBits = LogBaseTwo(maxTiles);
     auto maxPolys = (unsigned)(1 << (22 - tileBits));
     auto maxPolys = (unsigned)(1 << (22 - tileBits));
 
 
-    dtNavMeshParams params;
+    dtNavMeshParams params;     // NOLINT(hicpp-member-init)
     rcVcopy(params.orig, &boundingBox_.min_.x_);
     rcVcopy(params.orig, &boundingBox_.min_.x_);
     params.tileWidth = tileEdgeLength;
     params.tileWidth = tileEdgeLength;
     params.tileHeight = tileEdgeLength;
     params.tileHeight = tileEdgeLength;
@@ -423,7 +423,7 @@ bool NavigationMesh::Build()
         unsigned tileBits = LogBaseTwo(maxTiles);
         unsigned tileBits = LogBaseTwo(maxTiles);
         auto maxPolys = (unsigned)(1 << (22 - tileBits));
         auto maxPolys = (unsigned)(1 << (22 - tileBits));
 
 
-        dtNavMeshParams params;
+        dtNavMeshParams params;     // NOLINT(hicpp-member-init)
         rcVcopy(params.orig, &boundingBox_.min_.x_);
         rcVcopy(params.orig, &boundingBox_.min_.x_);
         params.tileWidth = tileEdgeLength;
         params.tileWidth = tileEdgeLength;
         params.tileHeight = tileEdgeLength;
         params.tileHeight = tileEdgeLength;
@@ -889,7 +889,7 @@ void NavigationMesh::SetNavigationDataAttr(const PODVector<unsigned char>& value
     numTilesX_ = buffer.ReadInt();
     numTilesX_ = buffer.ReadInt();
     numTilesZ_ = buffer.ReadInt();
     numTilesZ_ = buffer.ReadInt();
 
 
-    dtNavMeshParams params;
+    dtNavMeshParams params;     // NOLINT(hicpp-member-init)
     rcVcopy(params.orig, &boundingBox_.min_.x_);
     rcVcopy(params.orig, &boundingBox_.min_.x_);
     params.tileWidth = buffer.ReadFloat();
     params.tileWidth = buffer.ReadFloat();
     params.tileHeight = buffer.ReadFloat();
     params.tileHeight = buffer.ReadFloat();
@@ -1310,7 +1310,7 @@ bool NavigationMesh::BuildTile(Vector<NavigationGeometryInfo>& geometryList, int
 
 
     SimpleNavBuildData build;
     SimpleNavBuildData build;
 
 
-    rcConfig cfg;
+    rcConfig cfg;       // NOLINT(hicpp-member-init)
     memset(&cfg, 0, sizeof cfg);
     memset(&cfg, 0, sizeof cfg);
     cfg.cs = cellSize_;
     cfg.cs = cellSize_;
     cfg.ch = cellHeight_;
     cfg.ch = cellHeight_;
@@ -1465,7 +1465,7 @@ bool NavigationMesh::BuildTile(Vector<NavigationGeometryInfo>& geometryList, int
     unsigned char* navData = nullptr;
     unsigned char* navData = nullptr;
     int navDataSize = 0;
     int navDataSize = 0;
 
 
-    dtNavMeshCreateParams params;
+    dtNavMeshCreateParams params;       // NOLINT(hicpp-member-init)
     memset(&params, 0, sizeof params);
     memset(&params, 0, sizeof params);
     params.verts = build.polyMesh_->verts;
     params.verts = build.polyMesh_->verts;
     params.vertCount = build.polyMesh_->nverts;
     params.vertCount = build.polyMesh_->nverts;

+ 3 - 5
Source/Urho3D/Network/HttpRequest.cpp

@@ -207,7 +207,7 @@ unsigned HttpRequest::Read(void* dest, unsigned size)
 
 
     for (;;)
     for (;;)
     {
     {
-        Pair<unsigned, bool> status;
+        Pair<unsigned, bool> status{};
 
 
         for (;;)
         for (;;)
         {
         {
@@ -288,10 +288,8 @@ unsigned HttpRequest::GetAvailableSize() const
 
 
 Pair<unsigned, bool> HttpRequest::CheckAvailableSizeAndEof() const
 Pair<unsigned, bool> HttpRequest::CheckAvailableSizeAndEof() const
 {
 {
-    Pair<unsigned, bool> ret;
-    ret.first_ = (writePosition_ - readPosition_) & (READ_BUFFER_SIZE - 1);
-    ret.second_ = (state_ == HTTP_ERROR || (state_ == HTTP_CLOSED && !ret.first_));
-    return ret;
+    unsigned size = (writePosition_ - readPosition_) & (READ_BUFFER_SIZE - 1);
+    return {size, (state_ == HTTP_ERROR || (state_ == HTTP_CLOSED && !size))};
 }
 }
 
 
 }
 }

+ 2 - 2
Source/Urho3D/Physics/CollisionShape.h

@@ -112,11 +112,11 @@ struct ConvexData : public CollisionGeometryData
     /// Vertex data.
     /// Vertex data.
     SharedArrayPtr<Vector3> vertexData_;
     SharedArrayPtr<Vector3> vertexData_;
     /// Number of vertices.
     /// Number of vertices.
-    unsigned vertexCount_;
+    unsigned vertexCount_{};
     /// Index data.
     /// Index data.
     SharedArrayPtr<unsigned> indexData_;
     SharedArrayPtr<unsigned> indexData_;
     /// Number of indices.
     /// Number of indices.
-    unsigned indexCount_;
+    unsigned indexCount_{};
 };
 };
 
 
 /// Heightfield geometry data.
 /// Heightfield geometry data.

+ 0 - 11
Source/Urho3D/Physics/PhysicsWorld.cpp

@@ -57,7 +57,6 @@ const char* PHYSICS_CATEGORY = "Physics";
 extern const char* SUBSYSTEM_CATEGORY;
 extern const char* SUBSYSTEM_CATEGORY;
 
 
 static const int MAX_SOLVER_ITERATIONS = 256;
 static const int MAX_SOLVER_ITERATIONS = 256;
-static const int DEFAULT_FPS = 60;
 static const Vector3 DEFAULT_GRAVITY = Vector3(0.0f, -9.81f, 0.0f);
 static const Vector3 DEFAULT_GRAVITY = Vector3(0.0f, -9.81f, 0.0f);
 
 
 PhysicsWorldConfig PhysicsWorld::config;
 PhysicsWorldConfig PhysicsWorld::config;
@@ -147,17 +146,7 @@ struct PhysicsQueryCallback : public btCollisionWorld::ContactResultCallback
 
 
 PhysicsWorld::PhysicsWorld(Context* context) :
 PhysicsWorld::PhysicsWorld(Context* context) :
     Component(context),
     Component(context),
-    collisionConfiguration_(nullptr),
     fps_(DEFAULT_FPS),
     fps_(DEFAULT_FPS),
-    maxSubSteps_(0),
-    timeAcc_(0.0f),
-    maxNetworkAngularVelocity_(DEFAULT_MAX_NETWORK_ANGULAR_VELOCITY),
-    updateEnabled_(true),
-    interpolation_(true),
-    internalEdge_(true),
-    applyingTransforms_(false),
-    simulating_(false),
-    debugRenderer_(nullptr),
     debugMode_(btIDebugDraw::DBG_DrawWireframe | btIDebugDraw::DBG_DrawConstraints | btIDebugDraw::DBG_DrawConstraintLimits)
     debugMode_(btIDebugDraw::DBG_DrawWireframe | btIDebugDraw::DBG_DrawConstraints | btIDebugDraw::DBG_DrawConstraintLimits)
 {
 {
     gContactAddedCallback = CustomMaterialCombinerCallback;
     gContactAddedCallback = CustomMaterialCombinerCallback;

+ 14 - 13
Source/Urho3D/Physics/PhysicsWorld.h

@@ -124,6 +124,7 @@ struct PhysicsWorldConfig
     btCollisionConfiguration* collisionConfig_;
     btCollisionConfiguration* collisionConfig_;
 };
 };
 
 
+static const int DEFAULT_FPS = 60;
 static const float DEFAULT_MAX_NETWORK_ANGULAR_VELOCITY = 100.0f;
 static const float DEFAULT_MAX_NETWORK_ANGULAR_VELOCITY = 100.0f;
 
 
 /// Cache of collision geometry data.
 /// Cache of collision geometry data.
@@ -305,7 +306,7 @@ private:
     void SendCollisionEvents();
     void SendCollisionEvents();
 
 
     /// Bullet collision configuration.
     /// Bullet collision configuration.
-    btCollisionConfiguration* collisionConfiguration_;
+    btCollisionConfiguration* collisionConfiguration_{};
     /// Bullet collision dispatcher.
     /// Bullet collision dispatcher.
     UniquePtr<btDispatcher> collisionDispatcher_;
     UniquePtr<btDispatcher> collisionDispatcher_;
     /// Bullet collision broadphase.
     /// Bullet collision broadphase.
@@ -341,29 +342,29 @@ private:
     /// Preallocated buffer for physics collision contact data.
     /// Preallocated buffer for physics collision contact data.
     VectorBuffer contacts_;
     VectorBuffer contacts_;
     /// Simulation substeps per second.
     /// Simulation substeps per second.
-    unsigned fps_;
+    unsigned fps_{DEFAULT_FPS};
     /// Maximum number of simulation substeps per frame. 0 (default) unlimited, or negative values for adaptive timestep.
     /// Maximum number of simulation substeps per frame. 0 (default) unlimited, or negative values for adaptive timestep.
-    int maxSubSteps_;
+    int maxSubSteps_{};
     /// Time accumulator for non-interpolated mode.
     /// Time accumulator for non-interpolated mode.
-    float timeAcc_;
+    float timeAcc_{};
     /// Maximum angular velocity for network replication.
     /// Maximum angular velocity for network replication.
-    float maxNetworkAngularVelocity_;
+    float maxNetworkAngularVelocity_{DEFAULT_MAX_NETWORK_ANGULAR_VELOCITY};
     /// Automatic simulation update enabled flag.
     /// Automatic simulation update enabled flag.
-    bool updateEnabled_;
+    bool updateEnabled_{true};
     /// Interpolation flag.
     /// Interpolation flag.
-    bool interpolation_;
+    bool interpolation_{true};
     /// Use internal edge utility flag.
     /// Use internal edge utility flag.
-    bool internalEdge_;
+    bool internalEdge_{true};
     /// Applying transforms flag.
     /// Applying transforms flag.
-    bool applyingTransforms_;
+    bool applyingTransforms_{};
     /// Simulating flag.
     /// Simulating flag.
-    bool simulating_;
+    bool simulating_{};
     /// Debug draw depth test mode.
     /// Debug draw depth test mode.
-    bool debugDepthTest_;
+    bool debugDepthTest_{};
     /// Debug renderer.
     /// Debug renderer.
-    DebugRenderer* debugRenderer_;
+    DebugRenderer* debugRenderer_{};
     /// Debug draw flags.
     /// Debug draw flags.
-    int debugMode_;
+    int debugMode_{};
 };
 };
 
 
 /// Register Physics library objects.
 /// Register Physics library objects.

+ 4 - 13
Source/Urho3D/Resource/Image.cpp

@@ -243,16 +243,7 @@ bool CompressedLevel::Decompress(unsigned char* dest)
 }
 }
 
 
 Image::Image(Context* context) :
 Image::Image(Context* context) :
-    Resource(context),
-    width_(0),
-    height_(0),
-    depth_(0),
-    components_(0),
-    numCompressedLevels_(0),
-    cubemap_(false),
-    array_(false),
-    sRGB_(false),
-    compressedFormat_(CF_NONE)
+    Resource(context)
 {
 {
 }
 }
 
 
@@ -271,12 +262,12 @@ bool Image::BeginLoad(Deserializer& source)
     if (fileID == "DDS ")
     if (fileID == "DDS ")
     {
     {
         // DDS compressed format
         // DDS compressed format
-        DDSurfaceDesc2 ddsd;
+        DDSurfaceDesc2 ddsd;        // NOLINT(hicpp-member-init)
         source.Read(&ddsd, sizeof(ddsd));
         source.Read(&ddsd, sizeof(ddsd));
 
 
         // DDS DX10+
         // DDS DX10+
         const bool hasDXGI = ddsd.ddpfPixelFormat_.dwFourCC_ == FOURCC_DX10;
         const bool hasDXGI = ddsd.ddpfPixelFormat_.dwFourCC_ == FOURCC_DX10;
-        DDSHeader10 dxgiHeader;
+        DDSHeader10 dxgiHeader;     // NOLINT(hicpp-member-init)
         if (hasDXGI)
         if (hasDXGI)
             source.Read(&dxgiHeader, sizeof(dxgiHeader));
             source.Read(&dxgiHeader, sizeof(dxgiHeader));
 
 
@@ -1330,7 +1321,7 @@ bool Image::SaveDDS(const String& fileName) const
 
 
     outFile.WriteFileID("DDS ");
     outFile.WriteFileID("DDS ");
 
 
-    DDSurfaceDesc2 ddsd;
+    DDSurfaceDesc2 ddsd;        // NOLINT(hicpp-member-init)
     memset(&ddsd, 0, sizeof(ddsd));
     memset(&ddsd, 0, sizeof(ddsd));
     ddsd.dwSize_ = sizeof(ddsd);
     ddsd.dwSize_ = sizeof(ddsd);
     ddsd.dwFlags_ = 0x00000001l /*DDSD_CAPS*/
     ddsd.dwFlags_ = 0x00000001l /*DDSD_CAPS*/

+ 18 - 32
Source/Urho3D/Resource/Image.h

@@ -50,41 +50,27 @@ enum CompressedFormat
 /// Compressed image mip level.
 /// Compressed image mip level.
 struct CompressedLevel
 struct CompressedLevel
 {
 {
-    /// Construct empty.
-    CompressedLevel() :
-        data_(nullptr),
-        format_(CF_NONE),
-        width_(0),
-        height_(0),
-        depth_(0),
-        blockSize_(0),
-        dataSize_(0),
-        rowSize_(0),
-        rows_(0)
-    {
-    }
-
     /// Decompress to RGBA. The destination buffer required is width * height * 4 bytes. Return true if successful.
     /// Decompress to RGBA. The destination buffer required is width * height * 4 bytes. Return true if successful.
     bool Decompress(unsigned char* dest);
     bool Decompress(unsigned char* dest);
 
 
     /// Compressed image data.
     /// Compressed image data.
-    unsigned char* data_;
+    unsigned char* data_{};
     /// Compression format.
     /// Compression format.
-    CompressedFormat format_;
+    CompressedFormat format_{CF_NONE};
     /// Width.
     /// Width.
-    int width_;
+    int width_{};
     /// Height.
     /// Height.
-    int height_;
+    int height_{};
     /// Depth.
     /// Depth.
-    int depth_;
+    int depth_{};
     /// Block size in bytes.
     /// Block size in bytes.
-    unsigned blockSize_;
+    unsigned blockSize_{};
     /// Total data size in bytes.
     /// Total data size in bytes.
-    unsigned dataSize_;
+    unsigned dataSize_{};
     /// Row size in bytes.
     /// Row size in bytes.
-    unsigned rowSize_;
+    unsigned rowSize_{};
     /// Number of rows.
     /// Number of rows.
-    unsigned rows_;
+    unsigned rows_{};
 };
 };
 
 
 /// %Image resource.
 /// %Image resource.
@@ -221,23 +207,23 @@ private:
     static void FreeImageData(unsigned char* pixelData);
     static void FreeImageData(unsigned char* pixelData);
 
 
     /// Width.
     /// Width.
-    int width_;
+    int width_{};
     /// Height.
     /// Height.
-    int height_;
+    int height_{};
     /// Depth.
     /// Depth.
-    int depth_;
+    int depth_{};
     /// Number of color components.
     /// Number of color components.
-    unsigned components_;
+    unsigned components_{};
     /// Number of compressed mip levels.
     /// Number of compressed mip levels.
-    unsigned numCompressedLevels_;
+    unsigned numCompressedLevels_{};
     /// Cubemap status if DDS.
     /// Cubemap status if DDS.
-    bool cubemap_;
+    bool cubemap_{};
     /// Texture array status if DDS.
     /// Texture array status if DDS.
-    bool array_;
+    bool array_{};
     /// Data is sRGB.
     /// Data is sRGB.
-    bool sRGB_;
+    bool sRGB_{};
     /// Compressed format.
     /// Compressed format.
-    CompressedFormat compressedFormat_;
+    CompressedFormat compressedFormat_{CF_NONE};
     /// Pixel data.
     /// Pixel data.
     SharedArrayPtr<unsigned char> data_;
     SharedArrayPtr<unsigned char> data_;
     /// Precalculated mip level image.
     /// Precalculated mip level image.

+ 8 - 8
Source/Urho3D/Resource/PListFile.cpp

@@ -39,48 +39,48 @@ static PListValue EMPTY_VALUE;
 static PListValueMap EMPTY_VALUEMAP;
 static PListValueMap EMPTY_VALUEMAP;
 static PListValueVector EMPTY_VALUEVECTOR;
 static PListValueVector EMPTY_VALUEVECTOR;
 
 
-PListValue::PListValue() :
+PListValue::PListValue() :                                  // NOLINT(hicpp-member-init)
     type_(PLVT_NONE)
     type_(PLVT_NONE)
 {
 {
 }
 }
 
 
-PListValue::PListValue(int value) :
+PListValue::PListValue(int value) :                         // NOLINT(hicpp-member-init)
     type_(PLVT_NONE)
     type_(PLVT_NONE)
 {
 {
     SetInt(value);
     SetInt(value);
 }
 }
 
 
-PListValue::PListValue(bool value) :
+PListValue::PListValue(bool value) :                        // NOLINT(hicpp-member-init)
     type_(PLVT_NONE)
     type_(PLVT_NONE)
 {
 {
     SetBool(value);
     SetBool(value);
 }
 }
 
 
-PListValue::PListValue(float value) :
+PListValue::PListValue(float value) :                       // NOLINT(hicpp-member-init)
     type_(PLVT_NONE)
     type_(PLVT_NONE)
 {
 {
     SetFloat(value);
     SetFloat(value);
 }
 }
 
 
-PListValue::PListValue(const String& value) :
+PListValue::PListValue(const String& value) :               // NOLINT(hicpp-member-init)
     type_(PLVT_NONE)
     type_(PLVT_NONE)
 {
 {
     SetString(value);
     SetString(value);
 }
 }
 
 
-PListValue::PListValue(PListValueMap& valueMap) :
+PListValue::PListValue(PListValueMap& valueMap) :           // NOLINT(hicpp-member-init)
     type_(PLVT_NONE)
     type_(PLVT_NONE)
 {
 {
     SetValueMap(valueMap);
     SetValueMap(valueMap);
 }
 }
 
 
-PListValue::PListValue(PListValueVector& valueVector) :
+PListValue::PListValue(PListValueVector& valueVector) :     // NOLINT(hicpp-member-init)
     type_(PLVT_NONE)
     type_(PLVT_NONE)
 {
 {
     SetValueVector(valueVector);
     SetValueVector(valueVector);
 }
 }
 
 
-PListValue::PListValue(const PListValue& value) :
+PListValue::PListValue(const PListValue& value) :           // NOLINT(hicpp-member-init)
     type_(PLVT_NONE)
     type_(PLVT_NONE)
 {
 {
     *this = value;
     *this = value;

+ 0 - 6
Source/Urho3D/UI/FontFace.cpp

@@ -34,12 +34,6 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-FontGlyph::FontGlyph() :
-    page_(M_MAX_UNSIGNED),
-    used_(false)
-{
-}
-
 FontFace::FontFace(Font* font) :
 FontFace::FontFace(Font* font) :
     font_(font)
     font_(font)
 {
 {

+ 14 - 17
Source/Urho3D/UI/FontFace.h

@@ -36,31 +36,28 @@ class Texture2D;
 /// %Font glyph description.
 /// %Font glyph description.
 struct URHO3D_API FontGlyph
 struct URHO3D_API FontGlyph
 {
 {
-    /// Construct.
-    FontGlyph();
-
     /// X position in texture.
     /// X position in texture.
-    short x_;
+    short x_{};
     /// Y position in texture.
     /// Y position in texture.
-    short y_;
+    short y_{};
     /// Width in texture.
     /// Width in texture.
-    short texWidth_;
+    short texWidth_{};
     /// Height in texture.
     /// Height in texture.
-    short texHeight_;
+    short texHeight_{};
     /// Width on screen.
     /// Width on screen.
-    float width_;
+    float width_{};
     /// Height on screen.
     /// Height on screen.
-    float height_;
+    float height_{};
     /// Glyph X offset from origin.
     /// Glyph X offset from origin.
-    float offsetX_;
+    float offsetX_{};
     /// Glyph Y offset from origin.
     /// Glyph Y offset from origin.
-    float offsetY_;
+    float offsetY_{};
     /// Horizontal advance.
     /// Horizontal advance.
-    float advanceX_;
+    float advanceX_{};
     /// Texture page. M_MAX_UNSIGNED if not yet resident on any texture.
     /// Texture page. M_MAX_UNSIGNED if not yet resident on any texture.
-    unsigned page_;
+    unsigned page_{M_MAX_UNSIGNED};
     /// Used flag.
     /// Used flag.
-    bool used_;
+    bool used_{};
 };
 };
 
 
 /// %Font face description.
 /// %Font face description.
@@ -104,7 +101,7 @@ protected:
     SharedPtr<Texture2D> LoadFaceTexture(const SharedPtr<Image>& image);
     SharedPtr<Texture2D> LoadFaceTexture(const SharedPtr<Image>& image);
 
 
     /// Parent font.
     /// Parent font.
-    Font* font_;
+    Font* font_{};
     /// Glyph mapping.
     /// Glyph mapping.
     HashMap<unsigned, FontGlyph> glyphMapping_;
     HashMap<unsigned, FontGlyph> glyphMapping_;
     /// Kerning mapping.
     /// Kerning mapping.
@@ -112,9 +109,9 @@ protected:
     /// Glyph texture pages.
     /// Glyph texture pages.
     Vector<SharedPtr<Texture2D> > textures_;
     Vector<SharedPtr<Texture2D> > textures_;
     /// Point size.
     /// Point size.
-    float pointSize_;
+    float pointSize_{};
     /// Row height.
     /// Row height.
-    float rowHeight_;
+    float rowHeight_{};
 };
 };
 
 
 }
 }

Some files were not shown because too many files changed in this diff