Math.hh 2.48 KB
Newer Older
1 2 3 4 5
/***********************************************************************
 * Copyright 2011-2012 Computer Graphics Group RWTH Aachen University. *
 * All rights reserved.                                                *
 * Distributed under the terms of the MIT License (see LICENSE.TXT).   *
 **********************************************************************/
Robert Menzel's avatar
Robert Menzel committed
6 7 8 9

#ifndef ACGL_MATH_HH
#define ACGL_MATH_HH

Robert Menzel's avatar
Robert Menzel committed
10 11
#include <ACGL/ACGL.hh>

Robert Menzel's avatar
Robert Menzel committed
12 13 14 15 16
/*
 * For our basic vector math we use the GLM library.
 * This library has the advantage that it was designed to mimic the
 * syntax of GLSL for datatypes (vectors, matrices etc.) as well as functions.
 * It also supports swizzling similar to GLSL.
17 18 19
 *
 * Swizzling has to be defined before the glm.hpp gets first included, no not forget
 * this, you should never include glm yourself, but include always our ACGL/Math.hh!
Robert Menzel's avatar
Robert Menzel committed
20
 */
21

22 23 24
/////////////////////////////////////////////////////////////////////////////////////
// ignore compiler warnings from GLM:
//
Robert Menzel's avatar
Robert Menzel committed
25
#ifdef _MSC_VER
26 27 28 29 30
#pragma warning( push )
#pragma warning ( disable : 4201 )
#pragma warning ( disable : 4100 )
#pragma warning ( disable : 4996 )
#pragma warning ( disable : 4244 )
Robert Menzel's avatar
Robert Menzel committed
31 32
#endif

33 34 35 36 37 38 39 40 41 42 43 44 45 46
#if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4))
#define COMPILER_IS_GCC_4_6_OR_NEWER
#endif

#ifdef __clang__
//   clang/llvm:
#    pragma clang diagnostic push
#    pragma clang diagnostic ignored "-Wuninitialized"
#    pragma clang diagnostic ignored "-Wunused-parameter"
#elif defined __GNUC__
#  ifdef COMPILER_IS_GCC_4_6_OR_NEWER
//    gcc >= 4.6:
#     pragma GCC diagnostic push
#     pragma GCC diagnostic ignored "-Wtype-limits"
47 48
#     pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#     pragma GCC diagnostic ignored "-Wstrict-aliasing"
49 50 51 52 53 54 55
#  endif
// gcc:
#  pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
//
/////////////////////////////////////////////////////////////////////////////////////

56
#define GLM_FORCE_RADIANS
57

Robert Menzel's avatar
Robert Menzel committed
58
#include <glm/glm.hpp>
59
#include <glm/gtx/transform.hpp>
Robert Menzel's avatar
Robert Menzel committed
60
#include <glm/ext.hpp>
61

62 63 64 65 66 67 68 69 70 71 72 73 74

/////////////////////////////////////////////////////////////////////////////////////
// reactivate compiler warnings:
//
#ifdef __clang__
// clang/llvm:
#  pragma clang diagnostic pop
#elif defined COMPILER_IS_GCC_4_6_OR_NEWER
// gcc >= 4.6:
#  pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
Robert Menzel's avatar
Robert Menzel committed
75 76
#pragma warning( pop )
#endif
77 78
//
/////////////////////////////////////////////////////////////////////////////////////
Robert Menzel's avatar
Robert Menzel committed
79

Robert Menzel's avatar
Robert Menzel committed
80 81 82
#include <ACGL/Math/Constants.hh>
#include <ACGL/Math/Functions.hh>

83
#endif // ACGL_MATH_HH