smoke_API.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License
  4. * as published by the Free Software Foundation; either version 2
  5. * of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software Foundation,
  14. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  15. *
  16. * The Original Code is Copyright (C) 2009 by Daniel Genrich
  17. * All rights reserved.
  18. */
  19. /** \file
  20. * \ingroup smoke
  21. */
  22. #ifndef SMOKE_API_H_
  23. #define SMOKE_API_H_
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. struct FLUID_3D;
  28. // low res
  29. struct FLUID_3D *smoke_init(int *res, float dx, float dtdef, int use_heat, int use_fire, int use_colors);
  30. void smoke_free(struct FLUID_3D *fluid);
  31. void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta, float *dt_factor, float *vorticity, int *border_colli, float *burning_rate,
  32. float *flame_smoke, float *flame_smoke_color, float *flame_vorticity, float *flame_ignition_temp, float *flame_max_temp);
  33. void smoke_step(struct FLUID_3D *fluid, float gravity[3], float dtSubdiv);
  34. float *smoke_get_density(struct FLUID_3D *fluid);
  35. float *smoke_get_flame(struct FLUID_3D *fluid);
  36. float *smoke_get_fuel(struct FLUID_3D *fluid);
  37. float *smoke_get_react(struct FLUID_3D *fluid);
  38. float *smoke_get_color_r(struct FLUID_3D *fluid);
  39. float *smoke_get_color_g(struct FLUID_3D *fluid);
  40. float *smoke_get_color_b(struct FLUID_3D *fluid);
  41. void smoke_get_rgba(struct FLUID_3D *fluid, float *data, int sequential);
  42. void smoke_get_rgba_from_density(struct FLUID_3D *fluid, float color[3], float *data, int sequential);
  43. float *smoke_get_heat(struct FLUID_3D *fluid);
  44. float *smoke_get_velocity_x(struct FLUID_3D *fluid);
  45. float *smoke_get_velocity_y(struct FLUID_3D *fluid);
  46. float *smoke_get_velocity_z(struct FLUID_3D *fluid);
  47. /* Moving obstacle velocity provided by blender */
  48. void smoke_get_ob_velocity(struct FLUID_3D *fluid, float **x, float **y, float **z);
  49. float *smoke_get_force_x(struct FLUID_3D *fluid);
  50. float *smoke_get_force_y(struct FLUID_3D *fluid);
  51. float *smoke_get_force_z(struct FLUID_3D *fluid);
  52. unsigned char *smoke_get_obstacle(struct FLUID_3D *fluid);
  53. size_t smoke_get_index(int x, int max_x, int y, int max_y, int z);
  54. size_t smoke_get_index2d(int x, int max_x, int y);
  55. void smoke_dissolve(struct FLUID_3D *fluid, int speed, int log);
  56. // wavelet turbulence functions
  57. struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype, const char *noisefile_path, int use_fire, int use_colors);
  58. void smoke_turbulence_free(struct WTURBULENCE *wt);
  59. void smoke_turbulence_step(struct WTURBULENCE *wt, struct FLUID_3D *fluid);
  60. float *smoke_turbulence_get_density(struct WTURBULENCE *wt);
  61. float *smoke_turbulence_get_color_r(struct WTURBULENCE *wt);
  62. float *smoke_turbulence_get_color_g(struct WTURBULENCE *wt);
  63. float *smoke_turbulence_get_color_b(struct WTURBULENCE *wt);
  64. void smoke_turbulence_get_rgba(struct WTURBULENCE *wt, float *data, int sequential);
  65. void smoke_turbulence_get_rgba_from_density(struct WTURBULENCE *wt, float color[3], float *data, int sequential);
  66. float *smoke_turbulence_get_flame(struct WTURBULENCE *wt);
  67. float *smoke_turbulence_get_fuel(struct WTURBULENCE *wt);
  68. float *smoke_turbulence_get_react(struct WTURBULENCE *wt);
  69. void smoke_turbulence_get_res(struct WTURBULENCE *wt, int *res);
  70. int smoke_turbulence_get_cells(struct WTURBULENCE *wt);
  71. void smoke_turbulence_set_noise(struct WTURBULENCE *wt, int type, const char *noisefile_path);
  72. void smoke_initWaveletBlenderRNA(struct WTURBULENCE *wt, float *strength);
  73. void smoke_dissolve_wavelet(struct WTURBULENCE *wt, int speed, int log);
  74. /* export */
  75. void smoke_export(struct FLUID_3D *fluid, float *dt, float *dx, float **dens, float **react, float **flame, float **fuel, float **heat, float **heatold,
  76. float **vx, float **vy, float **vz, float **r, float **g, float **b, unsigned char **obstacles);
  77. void smoke_turbulence_export(struct WTURBULENCE *wt, float **dens, float **react, float **flame, float **fuel,
  78. float **r, float **g, float **b, float **tcu, float **tcv, float **tcw);
  79. /* data fields */
  80. int smoke_has_heat(struct FLUID_3D *fluid);
  81. int smoke_has_fuel(struct FLUID_3D *fluid);
  82. int smoke_has_colors(struct FLUID_3D *fluid);
  83. int smoke_turbulence_has_fuel(struct WTURBULENCE *wt);
  84. int smoke_turbulence_has_colors(struct WTURBULENCE *wt);
  85. void smoke_ensure_heat(struct FLUID_3D *fluid);
  86. void smoke_ensure_fire(struct FLUID_3D *fluid, struct WTURBULENCE *wt);
  87. void smoke_ensure_colors(struct FLUID_3D *fluid, struct WTURBULENCE *wt, float init_r, float init_g, float init_b);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif /* SMOKE_API_H_ */