Adds adl support

This commit is contained in:
Joshua Moerman 2014-09-19 15:38:28 +02:00
parent 72a6f35a8e
commit 94cc84e6d8
3 changed files with 146 additions and 0 deletions

117
glm/gtx/adl.hpp Normal file
View File

@ -0,0 +1,117 @@
///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
/// THE SOFTWARE.
///
/// @ref gtx_adl
/// @file gtx/adl.hpp
/// @date 2014-09-19 / 2014-09-19
/// @author Joshua Moerman
///
/// @brief Allows to call glm functions without the need of fully qualifying
/// the name
///
///////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "../trigonometric.hpp"
#include "../exponential.hpp"
#include "../common.hpp"
#include "../geometric.hpp"
#include "../matrix.hpp"
#include "../vector_relational.hpp"
namespace glm {
namespace detail {
using glm::radians;
using glm::degrees;
using glm::sin;
using glm::cos;
using glm::tan;
using glm::asin;
using glm::acos;
using glm::atan;
using glm::sinh;
using glm::cosh;
using glm::tanh;
using glm::asinh;
using glm::acosh;
using glm::atanh;
using glm::pow;
using glm::exp;
using glm::log;
using glm::exp2;
using glm::log2;
using glm::sqrt;
using glm::inversesqrt;
using glm::abs;
using glm::sign;
using glm::floor;
using glm::trunc;
using glm::round;
using glm::roundEven;
using glm::ceil;
using glm::fract;
using glm::mod;
using glm::modf;
using glm::min;
using glm::max;
using glm::clamp;
using glm::step;
using glm::smoothstep;
using glm::isnan;
using glm::isinf;
using glm::floatBitsToInt;
using glm::floatBitsToUint;
using glm::intBitsToFloat;
using glm::uintBitsToFloat;
using glm::fma;
using glm::frexp;
using glm::ldexp;
using glm::length;
using glm::distance;
using glm::dot;
using glm::cross;
using glm::normalize;
using glm::faceforward;
using glm::reflect;
using glm::refract;
using glm::matrixCompMult;
using glm::outerProduct;
using glm::transpose;
using glm::determinant;
using glm::inverse;
using glm::lessThan;
using glm::lessThanEqual;
using glm::greaterThan;
using glm::greaterThanEqual;
using glm::equal;
using glm::notEqual;
using glm::any;
using glm::all;
using glm::not_;
}
}

View File

@ -1,3 +1,4 @@
glmCreateTestGTC(gtx_adl)
glmCreateTestGTC(gtx_associated_min_max) glmCreateTestGTC(gtx_associated_min_max)
glmCreateTestGTC(gtx_bit) glmCreateTestGTC(gtx_bit)
glmCreateTestGTC(gtx_closest_point) glmCreateTestGTC(gtx_closest_point)

28
test/gtx/gtx_adl.cpp Normal file
View File

@ -0,0 +1,28 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2014-09-19
// Updated : 2014-09-19
// Licence : This source is under MIT licence
// File : test/gtx/gtx_adl.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/vec3.hpp>
#include <glm/gtx/adl.hpp>
template <typename T>
int length(T const &){
// This function should not be picked up in main
// So we return an error here
return 1;
}
int main(){
int Error(0);
glm::vec3 v(0, 0, 0);
// the glm::length function will return 0
Error += int(length(v));
return Error;
}