예제 #1
0
파일: workaround.hpp 프로젝트: TdroL/pr0-vk
	GLM_FUNC_QUALIFIER vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v)
	{
		GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
		GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");

		return vecType<float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
	}
		GLM_FUNC_QUALIFIER typename vecType<T>::bool_type greaterThanEqual
		(
			vecType<T> const & x, 
			vecType<T> const & y
		)
		{
			GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES, 
				"Invalid template instantiation of 'greaterThanEqual', GLM vector types required");
			GLM_STATIC_ASSERT(detail::is_bool<T>::_NO, 
				"Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");

			typename vecType<bool>::bool_type Result(vecType<bool>::null);
			for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
				Result[i] = x[i] >= y[i];
			return Result;
		}
예제 #3
0
		GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static genFIType call(genFIType x)
		{
			GLM_STATIC_ASSERT(
				(!std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer) || GLM_UNRESTRICTED_GENTYPE,
				"'abs' only accept floating-point and integer scalar or vector inputs");
			return x;
		}
예제 #4
0
		GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CXX14 static genFIType call(genFIType x)
		{
			GLM_STATIC_ASSERT(
				std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed || GLM_UNRESTRICTED_GENTYPE,
				"'abs' only accept floating-point and integer scalar or vector inputs");

			return x >= genFIType(0) ? x : -x;
			// TODO, perf comp with: *(((int *) &x) + 1) &= 0x7fffffff;
		}
		GLM_FUNC_QUALIFIER vecType<bool> not_(vecType<bool> const & v)
		{
			GLM_STATIC_ASSERT(detail::is_vector<vecType<bool> >::_YES, 
				"Invalid template instantiation of 'not_', GLM vector types required");

			typename vecType<bool>::bool_type Result(vecType<bool>::null);
			for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
				Result[i] = !v[i];
			return Result;
		}
		GLM_FUNC_QUALIFIER bool all(vecType<bool> const & v)
		{
			GLM_STATIC_ASSERT(detail::is_vector<vecType<bool> >::_YES, 
				"Invalid template instantiation of 'all', GLM boolean vector types required");

			bool Result = true;
			for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
				Result = Result && v[i];
			return Result;
		}
예제 #7
0
	GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverseLoop(vecType<T, P> const & v)
	{
		GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldReverse' only accept integer values");

		vecType<T, P> Result(0);
		T const BitSize = static_cast<T>(sizeof(T) * 8);
		for(T i = 0; i < BitSize; ++i)
		{
			vecType<T, P> const BitSet(v & (static_cast<T>(1) << i));
			vecType<T, P> const BitFirst(BitSet >> i);
			Result |= BitFirst << (BitSize - 1 - i);
		}
		return Result;
	}
		GLM_FUNC_QUALIFIER typename vecType<T>::bool_type equal
		(
			vecType<T> const & x, 
			vecType<T> const & y
		)
		{
			GLM_STATIC_ASSERT(detail::is_vector<vecType<T> >::_YES, 
				"Invalid template instantiation of 'equal', GLM vector types required");

			typename vecType<bool>::bool_type Result(vecType<bool>::null);
			for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
				Result[i] = x[i] == y[i];
			return Result;
		}
		inline typename vecType<T>::bool_type greaterThanEqual
		(
			vecType<T> const & x, 
			vecType<T> const & y
		)
		{
			GLM_STATIC_ASSERT(
				detail::type<T>::is_float || 
				detail::type<T>::is_int || 
				detail::type<T>::is_uint);

			typename vecType<bool>::bool_type Result(vecType<bool>::null);
			for(typename vecType<bool>::size_type i = 0; i < vecType<bool>::value_size(); ++i)
				Result[i] = x[i] >= y[i];
			return Result;
		}
예제 #10
0
파일: workaround.hpp 프로젝트: TdroL/pr0-vk
	GLM_FUNC_QUALIFIER vecType<T, P> compScale(vecType<floatType, P> const & v)
	{
		GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compScale' accepts only floating-point types for 'floatType' template parameter");

		return detail::compute_compScale<T, floatType, P, vecType, std::numeric_limits<T>::is_integer, std::numeric_limits<T>::is_signed>::call(v);
	}