Explorar o código

Fixed Visual Studio natvis support for vec4 #288, Added Visual Studio natvis support for vec1, quat and dualqual types

Christophe Riccio %!s(int64=11) %!d(string=hai) anos
pai
achega
1e0825028e
Modificáronse 5 ficheiros con 71 adicións e 19 borrados
  1. 2 1
      glm/CMakeLists.txt
  2. 15 5
      glm/detail/dummy.cpp
  3. 3 2
      glm/detail/type_vec4.hpp
  4. 3 1
      readme.txt
  5. 48 10
      util/glm.natvis

+ 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;
 }

+ 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)

+ 3 - 1
readme.txt

@@ -71,12 +71,14 @@ Features:
 
 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 decompose function VS2010 templating issues #294
 - Fixed mat4x3 = mat2x3 * mat4x2 operator #297
-- Fixed warnings in F2x11_1x10 pcking function in GTC_packing #295
+- 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

+ 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>
+