فهرست منبع

- add missing initialization of several class members
- prefer check for empty() over check for size() in OptimizeGraph (empty() is guaranteed to be constant time, size() is not)
- fix a couple of incorrect indentations

Andy Maloney 10 سال پیش
والد
کامیت
c014bb977c
7فایلهای تغییر یافته به همراه42 افزوده شده و 17 حذف شده
  1. 3 1
      code/BaseImporter.cpp
  2. 5 2
      code/ColladaExporter.h
  3. 18 8
      code/ColladaHelper.h
  4. 4 1
      code/ColladaLoader.cpp
  5. 1 0
      code/FindInvalidDataProcess.cpp
  6. 6 2
      code/OptimizeGraph.cpp
  7. 5 3
      code/OptimizeMeshes.cpp

+ 3 - 1
code/BaseImporter.cpp

@@ -480,7 +480,9 @@ namespace Assimp
 struct Assimp::BatchData
 struct Assimp::BatchData
 {
 {
 	BatchData()
 	BatchData()
-		:	next_id(0xffff)
+        : pIOSystem()
+        , pImporter()
+        , next_id(0xffff)
 	{}
 	{}
 
 
 	// IO system to be used for all imports
 	// IO system to be used for all imports

+ 5 - 2
code/ColladaExporter.h

@@ -144,8 +144,11 @@ protected:
   struct Property
   struct Property
   {
   {
     bool exist;
     bool exist;
-	float value;
-	Property() { exist = false; }
+	 float value;
+	 Property()
+         : exist(false)
+         , value(0.0f)
+     {}
   };
   };
 
 
   // summarize a material in an convinient way. 
   // summarize a material in an convinient way. 

+ 18 - 8
code/ColladaHelper.h

@@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <map>
 #include <map>
 #include <vector>
 #include <vector>
 #include <stdint.h>
 #include <stdint.h>
-#include "../include/assimp/types.h"
+#include "../include/assimp/light.h"
 #include "../include/assimp/mesh.h"
 #include "../include/assimp/mesh.h"
 #include "../include/assimp/material.h"
 #include "../include/assimp/material.h"
 
 
@@ -134,7 +134,8 @@ struct Camera
 struct Light
 struct Light
 {	
 {	
 	Light()
 	Light()
-		:	mAttConstant     (1.f)
+		:	mType            (aiLightSource_UNDEFINED)
+		,	mAttConstant     (1.f)
 		,	mAttLinear       (0.f)
 		,	mAttLinear       (0.f)
 		,	mAttQuadratic    (0.f)
 		,	mAttQuadratic    (0.f)
 		,	mFalloffAngle    (180.f)
 		,	mFalloffAngle    (180.f)
@@ -172,13 +173,14 @@ struct Light
 struct InputSemanticMapEntry
 struct InputSemanticMapEntry
 {
 {
 	InputSemanticMapEntry()
 	InputSemanticMapEntry()
-		:	mSet	(0)
+		:	mSet(0)
+		,	mType(IT_Invalid)
 	{}
 	{}
 
 
 	//! Index of set, optional
 	//! Index of set, optional
 	unsigned int mSet;
 	unsigned int mSet;
 
 
-	//! Name of referenced vertex input
+	//! Type of referenced vertex input
 	InputType mType;
 	InputType mType;
 };
 };
 
 
@@ -235,7 +237,7 @@ struct Node
 {
 {
 	std::string mName;
 	std::string mName;
 	std::string mID;
 	std::string mID;
-  std::string mSID;
+    std::string mSID;
 	Node* mParent;
 	Node* mParent;
 	std::vector<Node*> mChildren;
 	std::vector<Node*> mChildren;
 
 
@@ -384,8 +386,8 @@ struct Controller
 	// accessor URL of the joint names
 	// accessor URL of the joint names
 	std::string mJointNameSource;
 	std::string mJointNameSource;
 
 
-  ///< The bind shape matrix, as array of floats. I'm not sure what this matrix actually describes, but it can't be ignored in all cases
-  float mBindShapeMatrix[16];
+    ///< The bind shape matrix, as array of floats. I'm not sure what this matrix actually describes, but it can't be ignored in all cases
+    float mBindShapeMatrix[16];
 
 
 	// accessor URL of the joint inverse bind matrices
 	// accessor URL of the joint inverse bind matrices
 	std::string mJointOffsetMatrixSource;
 	std::string mJointOffsetMatrixSource;
@@ -609,7 +611,15 @@ struct ChannelEntry
 	const Collada::Accessor* mValueAccessor; ///> Collada accessor to the key value values
 	const Collada::Accessor* mValueAccessor; ///> Collada accessor to the key value values
 	const Collada::Data* mValueData; ///> Source datat array for the key value values
 	const Collada::Data* mValueData; ///> Source datat array for the key value values
 
 
-	ChannelEntry() { mChannel = NULL; mSubElement = 0; }
+	ChannelEntry()
+      : mChannel()
+      , mTransformIndex()
+      , mSubElement()
+      , mTimeAccessor()
+      , mTimeData()
+      , mValueAccessor()
+      , mValueData()
+   {}
 };
 };
 
 
 } // end of namespace Collada
 } // end of namespace Collada

+ 4 - 1
code/ColladaLoader.cpp

@@ -81,7 +81,10 @@ static const aiImporterDesc desc = {
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 // Constructor to be privately used by Importer
 ColladaLoader::ColladaLoader()
 ColladaLoader::ColladaLoader()
-: noSkeletonMesh(), ignoreUpDirection(false), mNodeNameCounter()
+    : noSkeletonMesh()
+    , ignoreUpDirection(false)
+    , invertTransparency(false)
+    , mNodeNameCounter()
 {}
 {}
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------

+ 1 - 0
code/FindInvalidDataProcess.cpp

@@ -58,6 +58,7 @@ using namespace Assimp;
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 // Constructor to be privately used by Importer
 FindInvalidDataProcess::FindInvalidDataProcess()
 FindInvalidDataProcess::FindInvalidDataProcess()
+    : configEpsilon(0.0f)
 {
 {
 	// nothing to do here
 	// nothing to do here
 }
 }

+ 6 - 2
code/OptimizeGraph.cpp

@@ -71,6 +71,10 @@ using namespace Assimp;
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 // Constructor to be privately used by Importer
 OptimizeGraphProcess::OptimizeGraphProcess()
 OptimizeGraphProcess::OptimizeGraphProcess()
+    : mScene()
+    , nodes_in()
+    , nodes_out()
+    , count_merged()
 {}
 {}
 
 
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
@@ -122,7 +126,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& no
 			++it;
 			++it;
 		}
 		}
 
 
-		if (nd->mNumMeshes || child_nodes.size()) { 
+		if (nd->mNumMeshes || !child_nodes.empty()) { 
 			nodes.push_back(nd);
 			nodes.push_back(nd);
 		}
 		}
 		else {
 		else {
@@ -172,7 +176,7 @@ void OptimizeGraphProcess::CollectNewChildren(aiNode* nd, std::list<aiNode*>& no
 			}
 			}
 			++it;
 			++it;
 		}
 		}
-		if (join_master && join.size()) {
+		if (join_master && !join.empty()) {
 			join_master->mName.length = sprintf(join_master->mName.data,"$MergedNode_%i",count_merged++);
 			join_master->mName.length = sprintf(join_master->mName.data,"$MergedNode_%i",count_merged++);
 
 
 			unsigned int out_meshes = 0;
 			unsigned int out_meshes = 0;

+ 5 - 3
code/OptimizeMeshes.cpp

@@ -60,9 +60,11 @@ static const unsigned int DeadBeef = 0xdeadbeef;
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 // Constructor to be privately used by Importer
 // Constructor to be privately used by Importer
 OptimizeMeshesProcess::OptimizeMeshesProcess()
 OptimizeMeshesProcess::OptimizeMeshesProcess()
-: pts (false)
-, max_verts( NotSet )
-, max_faces( NotSet ) {
+    : mScene()
+    , mesh()
+    , pts(false)
+    , max_verts( NotSet )
+    , max_faces( NotSet ) {
     // empty
     // empty
 }
 }