Explorar o código

Merge 0.9.6 branch

Christophe Riccio %!s(int64=11) %!d(string=hai) anos
pai
achega
3226580a36

+ 2 - 1
glm/CMakeLists.txt

@@ -4,6 +4,7 @@ file(GLOB ROOT_SOURCE *.cpp)
 file(GLOB ROOT_INLINE *.inl)
 file(GLOB ROOT_HEADER *.hpp)
 file(GLOB ROOT_TEXT ../*.txt)
+file(GLOB ROOT_NAT ../util/glm.natvis)
 
 file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
 file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
@@ -31,7 +32,7 @@ source_group("GTX Files" FILES ${GTX_HEADER})
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
 
 if(GLM_TEST_ENABLE)
-	add_executable(${NAME} ${ROOT_TEXT}
+	add_executable(${NAME} ${ROOT_TEXT} ${ROOT_NAT}
 		${ROOT_SOURCE}    ${ROOT_INLINE}    ${ROOT_HEADER}
 		${CORE_SOURCE}    ${CORE_INLINE}    ${CORE_HEADER}
 		${GTC_SOURCE}     ${GTC_INLINE}     ${GTC_HEADER}

+ 15 - 5
glm/detail/dummy.cpp

@@ -34,7 +34,8 @@
 ///////////////////////////////////////////////////////////////////////////////////
 
 #define GLM_MESSAGES
-#include "../glm.hpp"
+#include <glm/glm.hpp>
+#include <glm/ext.hpp>
 #include <limits>
 
 struct material
@@ -213,10 +214,19 @@ typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
 
 int main()
 {
-	glm::vec4 v(1);
-	float a = normalizeDotA(v, v);
-	float b = normalizeDotB(v, v);
-	float c = normalizeDotC(v, v);
+	glm::vec1 o(1);
+	glm::vec2 a(1);
+	glm::vec3 b(1);
+	glm::vec4 c(1);
+
+	glm::quat q;
+	glm::dualquat p;
+
+	glm::mat4 m(1);
+
+	float a0 = normalizeDotA(a, a);
+	float b0 = normalizeDotB(b, b);
+	float c0 = normalizeDotC(c, c);
 
 	return 0;
 }

+ 12 - 7
glm/detail/setup.hpp

@@ -632,12 +632,13 @@
 // User defines: GLM_FORCE_PURE GLM_FORCE_SSE2 GLM_FORCE_SSE3 GLM_FORCE_AVX GLM_FORCE_AVX2
 
 #define GLM_ARCH_PURE		0x0000
-#define GLM_ARCH_X86		0x0001
-#define GLM_ARCH_SSE2		0x0002
-#define GLM_ARCH_SSE3		0x0004
-#define GLM_ARCH_SSE4		0x0008
-#define GLM_ARCH_AVX		0x0010
-#define GLM_ARCH_AVX2		0x0020
+#define GLM_ARCH_ARM		0x0001
+#define GLM_ARCH_X86		0x0002
+#define GLM_ARCH_SSE2		0x0004
+#define GLM_ARCH_SSE3		0x0008
+#define GLM_ARCH_SSE4		0x0010
+#define GLM_ARCH_AVX		0x0020
+#define GLM_ARCH_AVX2		0x0040
 
 #if defined(GLM_FORCE_PURE)
 #	define GLM_ARCH GLM_ARCH_PURE
@@ -664,7 +665,9 @@
 #		define GLM_ARCH GLM_ARCH_PURE
 #	endif
 #elif (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS))
-#	if defined(__AVX2__)
+#	if defined(_M_ARM_FP)
+#		define GLM_ARCH (GLM_ARCH_ARM)
+#	elif defined(__AVX2__)
 #		define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
 #	elif defined(__AVX__)
 #		define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
@@ -725,6 +728,8 @@
 #	define GLM_MESSAGE_ARCH_DISPLAYED
 #	if(GLM_ARCH == GLM_ARCH_PURE)
 #		pragma message("GLM: Platform independent code")
+#	elif(GLM_ARCH & GLM_ARCH_ARM)
+#		pragma message("GLM: ARM instruction set")
 #	elif(GLM_ARCH & GLM_ARCH_AVX2)
 #		pragma message("GLM: AVX2 instruction set")
 #	elif(GLM_ARCH & GLM_ARCH_AVX)

+ 1 - 1
glm/detail/type_mat2x3.inl

@@ -432,7 +432,7 @@ namespace glm
 	}
 
 	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat3x2<T, P> const & m2)
+	GLM_FUNC_QUALIFIER tmat4x3<T, P> operator*(tmat2x3<T, P> const & m1, tmat4x2<T, P> const & m2)
 	{
 		return tmat4x3<T, P>(
 			m1[0][0] * m2[0][0] + m1[1][0] * m2[0][1],

+ 3 - 2
glm/detail/type_vec4.hpp

@@ -115,10 +115,11 @@ namespace detail
 #		if GLM_HAS_ANONYMOUS_UNION
 			union
 			{
-				typename detail::simd<T>::type data;
+				struct { T x, y, z, w;};
 				struct { T r, g, b, a; };
 				struct { T s, t, p, q; };
-				struct { T x, y, z, w;};
+
+				typename detail::simd<T>::type data;
 
 #				ifdef GLM_SWIZZLE
 					_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)

+ 0 - 1
glm/gtc/matrix_transform.inl

@@ -218,7 +218,6 @@ namespace glm
 	)
 	{
 		assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
-		assert(zFar > zNear);
 
 		T const tanHalfFovy = tan(fovy / static_cast<T>(2));
 

+ 7 - 7
glm/gtc/packing.inl

@@ -144,14 +144,14 @@ namespace detail
 	GLM_FUNC_QUALIFIER glm::uint floatTo11bit(float x)
 	{
 		if(x == 0.0f)
-			return 0;
+			return 0u;
 		else if(glm::isnan(x))
-			return ~0;
+			return ~0u;
 		else if(glm::isinf(x))
-			return 0x1f << 6;
+			return 0x1Fu << 6u;
 
 #		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
-			uint Pack = 0;
+			uint Pack = 0u;
 			memcpy(&Pack, &x, sizeof(Pack));
 #		else	
 			uint Pack = reinterpret_cast<uint&>(x);
@@ -183,11 +183,11 @@ namespace detail
 	GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x)
 	{
 		if(x == 0.0f)
-			return 0;
+			return 0u;
 		else if(glm::isnan(x))
-			return ~0;
+			return ~0u;
 		else if(glm::isinf(x))
-			return 0x1f << 5;
+			return 0x1Fu << 5u;
 
 #		if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
 			uint Pack = 0;

+ 8 - 7
glm/gtx/matrix_decompose.inl

@@ -125,31 +125,32 @@ namespace glm
 
 		// Now get scale and shear.
 		for(length_t i = 0; i < 3; ++i)
-			Row[i] = LocalMatrix[i];
+			for(int j = 0; j < 3; ++j)
+				Row[i][j] = LocalMatrix[i][j];
 
 		// Compute X scale factor and normalize first row.
 		Scale.x = length(Row[0]);// v3Length(Row[0]);
 
-		v3Scale(Row[0], 1.0);
+		v3Scale(Row[0], static_cast<T>(1));
 
 		// Compute XY shear factor and make 2nd row orthogonal to 1st.
 		Skew.z = dot(Row[0], Row[1]);
-		Row[1] = combine(Row[1], Row[0], 1.0, -Skew.z);
+		Row[1] = combine(Row[1], Row[0], static_cast<T>(1), -Skew.z);
 
 		// Now, compute Y scale and normalize 2nd row.
 		Scale.y = length(Row[1]);
-		v3Scale(Row[1], 1.0);
+		v3Scale(Row[1], static_cast<T>(1));
 		Skew.z /= Scale.y;
 
 		// Compute XZ and YZ shears, orthogonalize 3rd row.
 		Skew.y = glm::dot(Row[0], Row[2]);
-		Row[2] = combine(Row[2], Row[0], 1.0, -Skew.y);
+		Row[2] = combine(Row[2], Row[0], static_cast<T>(1), -Skew.y);
 		Skew.x = glm::dot(Row[1], Row[2]);
-		Row[2] = combine(Row[2], Row[1], 1.0, -Skew.x);
+		Row[2] = combine(Row[2], Row[1], static_cast<T>(1), -Skew.x);
 
 		// Next, get Z scale and normalize 3rd row.
 		Scale.z = length(Row[2]);
-		v3Scale(Row[2], 1.0);
+		v3Scale(Row[2], static_cast<T>(1));
 		Skew.y /= Scale.z;
 		Skew.x /= Scale.z;
 

+ 14 - 0
readme.txt

@@ -62,15 +62,29 @@ GLM is a header only library, there is nothing to build, just include it.
 More informations in GLM manual:
 http://glm.g-truc.net/glm.pdf
 
+================================================================================
+GLM 0.9.7.0: 2015-XX-XX
+--------------------------------------------------------------------------------
+
+
 ================================================================================
 GLM 0.9.6.2: 2015-01-XX
 --------------------------------------------------------------------------------
 Features:
 - Added display of GLM version with other GLM_MESSAGES
+- Added ARM instruction set detection
+
+Improvements:
+- Removed assert for perspective with zFar < zNear #298
+- Added Visual Studio natvis support for vec1, quat and dualqual types
 
 Fixes:
 - Fixed faceforward build #289
 - Fixed conflict with Xlib #define True 1 #293
+- Fixed decompose function VS2010 templating issues #294
+- Fixed mat4x3 = mat2x3 * mat4x2 operator #297
+- Fixed warnings in F2x11_1x10 packing function in GTC_packing #295
+- Fixed Visual Studio natvis support for vec4 #288
 
 ================================================================================
 GLM 0.9.6.1: 2014-12-10

+ 2 - 0
test/core/core_setup_message.cpp

@@ -176,6 +176,8 @@ int test_instruction_set()
 
 	if(GLM_ARCH == GLM_ARCH_PURE)
 		std::printf("GLM_ARCH_PURE ");
+	if(GLM_ARCH & GLM_ARCH_ARM)
+		std::printf("GLM_ARCH_ARM ");
 	if(GLM_ARCH & GLM_ARCH_AVX2)
 		std::printf("GLM_ARCH_AVX2 ");
 	if(GLM_ARCH & GLM_ARCH_AVX)

+ 48 - 10
util/glm.natvis

@@ -4,28 +4,66 @@
 <!-- Put them into My Documents/Visual Studio 2012/Visualizers/ -->
 
 <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
-    <Type Name="glm::detail::tvec2&lt;*&gt;">
-        <DisplayString>({x}, {y})</DisplayString>
+	<Type Name="glm::tvec1&lt;*&gt;">
+		<DisplayString>{x}</DisplayString>
+		<Expand>
+			<Item Name="x">x</Item>
+		</Expand>
+	</Type>
+
+	<Type Name="glm::tvec2&lt;*&gt;">
+		<DisplayString>{x}, {y}</DisplayString>
+		<Expand>
+			<Item Name="x">x</Item>
+			<Item Name="y">y</Item>
+		</Expand>
+	</Type>
+
+	<Type Name="glm::tvec3&lt;*&gt;">
+		<DisplayString>{x}, {y}, {z}</DisplayString>
 		<Expand>
 			<Item Name="x">x</Item>
 			<Item Name="y">y</Item>
+			<Item Name="z">z</Item>
 		</Expand>
-    </Type>
-    <Type Name="glm::detail::tvec3&lt;*&gt;">
-        <DisplayString>({x}, {y}, {z})</DisplayString>
+	</Type>
+
+	<Type Name="glm::tvec4&lt;*&gt;">
+		<DisplayString>{x}, {y}, {z}, {w}</DisplayString>
 		<Expand>
 			<Item Name="x">x</Item>
 			<Item Name="y">y</Item>
 			<Item Name="z">z</Item>
+			<Item Name="w">w</Item>
+		</Expand>
+	</Type>
+
+	<!--Type Name="glm::tmat4&lt;*&gt;">
+		<DisplayString>{value[0]}, {value[1]}, {value[2]}, {value[3]}</DisplayString>
+		<Expand>
+			<Item Name="[0]">value[0]</Item>
+			<Item Name="[1]">value[1]</Item>
+			<Item Name="[2]">value[2]</Item>
+			<Item Name="[3]">value[3]</Item>
 		</Expand>
-    </Type>
-    <Type Name="glm::detail::tvec4&lt;*&gt;">
-        <DisplayString>({x}, {y}, {z}, {w})</DisplayString>
+	</Type-->
+
+	<Type Name="glm::tquat&lt;*&gt;">
+		<DisplayString>({x}, {y}, {z}), {w}</DisplayString>
 		<Expand>
 			<Item Name="x">x</Item>
 			<Item Name="y">y</Item>
 			<Item Name="z">z</Item>
 			<Item Name="w">w</Item>
 		</Expand>
-    </Type>
-</AutoVisualizer>
+	</Type>
+
+	<Type Name="glm::tdualquat&lt;*&gt;">
+		<DisplayString>(({real.x}, {real.y}, {real.z}), {real.w}), (({dual.x}, {dual.y}, {dual.z}), {dual.w})</DisplayString>
+		<Expand>
+			<Item Name="real">real</Item>
+			<Item Name="dual">dual</Item>
+		</Expand>
+	</Type>
+</AutoVisualizer>
+