The modifications in mkktspace broke compilation on gcc 4.2.x
This is a patch proposed by sparky_ on irc.
Special thanks to cobe571 for being persistent on the matter.
Index: intern/mikktspace/mikktspace.c
===================================================================
--- intern/mikktspace/mikktspace.c	(revision 34881)
+++ intern/mikktspace/mikktspace.c	(working copy)
@@ -46,7 +46,7 @@
 	return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z);
 }
 
-static const SVec3		vadd( const SVec3 v1, const SVec3 v2 )
+static SVec3		vadd( const SVec3 v1, const SVec3 v2 )
 {
 	SVec3 vRes;
 
@@ -58,7 +58,7 @@
 }
 
 
-static const SVec3		vsub( const SVec3 v1, const SVec3 v2 )
+static SVec3		vsub( const SVec3 v1, const SVec3 v2 )
 {
 	SVec3 vRes;
 
@@ -69,7 +69,7 @@
 	return vRes;
 }
 
-static const SVec3		vscale(const float fS, const SVec3 v)
+static SVec3		vscale(const float fS, const SVec3 v)
 {
 	SVec3 vRes;
 
@@ -90,12 +90,12 @@
 	return sqrtf(LengthSquared(v));
 }
 
-static const SVec3		Normalize( const SVec3 v )
+static SVec3		Normalize( const SVec3 v )
 {
 	return vscale(1 / Length(v), v);
 }
 
-static const float		vdot( const SVec3 v1, const SVec3 v2)
+static float		vdot( const SVec3 v1, const SVec3 v2)
 {
 	return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
 }
@@ -182,7 +182,7 @@
 	piFace[0] = iIndexIn>>2;
 }
 
-static const STSpace AvgTSpace(const STSpace * pTS0, const STSpace * pTS1)
+static STSpace AvgTSpace(const STSpace * pTS0, const STSpace * pTS1)
 {
 	STSpace ts_res;
 
@@ -212,9 +212,9 @@
 
 
 
-const SVec3 GetPosition(const SMikkTSpaceContext * pContext, const int index);
-const SVec3 GetNormal(const SMikkTSpaceContext * pContext, const int index);
-const SVec3 GetTexCoord(const SMikkTSpaceContext * pContext, const int index);
+SVec3 GetPosition(const SMikkTSpaceContext * pContext, const int index);
+SVec3 GetNormal(const SMikkTSpaceContext * pContext, const int index);
+SVec3 GetTexCoord(const SMikkTSpaceContext * pContext, const int index);
 
 
 // degen triangles
@@ -429,21 +429,22 @@
 	int index;
 } STmpVert;
 
-static const int g_iCells = 2048;
+const int g_iCells = 2048;
 
+#ifdef _MSC_VER
+#define NOINLINE __declspec(noinline)
+#else
+#define NOINLINE __attribute__ ((noinline))
+#endif
+
 // it is IMPORTANT that this function is called to evaluate the hash since
 // inlining could potentially reorder instructions and generate different
 // results for the same effective input value fVal.
-#if defined(_MSC_VER) && !defined(FREE_WINDOWS)
-	#define NOINLINE __declspec(noinline)
-#else
-	#define NOINLINE __attribute__((noinline))
-#endif
-static NOINLINE int FindGridCell(const float fMin, const float fMax, const float fVal)
+NOINLINE int FindGridCell(const float fMin, const float fMax, const float fVal)
 {
-	const float fIndex = (g_iCells-1) * ((fVal-fMin)/(fMax-fMin));
-	const int iIndex = fIndex<0?0:((int) (fIndex+0.5f));
-	return iIndex<g_iCells?iIndex:(g_iCells-1);
+const float fIndex = g_iCells * ((fVal-fMin)/(fMax-fMin));
+const int iIndex = fIndex<0?0:((int)fIndex);
+return iIndex<g_iCells?iIndex:(g_iCells-1);
 }
 
 void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], const SMikkTSpaceContext * pContext, const int iL_in, const int iR_in);
@@ -874,7 +875,7 @@
 	return iTSpacesOffs;
 }
 
-const SVec3 GetPosition(const SMikkTSpaceContext * pContext, const int index)
+SVec3 GetPosition(const SMikkTSpaceContext * pContext, const int index)
 {
 	int iF, iI;
 	SVec3 res; float pos[3];
@@ -884,7 +885,7 @@
 	return res;
 }
 
-const SVec3 GetNormal(const SMikkTSpaceContext * pContext, const int index)
+SVec3 GetNormal(const SMikkTSpaceContext * pContext, const int index)
 {
 	int iF, iI;
 	SVec3 res; float norm[3];
@@ -894,7 +895,7 @@
 	return res;
 }
 
-const SVec3 GetTexCoord(const SMikkTSpaceContext * pContext, const int index)
+SVec3 GetTexCoord(const SMikkTSpaceContext * pContext, const int index)
 {
 	int iF, iI;
 	SVec3 res; float texc[2];
_______________________________________________
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to