Browse Source

NFF finished except cone implementation.
Added fixes by lynxeye to make assimp work with GCC 4.
Website - again a backup of the current version.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@130 67173fc5-114c-0410-ac8e-9d2fd5bffc1f

aramis_acg 17 years ago
parent
commit
559daf900d

+ 6 - 3
code/3DSConverter.cpp

@@ -265,6 +265,12 @@ void Dot3DSImporter::ConvertMaterial(Dot3DS::Material& oldMat,
 
 		case Dot3DS::Dot3DSFile::Metal :
 			eShading = aiShadingMode_CookTorrance; break;
+
+			// FIX to workaround a warning with GCC 4 who complained
+			// about a missing case Blinn: here - Blinn isn't a valid
+			// value in the 3DS Loader, it is just needed for ASE
+		case Dot3DS::Dot3DSFile::Blinn :
+			eShading = aiShadingMode_Blinn; break;
 	}
 	mat.AddProperty<int>( (int*)&eShading,1,AI_MATKEY_SHADING_MODEL);
 
@@ -402,7 +408,6 @@ void Dot3DSImporter::ConvertMeshes(aiScene* pcOut)
 			aiSplit[*a].push_back(iNum);
 		}
 		// now generate submeshes
-		bool bFirst = true;
 		for (unsigned int p = 0; p < this->mScene->mMaterials.size();++p)
 		{
 			if (aiSplit[p].size() != 0)
@@ -586,8 +591,6 @@ void Dot3DSImporter::GenerateNodeGraph(aiScene* pcOut)
 		//   |       |       |            |
 		// MESH_0  MESH_1  MESH_2  ...  MESH_N
 		//
-		unsigned int iCnt = 0;
-
 		DefaultLogger::get()->warn("No hierarchy information has been found in the file. ");
 
 		pcOut->mRootNode->mNumChildren = pcOut->mNumMeshes;

+ 3 - 3
code/3DSHelper.h

@@ -326,8 +326,8 @@ struct Texture
 		, mOffsetU	(0.0f)
 		, mOffsetV	(0.0f)
 		, mRotation	(0.0f)
-		, iUVSrc	(0)
 		, mMapMode	(aiTextureMapMode_Wrap)
+		, iUVSrc	(0)
 	{
 		mTextureBlend = std::numeric_limits<float>::quiet_NaN();
 	}
@@ -364,9 +364,9 @@ struct Material
 	mTransparency		(1.0f),
 	mBumpHeight			(1.0f),
 	iBakeUVTransform	(0),
-	pcSingleTexture		(NULL),
 	mShininessStrength	(1.0f),
-	mTwoSided			(false)
+	mTwoSided			(false),
+	pcSingleTexture		(NULL)
 	{
 		static int iCnt = 0;
 		

+ 1 - 1
code/3DSLoader.h

@@ -269,4 +269,4 @@ protected:
 
 } // end of namespace Assimp
 
-#endif // AI_3DSIMPORTER_H_INC
+#endif // AI_3DSIMPORTER_H_INC

+ 1 - 1
code/BaseImporter.h

@@ -189,4 +189,4 @@ protected:
 
 } // end of namespace Assimp
 
-#endif // AI_BASEIMPORTER_H_INC
+#endif // AI_BASEIMPORTER_H_INC

+ 99 - 11
code/NFFLoader.cpp

@@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "ParsingUtils.h"
 #include "StandardShapes.h"
 #include "fast_atof.h"
+#include "qnan.h"
 
 // public assimp headers
 #include "../include/IOStream.h"
@@ -105,7 +106,7 @@ bool GetNextLine(const char*& buffer, char out[4096])
 // ------------------------------------------------------------------------------------------------
 #define AI_NFF_PARSE_FLOAT(f) \
 	SkipSpaces(&sz); \
-	sz = fast_atof_move(sz, f); 
+	if (!::IsLineEnd(*sz))sz = fast_atof_move(sz, f); 
 
 // ------------------------------------------------------------------------------------------------
 #define AI_NFF_PARSE_TRIPLE(v) \
@@ -115,10 +116,12 @@ bool GetNextLine(const char*& buffer, char out[4096])
 
 // ------------------------------------------------------------------------------------------------
 #define AI_NFF_PARSE_SHAPE_INFORMATION() \
-	sz = &line[1]; \
-	aiVector3D center; float radius; \
+	aiVector3D center, radius(1.0f,std::numeric_limits<float>::quiet_NaN(),std::numeric_limits<float>::quiet_NaN()); \
 	AI_NFF_PARSE_TRIPLE(center); \
-	AI_NFF_PARSE_FLOAT(radius); \
+	AI_NFF_PARSE_TRIPLE(radius); \
+	if (is_qnan(radius.z))radius.z = radius.x; \
+	if (is_qnan(radius.y))radius.y = radius.x; \
+	currentMesh.radius = radius; \
 	currentMesh.center = center;
 
 // ------------------------------------------------------------------------------------------------
@@ -156,7 +159,9 @@ void NFFImporter::InternReadFile( const std::string& pFile,
 
 	char line[4096];
 	const char* sz;
-	unsigned int sphere = 0,cylinder = 0,cone = 0,numNamed = 0;
+	unsigned int sphere = 0,cylinder = 0,cone = 0,numNamed = 0,
+		dodecahedron = 0,octecahedron = 0,octahedron = 0,tetrahedron = 0, hexahedron = 0;
+
 	while (GetNextLine(buffer,line))
 	{
 		if ('p' == line[0])
@@ -186,7 +191,12 @@ void NFFImporter::InternReadFile( const std::string& pFile,
 			SkipSpaces(sz,&sz);
 			m = strtol10(sz);
 
-			out->vertices.reserve(out->vertices.size()+m);
+			// ---- flip the face order
+			out->vertices.resize(out->vertices.size()+m);
+			if (out == currentMeshWithNormals)
+			{
+				out->normals.resize(out->vertices.size());
+			}
 			for (unsigned int n = 0; n < m;++n)
 			{
 				if(!GetNextLine(buffer,line))
@@ -197,12 +207,12 @@ void NFFImporter::InternReadFile( const std::string& pFile,
 
 				aiVector3D v; sz = &line[0];
 				AI_NFF_PARSE_TRIPLE(v);
-				out->vertices.push_back(v);
+				out->vertices[out->vertices.size()-n-1] = v;
 
-				if ('p' == line[1])
+				if (out == currentMeshWithNormals)
 				{
 					AI_NFF_PARSE_TRIPLE(v);
-					out->normals.push_back(v);
+					out->normals[out->vertices.size()-n-1] = v;
 				}
 			}
 			out->faces.push_back(m);
@@ -256,15 +266,88 @@ void NFFImporter::InternReadFile( const std::string& pFile,
 			MeshInfo& currentMesh = meshesLocked.back();
 			currentMesh.shader = s;
 
+			sz = &line[1]; 
 			AI_NFF_PARSE_SHAPE_INFORMATION();
 
-			// generate the sphere - it consists of simple triangles
-			StandardShapes::MakeSphere(aiVector3D(), radius, iTesselation, currentMesh.vertices);
+			// we don't need scaling or translation here - we do it in the node's transform
+			StandardShapes::MakeSphere(aiVector3D(), 1.0f, iTesselation, currentMesh.vertices);
 			currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
 
 			// generate a name for the mesh
 			::sprintf(currentMesh.name,"sphere_%i",sphere++);
 		}
+		// 'dod' - dodecahedron
+		else if (!strncmp(line,"dod",3) && IsSpace(line[3]))
+		{
+			meshesLocked.push_back(MeshInfo(false,true));
+			MeshInfo& currentMesh = meshesLocked.back();
+			currentMesh.shader = s;
+
+			sz = &line[4]; 
+			AI_NFF_PARSE_SHAPE_INFORMATION();
+
+			// we don't need scaling or translation here - we do it in the node's transform
+			StandardShapes::MakeDodecahedron(aiVector3D(), 1.0f, currentMesh.vertices);
+			currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
+
+			// generate a name for the mesh
+			::sprintf(currentMesh.name,"dodecahedron_%i",dodecahedron++);
+		}
+
+		// 'oct' - octahedron
+		else if (!strncmp(line,"oct",3) && IsSpace(line[3]))
+		{
+			meshesLocked.push_back(MeshInfo(false,true));
+			MeshInfo& currentMesh = meshesLocked.back();
+			currentMesh.shader = s;
+
+			sz = &line[4]; 
+			AI_NFF_PARSE_SHAPE_INFORMATION();
+
+			// we don't need scaling or translation here - we do it in the node's transform
+			StandardShapes::MakeOctahedron(aiVector3D(), 1.0f, currentMesh.vertices);
+			currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
+
+			// generate a name for the mesh
+			::sprintf(currentMesh.name,"octecahedron_%i",octecahedron++);
+		}
+
+		// 'tet' - tetrahedron
+		else if (!strncmp(line,"tet",3) && IsSpace(line[3]))
+		{
+			meshesLocked.push_back(MeshInfo(false,true));
+			MeshInfo& currentMesh = meshesLocked.back();
+			currentMesh.shader = s;
+
+			sz = &line[4]; 
+			AI_NFF_PARSE_SHAPE_INFORMATION();
+
+			// we don't need scaling or translation here - we do it in the node's transform
+			StandardShapes::MakeTetrahedron(aiVector3D(), 1.0f, currentMesh.vertices);
+			currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
+
+			// generate a name for the mesh
+			::sprintf(currentMesh.name,"tetrahedron_%i",tetrahedron++);
+		}
+
+		// 'hex' - hexahedron
+		else if (!strncmp(line,"hex",3) && IsSpace(line[3]))
+		{
+			meshesLocked.push_back(MeshInfo(false,true));
+			MeshInfo& currentMesh = meshesLocked.back();
+			currentMesh.shader = s;
+
+			sz = &line[4]; 
+			AI_NFF_PARSE_SHAPE_INFORMATION();
+
+			// we don't need scaling or translation here - we do it in the node's transform
+			StandardShapes::MakeHexahedron(aiVector3D(),1.0f, currentMesh.vertices);
+			currentMesh.faces.resize(currentMesh.vertices.size()/3,3);
+
+			// generate a name for the mesh
+			::sprintf(currentMesh.name,"hexahedron_%i",hexahedron++);
+		}
+
 		// 'tess' - tesselation
 		else if (!strncmp(line,"tess",4) && IsSpace(line[4]))
 		{
@@ -359,12 +442,17 @@ void NFFImporter::InternReadFile( const std::string& pFile,
 			node->mNumMeshes = 1;
 			node->mMeshes = new unsigned int[1];
 			node->mMeshes[0] = m;
+			node->mName.Set(src.name);
 
 			// setup the transformation matrix of the node
 			node->mTransformation.a4 = src.center.x;
 			node->mTransformation.b4 = src.center.y;
 			node->mTransformation.c4 = src.center.z;
 
+			node->mTransformation.a1 = src.radius.x;
+			node->mTransformation.b2 = src.radius.y;
+			node->mTransformation.c3 = src.radius.z;
+
 			++ppcChildren;
 		}
 		else *pMeshes++ = m;

+ 1 - 1
code/NFFLoader.h

@@ -119,7 +119,7 @@ private:
 		bool bHasNormals, bLocked;
 
 		// for spheres, cones and cylinders: center point of the object
-		aiVector3D center;
+		aiVector3D center, radius;
 
 		char name[128];
 

+ 5 - 2
code/SGSpatialSort.h

@@ -110,7 +110,10 @@ protected:
 		Entry() { /** intentionally not initialized.*/ }
 		Entry( unsigned int pIndex, const aiVector3D& pPosition, float pDistance,uint32_t pSG) 
 			: 
-			mPosition( pPosition), mIndex( pIndex), mDistance( pDistance),mSmoothGroups (pSG)
+			mIndex( pIndex),
+			mPosition( pPosition),
+			mSmoothGroups (pSG),
+			mDistance( pDistance)
 			{ 	}
 
 		bool operator < (const Entry& e) const { return mDistance < e.mDistance; }
@@ -122,4 +125,4 @@ protected:
 
 } // end of namespace Assimp
 
-#endif // AI_SPATIALSORT_H_INC
+#endif // AI_SPATIALSORT_H_INC

+ 1 - 1
code/SmoothingGroups.h

@@ -100,4 +100,4 @@ void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups<T>& sMesh);
 // include implementations
 #include "SmoothingGroups.inl"
 
-#endif // !! AI_SMOOTHINGGROUPS_H_INC
+#endif // !! AI_SMOOTHINGGROUPS_H_INC

+ 2 - 4
code/SmoothingGroups.inl

@@ -95,8 +95,7 @@ void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups<T>& sMesh)
 	
 	// now generate the spatial sort tree
 	SGSpatialSort sSort;
-	for( std::vector<T>::iterator
-		i =  sMesh.mFaces.begin();
+	for( std::vector<T>::iterator i =  sMesh.mFaces.begin();
 		i != sMesh.mFaces.end();++i)
 	{
 		sSort.Add(sMesh.mPositions[(*i).mIndices[0]],(*i).mIndices[0],(*i).iSmoothGroup);
@@ -105,8 +104,7 @@ void ComputeNormalsWithSmoothingsGroups(MeshWithSmoothingGroups<T>& sMesh)
 	}
 	sSort.Prepare();
 
-	for( std::vector<T>::iterator
-		i =  sMesh.mFaces.begin();
+	for( std::vector<T>::iterator i =  sMesh.mFaces.begin();
 		i != sMesh.mFaces.end();++i)
 	{
 		std::vector<unsigned int> poResult;

BIN
code/StandardShapes.cpp


+ 62 - 8
code/StandardShapes.h

@@ -59,32 +59,52 @@ class ASSIMP_API StandardShapes
 
 public:
 
+	/** @brief Generates a hexahedron (cube)
+	 *
+	 *  Hexahedrons can be scaled on all axes.
+	 *  @param center Center point of the hexahedron
+	 *  @param length Radius of the hexahedron 
+	 *  @param positions Receives output triangles.
+	 */
+	static void MakeHexahedron(aiVector3D& center,const aiVector3D& length,
+		std::vector<aiVector3D>& positions);
+
+
 	/** @brief Generates an icosahedron
 	 *
 	 *  @param center Center point of the icosahedron
-	 *  @param length Face length of the icosahedron
+	 *  @param length Radius of the icosahedron
 	 *  @param positions Receives output triangles.
 	 */
-	static void MakeIcosahedron(aiVector3D& center,float length,
+	static void MakeIcosahedron(aiVector3D& center,const aiVector3D& length,
 		std::vector<aiVector3D>& positions);
 
 
 	/** @brief Generates a dodecahedron
 	 *
 	 *  @param center Center point of the dodecahedron
-	 *  @param length Face length of the dodecahedron
-	 *  @param positions Receives output triangles.
+	 *  @param length Radius of the dodecahedron
+	 *  @param positions Receives output triangles
 	 */
-	static void MakeDodecahedron(aiVector3D& center,float length,
+	static void MakeDodecahedron(aiVector3D& center,const aiVector3D& length,
 		std::vector<aiVector3D>& positions);
 
 	/** @brief Generates an octahedron
 	 *
 	 *  @param center Center point of the octahedron
-	 *  @param length Face length of the octahedron
+	 *  @param length Radius of the octahedron
+	 *  @param positions Receives output triangles.
+	 */
+	static void MakeOctahedron(aiVector3D& center,const aiVector3D& length,
+		std::vector<aiVector3D>& positions);
+
+	/** @brief Generates a tetrahedron
+	 *
+	 *  @param center Center point of the tetrahedron
+	 *  @param length Radius of the octahedron
 	 *  @param positions Receives output triangles.
 	 */
-	static void MakeOctahedron(aiVector3D& center,float length,
+	static void MakeTetrahedron(aiVector3D& center,const aiVector3D& length,
 		std::vector<aiVector3D>& positions);
 
 
@@ -95,7 +115,7 @@ public:
 	 *  @param tess Number of subdivions - 0 generates a octahedron
 	 *  @param positions Receives output triangles.
 	 */
-	static void MakeSphere(aiVector3D& center,float radius,unsigned int tess,
+	static void MakeSphere(aiVector3D& center,float length,unsigned int tess,
 		std::vector<aiVector3D>& positions);
 
 	/** @brief Generates a cone or a cylinder, either opened or closed.
@@ -140,6 +160,40 @@ public:
 	static void MakeCircle(aiVector3D& center, aiVector3D& normal, 
 		float radius, unsigned int tess,
 		std::vector<aiVector3D>& positions);
+
+
+	// simplified versions - the radius is a single float and applies
+	// to all axes. These version of the functions must be used if ou 
+	// REALLY want a platonic primitive :-)
+	static void MakeHexahedron(aiVector3D& center,float length,
+		std::vector<aiVector3D>& positions)
+	{
+		MakeHexahedron(center,aiVector3D(length),positions);
+	}
+
+	static void MakeDodecahedron(aiVector3D& center,float length,
+		std::vector<aiVector3D>& positions)
+	{
+		MakeDodecahedron(center,aiVector3D(length),positions);
+	}
+
+	static void MakeOcathedron(aiVector3D& center,float length,
+		std::vector<aiVector3D>& positions)
+	{
+		MakeOctahedron(center,aiVector3D(length),positions);
+	}
+
+	static void MakeTetrahedron(aiVector3D& center,float length,
+		std::vector<aiVector3D>& positions)
+	{
+		MakeTetrahedron(center,aiVector3D(length),positions);
+	}
+
+	static void MakeIcosahedron(aiVector3D& center,float length,
+		std::vector<aiVector3D>& positions)
+	{
+		MakeIcosahedron(center,aiVector3D(length),positions);
+	}
 	
 };
 } // ! Assimp

+ 2 - 12
code/qnan.h

@@ -3,9 +3,7 @@
 #if (!defined AI_QNAN_H_INCLUDED)
 #define AI_QNAN_H_INCLUDED
 
-#if (!defined ASSIMP_BUILD_CPP_09)
-#	include <boost/static_assert.hpp>
-#endif
+
 
 inline bool is_qnan(const float in)
 {
@@ -21,14 +19,6 @@ inline bool is_qnan(const float in)
 		int32_t i;
 	} FPUNION1,FPUNION2;
 
-	// use a compile-time asertion if possible
-#if (defined ASSIMP_BUILD_CPP_09)
-	static_assert(sizeof(float)==sizeof(int32_t),
-		"A float seems not to be 4 bytes on this platform");
-#else
-	BOOST_STATIC_ASSERT(sizeof(float)==sizeof(int32_t));
-#endif
-
 	FPUNION1.f = in;
 	FPUNION2.f = std::numeric_limits<float>::quiet_NaN();
 	return FPUNION1.i == FPUNION2.i;
@@ -39,4 +29,4 @@ inline bool is_not_qnan(const float in)
 	return !is_qnan(in);
 }
 
-#endif // !! AI_QNAN_H_INCLUDED
+#endif // !! AI_QNAN_H_INCLUDED

+ 1 - 1
include/NullLogger.h

@@ -79,4 +79,4 @@ public:
 
 }
 
-#endif // !! AI_NULLLOGGER_H_INCLUDED
+#endif // !! AI_NULLLOGGER_H_INCLUDED

+ 1 - 1
include/aiMaterial.inl

@@ -132,4 +132,4 @@ inline aiReturn aiMaterial::Get<aiString>(const char* pKey,aiString& pOut)
 	return aiGetMaterialString(this,pKey,&pOut);
 }
 
-#endif //! AI_MATERIAL_INL_INC
+#endif //! AI_MATERIAL_INL_INC

+ 1 - 1
include/aiMatrix3x3.h

@@ -89,4 +89,4 @@ struct aiMatrix3x3
 } // end of extern C
 #endif
 
-#endif // AI_MATRIX3x3_H_INC
+#endif // AI_MATRIX3x3_H_INC

+ 1 - 1
include/aiMatrix3x3.inl

@@ -53,4 +53,4 @@ inline aiMatrix3x3& aiMatrix3x3::Transpose()
 
 
 #endif // __cplusplus
-#endif // AI_MATRIX3x3_INL_INC
+#endif // AI_MATRIX3x3_INL_INC

+ 2 - 1
include/aiMesh.h

@@ -451,4 +451,5 @@ struct aiMesh
 }
 #endif
 
-#endif // AI_MESH_H_INC
+#endif // AI_MESH_H_INC
+

+ 2 - 2
include/aiTexture.h

@@ -164,7 +164,7 @@ struct aiTexture
 
 	// Construction
 	aiTexture ()
-		: mHeight(0), mWidth(0), pcData(NULL)
+		: mWidth(0), mHeight(0), pcData(NULL)
 	{
 		achFormatHint[0] = '\0';
 		achFormatHint[1] = '\0';
@@ -185,4 +185,4 @@ struct aiTexture
 }
 #endif
 
-#endif // AI_TEXTURE_H_INC
+#endif // AI_TEXTURE_H_INC

+ 5 - 1
include/aiVector3D.h

@@ -55,6 +55,7 @@ struct aiVector3D
 #ifdef __cplusplus
 	aiVector3D () : x(0.0f), y(0.0f), z(0.0f) {}
 	aiVector3D (float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}
+	aiVector3D (float _xyz) : x(_xyz), y(_xyz), z(_xyz) {}
 	aiVector3D (const aiVector3D& o) : x(o.x), y(o.y), z(o.z) {}
 
 	void Set( float pX, float pY, float pZ) { x = pX; y = pY; z = pZ; }
@@ -78,6 +79,9 @@ struct aiVector3D
 	inline aiVector3D& operator= (float f)
 		{x = y = z = f;return *this;}
 
+	const aiVector3D SymMul(const aiVector3D& o)
+		{return aiVector3D(x*o.x,y*o.y,z*o.z);}
+
 #endif // __cplusplus
 
 	float x, y, z;	
@@ -143,4 +147,4 @@ inline aiVector3D operator - ( const aiVector3D& v)
 
 #endif // __cplusplus
 
-#endif // AI_VECTOR3D_H_INC
+#endif // AI_VECTOR3D_H_INC

+ 1 - 1
include/aiVector3D.inl

@@ -30,4 +30,4 @@ inline aiVector3D operator * (const aiMatrix4x4& pMatrix, const aiVector3D& pVec
 
 
 #endif // __cplusplus
-#endif // AI_VECTOR3D_INL_INC
+#endif // AI_VECTOR3D_INL_INC

+ 1 - 0
test/NFF/dodecahedron.nff

@@ -0,0 +1 @@
+dod 0 0 0 5

+ 2 - 0
test/NFF/hexahedron.nff

@@ -0,0 +1,2 @@
+f 1 0 0
+hex 0 0 0 5 10 20

+ 1 - 0
test/NFF/octahedron.nff

@@ -0,0 +1 @@
+oct 0 0 0 5 5 5

+ 23 - 6
test/NFF/positionTest.nff

@@ -1,10 +1,27 @@
 
+tess 4
+
+f 0.3 0.3 0.3 1 1
+
 # a centered sphere
+
+
 s 0 0 0 5
 
-# a polgyon that should not be visible
-p 4
-5 0 0
-0 -5 0
--5 0 0
-0 5 0
+s 20 0 0 5
+
+s 40 0 0 5
+
+s 60 0 0 5
+
+
+
+f 1 1 1 1 1
+
+s -5 0 0 3
+
+s 0 5 0 3
+s 0 -5 0 3
+
+
+

+ 7 - 2
test/NFF/spheres.nff

@@ -14,11 +14,16 @@ s 5.0 4.0 8.0 3.0
 f 0.0 1.0 0.0 0 1 1
 
 # And another one
-s 1.0 -4.0 2.0 4.0
+s 1.0 -4.0 2.0 4.0 2 2
 
 #red
 f 1.0 0.0 0.0 0 1 1
 
 # a simple cone
 c 10 10 5 3
-c 14 14 3 6
+c 14 14 3 6
+
+
+# An icosahedron
+tess 0
+s 1 -15 2 4 8 8

+ 1 - 0
test/NFF/tetrahedron.nff

@@ -0,0 +1 @@
+tet 0 0 0 5

+ 1 - 0
tools/assimp_view/AssetHelper.h

@@ -201,6 +201,7 @@ class AssetHelper
 		// ------------------------------------------------------------------
 		// flip all normal vectors
 		void FlipNormals();
+		void FlipNormalsInt();
 	};
 
 #endif // !! IG

+ 11 - 1
tools/assimp_view/Normals.cpp

@@ -93,10 +93,11 @@ public:
 
 bool g_bWasFlipped = false;
 
+
 //-------------------------------------------------------------------------------
 // Flip all normal vectors
 //-------------------------------------------------------------------------------
-void AssetHelper::FlipNormals()
+void AssetHelper::FlipNormalsInt()
 {
 	// invert all normal vectors
 	for (unsigned int i = 0; i < this->pcScene->mNumMeshes;++i)
@@ -107,6 +108,13 @@ void AssetHelper::FlipNormals()
 			pcMesh->mNormals[a] *= -1.0f;
 		}
 	}
+}
+
+//-------------------------------------------------------------------------------
+void AssetHelper::FlipNormals()
+{
+	FlipNormalsInt();
+
 	// recreate native data
 	DeleteAssetData(true);
 	CreateAssetData();
@@ -145,12 +153,14 @@ void AssetHelper::SetNormalSet(unsigned int iSet)
 	{
 		MyGenFaceNormalsProcess* pcProcess = new MyGenFaceNormalsProcess();
 		pcProcess->Execute(this->pcScene);
+		//FlipNormalsInt();
 		delete pcProcess;
 	}
 	else if (SMOOTH == iSet)
 	{
 		MyGenVertexNormalsProcess* pcProcess = new MyGenVertexNormalsProcess();
 		pcProcess->Execute(this->pcScene);
+		//FlipNormalsInt();
 		delete pcProcess;
 	}
 	else if (ORIGINAL == iSet)