Browse Source

Added GLM_GTX_int_10_10_10_2

Christophe Riccio 15 years ago
parent
commit
2fb86e9b77
2 changed files with 67 additions and 0 deletions
  1. 39 0
      glm/gtx/int_10_10_10_2.hpp
  2. 28 0
      glm/gtx/int_10_10_10_2.inl

+ 39 - 0
glm/gtx/int_10_10_10_2.hpp

@@ -0,0 +1,39 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2010-07-07
+// Updated : 2010-07-07
+// Licence : This source is under MIT License
+// File    : glm/gtx/int_10_10_10_2.hpp
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Dependency:
+// - GLM core
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef glm_gtx_int_10_10_10_2
+#define glm_gtx_int_10_10_10_2
+
+// Dependency:
+#include "../glm.hpp"
+
+namespace glm
+{
+	namespace gtx{
+	//! GLM_GTX_int_10_10_10_2 extension: Add support for integer for core functions
+	namespace int_10_10_10_2
+	{
+		//! From GLM_GTX_int_10_10_10_2 extension.
+		int int10_10_10_2_cast(glm::vec4 const & v);
+
+		//! From GLM_GTX_int_10_10_10_2 extension.
+		uint uint10_10_10_2_cast(glm::vec4 const & v);
+
+	}//namespace integer
+	}//namespace gtx
+}//namespace glm
+
+#include "int_10_10_10_2.inl"
+
+namespace glm{using namespace gtx::int_10_10_10_2;}
+
+#endif//glm_gtx_int_10_10_10_2

+ 28 - 0
glm/gtx/int_10_10_10_2.inl

@@ -0,0 +1,28 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Created : 2010-07-07
+// Updated : 2010-07-07
+// Licence : This source is under MIT License
+// File    : glm/gtx/int_10_10_10_2.inl
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace glm{
+namespace gtx{
+namespace int_10_10_10_2
+{
+	//! From GLM_GTX_int_10_10_10_2 extension.
+	int int10_10_10_2_cast(glm::vec4 const & v)
+	{
+		return int(v.x * 2047.f) << 0 | int(v.y * 2047.f) << 10 | int(v.z * 2047.f) << 20 | int(v.w * 3.f) << 30;
+	}
+
+	//! From GLM_GTX_int_10_10_10_2 extension.
+	uint uint10_10_10_2_cast(glm::vec4 const & v)
+	{
+		return uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30;
+	}
+
+}//namespace int_10_10_10_2
+}//namespace gtx
+}//namespace glm