Merge branch '0.9.3' into swizzle

This commit is contained in:
Christophe Riccio 2011-10-14 14:08:15 +01:00
commit e93b6eb518
54 changed files with 5019 additions and 6933 deletions

View File

@ -8,9 +8,10 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "../core/_detail.hpp"
#include "../core/_vectorize.hpp"
namespace glm{
namespace glm
{
template <typename genIType>
GLM_FUNC_QUALIFIER genIType mask
(
@ -20,41 +21,7 @@ GLM_FUNC_QUALIFIER genIType mask
return ((genIType(1) << (count)) - genIType(1));
}
template <typename valIType>
GLM_FUNC_QUALIFIER detail::tvec2<valIType> mask
(
detail::tvec2<valIType> const & count
)
{
return detail::tvec2<valIType>(
mask(count[0]),
mask(count[1]));
}
template <typename valIType>
GLM_FUNC_QUALIFIER detail::tvec3<valIType> mask
(
detail::tvec3<valIType> const & count
)
{
return detail::tvec3<valIType>(
mask(count[0]),
mask(count[1]),
mask(count[2]));
}
template <typename valIType>
GLM_FUNC_QUALIFIER detail::tvec4<valIType> mask
(
detail::tvec4<valIType> const & count
)
{
return detail::tvec4<valIType>(
mask(count[0]),
mask(count[1]),
mask(count[2]),
mask(count[3]));
}
VECTORIZE_VEC(mask)
// extractField
template <typename genIType>
@ -458,41 +425,7 @@ GLM_FUNC_QUALIFIER genType powerOfTwoAbove(genType const & value)
return isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoAbove
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<valType>(
powerOfTwoAbove(value[0]),
powerOfTwoAbove(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoAbove
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<valType>(
powerOfTwoAbove(value[0]),
powerOfTwoAbove(value[1]),
powerOfTwoAbove(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoAbove
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<valType>(
powerOfTwoAbove(value[0]),
powerOfTwoAbove(value[1]),
powerOfTwoAbove(value[2]),
powerOfTwoAbove(value[3]));
}
VECTORIZE_VEC(powerOfTwoAbove)
// powerOfTwoBelow
template <typename genType>
@ -504,41 +437,7 @@ GLM_FUNC_QUALIFIER genType powerOfTwoBelow
return isPowerOfTwo(value) ? value : highestBitValue(value);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoBelow
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<valType>(
powerOfTwoBelow(value[0]),
powerOfTwoBelow(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoBelow
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<valType>(
powerOfTwoBelow(value[0]),
powerOfTwoBelow(value[1]),
powerOfTwoBelow(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoBelow
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<valType>(
powerOfTwoBelow(value[0]),
powerOfTwoBelow(value[1]),
powerOfTwoBelow(value[2]),
powerOfTwoBelow(value[3]));
}
VECTORIZE_VEC(powerOfTwoBelow)
// powerOfTwoNearest
template <typename genType>
@ -555,41 +454,7 @@ GLM_FUNC_QUALIFIER genType powerOfTwoNearest
return (next - value) < (value - prev) ? next : prev;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoNearest
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<valType>(
powerOfTwoNearest(value[0]),
powerOfTwoNearest(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoNearest
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<valType>(
powerOfTwoNearest(value[0]),
powerOfTwoNearest(value[1]),
powerOfTwoNearest(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoNearest
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<valType>(
powerOfTwoNearest(value[0]),
powerOfTwoNearest(value[1]),
powerOfTwoNearest(value[2]),
powerOfTwoNearest(value[3]));
}
VECTORIZE_VEC(powerOfTwoNearest)
template <typename genType>
GLM_FUNC_QUALIFIER genType bitRevert(genType const & In)
@ -604,41 +469,7 @@ GLM_FUNC_QUALIFIER genType bitRevert(genType const & In)
return Out;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRevert
(
detail::tvec2<valType> const & Value
)
{
return detail::tvec2<valType>(
bitRevert(Value[0]),
bitRevert(Value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRevert
(
detail::tvec3<valType> const & Value
)
{
return detail::tvec3<valType>(
bitRevert(Value[0]),
bitRevert(Value[1]),
bitRevert(Value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRevert
(
detail::tvec4<valType> const & Value
)
{
return detail::tvec4<valType>(
bitRevert(Value[0]),
bitRevert(Value[1]),
bitRevert(Value[2]),
bitRevert(Value[3]));
}
VECTORIZE_VEC(bitRevert)
template <typename genType>
GLM_FUNC_QUALIFIER genType bitRotateRight(genType const & In, std::size_t Shift)
@ -769,5 +600,4 @@ GLM_FUNC_QUALIFIER genIUType fillBitfieldWithZero
Result &= ~(1 << i);
return Result;
}
}//namespace glm

View File

@ -10,8 +10,8 @@
#ifndef glm_gtx_closest_point
#define glm_gtx_closest_point
namespace glm{
namespace glm
{
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
(
@ -31,7 +31,6 @@ GLM_FUNC_QUALIFIER detail::tvec3<valType> closestPointOnLine
if(Distance >= LineLength) return b;
return a + LineDirection * Distance;
}
}//namespace glm
#endif//glm_gtx_closest_point

View File

@ -7,8 +7,8 @@
// File : glm/gtx/color_cast.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER uint8 u8channel_cast(T a)
{
@ -730,5 +730,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<double> f64_abgr_cast<uint64>(uint64 color)
result.w = static_cast<double>((color >> 0) & 0xFFFF) / static_cast<double>(65535);
return result;
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/color_space.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rgbColor(const detail::tvec3<T>& hsvColor)
{
@ -146,5 +146,4 @@ GLM_FUNC_QUALIFIER T luminosity(const detail::tvec3<T>& color)
const detail::tvec3<T> tmp = detail::tvec3<T>(0.33, 0.59, 0.11);
return dot(color, tmp);
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/color_space_YCoCg.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> rgb2YCoCg
(
@ -61,5 +61,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<valType> YCoCgR2rgb
result.r = result.b + YCoCgRColor.y;
return result;
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/compatibility.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
// isfinite
template <typename genType>
GLM_FUNC_QUALIFIER bool isfinite(
@ -133,5 +133,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> isnan(
isnan(x.z),
isnan(x.w));
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : gtx_component_wise.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type compAdd(genType const & v)
{
@ -44,5 +44,4 @@ GLM_FUNC_QUALIFIER typename genType::value_type compMax(genType const & v)
result = max(result, v[i]);
return result;
}
}//namespace glm

View File

@ -20,773 +20,8 @@
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtc_half_float
/// @file glm/gtc/half_float.inl
/// @date 2009-04-29 / 2011-06-05
/// @ref gtx_constants
/// @file glm/gtx/constants.inl
/// @date 2011-10-14 / 2011-10-14
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "../core/_detail.hpp"
namespace glm{
template <typename genIType>
GLM_FUNC_QUALIFIER genIType mask
(
genIType const & count
)
{
return ((genIType(1) << (count)) - genIType(1));
}
template <typename valIType>
GLM_FUNC_QUALIFIER detail::tvec2<valIType> mask
(
detail::tvec2<valIType> const & count
)
{
return detail::tvec2<valIType>(
mask(count[0]),
mask(count[1]));
}
template <typename valIType>
GLM_FUNC_QUALIFIER detail::tvec3<valIType> mask
(
detail::tvec3<valIType> const & count
)
{
return detail::tvec3<valIType>(
mask(count[0]),
mask(count[1]),
mask(count[2]));
}
template <typename valIType>
GLM_FUNC_QUALIFIER detail::tvec4<valIType> mask
(
detail::tvec4<valIType> const & count
)
{
return detail::tvec4<valIType>(
mask(count[0]),
mask(count[1]),
mask(count[2]),
mask(count[3]));
}
// extractField
template <typename genIType>
GLM_FUNC_QUALIFIER genIType extractField
(
half const & value,
genIType const & first,
genIType const & count
)
{
assert(first + count < sizeof(half));
return (value._data() << first) >> ((sizeof(half) << 3) - count);
}
template <typename genIType>
GLM_FUNC_QUALIFIER genIType extractField
(
float const & value,
genIType const & first,
genIType const & count
)
{
assert(first + count < sizeof(float));
return (detail::uif32(value).i << first) >> ((sizeof(float) << 3) - count);
}
template <typename genIType>
GLM_FUNC_QUALIFIER genIType extractField
(
double const & value,
genIType const & first,
genIType const & count
)
{
assert(first + count < sizeof(double));
return (detail::uif64(value).i << first) >> ((sizeof(double) << genIType(3)) - count);
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER genIUType extractField
(
genIUType const & Value,
sizeType const & First,
sizeType const & Count
)
{
sizeType GenSize = sizeof(genIUType) << 3;
assert(First + Count <= GenSize);
genIUType ShiftLeft = Count ? Value << (GenSize - (Count + First)) : 0;
genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Count);
return ShiftBack;
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
(
detail::tvec2<genIUType> const & value,
sizeType const & first,
sizeType const & count
)
{
return detail::tvec2<genIUType>(
extractField(value[0], first, count),
extractField(value[1], first, count));
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
(
detail::tvec3<genIUType> const & value,
sizeType const & first,
sizeType const & count
)
{
return detail::tvec3<genIUType>(
extractField(value[0], first, count),
extractField(value[1], first, count),
extractField(value[2], first, count));
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
(
detail::tvec4<genIUType> const & value,
sizeType const & first,
sizeType const & count
)
{
return detail::tvec4<genIUType>(
extractField(value[0], first, count),
extractField(value[1], first, count),
extractField(value[2], first, count),
extractField(value[3], first, count));
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
(
detail::tvec2<genIUType> const & value,
detail::tvec2<sizeType> const & first,
detail::tvec2<sizeType> const & count
)
{
return detail::tvec2<genIUType>(
extractField(value[0], first[0], count[0]),
extractField(value[1], first[1], count[1]));
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
(
detail::tvec3<genIUType> const & value,
detail::tvec3<sizeType> const & first,
detail::tvec3<sizeType> const & count
)
{
return detail::tvec3<genIUType>(
extractField(value[0], first[0], count[0]),
extractField(value[1], first[1], count[1]),
extractField(value[2], first[2], count[2]));
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
(
detail::tvec4<genIUType> const & value,
detail::tvec4<sizeType> const & first,
detail::tvec4<sizeType> const & count
)
{
return detail::tvec4<genIUType>(
extractField(value[0], first[0], count[0]),
extractField(value[1], first[1], count[1]),
extractField(value[2], first[2], count[2]),
extractField(value[3], first[3], count[3]));
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec2<genIUType> extractField
(
genIUType const & value,
detail::tvec2<sizeType> const & first,
detail::tvec2<sizeType> const & count
)
{
return detail::tvec2<genIUType>(
extractField(value, first[0], count[0]),
extractField(value, first[1], count[1]));
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec3<genIUType> extractField
(
genIUType const & value,
detail::tvec3<sizeType> const & first,
detail::tvec3<sizeType> const & count
)
{
return detail::tvec3<genIUType>(
extractField(value, first[0], count[0]),
extractField(value, first[1], count[1]),
extractField(value, first[2], count[2]));
}
template <typename genIUType, typename sizeType>
GLM_FUNC_QUALIFIER detail::tvec4<genIUType> extractField
(
genIUType const & value,
detail::tvec4<sizeType> const & first,
detail::tvec4<sizeType> const & count
)
{
return detail::tvec4<genIUType>(
extractField(value, first[0], count[0]),
extractField(value, first[1], count[1]),
extractField(value, first[2], count[2]),
extractField(value, first[3], count[3]));
}
// lowestBit
template <typename genType>
GLM_FUNC_QUALIFIER int lowestBit
(
genType const & Value
)
{
assert(Value != genType(0)); // not valid call
genType Bit;
for(Bit = genType(0); !(Value & (1 << Bit)); ++Bit){}
return Bit;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<int> lowestBit
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<int>(
lowestBit(value[0]),
lowestBit(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<int> lowestBit
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<int>(
lowestBit(value[0]),
lowestBit(value[1]),
lowestBit(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<int> lowestBit
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<int>(
lowestBit(value[0]),
lowestBit(value[1]),
lowestBit(value[2]),
lowestBit(value[3]));
}
// highestBit
template <typename genType>
GLM_FUNC_QUALIFIER int highestBit
(
genType const & value
)
{
assert(value != genType(0)); // not valid call
genType bit = genType(-1);
for(genType tmp = value; tmp; tmp >>= 1, ++bit){}
return bit;
}
//template <>
//GLM_FUNC_QUALIFIER int highestBit<int>
//(
// int value
//)
//{
// int bit = -1;
// for(int tmp = value; tmp; tmp >>= 1, ++bit);
// return bit;
//}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<int> highestBit
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<int>(
highestBit(value[0]),
highestBit(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<int> highestBit
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<int>(
highestBit(value[0]),
highestBit(value[1]),
highestBit(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<int> highestBit
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<int>(
highestBit(value[0]),
highestBit(value[1]),
highestBit(value[2]),
highestBit(value[3]));
}
// highestBitValue
template <typename genType>
GLM_FUNC_QUALIFIER genType highestBitValue
(
genType const & value
)
{
genType tmp = value;
genType result = genType(0);
while(tmp)
{
result = (tmp & (~tmp + 1)); // grab lowest bit
tmp &= ~result; // clear lowest bit
}
return result;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<int> highestBitValue
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<int>(
highestBitValue(value[0]),
highestBitValue(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<int> highestBitValue
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<int>(
highestBitValue(value[0]),
highestBitValue(value[1]),
highestBitValue(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<int> highestBitValue
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<int>(
highestBitValue(value[0]),
highestBitValue(value[1]),
highestBitValue(value[2]),
highestBitValue(value[3]));
}
// isPowerOfTwo
template <typename genType>
GLM_FUNC_QUALIFIER bool isPowerOfTwo(genType const & Value)
{
//detail::If<std::numeric_limits<genType>::is_signed>::apply(abs, Value);
//return !(Value & (Value - 1));
// For old complier?
genType Result = Value;
if(std::numeric_limits<genType>::is_signed)
Result = abs(Result);
return !(Result & (Result - 1));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<bool> isPowerOfTwo
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<bool>(
isPowerOfTwo(value[0]),
isPowerOfTwo(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<bool> isPowerOfTwo
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<bool>(
isPowerOfTwo(value[0]),
isPowerOfTwo(value[1]),
isPowerOfTwo(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> isPowerOfTwo
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<bool>(
isPowerOfTwo(value[0]),
isPowerOfTwo(value[1]),
isPowerOfTwo(value[2]),
isPowerOfTwo(value[3]));
}
// powerOfTwoAbove
template <typename genType>
GLM_FUNC_QUALIFIER genType powerOfTwoAbove(genType const & value)
{
return isPowerOfTwo(value) ? value : highestBitValue(value) << 1;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoAbove
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<valType>(
powerOfTwoAbove(value[0]),
powerOfTwoAbove(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoAbove
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<valType>(
powerOfTwoAbove(value[0]),
powerOfTwoAbove(value[1]),
powerOfTwoAbove(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoAbove
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<valType>(
powerOfTwoAbove(value[0]),
powerOfTwoAbove(value[1]),
powerOfTwoAbove(value[2]),
powerOfTwoAbove(value[3]));
}
// powerOfTwoBelow
template <typename genType>
GLM_FUNC_QUALIFIER genType powerOfTwoBelow
(
genType const & value
)
{
return isPowerOfTwo(value) ? value : highestBitValue(value);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoBelow
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<valType>(
powerOfTwoBelow(value[0]),
powerOfTwoBelow(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoBelow
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<valType>(
powerOfTwoBelow(value[0]),
powerOfTwoBelow(value[1]),
powerOfTwoBelow(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoBelow
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<valType>(
powerOfTwoBelow(value[0]),
powerOfTwoBelow(value[1]),
powerOfTwoBelow(value[2]),
powerOfTwoBelow(value[3]));
}
// powerOfTwoNearest
template <typename genType>
GLM_FUNC_QUALIFIER genType powerOfTwoNearest
(
genType const & value
)
{
if(isPowerOfTwo(value))
return value;
genType prev = highestBitValue(value);
genType next = prev << 1;
return (next - value) < (value - prev) ? next : prev;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> powerOfTwoNearest
(
detail::tvec2<valType> const & value
)
{
return detail::tvec2<valType>(
powerOfTwoNearest(value[0]),
powerOfTwoNearest(value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> powerOfTwoNearest
(
detail::tvec3<valType> const & value
)
{
return detail::tvec3<valType>(
powerOfTwoNearest(value[0]),
powerOfTwoNearest(value[1]),
powerOfTwoNearest(value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> powerOfTwoNearest
(
detail::tvec4<valType> const & value
)
{
return detail::tvec4<valType>(
powerOfTwoNearest(value[0]),
powerOfTwoNearest(value[1]),
powerOfTwoNearest(value[2]),
powerOfTwoNearest(value[3]));
}
template <typename genType>
GLM_FUNC_QUALIFIER genType bitRevert(genType const & In)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRevert' only accept integer values");
genType Out = 0;
std::size_t BitSize = sizeof(genType) * 8;
for(std::size_t i = 0; i < BitSize; ++i)
if(In & (genType(1) << i))
Out |= genType(1) << (BitSize - 1 - i);
return Out;
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRevert
(
detail::tvec2<valType> const & Value
)
{
return detail::tvec2<valType>(
bitRevert(Value[0]),
bitRevert(Value[1]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRevert
(
detail::tvec3<valType> const & Value
)
{
return detail::tvec3<valType>(
bitRevert(Value[0]),
bitRevert(Value[1]),
bitRevert(Value[2]));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRevert
(
detail::tvec4<valType> const & Value
)
{
return detail::tvec4<valType>(
bitRevert(Value[0]),
bitRevert(Value[1]),
bitRevert(Value[2]),
bitRevert(Value[3]));
}
template <typename genType>
GLM_FUNC_QUALIFIER genType bitRotateRight(genType const & In, std::size_t Shift)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRotateRight' only accept integer values");
std::size_t BitSize = sizeof(genType) * 8;
return (In << Shift) | (In >> (BitSize - Shift));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRotateRight
(
detail::tvec2<valType> const & Value,
std::size_t Shift
)
{
return detail::tvec2<valType>(
bitRotateRight(Value[0], Shift),
bitRotateRight(Value[1], Shift));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRotateRight
(
detail::tvec3<valType> const & Value,
std::size_t Shift
)
{
return detail::tvec3<valType>(
bitRotateRight(Value[0], Shift),
bitRotateRight(Value[1], Shift),
bitRotateRight(Value[2], Shift));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRotateRight
(
detail::tvec4<valType> const & Value,
std::size_t Shift
)
{
return detail::tvec4<valType>(
bitRotateRight(Value[0], Shift),
bitRotateRight(Value[1], Shift),
bitRotateRight(Value[2], Shift),
bitRotateRight(Value[3], Shift));
}
template <typename genType>
GLM_FUNC_QUALIFIER genType bitRotateLeft(genType const & In, std::size_t Shift)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_integer, "'bitRotateLeft' only accept integer values");
std::size_t BitSize = sizeof(genType) * 8;
return (In >> Shift) | (In << (BitSize - Shift));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> bitRotateLeft
(
detail::tvec2<valType> const & Value,
std::size_t Shift
)
{
return detail::tvec2<valType>(
bitRotateLeft(Value[0], Shift),
bitRotateLeft(Value[1], Shift));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> bitRotateLeft
(
detail::tvec3<valType> const & Value,
std::size_t Shift
)
{
return detail::tvec3<valType>(
bitRotateLeft(Value[0], Shift),
bitRotateLeft(Value[1], Shift),
bitRotateLeft(Value[2], Shift));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> bitRotateLeft
(
detail::tvec4<valType> const & Value,
std::size_t Shift
)
{
return detail::tvec4<valType>(
bitRotateLeft(Value[0], Shift),
bitRotateLeft(Value[1], Shift),
bitRotateLeft(Value[2], Shift),
bitRotateLeft(Value[3], Shift));
}
template <typename genIUType>
GLM_FUNC_QUALIFIER genIUType fillBitfieldWithOne
(
genIUType const & Value,
int const & FromBit,
int const & ToBit
)
{
assert(FromBit <= ToBit);
assert(ToBit <= sizeof(genIUType) * std::size_t(8));
genIUType Result = Value;
for(std::size_t i = 0; i <= ToBit; ++i)
Result |= (1 << i);
return Result;
}
template <typename genIUType>
GLM_FUNC_QUALIFIER genIUType fillBitfieldWithZero
(
genIUType const & Value,
int const & FromBit,
int const & ToBit
)
{
assert(FromBit <= ToBit);
assert(ToBit <= sizeof(genIUType) * std::size_t(8));
genIUType Result = Value;
for(std::size_t i = 0; i <= ToBit; ++i)
Result &= ~(1 << i);
return Result;
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/epsilon.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER bool equalEpsilon
(
@ -226,5 +226,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
abs(x.z - y.z) >= epsilon.z,
abs(x.w - y.w) >= epsilon.w);
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/euler_angles.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> eulerAngleX
(
@ -241,5 +241,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<valType> orientate4
{
return yawPitchRoll(angles.z, angles.x, angles.y);
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/extend.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename genType>
genType extend
(
@ -52,5 +52,4 @@ detail::tvec4<valType> extend
{
return Origin + (Source - Origin) * Distance;
}
}//namespace glm

View File

@ -54,17 +54,17 @@ namespace glm
//! Faster than the common pow function but less accurate.
//! From GLM_GTX_fast_exponential extension.
template <typename valType>
valType fastPow(
valType const & x,
valType const & y);
template <typename genType>
genType fastPow(
genType const & x,
genType const & y);
//! Faster than the common pow function but less accurate.
//! From GLM_GTX_fast_exponential extension.
template <typename T, typename U>
T fastPow(
const T& x,
const U& y);
template <typename genTypeT, typename genTypeU>
genType fastPow(
genTypeT const & x,
genTypeU const & y);
//! Faster than the common exp function but less accurate.
//! From GLM_GTX_fast_exponential extension.

View File

@ -7,47 +7,18 @@
// File : glm/gtx/fast_exponential.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
#include "../core/_vectorize.hpp"
namespace glm
{
// fastPow:
template <typename T>
GLM_FUNC_QUALIFIER T fastPow(const T x, const T y)
template <typename genType>
GLM_FUNC_QUALIFIER genType fastPow(genType const & x, genType const & y)
{
return exp(y * log(x));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastPow(
const detail::tvec2<T>& x,
const detail::tvec2<T>& y)
{
return detail::tvec2<T>(
fastPow(x.x, y.x),
fastPow(x.y, y.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastPow(
const detail::tvec3<T>& x,
const detail::tvec3<T>& y)
{
return detail::tvec3<T>(
fastPow(x.x, y.x),
fastPow(x.y, y.y),
fastPow(x.z, y.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastPow(
const detail::tvec4<T>& x,
const detail::tvec4<T>& y)
{
return detail::tvec4<T>(
fastPow(x.x, y.x),
fastPow(x.y, y.y),
fastPow(x.z, y.z),
fastPow(x.w, y.w));
}
VECTORIZE_VEC_VEC(fastPow)
template <typename T>
GLM_FUNC_QUALIFIER T fastPow(const T x, int y)
@ -137,39 +108,12 @@ GLM_FUNC_QUALIFIER float fastExp(float x)
return 1.0f + x + (x2 * 0.5f) + (x3 * 0.1666666667f) + (x4 * 0.041666667f) + (x5 * 0.008333333333f)+ (x6 * 0.00138888888888f) + (x7 * 0.000198412698f) + (x8 * 0.0000248015873f);;
}
*/
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastExp(x.x),
fastExp(x.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastExp(x.x),
fastExp(x.y),
fastExp(x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastExp(x.x),
fastExp(x.y),
fastExp(x.z),
fastExp(x.w));
}
VECTORIZE_VEC(fastExp)
// fastLog
template <typename T>
GLM_FUNC_QUALIFIER T fastLog(const T x)
template <typename genType>
GLM_FUNC_QUALIFIER genType fastLog(genType const & x)
{
return std::log(x);
}
@ -183,108 +127,24 @@ GLM_FUNC_QUALIFIER float fastLog(float x)
}
*/
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastLog(x.x),
fastLog(x.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastLog(x.x),
fastLog(x.y),
fastLog(x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastLog(x.x),
fastLog(x.y),
fastLog(x.z),
fastLog(x.w));
}
VECTORIZE_VEC(fastLog)
//fastExp2, ln2 = 0.69314718055994530941723212145818f
template <typename T>
GLM_FUNC_QUALIFIER T fastExp2(const T x)
template <typename genType>
GLM_FUNC_QUALIFIER genType fastExp2(genType const & x)
{
return fastExp(0.69314718055994530941723212145818f * x);
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastExp2(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastExp2(x.x),
fastExp2(x.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastExp2(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastExp2(x.x),
fastExp2(x.y),
fastExp2(x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastExp2(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastExp2(x.x),
fastExp2(x.y),
fastExp2(x.z),
fastExp2(x.w));
}
VECTORIZE_VEC(fastExp2)
// fastLog2, ln2 = 0.69314718055994530941723212145818f
template <typename T>
GLM_FUNC_QUALIFIER T fastLog2(const T x)
template <typename genType>
GLM_FUNC_QUALIFIER genType fastLog2(genType const & x)
{
return fastLog(x) / 0.69314718055994530941723212145818f;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastLog2(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastLog2(x.x),
fastLog2(x.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastLog2(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastLog2(x.x),
fastLog2(x.y),
fastLog2(x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastLog2(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastLog2(x.x),
fastLog2(x.y),
fastLog2(x.z),
fastLog2(x.w));
}
VECTORIZE_VEC(fastLog2)
}//namespace glm

View File

@ -2,267 +2,76 @@
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2006-01-08
// Updated : 2006-01-08
// Updated : 2011-10-14
// Licence : This source is under MIT License
// File : glm/gtx/fast_trigonometry.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
#include "../core/_vectorize.hpp"
namespace glm
{
// sin
template <typename T>
GLM_FUNC_QUALIFIER T fastSin(const T x)
GLM_FUNC_QUALIFIER T fastSin(T const & x)
{
return x - ((x * x * x) / T(6)) + ((x * x * x * x * x) / T(120)) - ((x * x * x * x * x * x * x) / T(5040));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastSin(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastSin(x.x),
fastSin(x.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastSin(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastSin(x.x),
fastSin(x.y),
fastSin(x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastSin(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastSin(x.x),
fastSin(x.y),
fastSin(x.z),
fastSin(x.w));
}
VECTORIZE_VEC(fastSin)
// cos
template <typename T>
GLM_FUNC_QUALIFIER T fastCos(const T x)
GLM_FUNC_QUALIFIER T fastCos(T const & x)
{
return T(1) - (x * x * T(0.5)) + (x * x * x * x * T(0.041666666666)) - (x * x * x * x * x * x * T(0.00138888888888));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastCos(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastCos(x.x),
fastCos(x.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastCos(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastCos(x.x),
fastCos(x.y),
fastCos(x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastCos(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastCos(x.x),
fastCos(x.y),
fastCos(x.z),
fastCos(x.w));
}
VECTORIZE_VEC(fastCos)
// tan
template <typename T>
GLM_FUNC_QUALIFIER T fastTan(const T x)
GLM_FUNC_QUALIFIER T fastTan(T const & x)
{
return x + (x * x * x * T(0.3333333333)) + (x * x * x * x * x * T(0.1333333333333)) + (x * x * x * x * x * x * x * T(0.0539682539));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastTan(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastTan(x.x),
fastTan(x.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastTan(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastTan(x.x),
fastTan(x.y),
fastTan(x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastTan(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastTan(x.x),
fastTan(x.y),
fastTan(x.z),
fastTan(x.w));
}
VECTORIZE_VEC(fastTan)
// asin
template <typename T>
GLM_FUNC_QUALIFIER T fastAsin(const T x)
GLM_FUNC_QUALIFIER T fastAsin(T const & x)
{
return x + (x * x * x * T(0.166666667)) + (x * x * x * x * x * T(0.075)) + (x * x * x * x * x * x * x * T(0.0446428571)) + (x * x * x * x * x * x * x * x * x * T(0.0303819444));// + (x * x * x * x * x * x * x * x * x * x * x * T(0.022372159));
}
template <typename T> detail::tvec2<T> fastAsin(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastAsin(x.x),
fastAsin(x.y));
}
template <typename T> detail::tvec3<T> fastAsin(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastAsin(x.x),
fastAsin(x.y),
fastAsin(x.z));
}
template <typename T> detail::tvec4<T> fastAsin(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastAsin(x.x),
fastAsin(x.y),
fastAsin(x.z),
fastAsin(x.w));
}
VECTORIZE_VEC(fastAsin)
// acos
template <typename T>
GLM_FUNC_QUALIFIER T fastAcos(const T x)
GLM_FUNC_QUALIFIER T fastAcos(T const & x)
{
return T(1.5707963267948966192313216916398) - fastAsin(x); //(PI / 2)
}
template <typename T> detail::tvec2<T> fastAcos(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastAcos(x.x),
fastAcos(x.y));
}
template <typename T> detail::tvec3<T> fastAcos(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastAcos(x.x),
fastAcos(x.y),
fastAcos(x.z));
}
template <typename T> detail::tvec4<T> fastAcos(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastAcos(x.x),
fastAcos(x.y),
fastAcos(x.z),
fastAcos(x.w));
}
VECTORIZE_VEC(fastAcos)
// atan
template <typename T>
GLM_FUNC_QUALIFIER T fastAtan(const T y, const T x)
GLM_FUNC_QUALIFIER T fastAtan(T const & y, T const & x)
{
T sgn = sign(y) * sign(x);
return abs(fastAtan(y / x)) * sgn;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan(
const detail::tvec2<T>& y,
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastAtan(y.x, x.x),
fastAtan(y.y, x.y));
}
VECTORIZE_VEC_VEC(fastAtan)
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan(
const detail::tvec3<T>& y,
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastAtan(y.x, x.x),
fastAtan(y.y, x.y),
fastAtan(y.z, x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan(
const detail::tvec4<T>& y,
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastAtan(y.x, x.x),
fastAtan(y.y, x.y),
fastAtan(y.z, x.z),
fastAtan(y.w, x.w));
}
template <typename T>
GLM_FUNC_QUALIFIER T fastAtan(const T x)
GLM_FUNC_QUALIFIER T fastAtan(T const & x)
{
return x - (x * x * x * T(0.333333333333)) + (x * x * x * x * x * T(0.2)) - (x * x * x * x * x * x * x * T(0.1428571429)) + (x * x * x * x * x * x * x * x * x * T(0.111111111111)) - (x * x * x * x * x * x * x * x * x * x * x * T(0.0909090909));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> fastAtan(
const detail::tvec2<T>& x)
{
return detail::tvec2<T>(
fastAtan(x.x),
fastAtan(x.y));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> fastAtan(
const detail::tvec3<T>& x)
{
return detail::tvec3<T>(
fastAtan(x.x),
fastAtan(x.y),
fastAtan(x.z));
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> fastAtan(
const detail::tvec4<T>& x)
{
return detail::tvec4<T>(
fastAtan(x.x),
fastAtan(x.y),
fastAtan(x.z),
fastAtan(x.w));
}
VECTORIZE_VEC(fastAtan)
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/gradient_paint.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename valType>
valType radialGradient
(
@ -40,5 +40,4 @@ valType linearGradient
detail::tvec2<valType> Dist = Point1 - Point0;
return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist);
}
}//namespace glm

View File

@ -7,24 +7,27 @@
// File : glm/gtx/handed_coordinate_space.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER bool rightHanded(
GLM_FUNC_QUALIFIER bool rightHanded
(
detail::tvec3<T> const & tangent,
detail::tvec3<T> const & binormal,
detail::tvec3<T> const & normal)
detail::tvec3<T> const & normal
)
{
return dot(cross(normal, tangent), binormal) > T(0);
}
template <typename T>
GLM_FUNC_QUALIFIER bool leftHanded(
GLM_FUNC_QUALIFIER bool leftHanded
(
detail::tvec3<T> const & tangent,
detail::tvec3<T> const & binormal,
detail::tvec3<T> const & normal)
detail::tvec3<T> const & normal
)
{
return dot(cross(normal, tangent), binormal) < T(0);
}
}//namespace glm

View File

@ -55,57 +55,57 @@ namespace glm
//! From GLM_GTX_inertia extension.
template <typename T>
detail::tmat3x3<T> boxInertia3(
const T Mass,
const detail::tvec3<T>& Scale);
T const & Mass,
detail::tvec3<T> const & Scale);
//! Build an inertia matrix for a box.
//! From GLM_GTX_inertia extension.
template <typename T>
detail::tmat4x4<T> boxInertia4(
const T Mass,
const detail::tvec3<T>& Scale);
T const & Mass,
detail::tvec3<T> const & Scale);
//! Build an inertia matrix for a disk.
//! From GLM_GTX_inertia extension.
template <typename T>
detail::tmat3x3<T> diskInertia3(
const T Mass,
const T Radius);
T const & Mass,
T const & Radius);
//! Build an inertia matrix for a disk.
//! From GLM_GTX_inertia extension.
template <typename T>
detail::tmat4x4<T> diskInertia4(
const T Mass,
const T Radius);
T const & Mass,
T const & Radius);
//! Build an inertia matrix for a ball.
//! From GLM_GTX_inertia extension.
template <typename T>
detail::tmat3x3<T> ballInertia3(
const T Mass,
const T Radius);
T const & Mass,
T const & Radius);
//! Build an inertia matrix for a ball.
//! From GLM_GTX_inertia extension.
template <typename T>
detail::tmat4x4<T> ballInertia4(
const T Mass,
const T Radius);
T const & Mass,
T const & Radius);
//! Build an inertia matrix for a sphere.
//! From GLM_GTX_inertia extension.
template <typename T>
detail::tmat3x3<T> sphereInertia3(
const T Mass,
const T Radius);
T const & Mass,
T const & Radius);
//! Build an inertia matrix for a sphere.
//! From GLM_GTX_inertia extension.
template <typename T>
detail::tmat4x4<T> sphereInertia4(
const T Mass,
const T Radius);
T const & Mass,
T const & Radius);
/// @}
}// namespace glm

View File

@ -7,12 +7,14 @@
// File : glm/gtx/inertia.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3(
const T Mass,
const detail::tvec3<T>& Scale)
GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3
(
T const & Mass,
detail::tvec3<T> const & Scale
)
{
detail::tmat3x3<T> Result(T(1));
Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
@ -22,9 +24,11 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> boxInertia3(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4(
const T Mass,
const detail::tvec3<T>& Scale)
GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4
(
T const & Mass,
detail::tvec3<T> const & Scale
)
{
detail::tmat4x4<T> Result(T(1));
Result[0][0] = (Scale.y * Scale.y + Scale.z * Scale.z) * Mass / T(12);
@ -34,9 +38,11 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> boxInertia4(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3(
const T Mass,
const T Radius)
GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3
(
T const & Mass,
T const & Radius
)
{
T a = Mass * Radius * Radius / T(2);
detail::tmat3x3<T> Result(a);
@ -45,9 +51,11 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> diskInertia3(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4(
const T Mass,
const T Radius)
GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4
(
T const & Mass,
T const & Radius
)
{
T a = Mass * Radius * Radius / T(2);
detail::tmat4x4<T> Result(a);
@ -57,18 +65,22 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> diskInertia4(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> ballInertia3(
const T Mass,
const T Radius)
GLM_FUNC_QUALIFIER detail::tmat3x3<T> ballInertia3
(
T const & Mass,
T const & Radius
)
{
T a = T(2) * Mass * Radius * Radius / T(5);
return detail::tmat3x3<T>(a);
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4(
const T Mass,
const T Radius)
GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4
(
T const & Mass,
T const & Radius
)
{
T a = T(2) * Mass * Radius * Radius / T(5);
detail::tmat4x4<T> Result(a);
@ -77,23 +89,26 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> ballInertia4(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> sphereInertia3(
const T Mass,
const T Radius)
GLM_FUNC_QUALIFIER detail::tmat3x3<T> sphereInertia3
(
T const & Mass,
T const & Radius
)
{
T a = T(2) * Mass * Radius * Radius / T(3);
return detail::tmat3x3<T>(a);
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> sphereInertia4(
const T Mass,
const T Radius)
GLM_FUNC_QUALIFIER detail::tmat4x4<T> sphereInertia4
(
T const & Mass,
T const & Radius
)
{
T a = T(2) * Mass * Radius * Radius / T(3);
detail::tmat4x4<T> Result(a);
Result[3][3] = T(1);
return Result;
}
}//namespace glm

View File

@ -7,11 +7,13 @@
// File : glm/gtx/int_10_10_10_2.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast(glm::vec4 const & v)
namespace glm
{
GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast
(
glm::vec4 const & v
)
{
return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30);
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/integer.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
// pow
GLM_FUNC_QUALIFIER int pow(int x, int y)
{

View File

@ -10,8 +10,8 @@
#include <cfloat>
#include <limits>
namespace glm{
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER bool intersectRayTriangle
(
@ -193,5 +193,4 @@ GLM_FUNC_QUALIFIER bool intersectLineSphere
}
return false;
}
}//namespace glm

View File

@ -7,8 +7,10 @@
// File : glm/gtx/log_base.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
#include "../core/_vectorize.hpp"
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER genType log(
genType const & x,
@ -19,70 +21,6 @@ GLM_FUNC_QUALIFIER genType log(
return glm::log(x) / glm::log(base);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> log(
detail::tvec2<valType> const & v,
valType const & base)
{
return detail::tvec2<valType>(
log(v.x, base),
log(v.y, base));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> log(
detail::tvec3<valType> const & v,
valType const & base)
{
return detail::tvec3<valType>(
log(v.x, base),
log(v.y, base),
log(v.z, base));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
detail::tvec4<valType> const & v,
valType const & base)
{
return detail::tvec4<valType>(
log(v.x, base),
log(v.y, base),
log(v.z, base),
log(v.w, base));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> log(
detail::tvec2<valType> const & v,
detail::tvec2<valType> const & base)
{
return detail::tvec2<valType>(
log(v.x, base.x),
log(v.y, base.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> log(
detail::tvec3<valType> const & v,
detail::tvec3<valType> const & base)
{
return detail::tvec3<valType>(
log(v.x, base.x),
log(v.y, base.y),
log(v.z, base.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> log(
detail::tvec4<valType> const & v,
detail::tvec4<valType> const & base)
{
return detail::tvec4<valType>(
log(v.x, base.x),
log(v.y, base.y),
log(v.z, base.z),
log(v.w, base.w));
}
VECTORIZE_VEC_SCA(log)
VECTORIZE_VEC_VEC(log)
}//namespace glm

View File

@ -7,11 +7,13 @@
// File : glm/gtx/matrix_cross_product.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3(
detail::tvec3<T> const & x)
GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3
(
detail::tvec3<T> const & x
)
{
detail::tmat3x3<T> Result(T(0));
Result[0][1] = x.z;
@ -24,8 +26,10 @@ GLM_FUNC_QUALIFIER detail::tmat3x3<T> matrixCross3(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> matrixCross4(
detail::tvec3<T> const & x)
GLM_FUNC_QUALIFIER detail::tmat4x4<T> matrixCross4
(
detail::tvec3<T> const & x
)
{
detail::tmat4x4<T> Result(T(0));
Result[0][1] = x.z;

View File

@ -7,13 +7,15 @@
// File : glm/gtx/matrix_interpolation.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER void axisAngle(
GLM_FUNC_QUALIFIER void axisAngle
(
detail::tmat4x4<T> const & mat,
detail::tvec3<T> & axis,
T & angle)
T & angle
)
{
T epsilon = (T)0.01;
T epsilon2 = (T)0.1;
@ -76,9 +78,11 @@ GLM_FUNC_QUALIFIER void axisAngle(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix(
GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix
(
detail::tvec3<T> const & axis,
T const angle)
T const angle
)
{
T c = cos(angle);
T s = sin(angle);
@ -94,10 +98,12 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate(
GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate
(
detail::tmat4x4<T> const & m1,
detail::tmat4x4<T> const & m2,
T const delta)
T const delta
)
{
detail::tmat4x4<T> dltRotation = m2 * transpose(m1);
detail::tvec3<T> dltAxis;
@ -109,5 +115,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate(
out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]);
return out;
}
}//namespace glm

View File

@ -55,85 +55,85 @@ namespace glm
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat2x2<T> rowMajor2(
const detail::tvec2<T>& v1,
const detail::tvec2<T>& v2);
detail::tvec2<T> const & v1,
detail::tvec2<T> const & v2);
//! Build a row major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat2x2<T> rowMajor2(
const detail::tmat2x2<T>& m);
detail::tmat2x2<T> const & m);
//! Build a row major matrix from row vectors.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat3x3<T> rowMajor3(
const detail::tvec3<T>& v1,
const detail::tvec3<T>& v2,
const detail::tvec3<T>& v3);
detail::tvec3<T> const & v1,
detail::tvec3<T> const & v2,
detail::tvec3<T> const & v3);
//! Build a row major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat3x3<T> rowMajor3(
const detail::tmat3x3<T>& m);
detail::tmat3x3<T> const & m);
//! Build a row major matrix from row vectors.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat4x4<T> rowMajor4(
const detail::tvec4<T>& v1,
const detail::tvec4<T>& v2,
const detail::tvec4<T>& v3,
const detail::tvec4<T>& v4);
detail::tvec4<T> const & v1,
detail::tvec4<T> const & v2,
detail::tvec4<T> const & v3,
detail::tvec4<T> const & v4);
//! Build a row major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat4x4<T> rowMajor4(
const detail::tmat4x4<T>& m);
detail::tmat4x4<T> const & m);
//! Build a column major matrix from column vectors.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat2x2<T> colMajor2(
const detail::tvec2<T>& v1,
const detail::tvec2<T>& v2);
detail::tvec2<T> const & v1,
detail::tvec2<T> const & v2);
//! Build a column major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat2x2<T> colMajor2(
const detail::tmat2x2<T>& m);
detail::tmat2x2<T> const & m);
//! Build a column major matrix from column vectors.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat3x3<T> colMajor3(
const detail::tvec3<T>& v1,
const detail::tvec3<T>& v2,
const detail::tvec3<T>& v3);
detail::tvec3<T> const & v1,
detail::tvec3<T> const & v2,
detail::tvec3<T> const & v3);
//! Build a column major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat3x3<T> colMajor3(
const detail::tmat3x3<T>& m);
detail::tmat3x3<T> const & m);
//! Build a column major matrix from column vectors.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat4x4<T> colMajor4(
const detail::tvec4<T>& v1,
const detail::tvec4<T>& v2,
const detail::tvec4<T>& v3,
const detail::tvec4<T>& v4);
detail::tvec4<T> const & v1,
detail::tvec4<T> const & v2,
detail::tvec4<T> const & v3,
detail::tvec4<T> const & v4);
//! Build a column major matrix from other matrix.
//! From GLM_GTX_matrix_major_storage extension.
template <typename T>
detail::tmat4x4<T> colMajor4(
const detail::tmat4x4<T>& m);
detail::tmat4x4<T> const & m);
/// @}
}//namespace glm

View File

@ -7,12 +7,14 @@
// File : glm/gtx/matrix_major_storage.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2(
const detail::tvec2<T>& v1,
const detail::tvec2<T>& v2)
GLM_FUNC_QUALIFIER detail::tmat2x2<T> rowMajor2
(
detail::tvec2<T> const & v1,
detail::tvec2<T> const & v2
)
{
detail::tmat2x2<T> Result;
Result[0][0] = v1.x;
@ -168,5 +170,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> colMajor4(
{
return detail::tmat4x4<T>(m);
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/matrix_operation.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename valType>
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> diagonal2x2
(
@ -121,5 +121,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x2<valType> diagonal4x2
Result[1][1] = v[1];
return Result;
}
}//namespace glm

View File

@ -56,57 +56,57 @@ namespace glm
//! From GLM_GTX_matrix_query extension.
template<typename T>
bool isNull(
const detail::tmat2x2<T>& m,
const T epsilon = std::numeric_limits<T>::epsilon());
detail::tmat2x2<T> const & m,
T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix a null matrix.
//! From GLM_GTX_matrix_query extension.
template<typename T>
bool isNull(
const detail::tmat3x3<T>& m,
const T epsilon = std::numeric_limits<T>::epsilon());
detail::tmat3x3<T> const & m,
T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix a null matrix.
//! From GLM_GTX_matrix_query extension.
template<typename T>
bool isNull(
const detail::tmat4x4<T>& m,
const T epsilon = std::numeric_limits<T>::epsilon());
detail::tmat4x4<T> const & m,
T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix an identity matrix.
//! From GLM_GTX_matrix_query extension.
template<typename genType>
bool isIdentity(
const genType& m,
const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
genType const & m,
typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
//! Return if a matrix a normalized matrix.
//! From GLM_GTX_matrix_query extension.
template<typename T>
bool isNormalized(
const detail::tmat2x2<T>& m,
const T epsilon = std::numeric_limits<T>::epsilon());
detail::tmat2x2<T> const & m,
T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix a normalized matrix.
//! From GLM_GTX_matrix_query extension.
template<typename T>
bool isNormalized(
const detail::tmat3x3<T>& m,
const T epsilon = std::numeric_limits<T>::epsilon());
detail::tmat3x3<T> const & m,
T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix a normalized matrix.
//! From GLM_GTX_matrix_query extension.
template<typename T>
bool isNormalized(
const detail::tmat4x4<T>& m,
const T epsilon = std::numeric_limits<T>::epsilon());
detail::tmat4x4<T> const & m,
T const & epsilon = std::numeric_limits<T>::epsilon());
//! Return if a matrix an orthonormalized matrix.
//! From GLM_GTX_matrix_query extension.
template<typename genType>
bool isOrthogonal(
const genType& m,
const typename genType::value_type epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
genType const & m,
typename genType::value_type const & epsilon = std::numeric_limits<typename genType::value_type>::epsilon());
/// @}
}//namespace glm

View File

@ -10,12 +10,13 @@
// - GLM core
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template<typename T>
GLM_FUNC_QUALIFIER bool isNull(
const detail::tmat2x2<T>& m,
const T epsilon)
GLM_FUNC_QUALIFIER bool isNull
(
detail::tmat2x2<T> const & m,
T const & epsilon)
{
bool result = true;
for(int i = 0; result && i < 2 ; ++i)
@ -24,9 +25,11 @@ GLM_FUNC_QUALIFIER bool isNull(
}
template<typename T>
GLM_FUNC_QUALIFIER bool isNull(
const detail::tmat3x3<T>& m,
const T epsilon)
GLM_FUNC_QUALIFIER bool isNull
(
detail::tmat3x3<T> const & m,
T const & epsilon
)
{
bool result = true;
for(int i = 0; result && i < 3 ; ++i)
@ -35,9 +38,11 @@ GLM_FUNC_QUALIFIER bool isNull(
}
template<typename T>
GLM_FUNC_QUALIFIER bool isNull(
const detail::tmat4x4<T>& m,
const T epsilon)
GLM_FUNC_QUALIFIER bool isNull
(
detail::tmat4x4<T> const & m,
T const & epsilon
)
{
bool result = true;
for(int i = 0; result && i < 4 ; ++i)
@ -46,9 +51,11 @@ GLM_FUNC_QUALIFIER bool isNull(
}
template<typename genType>
GLM_FUNC_QUALIFIER bool isIdentity(
const genType& m,
const typename genType::value_type epsilon)
GLM_FUNC_QUALIFIER bool isIdentity
(
genType const & m,
typename genType::value_type const & epsilon
)
{
bool result = true;
for(typename genType::value_type i = typename genType::value_type(0); result && i < genType::col_size(); ++i)
@ -64,9 +71,11 @@ GLM_FUNC_QUALIFIER bool isIdentity(
}
template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized(
const detail::tmat2x2<T>& m,
const T epsilon)
GLM_FUNC_QUALIFIER bool isNormalized
(
detail::tmat2x2<T> const & m,
T const & epsilon
)
{
bool result = true;
for(int i = 0; result && i < 2; ++i)
@ -82,9 +91,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
}
template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized(
const detail::tmat3x3<T>& m,
const T epsilon)
GLM_FUNC_QUALIFIER bool isNormalized
(
detail::tmat3x3<T> const & m,
T const & epsilon
)
{
bool result = true;
for(int i = 0; result && i < 3; ++i)
@ -100,9 +111,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
}
template<typename T>
GLM_FUNC_QUALIFIER bool isNormalized(
const detail::tmat4x4<T>& m,
const T epsilon)
GLM_FUNC_QUALIFIER bool isNormalized
(
detail::tmat4x4<T> const & m,
T const & epsilon
)
{
bool result = true;
for(int i = 0; result && i < 4; ++i)
@ -118,9 +131,11 @@ GLM_FUNC_QUALIFIER bool isNormalized(
}
template<typename genType>
GLM_FUNC_QUALIFIER bool isOrthogonal(
const genType& m,
const typename genType::value_type epsilon)
GLM_FUNC_QUALIFIER bool isOrthogonal
(
genType const & m,
typename genType::value_type const & epsilon
)
{
bool result = true;
for(int i = 0; result && i < genType::col_size() - 1; ++i)
@ -136,5 +151,4 @@ GLM_FUNC_QUALIFIER bool isOrthogonal(
}
return result;
}
}//namespace glm

View File

@ -7,15 +7,16 @@
// File : glm/gtx/mixed_product.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename valType>
GLM_FUNC_QUALIFIER valType mixedProduct(
GLM_FUNC_QUALIFIER valType mixedProduct
(
detail::tvec3<valType> const & v1,
detail::tvec3<valType> const & v2,
detail::tvec3<valType> const & v3)
detail::tvec3<valType> const & v3
)
{
return dot(cross(v1, v2), v3);
}
}//namespace glm

View File

@ -10,8 +10,10 @@
// - GLM core
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
#include "../core/_vectorize.hpp"
namespace glm
{
//////////////////////
// higherMultiple
@ -62,44 +64,7 @@ GLM_FUNC_QUALIFIER double higherMultiple
return Tmp ? Source + Multiple - double(Tmp) : Source;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> higherMultiple
(
detail::tvec2<T> const & Source,
detail::tvec2<T> const & Multiple
)
{
detail::tvec2<T> Result;
for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> higherMultiple
(
detail::tvec3<T> const & Source,
detail::tvec3<T> const & Multiple
)
{
detail::tvec3<T> Result;
for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> higherMultiple
(
detail::tvec4<T> const & Source,
detail::tvec4<T> const & Multiple
)
{
detail::tvec4<T> Result;
for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
Result[i] = higherMultiple(Source[i], Multiple[i]);
return Result;
}
VECTORIZE_VEC_VEC(higherMultiple)
//////////////////////
// lowerMultiple
@ -151,43 +116,5 @@ GLM_FUNC_QUALIFIER double lowerMultiple
return Tmp ? Source - double(Tmp) : Source;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> lowerMultiple
(
detail::tvec2<T> const & Source,
detail::tvec2<T> const & Multiple
)
{
detail::tvec2<T> Result;
for(typename detail::tvec2<T>::size_type i = 0; i < detail::tvec2<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> lowerMultiple
(
detail::tvec3<T> const & Source,
detail::tvec3<T> const & Multiple
)
{
detail::tvec3<T> Result;
for(typename detail::tvec3<T>::size_type i = 0; i < detail::tvec3<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> lowerMultiple
(
detail::tvec4<T> const & Source,
detail::tvec4<T> const & Multiple
)
{
detail::tvec4<T> Result;
for(typename detail::tvec4<T>::size_type i = 0; i < detail::tvec4<T>::value_size(); ++i)
Result[i] = lowerMultiple(Source[i], Multiple[i]);
return Result;
}
VECTORIZE_VEC_VEC(lowerMultiple)
}//namespace glm

View File

@ -56,99 +56,73 @@ namespace glm
//! From GLM_GTX_norm extension.
template <typename T>
T length2(
const T x);
T const & x);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename genType>
typename genType::value_type length2(
genType const & x);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename T>
T length2(
const detail::tvec2<T> & x);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename T>
T length2(
const detail::tvec3<T>& x);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename T>
T length2(
const detail::tvec4<T>& x);
//! Returns the squared length of x.
//! From GLM_GTX_norm extension.
template <typename T>
T length2(
const detail::tquat<T>& q);
detail::tquat<T> const & q);
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
//! From GLM_GTX_norm extension.
template <typename T>
T distance2(
const T p0,
const T p1);
T const & p0,
T const & p1);
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
//! From GLM_GTX_norm extension.
template <typename T>
T distance2(
const detail::tvec2<T>& p0,
const detail::tvec2<T>& p1);
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
//! From GLM_GTX_norm extension.
template <typename T>
T distance2(
const detail::tvec3<T>& p0,
const detail::tvec3<T>& p1);
//! Returns the squared distance between p0 and p1, i.e., length(p0 - p1).
//! From GLM_GTX_norm extension.
template <typename T>
T distance2(
const detail::tvec4<T>& p0,
const detail::tvec4<T>& p1);
template <typename genType>
typename genType::value_type distance2(
genType const & p0,
genType const & p1);
//! Returns the L1 norm between x and y.
//! From GLM_GTX_norm extension.
template <typename T>
T l1Norm(
const detail::tvec3<T>& x,
const detail::tvec3<T>& y);
detail::tvec3<T> const & x,
detail::tvec3<T> const & y);
//! Returns the L1 norm of v.
//! From GLM_GTX_norm extension.
template <typename T>
T l1Norm(
const detail::tvec3<T>& v);
detail::tvec3<T> const & v);
//! Returns the L2 norm between x and y.
//! From GLM_GTX_norm extension.
template <typename T>
T l2Norm(
const detail::tvec3<T>& x,
const detail::tvec3<T>& y);
detail::tvec3<T> const & x,
detail::tvec3<T> const & y);
//! Returns the L2 norm of v.
//! From GLM_GTX_norm extension.
template <typename T>
T l2Norm(
const detail::tvec3<T>& x);
detail::tvec3<T> const & x);
//! Returns the L norm between x and y.
//! From GLM_GTX_norm extension.
template <typename T>
T lxNorm(
const detail::tvec3<T>& x,
const detail::tvec3<T>& y,
detail::tvec3<T> const & x,
detail::tvec3<T> const & y,
unsigned int Depth);
//! Returns the L norm of v.
//! From GLM_GTX_norm extension.
template <typename T>
T lxNorm(
const detail::tvec3<T>& x,
detail::tvec3<T> const & x,
unsigned int Depth);
/// @}

View File

@ -7,118 +7,148 @@
// File : glm/gtx/norm.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER T length2(
const T x)
GLM_FUNC_QUALIFIER T length2
(
T const & x
)
{
return x * x;
}
template <typename T>
GLM_FUNC_QUALIFIER T length2(
const detail::tvec2<T>& x)
GLM_FUNC_QUALIFIER T length2
(
detail::tvec2<T> const & x
)
{
return dot(x, x);
}
template <typename T>
GLM_FUNC_QUALIFIER T length2(
const detail::tvec3<T>& x)
GLM_FUNC_QUALIFIER T length2
(
detail::tvec3<T> const & x
)
{
return dot(x, x);
}
template <typename T>
GLM_FUNC_QUALIFIER T length2(
const detail::tvec4<T>& x)
GLM_FUNC_QUALIFIER T length2
(
detail::tvec4<T> const & x
)
{
return dot(x, x);
}
template <typename T>
GLM_FUNC_QUALIFIER T length2(
const detail::tquat<T>& q)
GLM_FUNC_QUALIFIER T length2
(
detail::tquat<T> const & q
)
{
return q.x * q.x + q.y * q.y + q.z * q.z + q.w * q.w;
}
template <typename T>
T distance2(
const T p0,
const T p1)
GLM_FUNC_QUALIFIER T distance2
(
T const & p0,
T const & p1
)
{
return length2(p1 - p0);
}
template <typename T>
T distance2(
const detail::tvec2<T>& p0,
const detail::tvec2<T>& p1)
GLM_FUNC_QUALIFIER T distance2
(
detail::tvec2<T> const & p0,
detail::tvec2<T> const & p1
)
{
return length2(p1 - p0);
}
template <typename T>
T distance2(
const detail::tvec3<T>& p0,
const detail::tvec3<T>& p1)
GLM_FUNC_QUALIFIER T distance2
(
detail::tvec3<T> const & p0,
detail::tvec3<T> const & p1
)
{
return length2(p1 - p0);
}
template <typename T>
T distance2(
const detail::tvec4<T>& p0,
const detail::tvec4<T>& p1)
GLM_FUNC_QUALIFIER T distance2
(
detail::tvec4<T> const & p0,
detail::tvec4<T> const & p1
)
{
return length2(p1 - p0);
}
template <typename T>
GLM_FUNC_QUALIFIER T l1Norm(
const detail::tvec3<T>& a,
const detail::tvec3<T>& b)
GLM_FUNC_QUALIFIER T l1Norm
(
detail::tvec3<T> const & a,
detail::tvec3<T> const & b
)
{
return abs(b.x - a.x) + abs(b.y - a.y) + abs(b.z - a.z);
}
template <typename T>
GLM_FUNC_QUALIFIER T l1Norm(
const detail::tvec3<T>& v)
GLM_FUNC_QUALIFIER T l1Norm
(
detail::tvec3<T> const & v
)
{
return abs(v.x) + abs(v.y) + abs(v.z);
}
template <typename T>
GLM_FUNC_QUALIFIER T l2Norm(
const detail::tvec3<T>& a,
const detail::tvec3<T>& b)
GLM_FUNC_QUALIFIER T l2Norm
(
detail::tvec3<T> const & a,
detail::tvec3<T> const & b
)
{
return length(b - a);
}
template <typename T>
GLM_FUNC_QUALIFIER T l2Norm(
const detail::tvec3<T>& v)
GLM_FUNC_QUALIFIER T l2Norm
(
detail::tvec3<T> const & v
)
{
return length(v);
}
template <typename T>
GLM_FUNC_QUALIFIER T lxNorm(
const detail::tvec3<T>& x,
const detail::tvec3<T>& y,
unsigned int Depth)
GLM_FUNC_QUALIFIER T lxNorm
(
detail::tvec3<T> const & x,
detail::tvec3<T> const & y,
unsigned int Depth
)
{
return pow(pow(y.x - x.x, T(Depth)) + pow(y.y - x.y, T(Depth)) + pow(y.z - x.z, T(Depth)), T(1) / T(Depth));
}
template <typename T>
GLM_FUNC_QUALIFIER T lxNorm(
const detail::tvec3<T>& v,
unsigned int Depth)
GLM_FUNC_QUALIFIER T lxNorm
(
detail::tvec3<T> const & v,
unsigned int Depth
)
{
return pow(pow(v.x, T(Depth)) + pow(v.y, T(Depth)) + pow(v.z, T(Depth)), T(1) / T(Depth));
}

View File

@ -7,8 +7,8 @@
// File : glm/gtx/normal.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal
(
@ -19,5 +19,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> triangleNormal
{
return normalize(cross(p1 - p2, p1 - p3));
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/normalize_dot.inl
//////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER genType normalizeDot
(
@ -112,5 +112,4 @@ GLM_FUNC_QUALIFIER valType fastNormalizeDot
fastInverseSqrt(glm::dot(x, x) *
glm::dot(y, y));
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/optimum_pow.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER genType pow2(const genType& x)
{
@ -55,5 +55,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> powOfTwo(const detail::tvec4<int>& x)
powOfTwo(x.z),
powOfTwo(x.w));
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/orthonormalize.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> orthonormalize
(
@ -40,5 +40,4 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> orthonormalize
{
return normalize(x - y * dot(y, x));
}
}//namespace glm

View File

@ -54,24 +54,10 @@ namespace glm
//! Projects x a perpendicular axis of Normal.
//! From GLM_GTX_perpendicular extension.
template <typename T>
detail::tvec2<T> perp(
detail::tvec2<T> const & x,
detail::tvec2<T> const & Normal);
//! Projects x a perpendicular axis of Normal.
//! From GLM_GTX_perpendicular extension.
template <typename T>
detail::tvec3<T> perp(
detail::tvec3<T> const & x,
detail::tvec3<T> const & Normal);
//! Projects x a perpendicular axis of Normal.
//! From GLM_GTX_perpendicular extension.
template <typename T>
detail::tvec4<T> perp(
detail::tvec4<T> const & x,
detail::tvec4<T> const & Normal);
template <typename vecType>
vecType perp(
vecType const & x,
vecType const & Normal);
/// @}
}//namespace glm

View File

@ -7,30 +7,15 @@
// File : glm/gtx/perpendicular.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> perp(
detail::tvec2<T> const & x,
detail::tvec2<T> const & Normal)
namespace glm
{
template <typename vecType>
GLM_FUNC_QUALIFIER vecType perp
(
vecType const & x,
vecType const & Normal
)
{
return x - proj(x, Normal);
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> perp(
detail::tvec3<T> const & x,
detail::tvec3<T> const & Normal)
{
return x - proj(x, Normal);
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> perp(
detail::tvec4<T> const & x,
detail::tvec4<T> const & Normal)
{
return x - proj(x, Normal);
}
}//namespace glm

View File

@ -53,12 +53,14 @@ namespace glm
//! Convert Euclidean to Polar coordinates, x is the xz distance, y, the latitude and z the longitude.
//! From GLM_GTX_polar_coordinates extension.
template <typename T>
detail::tvec3<T> polar(const detail::tvec3<T>& euclidean);
detail::tvec3<T> polar(
detail::tvec3<T> const & euclidean);
//! Convert Polar to Euclidean coordinates.
//! From GLM_GTX_polar_coordinates extension.
template <typename T>
detail::tvec3<T> euclidean(const detail::tvec3<T>& polar);
detail::tvec3<T> euclidean(
detail::tvec3<T> const & polar);
/// @}
}//namespace glm

View File

@ -10,8 +10,10 @@
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> polar(
const detail::tvec3<T>& euclidean)
GLM_FUNC_QUALIFIER detail::tvec3<T> polar
(
detail::tvec3<T> const & euclidean
)
{
T length = length(euclidean);
detail::tvec3<T> tmp = euclidean / length;
@ -24,8 +26,10 @@ namespace glm
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> euclidean(
const detail::tvec3<T>& polar)
GLM_FUNC_QUALIFIER detail::tvec3<T> euclidean
(
detail::tvec3<T> const & polar
)
{
T latitude = radians(polar.x);
T longitude = radians(polar.y);

View File

@ -52,24 +52,10 @@ namespace glm
//! Projects x on Normal.
//! From GLM_GTX_projection extension.
template <typename T>
detail::tvec2<T> proj(
detail::tvec2<T> const & x,
detail::tvec2<T> const & Normal);
//! Projects x on Normal.
//! From GLM_GTX_projection extension.
template <typename T>
detail::tvec3<T> proj(
detail::tvec3<T> const & x,
detail::tvec3<T> const & Normal);
//! Projects x on Normal.
//! From GLM_GTX_projection extension.
template <typename T>
detail::tvec4<T> proj(
detail::tvec4<T> const & x,
detail::tvec4<T> const & Normal);
template <typename vecType>
vecType proj(
vecType const & x,
vecType const & Normal);
/// @}
}//namespace glm

View File

@ -7,30 +7,15 @@
// File : glm/gtx/projection.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> proj(
detail::tvec2<T> const & x,
detail::tvec2<T> const & Normal)
namespace glm
{
template <typename vecType>
GLM_FUNC_QUALIFIER vecType proj
(
vecType const & x,
vecType const & Normal
)
{
return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> proj(
detail::tvec3<T> const & x,
detail::tvec3<T> const & Normal)
{
return dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> proj(
detail::tvec4<T> const & x,
detail::tvec4<T> const & Normal)
{
return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal;
}
}//namespace glm

View File

@ -9,8 +9,8 @@
#include <limits>
namespace glm{
namespace glm
{
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> cross
(
@ -295,5 +295,4 @@ GLM_FUNC_QUALIFIER detail::tquat<T> fastMix
{
return glm::normalize(x * (T(1) - a) + (y * a));
}
}//namespace glm

View File

@ -2,13 +2,15 @@
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-10-09
// Updated : 2008-10-09
// Updated : 2011-10-14
// Licence : This source is under MIT License
// File : glm/gtx/reciprocal.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
#include "../core/_vectorize.hpp"
namespace glm
{
// sec
template <typename genType>
GLM_FUNC_QUALIFIER genType sec
@ -21,41 +23,7 @@ GLM_FUNC_QUALIFIER genType sec
return genType(1) / glm::cos(angle);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> sec
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
sec(angle.x),
sec(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> sec
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
sec(angle.x),
sec(angle.y),
sec(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> sec
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
sec(angle.x),
sec(angle.y),
sec(angle.z),
sec(angle.w));
}
VECTORIZE_VEC(sec)
// csc
template <typename genType>
@ -69,41 +37,7 @@ GLM_FUNC_QUALIFIER genType csc
return genType(1) / glm::sin(angle);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> csc
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
csc(angle.x),
csc(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> csc
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
csc(angle.x),
csc(angle.y),
csc(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> csc
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
csc(angle.x),
csc(angle.y),
csc(angle.z),
csc(angle.w));
}
VECTORIZE_VEC(csc)
// cot
template <typename genType>
@ -117,41 +51,7 @@ GLM_FUNC_QUALIFIER genType cot
return genType(1) / glm::tan(angle);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> cot
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
cot(angle.x),
cot(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> cot
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
cot(angle.x),
cot(angle.y),
cot(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> cot
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
cot(angle.x),
cot(angle.y),
cot(angle.z),
cot(angle.w));
}
VECTORIZE_VEC(cot)
// asec
template <typename genType>
@ -165,41 +65,7 @@ GLM_FUNC_QUALIFIER genType asec
return acos(genType(1) / x);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> asec
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
asec(x.x),
asec(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> asec
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
asec(x.x),
asec(x.y),
asec(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> asec
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
asec(x.x),
asec(x.y),
asec(x.z),
asec(x.w));
}
VECTORIZE_VEC(asec)
// acsc
template <typename genType>
@ -213,41 +79,7 @@ GLM_FUNC_QUALIFIER genType acsc
return asin(genType(1) / x);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> acsc
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
acsc(x.x),
acsc(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> acsc
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
acsc(x.x),
acsc(x.y),
acsc(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> acsc
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
acsc(x.x),
acsc(x.y),
acsc(x.z),
acsc(x.w));
}
VECTORIZE_VEC(acsc)
// acot
template <typename genType>
@ -262,41 +94,7 @@ GLM_FUNC_QUALIFIER genType acot
return pi_over_2 - atan(x);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> acot
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
acot(x.x),
acot(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> acot
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
acot(x.x),
acot(x.y),
acot(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> acot
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
acot(x.x),
acot(x.y),
acot(x.z),
acot(x.w));
}
VECTORIZE_VEC(acot)
// sech
template <typename genType>
@ -310,41 +108,7 @@ GLM_FUNC_QUALIFIER genType sech
return genType(1) / glm::cosh(angle);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> sech
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
sech(angle.x),
sech(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> sech
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
sech(angle.x),
sech(angle.y),
sech(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> sech
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
sech(angle.x),
sech(angle.y),
sech(angle.z),
sech(angle.w));
}
VECTORIZE_VEC(sech)
// csch
template <typename genType>
@ -358,41 +122,7 @@ GLM_FUNC_QUALIFIER genType csch
return genType(1) / glm::sinh(angle);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> csch
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
csch(angle.x),
csch(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> csch
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
csch(angle.x),
csch(angle.y),
csch(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> csch
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
csch(angle.x),
csch(angle.y),
csch(angle.z),
csch(angle.w));
}
VECTORIZE_VEC(csch)
// coth
template <typename genType>
@ -406,41 +136,7 @@ GLM_FUNC_QUALIFIER genType coth
return glm::cosh(angle) / glm::sinh(angle);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> coth
(
detail::tvec2<valType> const & angle
)
{
return detail::tvec2<valType>(
coth(angle.x),
coth(angle.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> coth
(
detail::tvec3<valType> const & angle
)
{
return detail::tvec3<valType>(
coth(angle.x),
coth(angle.y),
coth(angle.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> coth
(
detail::tvec4<valType> const & angle
)
{
return detail::tvec4<valType>(
coth(angle.x),
coth(angle.y),
coth(angle.z),
coth(angle.w));
}
VECTORIZE_VEC(coth)
// asech
template <typename genType>
@ -454,41 +150,7 @@ GLM_FUNC_QUALIFIER genType asech
return acosh(genType(1) / x);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> asech
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
asech(x.x),
asech(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> asech
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
asech(x.x),
asech(x.y),
asech(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> asech
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
asech(x.x),
asech(x.y),
asech(x.z),
asech(x.w));
}
VECTORIZE_VEC(asech)
// acsch
template <typename genType>
@ -502,41 +164,7 @@ GLM_FUNC_QUALIFIER genType acsch
return asinh(genType(1) / x);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> acsch
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
acsch(x.x),
acsch(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> acsch
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
acsch(x.x),
acsch(x.y),
acsch(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> acsch
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
acsch(x.x),
acsch(x.y),
acsch(x.z),
acsch(x.w));
}
VECTORIZE_VEC(acsch)
// acoth
template <typename genType>
@ -550,40 +178,5 @@ GLM_FUNC_QUALIFIER genType acoth
return atanh(genType(1) / x);
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<valType> acoth
(
detail::tvec2<valType> const & x
)
{
return detail::tvec2<valType>(
acoth(x.x),
acoth(x.y));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec3<valType> acoth
(
detail::tvec3<valType> const & x
)
{
return detail::tvec3<valType>(
acoth(x.x),
acoth(x.y),
acoth(x.z));
}
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<valType> acoth
(
detail::tvec4<valType> const & x
)
{
return detail::tvec4<valType>(
acoth(x.x),
acoth(x.y),
acoth(x.z),
acoth(x.w));
}
VECTORIZE_VEC(acoth)
}//namespace glm

View File

@ -7,26 +7,30 @@
// File : glm/gtx/rotate_vector.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec2<T> rotate(
GLM_FUNC_QUALIFIER detail::tvec2<T> rotate
(
detail::tvec2<T> const & v,
T const & angle)
T const & angle
)
{
detail::tvec2<T> Result;
const T Cos = cos(radians(angle));
const T Sin = sin(radians(angle));
T const Cos = cos(radians(angle));
T const Sin = sin(radians(angle));
Result.x = v.x * Cos - v.y * Sin;
Result.y = v.x * Sin + v.y * Cos;
return Result;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rotate(
const detail::tvec3<T> & v,
GLM_FUNC_QUALIFIER detail::tvec3<T> rotate
(
detail::tvec3<T> const & v,
T const & angle,
const detail::tvec3<T> & normal)
detail::tvec3<T> const & normal
)
{
return detail::tmat3x3<T>(glm::rotate(angle, normal)) * v;
}
@ -43,18 +47,22 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateGTX(
}
*/
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> rotate(
GLM_FUNC_QUALIFIER detail::tvec4<T> rotate
(
detail::tvec4<T> const & v,
T const & angle,
detail::tvec3<T> const & normal)
detail::tvec3<T> const & normal
)
{
return rotate(angle, normal) * v;
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX(
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX
(
detail::tvec3<T> const & v,
T const & angle)
T const & angle
)
{
detail::tvec3<T> Result = v;
const T Cos = cos(radians(angle));
@ -65,9 +73,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateX(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY(
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY
(
detail::tvec3<T> const & v,
T const & angle)
T const & angle
)
{
detail::tvec3<T> Result = v;
const T Cos = cos(radians(angle));
@ -78,9 +88,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateY(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ(
GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ
(
detail::tvec3<T> const & v,
T const & angle)
T const & angle
)
{
detail::tvec3<T> Result = v;
const T Cos = cos(radians(angle));
@ -91,9 +103,11 @@ GLM_FUNC_QUALIFIER detail::tvec3<T> rotateZ(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX(
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX
(
detail::tvec4<T> const & v,
T const & angle)
T const & angle
)
{
detail::tvec4<T> Result = v;
const T Cos = cos(radians(angle));
@ -104,9 +118,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateX(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY(
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY
(
detail::tvec4<T> const & v,
T const & angle)
T const & angle
)
{
detail::tvec4<T> Result = v;
const T Cos = cos(radians(angle));
@ -117,9 +133,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateY(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ(
GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ
(
detail::tvec4<T> const & v,
T const & angle)
T const & angle
)
{
detail::tvec4<T> Result = v;
const T Cos = cos(radians(angle));
@ -130,9 +148,11 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> rotateZ(
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation(
GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation
(
detail::tvec3<T> const & Normal,
detail::tvec3<T> const & Up)
detail::tvec3<T> const & Up
)
{
if(all(equal(Normal, Up)))
return detail::tmat4x4<T>(T(1));
@ -141,5 +161,4 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> orientation(
T Angle = degrees(acos(dot(Normal, Up)));
return rotate(Angle, RotationAxis);
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/transform2.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER detail::tmat3x3<T> shearX2D(
const detail::tmat3x3<T>& m,
@ -150,6 +150,5 @@ GLM_FUNC_QUALIFIER detail::tmat4x4<T> scaleBias(
{
return m * scaleBias(scale, bias);
}
}//namespace glm

View File

@ -181,8 +181,8 @@ namespace detail
# define GLM_NEXT_AFTER_DBL(x, toward) nextafter((x), (toward))
#endif
namespace glm{
namespace glm
{
GLM_FUNC_QUALIFIER float next_float(float const & x)
{
return GLM_NEXT_AFTER_FLT(x, std::numeric_limits<float>::max());
@ -296,103 +296,4 @@ GLM_FUNC_QUALIFIER vecType<uint> float_distance(vecType<T> const & x, vecType<T>
Result[i] = float_distance(x[i], y[i]);
return Result;
}
/*
inline std::size_t ulp
(
detail::thalf const & a,
detail::thalf const & b
)
{
std::size_t Count = 0;
float TempA(a);
float TempB(b);
//while((TempA = _nextafterf(TempA, TempB)) != TempB)
++Count;
return Count;
}
inline std::size_t ulp
(
float const & a,
float const & b
)
{
std::size_t Count = 0;
float Temp = a;
//while((Temp = _nextafterf(Temp, b)) != b)
{
std::cout << Temp << " " << b << std::endl;
++Count;
}
return Count;
}
inline std::size_t ulp
(
double const & a,
double const & b
)
{
std::size_t Count = 0;
double Temp = a;
//while((Temp = _nextafter(Temp, b)) != b)
{
std::cout << Temp << " " << b << std::endl;
++Count;
}
return Count;
}
template <typename T>
inline std::size_t ulp
(
detail::tvec2<T> const & a,
detail::tvec2<T> const & b
)
{
std::size_t ulps[] =
{
ulp(a[0], b[0]),
ulp(a[1], b[1])
};
return glm::max(ulps[0], ulps[1]);
}
template <typename T>
inline std::size_t ulp
(
detail::tvec3<T> const & a,
detail::tvec3<T> const & b
)
{
std::size_t ulps[] =
{
ulp(a[0], b[0]),
ulp(a[1], b[1]),
ulp(a[2], b[2])
};
return glm::max(glm::max(ulps[0], ulps[1]), ulps[2]);
}
template <typename T>
inline std::size_t ulp
(
detail::tvec4<T> const & a,
detail::tvec4<T> const & b
)
{
std::size_t ulps[] =
{
ulp(a[0], b[0]),
ulp(a[1], b[1]),
ulp(a[2], b[2]),
ulp(a[3], b[3])
};
return glm::max(glm::max(ulps[0], ulps[1]), glm::max(ulps[2], ulps[3]));
}
*/
}//namespace glm

View File

@ -7,7 +7,7 @@
// File : glm/gtx/unsigned_int.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/vector_access.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename valType>
GLM_FUNC_QUALIFIER void set
(
@ -50,5 +50,4 @@ GLM_FUNC_QUALIFIER void set
v.z = z;
v.w = w;
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/vector_angle.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER typename genType::value_type angle
(
@ -50,5 +50,4 @@ GLM_FUNC_QUALIFIER valType orientedAngle
else
return Angle;
}
}//namespace glm

View File

@ -12,8 +12,8 @@
#include <cassert>
namespace glm{
namespace glm
{
template <typename T>
GLM_FUNC_QUALIFIER bool areCollinear
(
@ -166,5 +166,4 @@ GLM_FUNC_QUALIFIER bool areSimilar
similar = (abs(v0[i] - v1[i]) <= epsilon);
return similar;
}
}//namespace glm

View File

@ -7,8 +7,8 @@
// File : glm/gtx/verbose_operator.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER genType add(genType const & a, genType const & b)
{
@ -121,5 +121,4 @@ GLM_FUNC_QUALIFIER genTypeT mad(genTypeT const & a, genTypeU const & b, genTypeV
{
return a * b + c;
}
}//namespace glm

View File

@ -10,8 +10,8 @@
// - GLM core
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace glm
{
template <typename genType>
GLM_FUNC_QUALIFIER genType clamp
(
@ -162,5 +162,4 @@ GLM_FUNC_QUALIFIER detail::tvec4<T> mirrorRepeat
Result[i] = mirrorRepeat(Texcoord[i]);
return Result;
}
}//namespace glm