You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

  1. //
  2. // Lol Engine — Sample math program: check trigonometric functions
  3. //
  4. // Copyright © 2005—2011 Sam Hocevar <sam@hocevar.net>
  5. //
  6. // This program is free software. It comes without any warranty, to
  7. // the extent permitted by applicable law. You can redistribute it
  8. // and/or modify it under the terms of the Do What the Fuck You Want
  9. // to Public License, Version 2, as published by the WTFPL Task Force.
  10. // See http://www.wtfpl.net/ for more details.
  11. //
  12. #if HAVE_CONFIG_H
  13. # include "config.h"
  14. #endif
  15. #include <cstdio>
  16. #include <lol/engine.h>
  17. using namespace lol;
  18. mat4 multiply_copy(mat4 m1, mat4 m2, mat4 m3)
  19. {
  20. return m1 * m2 * m3;
  21. }
  22. mat4 multiply_ref(mat4 const &m1, mat4 const &m2, mat4 const &m3)
  23. {
  24. return m1 * m2 * m3;
  25. }
  26. int main(int argc, char **argv)
  27. {
  28. UNUSED(argc, argv);
  29. mat4 a = mat4::rotate(0.1f, vec3(1.f, 1.f, 0.f));
  30. mat4 b = mat4::rotate(0.1f, vec3(0.f, 0.f, 1.f));
  31. mat4 m = mat4(1.f);
  32. for (int i = 0; i < 40000000; ++i)
  33. //m = multiply_copy(a, m, b);
  34. m = multiply_ref(a, m, b);
  35. m.printf();
  36. return EXIT_SUCCESS;
  37. }