Real.h 978 B

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