(GLM) Cleanups

This commit is contained in:
twinaphex 2016-11-01 06:47:44 +01:00
parent af642521ae
commit 0fd569983c
6 changed files with 4 additions and 217 deletions

View File

@ -49,7 +49,6 @@ namespace detail
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed,
"'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;
}
};
@ -206,17 +205,6 @@ namespace detail
VECTORIZE_VEC(round)
/*
// roundEven
template <typename genType>
GLM_FUNC_QUALIFIER genType roundEven(genType const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'roundEven' only accept floating-point inputs");
return genType(int(x + genType(int(x) % 2)));
}
*/
// roundEven
template <typename genType>
GLM_FUNC_QUALIFIER genType roundEven(genType const & x)
@ -230,25 +218,12 @@ namespace detail
genType FractionalPart = fract(x);
if(FractionalPart > static_cast<genType>(0.5) || FractionalPart < static_cast<genType>(0.5))
{
return round(x);
}
else if((Integer % 2) == 0)
{
if((Integer % 2) == 0)
return IntegerPart;
}
else if(x <= static_cast<genType>(0)) // Work around...
{
if(x <= static_cast<genType>(0)) // Work around...
return IntegerPart - static_cast<genType>(1);
}
else
{
return IntegerPart + static_cast<genType>(1);
}
//else // Bug on MinGW 4.5.2
//{
// return mix(IntegerPart + genType(-1), IntegerPart + genType(1), x <= genType(0));
//}
return IntegerPart + static_cast<genType>(1);
}
VECTORIZE_VEC(roundEven)
@ -354,14 +329,6 @@ namespace detail
modf(x.w, i.w));
}
//// Only valid if (INT_MIN <= x-y <= INT_MAX)
//// min(x,y)
//r = y + ((x - y) & ((x - y) >> (sizeof(int) *
//CHAR_BIT - 1)));
//// max(x,y)
//r = x - ((x - y) & ((x - y) >> (sizeof(int) *
//CHAR_BIT - 1)));
// min
template <typename genType>
GLM_FUNC_QUALIFIER genType min

View File

@ -112,8 +112,7 @@ namespace glm
Borrow = x >= y ? static_cast<uint32>(0) : static_cast<uint32>(1);
if(y >= x)
return y - x;
else
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
}
template <>

View File

@ -34,43 +34,6 @@ namespace glm{
namespace detail
{
// tvec1 type explicit instantiation
/*
template struct tvec1<uint8, lowp>;
template struct tvec1<uint16, lowp>;
template struct tvec1<uint32, lowp>;
template struct tvec1<uint64, lowp>;
template struct tvec1<int8, lowp>;
template struct tvec1<int16, lowp>;
template struct tvec1<int32, lowp>;
template struct tvec1<int64, lowp>;
template struct tvec1<float16, lowp>;
template struct tvec1<float32, lowp>;
template struct tvec1<float64, lowp>;
template struct tvec1<uint8, mediump>;
template struct tvec1<uint16, mediump>;
template struct tvec1<uint32, mediump>;
template struct tvec1<uint64, mediump>;
template struct tvec1<int8, mediump>;
template struct tvec1<int16, mediump>;
template struct tvec1<int32, mediump>;
template struct tvec1<int64, mediump>;
template struct tvec1<float16, mediump>;
template struct tvec1<float32, mediump>;
template struct tvec1<float64, mediump>;
template struct tvec1<uint8, highp>;
template struct tvec1<uint16, highp>;
template struct tvec1<uint32, highp>;
template struct tvec1<uint64, highp>;
template struct tvec1<int8, highp>;
template struct tvec1<int16, highp>;
template struct tvec1<int32, highp>;
template struct tvec1<int64, highp>;
template struct tvec1<float16, highp>;
template struct tvec1<float32, highp>;
template struct tvec1<float64, highp>;
*/
// tvec2 type explicit instantiation
template struct tvec2<uint8, lowp>;
template struct tvec2<uint16, lowp>;

View File

@ -39,12 +39,6 @@ namespace detail
{
template <typename T>
GLM_FUNC_QUALIFIER T operator() (T const & Min, T const & Max) const;
/*
{
GLM_STATIC_ASSERT(0, "'linearRand' invalid template parameter type. GLM_GTC_random only supports floating-point template types.");
return Min;
}
*/
};
template <>

View File

@ -11,25 +11,6 @@
namespace glm{
namespace detail{
//////////////////////////////////////
// Debugging
#if 0
void print(__m128 v)
{
GLM_ALIGN(16) float result[4];
_mm_store_ps(result, v);
printf("__m128: %f %f %f %f\n", result[0], result[1], result[2], result[3]);
}
void print(const fvec4SIMD &v)
{
printf("fvec4SIMD: %f %f %f %f\n", v.x, v.y, v.z, v.w);
}
#endif
//////////////////////////////////////
// Implicit basic constructors

View File

@ -46,121 +46,4 @@
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
# pragma message("GLM: GLM_VIRTREV_xstream extension included")
#endif
/*
namespace glm{
namespace detail
{
template<typename T>
std::ostream & operator << (std::ostream & stream, glm::detail::tvec2<T, P> const & vec)
{
stream << "<glm_vec2 ";
stream << "x=\"" << vec.x << "\" ";
stream << "y=\"" << vec.y << "\" ";
stream << "/>";
return stream;
}
template<typename T>
std::ostream & operator << (std::ostream & stream, glm::detail::tvec3<T, P> const & vec)
{
stream << "<glm_vec3 ";
stream << "x=\"" << vec.x << "\" ";
stream << "y=\"" << vec.y << "\" ";
stream << "z=\"" << vec.z << "\" ";
stream << "/>";
return stream;
}
template<typename T>
std::ostream & operator << (std::ostream & stream, glm::detail::tvec4<T, P> const & vec)
{
stream << "<glm_vec4 ";
stream << "x=\"" << vec.x << "\" ";
stream << "y=\"" << vec.y << "\" ";
stream << "z=\"" << vec.z << "\" ";
stream << "w=\"" << vec.w << "\" ";
stream << "/>";
return stream;
}
template<typename T>
std::ostream & operator << (std::ostream & stream, glm::detail::tmat2x2<T, P> const & mat)
{
stream << "<glm_mat2>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
stream << "/>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
stream << "/>" << std::endl;
stream << "</glm_mat2>";
return stream;
}
template<typename T>
std::ostream & operator << (std::ostream & stream, glm::detail::tmat3x3<T, P> const & mat)
{
stream << "<glm_mat3>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
stream << "/>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
stream << "/>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
stream << "/>" << std::endl;
stream << "</glm_mat3>";
return stream;
}
template<typename T>
std::ostream & operator << (std::ostream & stream, glm::detail::tmat4x4<T, P> const & mat)
{
stream << "<glm_mat4>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 0)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 0)[1] << "\" ";
stream << "z=\"" << glm::row(mat, 0)[2] << "\" ";
stream << "w=\"" << glm::row(mat, 0)[3] << "\" ";
stream << "/>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 1)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 1)[1] << "\" ";
stream << "z=\"" << glm::row(mat, 1)[2] << "\" ";
stream << "w=\"" << glm::row(mat, 1)[3] << "\" ";
stream << "/>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 2)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 2)[1] << "\" ";
stream << "z=\"" << glm::row(mat, 2)[2] << "\" ";
stream << "w=\"" << glm::row(mat, 2)[3] << "\" ";
stream << "/>" << std::endl;
stream << "<row ";
stream << "x=\"" << glm::row(mat, 3)[0] << "\" ";
stream << "y=\"" << glm::row(mat, 3)[1] << "\" ";
stream << "z=\"" << glm::row(mat, 3)[2] << "\" ";
stream << "w=\"" << glm::row(mat, 3)[3] << "\" ";
stream << "/>" << std::endl;
stream << "</glm_mat4>";
return stream;
}
}//namespace detail
}//namespace glm
*/
#endif//GLM_VIRTREV_xstream