Real.h 914 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-FileCopyrightText: 2022 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Jolt/Math/DVec3.h>
  5. #include <Jolt/Math/DMat44.h>
  6. JPH_NAMESPACE_BEGIN
  7. #ifdef JPH_DOUBLE_PRECISION
  8. // Define real to double
  9. using Real = double;
  10. using Real3 = Double3;
  11. using RVec3 = DVec3;
  12. using RVec3Arg = DVec3Arg;
  13. using RMat44 = DMat44;
  14. using RMat44Arg = DMat44Arg;
  15. #define JPH_RVECTOR_ALIGNMENT JPH_DVECTOR_ALIGNMENT
  16. #else
  17. // Define real to float
  18. using Real = float;
  19. using Real3 = Float3;
  20. using RVec3 = Vec3;
  21. using RVec3Arg = Vec3Arg;
  22. using RMat44 = Mat44;
  23. using RMat44Arg = Mat44Arg;
  24. #define JPH_RVECTOR_ALIGNMENT JPH_VECTOR_ALIGNMENT
  25. #endif // JPH_DOUBLE_PRECISION
  26. // Put the 'real' operator in a namespace so that users can opt in to use it:
  27. // using namespace JPH::literals;
  28. namespace literals {
  29. constexpr Real operator "" _r (long double inValue) { return Real(inValue); }
  30. };
  31. JPH_NAMESPACE_END