BKE_softbody.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * ***** BEGIN GPL LICENSE BLOCK *****
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software Foundation,
  16. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. *
  18. * The Original Code is Copyright (C) Blender Foundation.
  19. * All rights reserved.
  20. *
  21. * The Original Code is: all of this file.
  22. *
  23. * Contributor(s): none yet.
  24. *
  25. * ***** END GPL LICENSE BLOCK *****
  26. */
  27. #ifndef __BKE_SOFTBODY_H__
  28. #define __BKE_SOFTBODY_H__
  29. /** \file BKE_softbody.h
  30. * \ingroup bke
  31. */
  32. struct Object;
  33. struct Scene;
  34. struct SoftBody;
  35. typedef struct BodyPoint {
  36. float origS[3], origE[3], origT[3], pos[3], vec[3], force[3];
  37. float goal;
  38. float prevpos[3], prevvec[3], prevdx[3], prevdv[3]; /* used for Heun integration */
  39. float impdv[3], impdx[3];
  40. int nofsprings; int *springs;
  41. float choke, choke2, frozen;
  42. float colball;
  43. short loc_flag; //reserved by locale module specific states
  44. //char octantflag;
  45. float mass;
  46. float springweight;
  47. } BodyPoint;
  48. /* allocates and initializes general main data */
  49. extern struct SoftBody *sbNew(struct Scene *scene);
  50. /* frees internal data and softbody itself */
  51. extern void sbFree(struct SoftBody *sb);
  52. /* frees simulation data to reset simulation */
  53. extern void sbFreeSimulation(struct SoftBody *sb);
  54. /* do one simul step, reading and writing vertex locs from given array */
  55. extern void sbObjectStep(struct Scene *scene, struct Object *ob, float framnr, float (*vertexCos)[3], int numVerts);
  56. /* makes totally fresh start situation, resets time */
  57. extern void sbObjectToSoftbody(struct Object *ob);
  58. /* links the softbody module to a 'test for Interrupt' function */
  59. /* pass NULL to unlink again */
  60. extern void sbSetInterruptCallBack(int (*f)(void));
  61. extern void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float lscale[3][3]);
  62. #endif