b2TimeStep.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2006-2011 Erin Catto http://www.box2d.org
  3. * Copyright (c) 2014 Google, Inc.
  4. *
  5. * This software is provided 'as-is', without any express or implied
  6. * warranty. In no event will the authors be held liable for any damages
  7. * arising from the use of this software.
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. * 1. The origin of this software must not be misrepresented; you must not
  12. * claim that you wrote the original software. If you use this software
  13. * in a product, an acknowledgment in the product documentation would be
  14. * appreciated but is not required.
  15. * 2. Altered source versions must be plainly marked as such, and must not be
  16. * misrepresented as being the original software.
  17. * 3. This notice may not be removed or altered from any source distribution.
  18. */
  19. #ifndef B2_TIME_STEP_H
  20. #define B2_TIME_STEP_H
  21. #include <Box2D/Common/b2Math.h>
  22. /// Profiling data. Times are in milliseconds.
  23. struct b2Profile
  24. {
  25. float32 step;
  26. float32 collide;
  27. float32 solve;
  28. float32 solveInit;
  29. float32 solveVelocity;
  30. float32 solvePosition;
  31. float32 broadphase;
  32. float32 solveTOI;
  33. };
  34. /// This is an internal structure.
  35. struct b2TimeStep
  36. {
  37. float32 dt; // time step
  38. float32 inv_dt; // inverse time step (0 if dt == 0).
  39. float32 dtRatio; // dt * inv_dt0
  40. int32 velocityIterations;
  41. int32 positionIterations;
  42. int32 particleIterations;
  43. bool warmStarting;
  44. };
  45. /// This is an internal structure.
  46. struct b2Position
  47. {
  48. b2Vec2 c;
  49. float32 a;
  50. };
  51. /// This is an internal structure.
  52. struct b2Velocity
  53. {
  54. b2Vec2 v;
  55. float32 w;
  56. };
  57. /// Solver Data
  58. struct b2SolverData
  59. {
  60. b2TimeStep step;
  61. b2Position* positions;
  62. b2Velocity* velocities;
  63. };
  64. #endif