Browse Source

Style: Apply clang-tidy's `modernize-use-default-member-init`

Rémi Verschelde 4 years ago
parent
commit
65a2888057

+ 1 - 1
modules/fbx/fbx_parser/FBXAnimation.cpp

@@ -130,7 +130,7 @@ AnimationCurve::~AnimationCurve() {
 AnimationCurveNode::AnimationCurveNode(uint64_t id, const ElementPtr element, const std::string &name,
 AnimationCurveNode::AnimationCurveNode(uint64_t id, const ElementPtr element, const std::string &name,
 		const Document &doc, const char *const *target_prop_whitelist /*= NULL*/,
 		const Document &doc, const char *const *target_prop_whitelist /*= NULL*/,
 		size_t whitelist_size /*= 0*/) :
 		size_t whitelist_size /*= 0*/) :
-		Object(id, element, name), target(), doc(doc) {
+		Object(id, element, name), doc(doc) {
 	const ScopePtr sc = GetRequiredScope(element);
 	const ScopePtr sc = GetRequiredScope(element);
 
 
 	// find target node
 	// find target node

+ 2 - 2
modules/fbx/fbx_parser/FBXDocument.cpp

@@ -93,7 +93,7 @@ using namespace Util;
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 LazyObject::LazyObject(uint64_t id, const ElementPtr element, const Document &doc) :
 LazyObject::LazyObject(uint64_t id, const ElementPtr element, const Document &doc) :
-		doc(doc), element(element), id(id), flags() {
+		doc(doc), element(element), id(id) {
 	// empty
 	// empty
 }
 }
 
 
@@ -252,7 +252,7 @@ FileGlobalSettings::~FileGlobalSettings() {
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 Document::Document(const Parser &parser, const ImportSettings &settings) :
 Document::Document(const Parser &parser, const ImportSettings &settings) :
-		settings(settings), parser(parser), SafeToImport(false) {
+		settings(settings), parser(parser) {
 	// Cannot use array default initialization syntax because vc8 fails on it
 	// Cannot use array default initialization syntax because vc8 fails on it
 	for (unsigned int &timeStamp : creationTimeStamp) {
 	for (unsigned int &timeStamp : creationTimeStamp) {
 		timeStamp = 0;
 		timeStamp = 0;

+ 30 - 41
modules/fbx/fbx_parser/FBXImportSettings.h

@@ -80,60 +80,52 @@ namespace FBXDocParser {
 
 
 /** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
 /** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */
 struct ImportSettings {
 struct ImportSettings {
-	ImportSettings() :
-			strictMode(true), readAllLayers(true), readAllMaterials(true), readMaterials(true), readTextures(true), readCameras(true), readLights(true), readAnimations(true), readWeights(true), preservePivots(true), optimizeEmptyAnimationCurves(true), useLegacyEmbeddedTextureNaming(false), removeEmptyBones(true), convertToMeters(false) {
-		// empty
-	}
-
 	/** enable strict mode:
 	/** enable strict mode:
      *   - only accept fbx 2012, 2013 files
      *   - only accept fbx 2012, 2013 files
      *   - on the slightest error, give up.
      *   - on the slightest error, give up.
      *
      *
      *  Basically, strict mode means that the fbx file will actually
      *  Basically, strict mode means that the fbx file will actually
-     *  be validated. Strict mode is off by default. */
-	bool strictMode;
+     *  be validated.*/
+	bool strictMode = true;
 
 
 	/** specifies whether all geometry layers are read and scanned for
 	/** specifies whether all geometry layers are read and scanned for
       * usable data channels. The FBX spec indicates that many readers
       * usable data channels. The FBX spec indicates that many readers
       * will only read the first channel and that this is in some way
       * will only read the first channel and that this is in some way
       * the recommended way- in reality, however, it happens a lot that
       * the recommended way- in reality, however, it happens a lot that
-      * vertex data is spread among multiple layers. The default
-      * value for this option is true.*/
-	bool readAllLayers;
+      * vertex data is spread among multiple layers.*/
+	bool readAllLayers = true;
 
 
 	/** specifies whether all materials are read, or only those that
 	/** specifies whether all materials are read, or only those that
      *  are referenced by at least one mesh. Reading all materials
      *  are referenced by at least one mesh. Reading all materials
      *  may make FBX reading a lot slower since all objects
      *  may make FBX reading a lot slower since all objects
-     *  need to be processed .
-     *  This bit is ignored unless readMaterials=true*/
-	bool readAllMaterials;
+     *  need to be processed.
+     *  This bit is ignored unless readMaterials=true.*/
+	bool readAllMaterials = true;
 
 
 	/** import materials (true) or skip them and assign a default
 	/** import materials (true) or skip them and assign a default
-     *  material. The default value is true.*/
-	bool readMaterials;
+     *  material.*/
+	bool readMaterials = true;
 
 
-	/** import embedded textures? Default value is true.*/
-	bool readTextures;
+	/** import embedded textures?*/
+	bool readTextures = true;
 
 
-	/** import cameras? Default value is true.*/
-	bool readCameras;
+	/** import cameras?*/
+	bool readCameras = true;
 
 
-	/** import light sources? Default value is true.*/
-	bool readLights;
+	/** import light sources?*/
+	bool readLights = true;
 
 
 	/** import animations (i.e. animation curves, the node
 	/** import animations (i.e. animation curves, the node
-     *  skeleton is always imported). Default value is true. */
-	bool readAnimations;
+     *  skeleton is always imported).*/
+	bool readAnimations = true;
 
 
-	/** read bones (vertex weights and deform info).
-     *  Default value is true. */
-	bool readWeights;
+	/** read bones (vertex weights and deform info).*/
+	bool readWeights = true;
 
 
 	/** preserve transformation pivots and offsets. Since these can
 	/** preserve transformation pivots and offsets. Since these can
      *  not directly be represented in assimp, additional dummy
      *  not directly be represented in assimp, additional dummy
      *  nodes will be generated. Note that settings this to false
      *  nodes will be generated. Note that settings this to false
-     *  can make animation import a lot slower. The default value
-     *  is true.
+     *  can make animation import a lot slower.
      *
      *
      *  The naming scheme for the generated nodes is:
      *  The naming scheme for the generated nodes is:
      *    <OriginalName>_$AssimpFbx$_<TransformName>
      *    <OriginalName>_$AssimpFbx$_<TransformName>
@@ -149,24 +141,21 @@ struct ImportSettings {
      *    Scaling
      *    Scaling
      *    Rotation
      *    Rotation
      **/
      **/
-	bool preservePivots;
+	bool preservePivots = true;
 
 
 	/** do not import animation curves that specify a constant
 	/** do not import animation curves that specify a constant
-     *  values matching the corresponding node transformation.
-     *  The default value is true. */
-	bool optimizeEmptyAnimationCurves;
+     *  values matching the corresponding node transformation.*/
+	bool optimizeEmptyAnimationCurves = true;
 
 
-	/** use legacy naming for embedded textures eg: (*0, *1, *2)
-    */
-	bool useLegacyEmbeddedTextureNaming;
+	/** use legacy naming for embedded textures eg: (*0, *1, *2).*/
+	bool useLegacyEmbeddedTextureNaming = false;
 
 
-	/** Empty bones shall be removed
-    */
-	bool removeEmptyBones;
+	/** Empty bones shall be removed.*/
+	bool removeEmptyBones = true;
 
 
-	/** Set to true to perform a conversion from cm to meter after the import
-    */
-	bool convertToMeters;
+	/** Set to true to perform a conversion from cm to meter after
+	 *  the import.*/
+	bool convertToMeters = false;
 };
 };
 } // namespace FBXDocParser
 } // namespace FBXDocParser
 
 

+ 2 - 2
modules/fbx/fbx_parser/FBXMaterial.cpp

@@ -171,7 +171,7 @@ Material::~Material() {
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 Texture::Texture(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) :
 Texture::Texture(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) :
-		Object(id, element, name), uvScaling(1.0f, 1.0f), media(nullptr) {
+		Object(id, element, name), uvScaling(1.0f, 1.0f) {
 	const ScopePtr sc = GetRequiredScope(element);
 	const ScopePtr sc = GetRequiredScope(element);
 
 
 	const ElementPtr Type = sc->GetElement("Type");
 	const ElementPtr Type = sc->GetElement("Type");
@@ -297,7 +297,7 @@ void LayeredTexture::fillTexture(const Document &doc) {
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 Video::Video(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) :
 Video::Video(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) :
-		Object(id, element, name), contentLength(0), content(0) {
+		Object(id, element, name) {
 	const ScopePtr sc = GetRequiredScope(element);
 	const ScopePtr sc = GetRequiredScope(element);
 
 
 	const ElementPtr Type = sc->GetElement("Type");
 	const ElementPtr Type = sc->GetElement("Type");

+ 1 - 1
modules/fbx/fbx_parser/FBXMeshGeometry.cpp

@@ -88,7 +88,7 @@ using namespace Util;
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 Geometry::Geometry(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc) :
 Geometry::Geometry(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc) :
-		Object(id, element, name), skin() {
+		Object(id, element, name) {
 	const std::vector<const Connection *> &conns = doc.GetConnectionsByDestinationSequenced(ID(), "Deformer");
 	const std::vector<const Connection *> &conns = doc.GetConnectionsByDestinationSequenced(ID(), "Deformer");
 	for (const Connection *con : conns) {
 	for (const Connection *con : conns) {
 		const Skin *sk = ProcessSimpleConnection<Skin>(*con, false, "Skin -> Geometry", element);
 		const Skin *sk = ProcessSimpleConnection<Skin>(*con, false, "Skin -> Geometry", element);

+ 1 - 1
modules/fbx/fbx_parser/FBXParser.cpp

@@ -216,7 +216,7 @@ Scope::~Scope() {
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 Parser::Parser(const TokenList &tokens, bool is_binary) :
 Parser::Parser(const TokenList &tokens, bool is_binary) :
-		tokens(tokens), last(), current(), cursor(tokens.begin()), is_binary(is_binary) {
+		tokens(tokens), cursor(tokens.begin()), is_binary(is_binary) {
 	root = new_Scope(*this, true);
 	root = new_Scope(*this, true);
 	scopes.push_back(root);
 	scopes.push_back(root);
 }
 }

+ 1 - 2
modules/fbx/fbx_parser/FBXProperties.cpp

@@ -145,8 +145,7 @@ std::string PeekPropertyName(const Element &element) {
 } // namespace
 } // namespace
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
-PropertyTable::PropertyTable() :
-		templateProps(), element() {
+PropertyTable::PropertyTable() {
 }
 }
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------

+ 24 - 49
servers/rendering/renderer_rd/renderer_storage_rd.h

@@ -691,21 +691,21 @@ private:
 	};
 	};
 
 
 	struct Particles {
 	struct Particles {
-		bool inactive;
-		float inactive_time;
-		bool emitting;
-		bool one_shot;
-		int amount;
-		float lifetime;
-		float pre_process_time;
-		float explosiveness;
-		float randomness;
-		bool restart_request;
-		AABB custom_aabb;
-		bool use_local_coords;
+		bool inactive = true;
+		float inactive_time = 0.0;
+		bool emitting = false;
+		bool one_shot = false;
+		int amount = 0;
+		float lifetime = 1.0;
+		float pre_process_time = 0.0;
+		float explosiveness = 0.0;
+		float randomness = 0.0;
+		bool restart_request = false;
+		AABB custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8));
+		bool use_local_coords = true;
 		RID process_material;
 		RID process_material;
 
 
-		RS::ParticlesDrawOrder draw_order;
+		RS::ParticlesDrawOrder draw_order = RS::PARTICLES_DRAW_ORDER_INDEX;
 
 
 		Vector<RID> draw_passes;
 		Vector<RID> draw_passes;
 
 
@@ -730,21 +730,21 @@ private:
 
 
 		RID sub_emitter;
 		RID sub_emitter;
 
 
-		float phase;
-		float prev_phase;
-		uint64_t prev_ticks;
-		uint32_t random_seed;
+		float phase = 0.0;
+		float prev_phase = 0.0;
+		uint64_t prev_ticks = 0;
+		uint32_t random_seed = 0;
 
 
-		uint32_t cycle_number;
+		uint32_t cycle_number = 0;
 
 
-		float speed_scale;
+		float speed_scale = 1.0;
 
 
-		int fixed_fps;
-		bool fractional_delta;
-		float frame_remainder;
-		float collision_base_size;
+		int fixed_fps = 0;
+		bool fractional_delta = false;
+		float frame_remainder = 0;
+		float collision_base_size = 0.01;
 
 
-		bool clear;
+		bool clear = true;
 
 
 		bool force_sub_emit = false;
 		bool force_sub_emit = false;
 
 
@@ -757,31 +757,6 @@ private:
 
 
 		Set<RID> collisions;
 		Set<RID> collisions;
 
 
-		Particles() :
-				inactive(true),
-				inactive_time(0.0),
-				emitting(false),
-				one_shot(false),
-				amount(0),
-				lifetime(1.0),
-				pre_process_time(0.0),
-				explosiveness(0.0),
-				randomness(0.0),
-				restart_request(false),
-				custom_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))),
-				use_local_coords(true),
-				draw_order(RS::PARTICLES_DRAW_ORDER_INDEX),
-				prev_ticks(0),
-				random_seed(0),
-				cycle_number(0),
-				speed_scale(1.0),
-				fixed_fps(0),
-				fractional_delta(false),
-				frame_remainder(0),
-				collision_base_size(0.01),
-				clear(true) {
-		}
-
 		Dependency dependency;
 		Dependency dependency;
 
 
 		ParticlesFrameParams frame_params;
 		ParticlesFrameParams frame_params;