Browse Source

Updated GLM manual with per feature headers. Fixed io.

Christophe Riccio 12 năm trước cách đây
mục cha
commit
fd256dfaa8
8 tập tin đã thay đổi với 24 bổ sung76 xóa
  1. BIN
      doc/glm.docx
  2. BIN
      doc/~$glm.docx
  3. 5 3
      glm/detail/func_matrix.hpp
  4. 5 12
      glm/gtx/io.hpp
  5. 10 55
      glm/gtx/io.inl
  6. 0 1
      glm/gtx/string_cast.inl
  7. 4 3
      readme.txt
  8. 0 2
      test/gtx/gtx_simd_vec4.cpp

BIN
doc/glm.docx


BIN
doc/~$glm.docx


+ 5 - 3
glm/detail/func_matrix.hpp

@@ -77,9 +77,11 @@ namespace glm
 	/// @tparam matType Floating-point matrix types.
 	///
 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
-	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>	
-	template <typename T, precision P, template <typename, precision> class matType>
-	GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
+#	if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))
+		template <typename T, precision P, template <typename, precision> class matType>
+		GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
+#	endif
 	
 	/// Return the determinant of a squared matrix.
 	/// 

+ 5 - 12
glm/gtx/io.hpp

@@ -40,8 +40,8 @@
 #define GLM_GTX_io
 
 // Dependency:
-#include "../glm.hpp"
-#include "../gtx/quaternion.hpp"
+#include "../detail/setup.hpp"
+#include "../gtc/quaternion.hpp"
 
 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
 #	pragma message("GLM: GLM_GTX_io extension included")
@@ -114,7 +114,6 @@ namespace glm
 
   namespace detail
   {
-
     template <typename CTy, typename CTr, typename T, precision P>
     GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tquat<T,P> const&);
     template <typename CTy, typename CTr, typename T, precision P>
@@ -141,15 +140,9 @@ namespace glm
     GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x3<T,P> const&);
     template <typename CTy, typename CTr, typename T, precision P>
     GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&, tmat4x4<T,P> const&);
-    
-    template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_DECL std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>&,
-                                                          std::pair<tmat4x4<T,P> const,
-                                                                    tmat4x4<T,P> const> const&);
-    
-  }//namespace detail
-  
-	/// @}
+
+	/// @}  
+}//namespace detail
 }//namespace glm
 
 #include "io.inl"

+ 10 - 55
glm/gtx/io.inl

@@ -7,6 +7,7 @@
 // File    : glm/gtx/inl.inl
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
+#include "../matrix.hpp"
 // #include <boost/io/ios_state.hpp> // boost::io::ios_all_saver
 #include <iomanip>                // std::setfill<>, std::fixed, std::setprecision, std::right,
                                   // std::setw
@@ -180,16 +181,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x2<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x2<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat2x2<T,P> m(a);
-
-        if (io::format_guard::row_major == io::order()) {
-          m = transpose(a);
-        }
         
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -200,12 +196,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x3<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x3<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat2x3<T,P> m(a);
 
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -216,12 +211,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x4<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat2x4<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat2x4<T,P> m(a);
 
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -232,12 +226,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x2<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x2<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat3x2<T,P> m(a);
 
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -249,16 +242,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x3<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x3<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat3x3<T,P> m(a);
-
-        if (io::format_guard::row_major == io::order()) {
-          m = transpose(a);
-        }
 
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -270,12 +258,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x4<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat3x4<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat3x4<T,P> m(a);
 
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -287,12 +274,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x2<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x2<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat4x2<T,P> m(a);
 
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -305,12 +291,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x3<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x3<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat4x3<T,P> m(a);
 
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -323,16 +308,11 @@ namespace detail
     }
 
     template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& a)
+    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& operator<<(std::basic_ostream<CTy,CTr>& os, tmat4x4<T,P> const& m)
     {
       typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
 
       if (cerberus) {
-        tmat4x4<T,P> m(a);
-
-        if (io::format_guard::row_major == io::order()) {
-          m = transpose(a);
-        }
 
         os << io::cr()
            << '[' << m[0] << io::cr()
@@ -344,30 +324,5 @@ namespace detail
       return os;
     }
 
-    template <typename CTy, typename CTr, typename T, precision P>
-    GLM_FUNC_QUALIFIER std::basic_ostream<CTy,CTr>& 
-    operator<<(std::basic_ostream<CTy,CTr>& os,
-               std::pair<tmat4x4<T,P> const, tmat4x4<T,P> const> const& a)
-    {
-      typename std::basic_ostream<CTy,CTr>::sentry const cerberus(os);
-
-      if (cerberus) {
-        tmat4x4<T,P> ml(a.first);
-        tmat4x4<T,P> mr(a.second);
-
-        if (io::format_guard::row_major == io::order()) {
-          ml = transpose(a.first);
-          mr = transpose(a.second);
-        }
-        
-        os << io::cr()
-           << '[' << ml[0] << "  [" << mr[0] << io::cr()
-           << ' ' << ml[1] << "   " << mr[1] << io::cr()
-           << ' ' << ml[2] << "   " << mr[2] << io::cr()
-           << ' ' << ml[3] << "]  " << mr[3] << ']';
-      }
-
-      return os;
-    }
 }//namespace detail
 }//namespace glm

+ 0 - 1
glm/gtx/string_cast.inl

@@ -23,7 +23,6 @@ namespace detail
 			return std::string();
 
 		va_start(list, msg);
-
 #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC8))
 			vsprintf_s(text, STRING_BUFFER, msg, list);
 #else//

+ 4 - 3
readme.txt

@@ -41,6 +41,7 @@ GLM 0.9.5.0: 2013-12-25
 --------------------------------------------------------------------------------
 - Added forward declarations (glm/fwd.hpp) for faster compilations
 - Added per feature headers
+- Minimized GLM internal dependencies
 - Improved Intel Compiler detection
 - Added bitfieldInterleave and _mm_bit_interleave_si128 functions
 - Added GTX_scalar_relational
@@ -53,8 +54,8 @@ GLM 0.9.5.0: 2013-12-25
 - Fixed post increment and decrement operators
 - Fixed perspective with zNear == 0 (#71)
 - Removed l-value swizzle operators
-- Clean up compiler detection code for unsupported compilers
-- Uses C++ casts
+- Cleaned up compiler detection code for unsupported compilers
+- Replaced C cast by C++ casts
 - Fixed .length() that should return a int and not a size_t
 - Added GLM_FORCE_SIZE_T_LENGTH and glm::length_t
 - Removed unnecessary conversions
@@ -73,7 +74,7 @@ GLM 0.9.5.0: 2013-12-25
 - Fixed CUDA coverage for GTC extensions
 - Added GTX_io extension
 - Improved GLM messages enabled when defining GLM_MESSAGES
-- Implementation detail _inverse is now private
+- Hidden matrix _inverse function implementation detail into private section
 
 ================================================================================
 GLM 0.9.4.6: 2013-09-20

+ 0 - 2
test/gtx/gtx_simd_vec4.cpp

@@ -34,8 +34,6 @@ int main()
 
 	glm::simdVec4 GNI(add0);
 
-	printf("%f\n", GNI.Data /* .m128_f32 */);
-
 	return 0;
 }