gtx_hash.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #if __cplusplus >= 201103L
  2. #include <glm/detail/setup.hpp>
  3. #if GLM_COMPILER & GLM_COMPILER_CLANG
  4. # pragma clang diagnostic push
  5. # pragma clang diagnostic ignored "-Wfloat-equal"
  6. #endif
  7. #define GLM_ENABLE_EXPERIMENTAL
  8. #include <glm/gtx/hash.hpp>
  9. #include <unordered_map>
  10. static int test_compile()
  11. {
  12. int Error = 0;
  13. // Vector types
  14. std::unordered_map<glm::ivec1, int> map_vec1;
  15. Error += ++map_vec1[glm::ivec1(0)];
  16. std::unordered_map<glm::ivec2, int> map_vec2;
  17. Error += ++map_vec2[glm::ivec2(0)];
  18. std::unordered_map<glm::ivec3, int> map_vec3;
  19. Error += ++map_vec3[glm::ivec3(0)];
  20. std::unordered_map<glm::ivec4, int> map_vec4;
  21. Error += ++map_vec4[glm::ivec4(0)];
  22. // Quaternion types
  23. std::unordered_map<glm::quat, int> map_quat;
  24. Error += ++map_quat[glm::quat(0.0f, glm::vec3(0.0f))];
  25. std::unordered_map<glm::dualquat, int> map_dualquat;
  26. Error += ++map_dualquat[glm::dualquat(glm::vec3(0.0f))];
  27. // Matrix types
  28. std::unordered_map<glm::mat2x2, int> map_mat2x2;
  29. Error += ++map_mat2x2[glm::mat2x2(0.0f)];
  30. std::unordered_map<glm::mat2x3, int> map_mat2x3;
  31. Error += ++map_mat2x3[glm::mat2x3(0.0f)];
  32. std::unordered_map<glm::mat2x4, int> map_mat2x4;
  33. Error += ++map_mat2x4[glm::mat2x4(0.0f)];
  34. std::unordered_map<glm::mat3x2, int> map_mat3x2;
  35. Error += ++map_mat3x2[glm::mat3x2(0.0f)];
  36. std::unordered_map<glm::mat3x3, int> map_mat3x3;
  37. Error += ++map_mat3x3[glm::mat3x3(0.0f)];
  38. std::unordered_map<glm::mat3x4, int> map_mat3x4;
  39. Error += ++map_mat3x4[glm::mat3x4(0.0f)];
  40. std::unordered_map<glm::mat4x2, int> map_mat4x2;
  41. Error += ++map_mat4x2[glm::mat4x2(0.0f)];
  42. std::unordered_map<glm::mat4x3, int> map_mat4x3;
  43. Error += ++map_mat4x3[glm::mat4x3(0.0f)];
  44. std::unordered_map<glm::mat4x4, int> map_mat4x4;
  45. Error += ++map_mat4x4[glm::mat4x4(0.0f)];
  46. return Error > 0 ? 0 : 1;
  47. }
  48. int main()
  49. {
  50. int Error = 0;
  51. Error += test_compile();
  52. return Error;
  53. }
  54. #if GLM_COMPILER & GLM_COMPILER_CLANG
  55. # pragma clang diagnostic pop
  56. #endif
  57. #else
  58. int main()
  59. {
  60. return 0;
  61. }
  62. #endif// __cplusplus >= 201103L