core_setup_precision.cpp 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
  5. /// Permission is hereby granted, free of charge, to any person obtaining a copy
  6. /// of this software and associated documentation files (the "Software"), to deal
  7. /// in the Software without restriction, including without limitation the rights
  8. /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. /// copies of the Software, and to permit persons to whom the Software is
  10. /// furnished to do so, subject to the following conditions:
  11. ///
  12. /// The above copyright notice and this permission notice shall be included in
  13. /// all copies or substantial portions of the Software.
  14. ///
  15. /// Restrictions:
  16. /// By making use of the Software for military purposes, you choose to make
  17. /// a Bunny unhappy.
  18. ///
  19. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. /// THE SOFTWARE.
  26. ///
  27. /// @file test/core/core_setup_precision.cpp
  28. /// @date 2011-05-31 / 2014-11-25
  29. /// @author Christophe Riccio
  30. ///////////////////////////////////////////////////////////////////////////////////
  31. #define GLM_FORCE_INLINE
  32. #define GLM_PRECISION_HIGHP_FLOAT
  33. #include <glm/glm.hpp>
  34. #include <glm/ext.hpp>
  35. static int test_mat()
  36. {
  37. int Error = 0;
  38. Error += sizeof(glm::mat2) == sizeof(glm::highp_mat2) ? 0 : 1;
  39. Error += sizeof(glm::mat3) == sizeof(glm::highp_mat3) ? 0 : 1;
  40. Error += sizeof(glm::mat4) == sizeof(glm::highp_mat4) ? 0 : 1;
  41. Error += sizeof(glm::mat2x2) == sizeof(glm::highp_mat2x2) ? 0 : 1;
  42. Error += sizeof(glm::mat2x3) == sizeof(glm::highp_mat2x3) ? 0 : 1;
  43. Error += sizeof(glm::mat2x4) == sizeof(glm::highp_mat2x4) ? 0 : 1;
  44. Error += sizeof(glm::mat3x2) == sizeof(glm::highp_mat3x2) ? 0 : 1;
  45. Error += sizeof(glm::mat3x3) == sizeof(glm::highp_mat3x3) ? 0 : 1;
  46. Error += sizeof(glm::mat3x4) == sizeof(glm::highp_mat3x4) ? 0 : 1;
  47. Error += sizeof(glm::mat4x2) == sizeof(glm::highp_mat4x2) ? 0 : 1;
  48. Error += sizeof(glm::mat4x3) == sizeof(glm::highp_mat4x3) ? 0 : 1;
  49. Error += sizeof(glm::mat4x4) == sizeof(glm::highp_mat4x4) ? 0 : 1;
  50. return Error;
  51. }
  52. static int test_vec()
  53. {
  54. int Error = 0;
  55. Error += sizeof(glm::vec2) == sizeof(glm::highp_vec2) ? 0 : 1;
  56. Error += sizeof(glm::vec3) == sizeof(glm::highp_vec3) ? 0 : 1;
  57. Error += sizeof(glm::vec4) == sizeof(glm::highp_vec4) ? 0 : 1;
  58. return Error;
  59. }
  60. static int test_dvec()
  61. {
  62. int Error = 0;
  63. Error += sizeof(glm::dvec2) == sizeof(glm::highp_dvec2) ? 0 : 1;
  64. Error += sizeof(glm::dvec3) == sizeof(glm::highp_dvec3) ? 0 : 1;
  65. Error += sizeof(glm::dvec4) == sizeof(glm::highp_dvec4) ? 0 : 1;
  66. return Error;
  67. }
  68. int main()
  69. {
  70. int Error = 0;
  71. Error += test_mat();
  72. Error += test_vec();
  73. Error += test_dvec();
  74. return Error;
  75. }