Fixed merge
This commit is contained in:
commit
bc326abd50
@ -104,10 +104,7 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
|
||||
{
|
||||
if(Source > genType(0))
|
||||
{
|
||||
genType Tmp = Source - genType(1);
|
||||
return Tmp + (Multiple - std::fmod(Tmp, Multiple));
|
||||
}
|
||||
return Source + (Multiple - std::fmod(Source, Multiple));
|
||||
else
|
||||
return Source + std::fmod(-Source, Multiple);
|
||||
}
|
||||
@ -152,10 +149,7 @@ namespace detail
|
||||
if(Source >= genType(0))
|
||||
return Source - std::fmod(Source, Multiple);
|
||||
else
|
||||
{
|
||||
genType Tmp = Source + genType(1);
|
||||
return Tmp - std::fmod(Tmp, Multiple) - Multiple;
|
||||
}
|
||||
return Source - std::fmod(Source, Multiple) - Multiple;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -60,7 +60,10 @@ namespace glm
|
||||
template <typename floatType, typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<floatType, P> compNormalize(vecType<T, P> const & v);
|
||||
|
||||
template <typename floatType, typename T, precision P, template <typename, precision> class vecType>
|
||||
/// Convert a normalized float vector to an integer vector.
|
||||
/// If the parameter value type is already a floating precision type, the value is passed through.
|
||||
/// @see gtx_component_wise
|
||||
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> compScale(vecType<floatType, P> const & v);
|
||||
|
||||
/// Add all vector components together.
|
||||
|
@ -113,7 +113,7 @@ namespace detail
|
||||
template <typename T, typename floatType, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> compScale(vecType<floatType, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "'compNormalize' accepts only floating-point types for 'floatType' template parameter");
|
||||
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);
|
||||
}
|
||||
|
@ -53,7 +53,10 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
|
||||
|
||||
#### [GLM 0.9.7.2](https://github.com/g-truc/glm/releases/latest) - 2015-XX-XX
|
||||
##### Improvements:
|
||||
- Added compNormalize function to GTX_component_wise
|
||||
- Added compNormalize and compScale functions to GTX_component_wise
|
||||
|
||||
##### Fixes:
|
||||
- Fixed GTC_round floorMultiple/ceilMultiple #412
|
||||
|
||||
#### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07
|
||||
##### Improvements:
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <glm/gtc/round.hpp>
|
||||
#include <glm/gtc/type_precision.hpp>
|
||||
#include <glm/gtc/vec1.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <cstdio>
|
||||
@ -293,6 +294,86 @@ namespace ceilPowerOfTwo
|
||||
}
|
||||
}//namespace ceilPowerOfTwo
|
||||
|
||||
namespace floorMultiple
|
||||
{
|
||||
template <typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Source;
|
||||
genType Multiple;
|
||||
genType Return;
|
||||
genType Epsilon;
|
||||
};
|
||||
|
||||
int test_float()
|
||||
{
|
||||
type<glm::float64> const Data[] =
|
||||
{
|
||||
{3.4, 0.3, 3.3, 0.0001},
|
||||
{-1.4, 0.3, -1.5, 0.0001},
|
||||
};
|
||||
|
||||
int Error(0);
|
||||
|
||||
for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::float64>); i < n; ++i)
|
||||
{
|
||||
glm::float64 Result = glm::floorMultiple(Data[i].Source, Data[i].Multiple);
|
||||
Error += glm::epsilonEqual(Data[i].Return, Result, Data[i].Epsilon) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += test_float();
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace floorMultiple
|
||||
|
||||
namespace ceilMultiple
|
||||
{
|
||||
template <typename genType>
|
||||
struct type
|
||||
{
|
||||
genType Source;
|
||||
genType Multiple;
|
||||
genType Return;
|
||||
genType Epsilon;
|
||||
};
|
||||
|
||||
int test_float()
|
||||
{
|
||||
type<glm::float64> const Data[] =
|
||||
{
|
||||
{3.4, 0.3, 3.6, 0.0001},
|
||||
{-1.4, 0.3, -1.2, 0.0001},
|
||||
};
|
||||
|
||||
int Error(0);
|
||||
|
||||
for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::float64>); i < n; ++i)
|
||||
{
|
||||
glm::float64 Result = glm::ceilMultiple(Data[i].Source, Data[i].Multiple);
|
||||
Error += glm::epsilonEqual(Data[i].Return, Result, Data[i].Epsilon) ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += test_float();
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace ceilMultiple
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error(0);
|
||||
@ -304,5 +385,8 @@ int main()
|
||||
Error += ceilPowerOfTwo::perf();
|
||||
# endif//NDEBUG
|
||||
|
||||
Error += floorMultiple::test();
|
||||
Error += ceilMultiple::test();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user