Browse Source

Improved half implementation

Christophe Riccio 14 years ago
parent
commit
16bcc4444f

+ 1 - 1
glm/core/func_common.inl

@@ -158,7 +158,7 @@ namespace detail
     template <>
     template <>
 	GLM_FUNC_QUALIFIER detail::thalf floor<detail::thalf>(detail::thalf const& x)
 	GLM_FUNC_QUALIFIER detail::thalf floor<detail::thalf>(detail::thalf const& x)
     {
     {
-        return detail::thalf(::std::floor(float(x)));
+        return detail::thalf(::std::floor(x.toFloat()));
     }
     }
 
 
     template <typename genType>
     template <typename genType>

+ 25 - 1
glm/core/type_half.hpp

@@ -53,7 +53,7 @@ namespace detail
 
 
 		// Cast
 		// Cast
 		//operator float();
 		//operator float();
-		GLM_FUNC_DECL operator float() const;
+		//GLM_FUNC_DECL operator float() const;
 		//operator double();
 		//operator double();
 		//operator double() const;
 		//operator double() const;
 
 
@@ -89,6 +89,30 @@ namespace detail
 
 
 	thalf operator++ (thalf const & s, int);
 	thalf operator++ (thalf const & s, int);
 
 
+	bool operator==(
+		detail::thalf const & x, 
+		detail::thalf const & y);
+
+	bool operator!=(
+		detail::thalf const & x, 
+		detail::thalf const & y);
+
+	bool operator<(
+		detail::thalf const & x, 
+		detail::thalf const & y);
+
+	bool operator<=(
+		detail::thalf const & x, 
+		detail::thalf const & y);
+
+	bool operator>(
+		detail::thalf const & x, 
+		detail::thalf const & y);
+
+	bool operator>=(
+		detail::thalf const & x, 
+		detail::thalf const & y);
+
 }//namespace detail
 }//namespace detail
 }//namespace glm
 }//namespace glm
 
 

+ 68 - 12
glm/core/type_half.inl

@@ -250,7 +250,9 @@ namespace detail
 			// Assemble the half from s, e and m.
 			// Assemble the half from s, e and m.
 			//
 			//
 
 
-			return hdata(s | (e << 10) | (m >> 13));
+			hdata Hdata(s | (e << 10) | (m >> 13));
+
+			return Hdata;
 		}
 		}
 	}
 	}
 
 
@@ -273,10 +275,10 @@ namespace detail
 	//	return toFloat();
 	//	return toFloat();
 	//}
 	//}
 
 
-	GLM_FUNC_QUALIFIER thalf::operator float() const 
-	{
-		return toFloat32(this->data);
-	}
+	//GLM_FUNC_QUALIFIER thalf::operator float() const 
+	//{
+	//	return toFloat32(this->data);
+	//}
 
 
 	//GLM_FUNC_QUALIFIER half::operator double()
 	//GLM_FUNC_QUALIFIER half::operator double()
 	//{
 	//{
@@ -338,38 +340,92 @@ namespace detail
 
 
 	GLM_FUNC_QUALIFIER detail::thalf operator+ (detail::thalf const & s1, detail::thalf const & s2)
 	GLM_FUNC_QUALIFIER detail::thalf operator+ (detail::thalf const & s1, detail::thalf const & s2)
 	{
 	{
-		return detail::thalf(float(s1) + float(s2));
+		return detail::thalf(s1.toFloat() + s2.toFloat());
 	}
 	}
 
 
 	GLM_FUNC_QUALIFIER detail::thalf operator- (detail::thalf const & s1, detail::thalf const & s2)
 	GLM_FUNC_QUALIFIER detail::thalf operator- (detail::thalf const & s1, detail::thalf const & s2)
 	{
 	{
-		return detail::thalf(float(s1) - float(s2));
+		return detail::thalf(s1.toFloat() - s2.toFloat());
 	}
 	}
 
 
 	GLM_FUNC_QUALIFIER detail::thalf operator* (detail::thalf const & s1, detail::thalf const & s2)
 	GLM_FUNC_QUALIFIER detail::thalf operator* (detail::thalf const & s1, detail::thalf const & s2)
 	{
 	{
-		return detail::thalf(float(s1) * float(s2));
+		return detail::thalf(s1.toFloat() * s2.toFloat());
 	}
 	}
 
 
 	GLM_FUNC_QUALIFIER detail::thalf operator/ (detail::thalf const & s1, detail::thalf const & s2)
 	GLM_FUNC_QUALIFIER detail::thalf operator/ (detail::thalf const & s1, detail::thalf const & s2)
 	{
 	{
-		return detail::thalf(float(s1) / float(s2));
+		return detail::thalf(s1.toFloat() / s2.toFloat());
 	}
 	}
 
 
 	// Unary constant operators
 	// Unary constant operators
 	GLM_FUNC_QUALIFIER detail::thalf operator- (detail::thalf const & s)
 	GLM_FUNC_QUALIFIER detail::thalf operator- (detail::thalf const & s)
 	{
 	{
-		return detail::thalf(-float(s));
+		return detail::thalf(-s.toFloat());
 	}
 	}
 
 
 	GLM_FUNC_QUALIFIER detail::thalf operator-- (detail::thalf const & s, int)
 	GLM_FUNC_QUALIFIER detail::thalf operator-- (detail::thalf const & s, int)
 	{
 	{
-		return detail::thalf(float(s) - 1.0f);
+		return detail::thalf(s.toFloat() - 1.0f);
 	}
 	}
 
 
 	GLM_FUNC_QUALIFIER detail::thalf operator++ (detail::thalf const & s, int)
 	GLM_FUNC_QUALIFIER detail::thalf operator++ (detail::thalf const & s, int)
 	{
 	{
-		return detail::thalf(float(s) + 1.0f);
+		return detail::thalf(s.toFloat() + 1.0f);
+	}
+
+	GLM_FUNC_QUALIFIER bool operator==
+	(
+		detail::thalf const & x, 
+		detail::thalf const & y
+	)
+	{
+		return x._data() == y._data();
+	}
+
+	GLM_FUNC_QUALIFIER bool operator!=
+	(
+		detail::thalf const & x, 
+		detail::thalf const & y
+	)
+	{
+		return x._data() != y._data();
+	}
+
+	GLM_FUNC_QUALIFIER bool operator<
+	(
+		detail::thalf const & x, 
+		detail::thalf const & y
+	)
+	{
+		return x.toFloat() < y.toFloat();
+	}
+
+	GLM_FUNC_QUALIFIER bool operator<=
+	(
+		detail::thalf const & x, 
+		detail::thalf const & y
+	)
+	{
+		return x.toFloat() <= y.toFloat();
+	}
+
+	GLM_FUNC_QUALIFIER bool operator>
+	(
+		detail::thalf const & x, 
+		detail::thalf const & y
+	)
+	{
+		return x.toFloat() > y.toFloat();
+	}
+
+	GLM_FUNC_QUALIFIER bool operator>=
+	(
+		detail::thalf const & x, 
+		detail::thalf const & y
+	)
+	{
+		return x.toFloat() >= y.toFloat();
 	}
 	}
 
 
 }//namespace detail
 }//namespace detail

+ 4 - 4
glm/core/type_vec2.inl

@@ -142,11 +142,11 @@ namespace detail
 	template <typename U, typename V> 
 	template <typename U, typename V> 
 	GLM_FUNC_QUALIFIER tvec2<T>::tvec2
 	GLM_FUNC_QUALIFIER tvec2<T>::tvec2
 	(
 	(
-		U const & x, 
-		V const & y
+		U const & a, 
+		V const & b
 	) :
 	) :
-		x(value_type(x)),
-		y(value_type(y))
+		x(value_type(a)),
+		y(value_type(b))
 	{}
 	{}
 
 
 	//////////////////////////////////////
 	//////////////////////////////////////

+ 1 - 1
glm/gtc/half_float.hpp

@@ -47,7 +47,7 @@
 namespace glm{
 namespace glm{
 namespace detail
 namespace detail
 {
 {
-#ifndef _MSC_EXTENSIONS
+#if 1 //ndef _MSC_EXTENSIONS
 	template <>
 	template <>
 	struct tvec2<thalf>
 	struct tvec2<thalf>
 	{
 	{

+ 1 - 1
glm/gtc/half_float.inl

@@ -29,7 +29,7 @@
 namespace glm{
 namespace glm{
 namespace detail{
 namespace detail{
 
 
-#ifndef _MSC_EXTENSIONS
+#if 1 //ndef _MSC_EXTENSIONS
 
 
 //////////////////////////////////////
 //////////////////////////////////////
 // hvec2
 // hvec2

+ 13 - 7
glm/gtx/multiple.inl

@@ -29,12 +29,15 @@ GLM_FUNC_QUALIFIER genType higherMultiple
 template <> 
 template <> 
 GLM_FUNC_QUALIFIER detail::thalf higherMultiple
 GLM_FUNC_QUALIFIER detail::thalf higherMultiple
 (
 (
-	detail::thalf const & Source, 
-	detail::thalf const & Multiple
+	detail::thalf const & SourceH, 
+	detail::thalf const & MultipleH
 )
 )
 {
 {
-	int Tmp = int(float(Source)) % int(float(Multiple));
-	return Tmp ? Source + Multiple - detail::thalf(float(Tmp)) : Source;
+	float Source = SourceH.toFloat();
+	float Multiple = MultipleH.toFloat();
+
+	int Tmp = int(float(Source)) % int();
+	return detail::thalf(Tmp ? Source + Multiple - float(Tmp) : Source);
 }
 }
 
 
 template <> 
 template <> 
@@ -115,12 +118,15 @@ GLM_FUNC_QUALIFIER genType lowerMultiple
 template <> 
 template <> 
 GLM_FUNC_QUALIFIER detail::thalf lowerMultiple
 GLM_FUNC_QUALIFIER detail::thalf lowerMultiple
 (
 (
-	detail::thalf const & Source, 
-	detail::thalf const & Multiple
+	detail::thalf const & SourceH, 
+	detail::thalf const & MultipleH
 )
 )
 {
 {
+	float Source = SourceH.toFloat();
+	float Multiple = MultipleH.toFloat();
+
 	int Tmp = int(float(Source)) % int(float(Multiple));
 	int Tmp = int(float(Source)) % int(float(Multiple));
-	return Tmp ? Source - detail::thalf(float(Tmp)) : Source;
+	return detail::thalf(Tmp ? Source - float(Tmp) : Source);
 }
 }
 
 
 template <> 
 template <> 

+ 39 - 48
glm/gtx/string_cast.inl

@@ -43,7 +43,7 @@ namespace detail
 
 
 	GLM_FUNC_QUALIFIER std::string to_string(detail::thalf const & x)
 	GLM_FUNC_QUALIFIER std::string to_string(detail::thalf const & x)
 	{
 	{
-		return detail::format("half(%2.4f)", float(x));
+		return detail::format("half(%2.4f)", x.toFloat());
 	}
 	}
 
 
 	GLM_FUNC_QUALIFIER std::string to_string(float x)
 	GLM_FUNC_QUALIFIER std::string to_string(float x)
@@ -111,7 +111,7 @@ namespace detail
 		detail::tvec2<detail::thalf> const & v
 		detail::tvec2<detail::thalf> const & v
 	)
 	)
 	{
 	{
-		return detail::format("hvec2(%2.4f, %2.4f)", float(v.x), float(v.y));
+		return detail::format("hvec2(%2.4f, %2.4f)", v.x.toFloat(), v.y.toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
@@ -120,7 +120,7 @@ namespace detail
 		detail::tvec3<detail::thalf> const & v
 		detail::tvec3<detail::thalf> const & v
 	)
 	)
 	{
 	{
-		return detail::format("hvec3(%2.4f, %2.4f, %2.4f)", float(v.x), float(v.y), float(v.z));
+		return detail::format("hvec3(%2.4f, %2.4f, %2.4f)", v.x.toFloat(), v.y.toFloat(), v.z.toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
@@ -129,7 +129,7 @@ namespace detail
 		detail::tvec4<detail::thalf> const & v
 		detail::tvec4<detail::thalf> const & v
 	)
 	)
 	{
 	{
-		return detail::format("hvec4(%2.4f, %2.4f, %2.4f, %2.4f)", float(v.x), float(v.y), float(v.z), float(v.w));
+		return detail::format("hvec4(%2.4f, %2.4f, %2.4f, %2.4f)", v.x.toFloat(), v.y.toFloat(), v.z.toFloat(), v.w.toFloat());
 	}
 	}
 
 
 	////////////////////////////////
 	////////////////////////////////
@@ -261,115 +261,106 @@ namespace detail
 		detail::tmat2x2<detail::thalf> const & m
 		detail::tmat2x2<detail::thalf> const & m
 	)
 	)
 	{
 	{
-		detail::tmat2x2<float> x(m);
 		return detail::format("hmat2x2((%f, %f), (%f, %f))", 
 		return detail::format("hmat2x2((%f, %f), (%f, %f))", 
-			x[0][0], x[0][1], 
-			x[1][0], x[1][1]);
+			m[0][0].toFloat(), m[0][1].toFloat(), 
+			m[1][0].toFloat(), m[1][1].toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
 	GLM_FUNC_QUALIFIER std::string to_string
 	GLM_FUNC_QUALIFIER std::string to_string
 	(
 	(
-		detail::tmat2x3<detail::thalf> const & m
+		detail::tmat2x3<detail::thalf> const & x
 	)
 	)
 	{
 	{
-		detail::tmat2x3<float> x(m);
 		return detail::format("hmat2x3((%f, %f, %f), (%f, %f, %f))", 
 		return detail::format("hmat2x3((%f, %f, %f), (%f, %f, %f))", 
-			x[0][0], x[0][1], x[0][2], 
-			x[1][0], x[1][1], x[1][2]);
+			x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), 
+			x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
 	GLM_FUNC_QUALIFIER std::string to_string
 	GLM_FUNC_QUALIFIER std::string to_string
 	(
 	(
-		detail::tmat2x4<detail::thalf> const & m
+		detail::tmat2x4<detail::thalf> const & x
 	)
 	)
 	{
 	{
-		detail::tmat2x4<float> x(m);
 		return detail::format("hmat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))", 
 		return detail::format("hmat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))", 
-			x[0][0], x[0][1], x[0][2], x[0][3], 
-			x[1][0], x[1][1], x[1][2], x[1][3]);
+			x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), x[0][3].toFloat(), 
+			x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), x[1][3].toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
 	GLM_FUNC_QUALIFIER std::string to_string
 	GLM_FUNC_QUALIFIER std::string to_string
 	(
 	(
-		detail::tmat3x2<detail::thalf> const & m
+		detail::tmat3x2<detail::thalf> const & x
 	)
 	)
 	{
 	{
-		detail::tmat3x2<float> x(m);
 		return detail::format("hmat3x2((%f, %f), (%f, %f), (%f, %f))", 
 		return detail::format("hmat3x2((%f, %f), (%f, %f), (%f, %f))", 
-			x[0][0], x[0][1], 
-			x[1][0], x[1][1], 
-			x[2][0], x[2][1]);
+			x[0][0].toFloat(), x[0][1].toFloat(), 
+			x[1][0].toFloat(), x[1][1].toFloat(), 
+			x[2][0].toFloat(), x[2][1].toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
 	GLM_FUNC_QUALIFIER std::string to_string
 	GLM_FUNC_QUALIFIER std::string to_string
 	(
 	(
-		detail::tmat3x3<detail::thalf> const & m
+		detail::tmat3x3<detail::thalf> const & x
 	)
 	)
 	{
 	{
-		detail::tmat3x3<float> x(m);
 		return detail::format("hmat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", 
 		return detail::format("hmat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", 
-			x[0][0], x[0][1], x[0][2], 
-			x[1][0], x[1][1], x[1][2],
-			x[2][0], x[2][1], x[2][2]);
+			x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), 
+			x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(),
+			x[2][0].toFloat(), x[2][1].toFloat(), x[2][2].toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
 	GLM_FUNC_QUALIFIER std::string to_string
 	GLM_FUNC_QUALIFIER std::string to_string
 	(
 	(
-		detail::tmat3x4<detail::thalf> const & m
+		detail::tmat3x4<detail::thalf> const & x
 	)
 	)
 	{
 	{
-		detail::tmat3x4<float> x(m);
 		return detail::format("hmat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", 
 		return detail::format("hmat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", 
-			x[0][0], x[0][1], x[0][2], x[0][3], 
-			x[1][0], x[1][1], x[1][2], x[1][3], 
-			x[2][0], x[2][1], x[2][2], x[2][3]);
+			x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), x[0][3].toFloat(), 
+			x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), x[1][3].toFloat(), 
+			x[2][0].toFloat(), x[2][1].toFloat(), x[2][2].toFloat(), x[2][3].toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
 	GLM_FUNC_QUALIFIER std::string to_string
 	GLM_FUNC_QUALIFIER std::string to_string
 	(
 	(
-		detail::tmat4x2<detail::thalf> const & m
+		detail::tmat4x2<detail::thalf> const & x
 	)
 	)
 	{
 	{
-		detail::tmat4x2<float> x(m);
 		return detail::format("hmat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))", 
 		return detail::format("hmat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))", 
-			x[0][0], x[0][1], 
-			x[1][0], x[1][1], 
-			x[2][0], x[2][1], 
-			x[3][0], x[3][1]);
+			x[0][0].toFloat(), x[0][1].toFloat(), 
+			x[1][0].toFloat(), x[1][1].toFloat(), 
+			x[2][0].toFloat(), x[2][1].toFloat(), 
+			x[3][0].toFloat(), x[3][1].toFloat());
 	}
 	}
 
 
 	template <> 
 	template <> 
 	GLM_FUNC_QUALIFIER std::string to_string
 	GLM_FUNC_QUALIFIER std::string to_string
 	(
 	(
-		detail::tmat4x3<detail::thalf> const & m
+		detail::tmat4x3<detail::thalf> const & x
 	)
 	)
 	{
 	{
-		detail::tmat4x3<float> x(m);
 		return detail::format("hmat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", 
 		return detail::format("hmat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", 
-			x[0][0], x[0][1], x[0][2],
-			x[1][0], x[1][1], x[1][2], 
-			x[2][0], x[2][1], x[2][2],
-			x[3][0], x[3][1], x[3][2]);
+			x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(),
+			x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), 
+			x[2][0].toFloat(), x[2][1].toFloat(), x[2][2].toFloat(),
+			x[3][0].toFloat(), x[3][1].toFloat(), x[3][2].toFloat());
 	}
 	}
 
 
 	template <>
 	template <>
 	GLM_FUNC_QUALIFIER std::string to_string
 	GLM_FUNC_QUALIFIER std::string to_string
 	(
 	(
-		detail::tmat4x4<detail::thalf> const & m
+		detail::tmat4x4<detail::thalf> const & x
 	)
 	)
 	{
 	{
-		detail::tmat4x4<float> x(m);
 		return detail::format("hmat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", 
 		return detail::format("hmat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", 
-			x[0][0], x[0][1], x[0][2], x[0][3],
-			x[1][0], x[1][1], x[1][2], x[1][3],
-			x[2][0], x[2][1], x[2][2], x[2][3],
-			x[3][0], x[3][1], x[3][2], x[3][3]);
+			x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), x[0][3].toFloat(),
+			x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), x[1][3].toFloat(),
+			x[2][0].toFloat(), x[2][1].toFloat(), x[2][2].toFloat(), x[2][3].toFloat(),
+			x[3][0].toFloat(), x[3][1].toFloat(), x[3][2].toFloat(), x[3][3].toFloat());
 	}
 	}
 
 
 	////////////////////////////////
 	////////////////////////////////

+ 21 - 6
test/core/core_func_packing.cpp

@@ -16,12 +16,17 @@
 int test_packUnorm2x16()
 int test_packUnorm2x16()
 {
 {
 	int Error = 0;
 	int Error = 0;
-	
+/*	
 	std::vector<glm::hvec2> A;
 	std::vector<glm::hvec2> A;
 	A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 0.0f)));
 	A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 0.0f)));
 	A.push_back(glm::hvec2(glm::half( 0.5f), glm::half( 0.7f)));
 	A.push_back(glm::hvec2(glm::half( 0.5f), glm::half( 0.7f)));
 	A.push_back(glm::hvec2(glm::half( 0.1f), glm::half( 0.2f)));
 	A.push_back(glm::hvec2(glm::half( 0.1f), glm::half( 0.2f)));
-	
+*/
+	std::vector<glm::vec2> A;
+	A.push_back(glm::vec2(1.0f, 0.0f));
+	A.push_back(glm::vec2(0.5f, 0.7f));
+	A.push_back(glm::vec2(0.1f, 0.2f));
+
 	for(std::size_t i = 0; i < A.size(); ++i)
 	for(std::size_t i = 0; i < A.size(); ++i)
 	{
 	{
 		glm::vec2 B(A[i]);
 		glm::vec2 B(A[i]);
@@ -37,12 +42,17 @@ int test_packUnorm2x16()
 int test_packSnorm2x16()
 int test_packSnorm2x16()
 {
 {
 	int Error = 0;
 	int Error = 0;
-	
+/*
 	std::vector<glm::hvec2> A;
 	std::vector<glm::hvec2> A;
 	A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 0.0f)));
 	A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 0.0f)));
 	A.push_back(glm::hvec2(glm::half(-0.5f), glm::half(-0.7f)));
 	A.push_back(glm::hvec2(glm::half(-0.5f), glm::half(-0.7f)));
 	A.push_back(glm::hvec2(glm::half(-0.1f), glm::half( 0.1f)));
 	A.push_back(glm::hvec2(glm::half(-0.1f), glm::half( 0.1f)));
-	
+*/
+	std::vector<glm::vec2> A;
+	A.push_back(glm::vec2( 1.0f, 0.0f));
+	A.push_back(glm::vec2(-0.5f,-0.7f));
+	A.push_back(glm::vec2(-0.1f, 0.1f));
+
 	for(std::size_t i = 0; i < A.size(); ++i)
 	for(std::size_t i = 0; i < A.size(); ++i)
 	{
 	{
 		glm::vec2 B(A[i]);
 		glm::vec2 B(A[i]);
@@ -98,12 +108,17 @@ int test_packSnorm4x8()
 int test_packHalf2x16()
 int test_packHalf2x16()
 {
 {
 	int Error = 0;
 	int Error = 0;
-	
+/*
 	std::vector<glm::hvec2> A;
 	std::vector<glm::hvec2> A;
 	A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 2.0f)));
 	A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 2.0f)));
 	A.push_back(glm::hvec2(glm::half(-1.0f), glm::half(-2.0f)));
 	A.push_back(glm::hvec2(glm::half(-1.0f), glm::half(-2.0f)));
 	A.push_back(glm::hvec2(glm::half(-1.1f), glm::half( 1.1f)));
 	A.push_back(glm::hvec2(glm::half(-1.1f), glm::half( 1.1f)));
-	
+*/
+	std::vector<glm::vec2> A;
+	A.push_back(glm::vec2( 1.0f, 2.0f));
+	A.push_back(glm::vec2(-1.0f,-2.0f));
+	A.push_back(glm::vec2(-1.1f, 1.1f));
+
 	for(std::size_t i = 0; i < A.size(); ++i)
 	for(std::size_t i = 0; i < A.size(); ++i)
 	{
 	{
 		glm::vec2 B(A[i]);
 		glm::vec2 B(A[i]);

+ 4 - 4
test/core/core_type_half.cpp

@@ -18,14 +18,14 @@ int main()
 	glm::half B(2.0f);
 	glm::half B(2.0f);
 	glm::half C = A + B;
 	glm::half C = A + B;
 	glm::half D(C);
 	glm::half D(C);
-	float E = D;
-	int F = float(C);
+	float E = D.toFloat();
+	int F = C.toFloat();
 	Result += float(F) == E ? 0 : 1;
 	Result += float(F) == E ? 0 : 1;
 	glm::half G = B * C;
 	glm::half G = B * C;
 	glm::half H = G / C;
 	glm::half H = G / C;
 	H += glm::half(1.0f);
 	H += glm::half(1.0f);
-	double J = H;
-	int I = float(H);
+	double J = H.toFloat();
+	int I = H.toFloat();
 	Result += J == 3.0 ? 0 : 1;
 	Result += J == 3.0 ? 0 : 1;
 	Result += I == 3 ? 0 : 1;
 	Result += I == 3 ? 0 : 1;
 	
 	

+ 4 - 1
test/gtc/gtc_half_float.cpp

@@ -139,7 +139,10 @@ int test_half_ctor_vec2()
 	int Error = 0;
 	int Error = 0;
 	
 	
 	{
 	{
-		glm::hvec2 A(1, 2);
+		glm::hvec2 A;
+		A.x = glm::half(1);
+		A.y = glm::half(2);
+		//glm::hvec2 A(1, 2);
 		glm::hvec2 B(A);
 		glm::hvec2 B(A);
 		glm::vec2 C(1, 2);
 		glm::vec2 C(1, 2);
 		glm::hvec2 D(C);
 		glm::hvec2 D(C);