Browse Source

Fixed declaration and definision mismatches (#148)

Christophe Riccio 12 years ago
parent
commit
06ac77dad4

+ 103 - 12
glm/detail/type_vec1.hpp

@@ -95,18 +95,6 @@ namespace detail
 		GLM_FUNC_DECL explicit tvec1(
 			T const & s);
 
-		//////////////////////////////////////
-		// Swizzle constructors
-
-		
-
-		//////////////////////////////////////
-		// Conversion scalar constructors
-
-		//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
-		template <typename U>
-		GLM_FUNC_DECL explicit tvec1(U const & s);
-
 		//////////////////////////////////////
 		// Conversion vector constructors
 		
@@ -184,6 +172,109 @@ namespace detail
 		GLM_FUNC_DECL tvec1<T, P> & operator>>=(tvec1<U, P> const & v);
 	};
 
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator+(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator+(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator-(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator-(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator-	(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator*(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator*(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator*(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator/(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator/(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator/(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator-(tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL bool operator==(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL bool operator!=(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator%(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator%(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator%(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator&(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator&(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator&(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator|(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator|(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator|(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator^(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator^(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator^(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator<<(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator<<(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator<<(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v, T const & s);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator>>(T const & s, tvec1<T, P> const & v);
+
+	template <typename T, precision P>
+	GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
+
+	template <typename T, precision P> 
+	GLM_FUNC_DECL tvec1<T, P> operator~(tvec1<T, P> const & v);
+
 }//namespace detail
 }//namespace glm
 

+ 20 - 32
glm/detail/type_vec1.inl

@@ -93,18 +93,6 @@ namespace detail
 		x(s)
 	{}
 
-	//////////////////////////////////////
-	// Conversion scalar constructors
-		
-	template <typename T, precision P>
-	template <typename U> 
-	GLM_FUNC_QUALIFIER tvec1<T, P>::tvec1
-	(
-		U const & s
-	) :
-		x(static_cast<T>(s))
-	{}
-
 	//////////////////////////////////////
 	// Conversion vector constructors
 
@@ -454,7 +442,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator+
 	(
 		tvec1<T, P> const & v,
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -464,7 +452,7 @@ namespace detail
 	template <typename T, precision P> 
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator+ 
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -488,7 +476,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator-
 	(
 		tvec1<T, P> const & v, 
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -498,7 +486,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator-
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -522,7 +510,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator*
 	(
 		tvec1<T, P> const & v,
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -532,7 +520,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator*
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -556,7 +544,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator/
 	(
 		tvec1<T, P> const & v,
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -566,7 +554,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator/
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -625,7 +613,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator%
 	(
 		tvec1<T, P> const & v,
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -635,7 +623,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator%
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -658,7 +646,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator&
 	(
 		tvec1<T, P> const & v, 
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -668,7 +656,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator&
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -691,7 +679,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator|
 	(
 		tvec1<T, P> const & v,
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -701,7 +689,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator|
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -724,7 +712,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator^
 	(
 		tvec1<T, P> const & v,
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -734,7 +722,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator^
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -757,7 +745,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator<<
 	(
 		tvec1<T, P> const & v, 
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -767,7 +755,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator<<
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{
@@ -790,7 +778,7 @@ namespace detail
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator>>
 	(
 		tvec1<T, P> const & v,
-		typename tvec1<T, P>::T const & s
+		T const & s
 	)
 	{
 		return tvec1<T, P>(
@@ -800,7 +788,7 @@ namespace detail
 	template <typename T, precision P>
 	GLM_FUNC_QUALIFIER tvec1<T, P> operator>>
 	(
-		typename tvec1<T, P>::T const & s,
+		T const & s,
 		tvec1<T, P> const & v
 	)
 	{

+ 1 - 1
glm/gtc/quaternion.inl

@@ -457,7 +457,7 @@ namespace detail
 	(
 		detail::tquat<T, P> const & x, 
 		detail::tquat<T, P> const & y, 
-		typename detail::tquat<T, P>::T const & a
+		T const & a
 	)
 	{
 		if(a <= T(0)) return x;

+ 1 - 1
glm/gtx/fast_square_root.inl

@@ -26,7 +26,7 @@ namespace glm
 	// fastInversesqrt
 	GLM_FUNC_QUALIFIER float fastInverseSqrt(float x)
 	{
-		return detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(x).x;
+		return detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x)).x;
 	}
 	
 	template <template <class, precision> class vecType, typename T, precision P>

+ 1 - 1
glm/gtx/rotate_normalized_axis.hpp

@@ -81,7 +81,7 @@ namespace glm
 	template <typename T, precision P>
 	detail::tquat<T, P> rotateNormalizedAxis(
 		detail::tquat<T, P> const & q,
-		typename detail::tquat<T, P>::T const & angle,
+		T const & angle,
 		detail::tvec3<T, P> const & axis);
 
 	/// @}

+ 12 - 12
test/gtc/gtc_packing.cpp

@@ -112,12 +112,12 @@ int test_Half4x16()
 	int Error = 0;
 
 	std::vector<glm::vec4> Tests;
-	Tests.push_back(glm::vec4(1.0));
-	Tests.push_back(glm::vec4(0.0));
-	Tests.push_back(glm::vec4(2.0));
-	Tests.push_back(glm::vec4(0.1));
-	Tests.push_back(glm::vec4(0.5));
-	Tests.push_back(glm::vec4(-0.9));
+	Tests.push_back(glm::vec4(1.0f));
+	Tests.push_back(glm::vec4(0.0f));
+	Tests.push_back(glm::vec4(2.0f));
+	Tests.push_back(glm::vec4(0.1f));
+	Tests.push_back(glm::vec4(0.5f));
+	Tests.push_back(glm::vec4(-0.9f));
 
 	for(std::size_t i = 0; i < Tests.size(); ++i)
 	{
@@ -232,12 +232,12 @@ int test_F2x11_1x10()
 	int Error = 0;
 
 	std::vector<glm::vec3> Tests;
-	Tests.push_back(glm::vec3(1.0));
-	Tests.push_back(glm::vec3(0.0));
-	Tests.push_back(glm::vec3(2.0));
-	Tests.push_back(glm::vec3(0.1));
-	Tests.push_back(glm::vec3(0.5));
-	Tests.push_back(glm::vec3(0.9));
+	Tests.push_back(glm::vec3(1.0f));
+	Tests.push_back(glm::vec3(0.0f));
+	Tests.push_back(glm::vec3(2.0f));
+	Tests.push_back(glm::vec3(0.1f));
+	Tests.push_back(glm::vec3(0.5f));
+	Tests.push_back(glm::vec3(0.9f));
 
 	for(std::size_t i = 0; i < Tests.size(); ++i)
 	{