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) 2006 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
20 /** \file
21  * \ingroup DNA
22  */
23 
24 #pragma once
25 
26 #include "DNA_listBase.h"
27 
28 /**
29  * #FluidDomainSettings.flags
30  * Domain flags.
31  */
32 enum {
33   FLUID_DOMAIN_USE_NOISE = (1 << 1),        /* Use noise. */
34   FLUID_DOMAIN_USE_DISSOLVE = (1 << 2),     /* Let smoke dissolve. */
35   FLUID_DOMAIN_USE_DISSOLVE_LOG = (1 << 3), /* Using 1/x for dissolve. */
36 
37 #ifdef DNA_DEPRECATED_ALLOW
38   FLUID_DOMAIN_USE_HIGH_SMOOTH = (1 << 5), /* -- Deprecated -- */
39 #endif
40   FLUID_DOMAIN_FILE_LOAD = (1 << 6), /* Flag for file load. */
41   FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN = (1 << 7),
42   FLUID_DOMAIN_USE_ADAPTIVE_TIME = (1 << 8),    /* Adaptive time stepping in domain. */
43   FLUID_DOMAIN_USE_MESH = (1 << 9),             /* Use mesh. */
44   FLUID_DOMAIN_USE_GUIDE = (1 << 10),           /* Use guiding. */
45   FLUID_DOMAIN_USE_SPEED_VECTORS = (1 << 11),   /* Generate mesh speed vectors. */
46   FLUID_DOMAIN_EXPORT_MANTA_SCRIPT = (1 << 12), /* Export mantaflow script during bake. */
47   FLUID_DOMAIN_USE_FRACTIONS = (1 << 13),       /* Use second order obstacles. */
48   FLUID_DOMAIN_DELETE_IN_OBSTACLE = (1 << 14),  /* Delete fluid inside obstacles. */
49   FLUID_DOMAIN_USE_DIFFUSION = (1 << 15), /* Use diffusion (e.g. viscosity, surface tension). */
50   FLUID_DOMAIN_USE_RESUMABLE_CACHE = (1 << 16), /* Determine if cache should be resumable. */
51 };
52 
53 /**
54  * #FluidDomainSettings.border_collisions
55  * Border collisions.
56  */
57 enum {
58   FLUID_DOMAIN_BORDER_FRONT = (1 << 1),
59   FLUID_DOMAIN_BORDER_BACK = (1 << 2),
60   FLUID_DOMAIN_BORDER_RIGHT = (1 << 3),
61   FLUID_DOMAIN_BORDER_LEFT = (1 << 4),
62   FLUID_DOMAIN_BORDER_TOP = (1 << 5),
63   FLUID_DOMAIN_BORDER_BOTTOM = (1 << 6),
64 };
65 
66 /* Cache file formats. */
67 enum {
68   FLUID_DOMAIN_FILE_UNI = (1 << 0),
69   FLUID_DOMAIN_FILE_OPENVDB = (1 << 1),
70   FLUID_DOMAIN_FILE_RAW = (1 << 2),
71   FLUID_DOMAIN_FILE_OBJECT = (1 << 3),
72   FLUID_DOMAIN_FILE_BIN_OBJECT = (1 << 4),
73 };
74 
75 /**
76  * #FluidDomainSettings.axis_slice_method
77  * Axis aligned method.
78  */
79 enum {
80   AXIS_SLICE_FULL = 0,
81   AXIS_SLICE_SINGLE = 1,
82 };
83 
84 /**
85  * #FluidDomainSettings.slice_axis
86  * Single slice direction.
87  */
88 enum {
89   SLICE_AXIS_AUTO = 0,
90   SLICE_AXIS_X = 1,
91   SLICE_AXIS_Y = 2,
92   SLICE_AXIS_Z = 3,
93 };
94 
95 /**
96  * #FluidDomainSettings.interp_method
97  * Display interpolation method.
98  */
99 typedef enum FLUID_DisplayInterpolationMethod {
100   FLUID_DISPLAY_INTERP_LINEAR = 0,
101   FLUID_DISPLAY_INTERP_CUBIC = 1,
102   FLUID_DISPLAY_INTERP_CLOSEST = 2,
103 } FLUID_DisplayInterpolationMethod;
104 
105 /** #FluidDomainSettings.vector_draw_type */
106 enum {
107   VECTOR_DRAW_NEEDLE = 0,
108   VECTOR_DRAW_STREAMLINE = 1,
109   VECTOR_DRAW_MAC = 2,
110 };
111 
112 /** #FluidDomainSettings.vector_draw_mac_components */
113 enum {
114   VECTOR_DRAW_MAC_X = (1 << 0),
115   VECTOR_DRAW_MAC_Y = (1 << 1),
116   VECTOR_DRAW_MAC_Z = (1 << 2),
117 };
118 
119 /**
120  * #FluidDomainSettings.vector_field
121  * Fluid domain vector fields.
122  */
123 typedef enum FLUID_DisplayVectorField {
124   FLUID_DOMAIN_VECTOR_FIELD_VELOCITY = 0,
125   FLUID_DOMAIN_VECTOR_FIELD_GUIDE_VELOCITY = 1,
126   FLUID_DOMAIN_VECTOR_FIELD_FORCE = 2,
127 } FLUID_DisplayVectorField;
128 
129 /** #FluidDomainSettings.sndparticle_boundary */
130 enum {
131   SNDPARTICLE_BOUNDARY_DELETE = 0,
132   SNDPARTICLE_BOUNDARY_PUSHOUT = 1,
133 };
134 
135 /** #FluidDomainSettings.sndparticle_combined_export */
136 enum {
137   SNDPARTICLE_COMBINED_EXPORT_OFF = 0,
138   SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM = 1,
139   SNDPARTICLE_COMBINED_EXPORT_SPRAY_BUBBLE = 2,
140   SNDPARTICLE_COMBINED_EXPORT_FOAM_BUBBLE = 3,
141   SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM_BUBBLE = 4,
142 };
143 
144 /** #FluidDomainSettings.coba_field */
145 enum {
146   FLUID_DOMAIN_FIELD_DENSITY = 0,
147   FLUID_DOMAIN_FIELD_HEAT = 1,
148   FLUID_DOMAIN_FIELD_FUEL = 2,
149   FLUID_DOMAIN_FIELD_REACT = 3,
150   FLUID_DOMAIN_FIELD_FLAME = 4,
151   FLUID_DOMAIN_FIELD_VELOCITY_X = 5,
152   FLUID_DOMAIN_FIELD_VELOCITY_Y = 6,
153   FLUID_DOMAIN_FIELD_VELOCITY_Z = 7,
154   FLUID_DOMAIN_FIELD_COLOR_R = 8,
155   FLUID_DOMAIN_FIELD_COLOR_G = 9,
156   FLUID_DOMAIN_FIELD_COLOR_B = 10,
157   FLUID_DOMAIN_FIELD_FORCE_X = 11,
158   FLUID_DOMAIN_FIELD_FORCE_Y = 12,
159   FLUID_DOMAIN_FIELD_FORCE_Z = 13,
160   FLUID_DOMAIN_FIELD_PHI = 14,
161   FLUID_DOMAIN_FIELD_PHI_IN = 15,
162   FLUID_DOMAIN_FIELD_PHI_OUT = 16,
163   FLUID_DOMAIN_FIELD_PHI_OBSTACLE = 17,
164   FLUID_DOMAIN_FIELD_FLAGS = 18,
165   FLUID_DOMAIN_FIELD_PRESSURE = 19,
166 };
167 
168 /**
169  * #FluidDomainSettings.gridlines_color_field
170  * Fluid grid-line display color field types.
171  */
172 enum {
173   FLUID_GRIDLINE_COLOR_TYPE_FLAGS = 1,
174   FLUID_GRIDLINE_COLOR_TYPE_RANGE = 2,
175 };
176 
177 /**
178  * #FluidDomainSettings.gridlines_cell_filter
179  * Fluid cell types.
180  */
181 enum {
182   FLUID_CELL_TYPE_NONE = 0,
183   FLUID_CELL_TYPE_FLUID = (1 << 0),
184   FLUID_CELL_TYPE_OBSTACLE = (1 << 1),
185   FLUID_CELL_TYPE_EMPTY = (1 << 2),
186   FLUID_CELL_TYPE_INFLOW = (1 << 3),
187   FLUID_CELL_TYPE_OUTFLOW = (1 << 4),
188 };
189 
190 /* Fluid domain types. */
191 enum {
192   FLUID_DOMAIN_TYPE_GAS = 0,
193   FLUID_DOMAIN_TYPE_LIQUID = 1,
194 };
195 
196 /* Smoke noise types. */
197 enum {
198   FLUID_NOISE_TYPE_WAVELET = (1 << 0),
199 };
200 
201 /* Mesh levelset generator types. */
202 enum {
203   FLUID_DOMAIN_MESH_IMPROVED = 0,
204   FLUID_DOMAIN_MESH_UNION = 1,
205 };
206 
207 /* Guiding velocity source. */
208 enum {
209   FLUID_DOMAIN_GUIDE_SRC_DOMAIN = 0,
210   FLUID_DOMAIN_GUIDE_SRC_EFFECTOR = 1,
211 };
212 
213 /* Fluid data fields (active_fields). */
214 enum {
215   FLUID_DOMAIN_ACTIVE_HEAT = (1 << 0),
216   FLUID_DOMAIN_ACTIVE_FIRE = (1 << 1),
217   FLUID_DOMAIN_ACTIVE_COLORS = (1 << 2),
218   FLUID_DOMAIN_ACTIVE_COLOR_SET = (1 << 3),
219   FLUID_DOMAIN_ACTIVE_OBSTACLE = (1 << 4),
220   FLUID_DOMAIN_ACTIVE_GUIDE = (1 << 5),
221   FLUID_DOMAIN_ACTIVE_INVEL = (1 << 6),
222   FLUID_DOMAIN_ACTIVE_OUTFLOW = (1 << 7),
223 };
224 
225 /* Particle types. */
226 enum {
227   FLUID_DOMAIN_PARTICLE_FLIP = (1 << 0),
228   FLUID_DOMAIN_PARTICLE_SPRAY = (1 << 1),
229   FLUID_DOMAIN_PARTICLE_BUBBLE = (1 << 2),
230   FLUID_DOMAIN_PARTICLE_FOAM = (1 << 3),
231   FLUID_DOMAIN_PARTICLE_TRACER = (1 << 4),
232 };
233 
234 /* Liquid simulation methods. */
235 enum {
236   FLUID_DOMAIN_METHOD_FLIP = (1 << 0),
237   FLUID_DOMAIN_METHOD_APIC = (1 << 1),
238 };
239 
240 /* Cache options. */
241 enum {
242   FLUID_DOMAIN_BAKING_DATA = (1 << 0),
243   FLUID_DOMAIN_BAKED_DATA = (1 << 1),
244   FLUID_DOMAIN_BAKING_NOISE = (1 << 2),
245   FLUID_DOMAIN_BAKED_NOISE = (1 << 3),
246   FLUID_DOMAIN_BAKING_MESH = (1 << 4),
247   FLUID_DOMAIN_BAKED_MESH = (1 << 5),
248   FLUID_DOMAIN_BAKING_PARTICLES = (1 << 6),
249   FLUID_DOMAIN_BAKED_PARTICLES = (1 << 7),
250   FLUID_DOMAIN_BAKING_GUIDE = (1 << 8),
251   FLUID_DOMAIN_BAKED_GUIDE = (1 << 9),
252   FLUID_DOMAIN_OUTDATED_DATA = (1 << 10),
253   FLUID_DOMAIN_OUTDATED_NOISE = (1 << 11),
254   FLUID_DOMAIN_OUTDATED_MESH = (1 << 12),
255   FLUID_DOMAIN_OUTDATED_PARTICLES = (1 << 13),
256   FLUID_DOMAIN_OUTDATED_GUIDE = (1 << 14),
257 };
258 
259 #define FLUID_DOMAIN_BAKING_ALL \
260   (FLUID_DOMAIN_BAKING_DATA | FLUID_DOMAIN_BAKING_NOISE | FLUID_DOMAIN_BAKING_MESH | \
261    FLUID_DOMAIN_BAKING_PARTICLES | FLUID_DOMAIN_BAKING_GUIDE)
262 
263 #define FLUID_DOMAIN_BAKED_ALL \
264   (FLUID_DOMAIN_BAKED_DATA | FLUID_DOMAIN_BAKED_NOISE | FLUID_DOMAIN_BAKED_MESH | \
265    FLUID_DOMAIN_BAKED_PARTICLES | FLUID_DOMAIN_BAKED_GUIDE)
266 
267 #define FLUID_DOMAIN_DIR_DEFAULT "cache_fluid"
268 #define FLUID_DOMAIN_DIR_CONFIG "config"
269 #define FLUID_DOMAIN_DIR_DATA "data"
270 #define FLUID_DOMAIN_DIR_NOISE "noise"
271 #define FLUID_DOMAIN_DIR_MESH "mesh"
272 #define FLUID_DOMAIN_DIR_PARTICLES "particles"
273 #define FLUID_DOMAIN_DIR_GUIDE "guiding"
274 #define FLUID_DOMAIN_DIR_SCRIPT "script"
275 #define FLUID_DOMAIN_SMOKE_SCRIPT "smoke_script.py"
276 #define FLUID_DOMAIN_LIQUID_SCRIPT "liquid_script.py"
277 #define FLUID_CACHE_VERSION "C01"
278 
279 /* Cache file names. */
280 #define FLUID_NAME_CONFIG "config"
281 #define FLUID_NAME_DATA "fluid_data"
282 #define FLUID_NAME_NOISE "fluid_noise"
283 #define FLUID_NAME_MESH "fluid_mesh"
284 #define FLUID_NAME_PARTICLES "fluid_particles"
285 #define FLUID_NAME_GUIDING "fluid_guiding"
286 
287 /* Fluid object names.*/
288 #define FLUID_NAME_FLAGS "flags"       /* == OpenVDB grid attribute name. */
289 #define FLUID_NAME_VELOCITY "velocity" /* == OpenVDB grid attribute name. */
290 #define FLUID_NAME_VEL "vel"
291 #define FLUID_NAME_VELOCITYTMP "velocity_previous" /* == OpenVDB grid attribute name. */
292 #define FLUID_NAME_VELOCITYX "x_vel"
293 #define FLUID_NAME_VELOCITYY "y_vel"
294 #define FLUID_NAME_VELOCITYZ "z_vel"
295 #define FLUID_NAME_PRESSURE "pressure"
296 #define FLUID_NAME_PHIOBS "phi_obstacle" /* == OpenVDB grid attribute name. */
297 #define FLUID_NAME_PHISIN "phiSIn"
298 #define FLUID_NAME_PHIIN "phi_inflow" /* == OpenVDB grid attribute name. */
299 #define FLUID_NAME_PHIOUT "phi_out"   /* == OpenVDB grid attribute name. */
300 #define FLUID_NAME_FORCES "forces"
301 #define FLUID_NAME_FORCE_X "x_force"
302 #define FLUID_NAME_FORCE_Y "y_force"
303 #define FLUID_NAME_FORCE_Z "z_force"
304 #define FLUID_NAME_NUMOBS "numObs"
305 #define FLUID_NAME_PHIOBSSIN "phiObsSIn"
306 #define FLUID_NAME_PHIOBSIN "phi_obstacle_inflow"
307 #define FLUID_NAME_OBVEL "obvel"
308 #define FLUID_NAME_OBVELC "obvelC"
309 #define FLUID_NAME_OBVEL_X "x_obvel"
310 #define FLUID_NAME_OBVEL_Y "y_obvel"
311 #define FLUID_NAME_OBVEL_Z "z_obvel"
312 #define FLUID_NAME_FRACTIONS "fractions"
313 #define FLUID_NAME_INVELC "invelC"
314 #define FLUID_NAME_INVEL_X "x_invel"
315 #define FLUID_NAME_INVEL_Y "y_invel"
316 #define FLUID_NAME_INVEL_Z "z_invel"
317 #define FLUID_NAME_PHIOUTSIN "phiOutSIn"
318 #define FLUID_NAME_PHIOUTIN "phi_out_inflow"
319 
320 /* Smoke object names. */
321 #define FLUID_NAME_SHADOW "shadow"     /* == OpenVDB grid attribute name. */
322 #define FLUID_NAME_EMISSION "emission" /* == OpenVDB grid attribute name. */
323 #define FLUID_NAME_EMISSIONIN "emissionIn"
324 #define FLUID_NAME_DENSITY "density"          /* == OpenVDB grid attribute name. */
325 #define FLUID_NAME_DENSITYIN "density_inflow" /* == OpenVDB grid attribute name. */
326 #define FLUID_NAME_HEAT "heat"
327 #define FLUID_NAME_HEATIN "heatIn"
328 #define FLUID_NAME_TEMPERATURE "temperature"          /* == OpenVDB grid attribute name. */
329 #define FLUID_NAME_TEMPERATUREIN "temperature_inflow" /* == OpenVDB grid attribute name. */
330 #define FLUID_NAME_COLORR "color_r"                   /* == OpenVDB grid attribute name. */
331 #define FLUID_NAME_COLORG "color_g"                   /* == OpenVDB grid attribute name. */
332 #define FLUID_NAME_COLORB "color_b"                   /* == OpenVDB grid attribute name. */
333 #define FLUID_NAME_COLORRIN "color_r_inflow"          /* == OpenVDB grid attribute name. */
334 #define FLUID_NAME_COLORGIN "color_g_inflow"          /* == OpenVDB grid attribute name. */
335 #define FLUID_NAME_COLORBIN "color_b_inflow"          /* == OpenVDB grid attribute name. */
336 #define FLUID_NAME_FLAME "flame"                      /* == OpenVDB grid attribute name. */
337 #define FLUID_NAME_FUEL "fuel"                        /* == OpenVDB grid attribute name. */
338 #define FLUID_NAME_REACT "react"                      /* == OpenVDB grid attribute name. */
339 #define FLUID_NAME_FUELIN "fuel_inflow"               /* == OpenVDB grid attribute name. */
340 #define FLUID_NAME_REACTIN "react_inflow"             /* == OpenVDB grid attribute name. */
341 
342 /* Liquid object names. */
343 #define FLUID_NAME_PHIPARTS "phi_particles" /* == OpenVDB grid attribute name. */
344 #define FLUID_NAME_PHI "phi"                /* == OpenVDB grid attribute name. */
345 #define FLUID_NAME_PHITMP "phi_previous"    /* == OpenVDB grid attribute name. */
346 #define FLUID_NAME_VELOCITYOLD "velOld"
347 #define FLUID_NAME_VELOCITYPARTS "velParts"
348 #define FLUID_NAME_MAPWEIGHTS "mapWeights"
349 #define FLUID_NAME_PP "pp"
350 #define FLUID_NAME_PVEL "pVel"
351 #define FLUID_NAME_PARTS "particles"                  /* == OpenVDB grid attribute name. */
352 #define FLUID_NAME_PARTSVELOCITY "particles_velocity" /* == OpenVDB grid attribute name. */
353 #define FLUID_NAME_PINDEX "pindex"
354 #define FLUID_NAME_GPI "gpi"
355 #define FLUID_NAME_CURVATURE "gpi"
356 
357 /* Noise object names. */
358 #define FLUID_NAME_VELOCITY_NOISE "velocity_noise"
359 #define FLUID_NAME_DENSITY_NOISE "density_noise" /* == OpenVDB grid attribute name. */
360 #define FLUID_NAME_PHIIN_NOISE "phiIn_noise"
361 #define FLUID_NAME_PHIOUT_NOISE "phiOut_noise"
362 #define FLUID_NAME_PHIOBS_NOISE "phiObs_noise"
363 #define FLUID_NAME_FLAGS_NOISE "flags_noise"
364 #define FLUID_NAME_TMPIN_NOISE "tmpIn_noise"
365 #define FLUID_NAME_EMISSIONIN_NOISE "emissionIn_noise"
366 #define FLUID_NAME_ENERGY "energy"
367 #define FLUID_NAME_TMPFLAGS "tmpFlags"
368 #define FLUID_NAME_TEXTURE_U "textureU"
369 #define FLUID_NAME_TEXTURE_V "textureV"
370 #define FLUID_NAME_TEXTURE_W "textureW"
371 #define FLUID_NAME_TEXTURE_U2 "textureU2"
372 #define FLUID_NAME_TEXTURE_V2 "textureV2"
373 #define FLUID_NAME_TEXTURE_W2 "textureW2"
374 #define FLUID_NAME_UV0 "uv_grid_0"              /* == OpenVDB grid attribute name. */
375 #define FLUID_NAME_UV1 "uv_grid_1"              /* == OpenVDB grid attribute name. */
376 #define FLUID_NAME_COLORR_NOISE "color_r_noise" /* == OpenVDB grid attribute name. */
377 #define FLUID_NAME_COLORG_NOISE "color_g_noise" /* == OpenVDB grid attribute name. */
378 #define FLUID_NAME_COLORB_NOISE "color_b_noise" /* == OpenVDB grid attribute name. */
379 #define FLUID_NAME_FLAME_NOISE "flame_noise"
380 #define FLUID_NAME_FUEL_NOISE "fuel_noise"
381 #define FLUID_NAME_REACT_NOISE "react_noise"
382 
383 /* Mesh object names. */
384 #define FLUID_NAME_PHIPARTS_MESH "phiParts_mesh"
385 #define FLUID_NAME_PHI_MESH "phi_mesh"
386 #define FLUID_NAME_PP_MESH "pp_mesh"
387 #define FLUID_NAME_FLAGS_MESH "flags_mesh"
388 #define FLUID_NAME_LMESH "lMesh"
389 /* == OpenVDB grid attribute name. */
390 #define FLUID_NAME_VELOCITYVEC_MESH "vertex_velocities_mesh"
391 #define FLUID_NAME_VELOCITY_MESH "velocity_mesh"
392 #define FLUID_NAME_PINDEX_MESH "pindex_mesh"
393 #define FLUID_NAME_GPI_MESH "gpi_mesh"
394 
395 /* Particles object names. */
396 #define FLUID_NAME_PP_PARTICLES "ppSnd"
397 #define FLUID_NAME_PVEL_PARTICLES "pVelSnd"
398 #define FLUID_NAME_PLIFE_PARTICLES "pLifeSnd"
399 #define FLUID_NAME_PFORCE_PARTICLES "pForceSnd"
400 /* == OpenVDB grid attribute name. */
401 #define FLUID_NAME_PARTS_PARTICLES "particles_secondary"
402 /* == OpenVDB grid attribute name. */
403 #define FLUID_NAME_PARTSVEL_PARTICLES "particles_velocity_secondary"
404 /* == OpenVDB grid attribute name. */
405 #define FLUID_NAME_PARTSLIFE_PARTICLES "particles_life_secondary"
406 #define FLUID_NAME_PARTSFORCE_PARTICLES "particles_force_secondary"
407 #define FLUID_NAME_VELOCITY_PARTICLES "velocity_secondary"
408 #define FLUID_NAME_FLAGS_PARTICLES "flags_secondary"
409 #define FLUID_NAME_PHI_PARTICLES "phi_secondary"
410 #define FLUID_NAME_PHIOBS_PARTICLES "phiObs_secondary"
411 #define FLUID_NAME_PHIOUT_PARTICLES "phiOut_secondary"
412 #define FLUID_NAME_NORMAL_PARTICLES "normal_secondary"
413 #define FLUID_NAME_NEIGHBORRATIO_PARTICLES "neighbor_ratio_secondary"
414 /* == OpenVDB grid attribute name. */
415 #define FLUID_NAME_TRAPPEDAIR_PARTICLES "trapped_air_secondary"
416 /* == OpenVDB grid attribute name. */
417 #define FLUID_NAME_WAVECREST_PARTICLES "wave_crest_secondary"
418 /* == OpenVDB grid attribute name. */
419 #define FLUID_NAME_KINETICENERGY_PARTICLES "kinetic_energy_secondary"
420 
421 /* Guiding object names. */
422 #define FLUID_NAME_VELT "velT"
423 #define FLUID_NAME_WEIGHTGUIDE "weightGuide"
424 #define FLUID_NAME_NUMGUIDES "numGuides"
425 #define FLUID_NAME_PHIGUIDEIN "phiGuideIn"
426 #define FLUID_NAME_GUIDEVELC "guidevelC"
427 #define FLUID_NAME_GUIDEVEL_X "x_guidevel"
428 #define FLUID_NAME_GUIDEVEL_Y "y_guidevel"
429 #define FLUID_NAME_GUIDEVEL_Z "z_guidevel"
430 #define FLUID_NAME_GUIDEVEL "guidevel"
431 #define FLUID_NAME_VELOCITY_GUIDE "velocity_guide"
432 
433 /* Cache file extensions. */
434 #define FLUID_DOMAIN_EXTENSION_UNI ".uni"
435 #define FLUID_DOMAIN_EXTENSION_OPENVDB ".vdb"
436 #define FLUID_DOMAIN_EXTENSION_RAW ".raw"
437 #define FLUID_DOMAIN_EXTENSION_OBJ ".obj"
438 #define FLUID_DOMAIN_EXTENSION_BINOBJ ".bobj.gz"
439 
440 enum {
441   FLUID_DOMAIN_GRID_FLOAT = 0,
442   FLUID_DOMAIN_GRID_INT = 1,
443   FLUID_DOMAIN_GRID_VEC3F = 2,
444 };
445 
446 enum {
447   FLUID_DOMAIN_CACHE_FILES_SINGLE = 0,
448   FLUID_DOMAIN_CACHE_FILES_COMBINED = 1,
449 };
450 
451 enum {
452   FLUID_DOMAIN_CACHE_REPLAY = 0,
453   FLUID_DOMAIN_CACHE_MODULAR = 1,
454   FLUID_DOMAIN_CACHE_ALL = 2,
455 };
456 
457 enum {
458   VDB_COMPRESSION_BLOSC = 0,
459   VDB_COMPRESSION_ZIP = 1,
460   VDB_COMPRESSION_NONE = 2,
461 };
462 
463 enum {
464   VDB_PRECISION_HALF_FLOAT = 0,
465   VDB_PRECISION_FULL_FLOAT = 1,
466   VDB_PRECISION_MINI_FLOAT = 2,
467 };
468 
469 /* Deprecated values (i.e. all defines and enums below this line up until typedefs). */
470 /* Cache compression. */
471 enum {
472   SM_CACHE_LIGHT = 0,
473   SM_CACHE_HEAVY = 1,
474 };
475 
476 /* High resolution sampling types. */
477 enum {
478   SM_HRES_NEAREST = 0,
479   SM_HRES_LINEAR = 1,
480   SM_HRES_FULLSAMPLE = 2,
481 };
482 
483 typedef struct FluidDomainVertexVelocity {
484   float vel[3];
485 } FluidDomainVertexVelocity;
486 
487 typedef struct FluidDomainSettings {
488 
489   /* -- Runtime-only fields (from here on). -- */
490 
491   struct FluidModifierData *fmd; /* For fast RNA access. */
492   struct MANTA *fluid;
493   struct MANTA *fluid_old; /* Adaptive domain needs access to old fluid state. */
494   void *fluid_mutex;
495   struct Collection *fluid_group;
496   struct Collection *force_group;    /* UNUSED */
497   struct Collection *effector_group; /* Effector objects group. */
498   struct GPUTexture *tex_density;
499   struct GPUTexture *tex_color;
500   struct GPUTexture *tex_wt;
501   struct GPUTexture *tex_shadow;
502   struct GPUTexture *tex_flame;
503   struct GPUTexture *tex_flame_coba;
504   struct GPUTexture *tex_coba;
505   struct GPUTexture *tex_field;
506   struct GPUTexture *tex_velocity_x;
507   struct GPUTexture *tex_velocity_y;
508   struct GPUTexture *tex_velocity_z;
509   struct GPUTexture *tex_flags;
510   struct GPUTexture *tex_range_field;
511   struct Object *guide_parent;
512   /** Vertex velocities of simulated fluid mesh. */
513   struct FluidDomainVertexVelocity *mesh_velocities;
514   struct EffectorWeights *effector_weights;
515 
516   /* Domain object data. */
517   float p0[3];          /* Start point of BB in local space
518                          * (includes sub-cell shift for adaptive domain). */
519   float p1[3];          /* End point of BB in local space. */
520   float dp0[3];         /* Difference from object center to grid start point. */
521   float cell_size[3];   /* Size of simulation cell in local space. */
522   float global_size[3]; /* Global size of domain axises. */
523   float prev_loc[3];
524   int shift[3];         /* Current domain shift in simulation cells. */
525   float shift_f[3];     /* Exact domain shift. */
526   float obj_shift_f[3]; /* How much object has shifted since previous smoke frame (used to "lock"
527                          * domain while drawing). */
528   float imat[4][4];     /* Domain object imat. */
529   float obmat[4][4];    /* Domain obmat. */
530   float fluidmat[4][4]; /* Low res fluid matrix. */
531   float fluidmat_wt[4][4]; /* High res fluid matrix. */
532   int base_res[3];         /* Initial "non-adapted" resolution. */
533   int res_min[3];          /* Cell min. */
534   int res_max[3];          /* Cell max. */
535   int res[3];              /* Data resolution (res_max-res_min). */
536   int total_cells;
537   float dx;               /* 1.0f / res. */
538   float scale;            /* Largest domain size. */
539   int boundary_width;     /* Usually this is just 1. */
540   float gravity_final[3]; /* Scene or domain gravity multiplied with gravity weight. */
541 
542   /* -- User-accesible fields (from here on). -- */
543 
544   /* Adaptive domain options. */
545   int adapt_margin;
546   int adapt_res;
547   float adapt_threshold;
548 
549   /* Fluid domain options */
550   int maxres;            /* Longest axis on the BB gets this resolution assigned. */
551   int solver_res;        /* Dimension of manta solver, 2d or 3d. */
552   int border_collisions; /* How domain border collisions are handled. */
553   int flags;             /* Use-mesh, use-noise, etc. */
554   float gravity[3];
555   int active_fields;
556   short type;    /* Gas, liquid. */
557   char _pad2[6]; /* Unused. */
558 
559   /* Smoke domain options. */
560   float alpha;
561   float beta;
562   int diss_speed; /* In frames. */
563   float vorticity;
564   float active_color[3]; /* Monitor smoke color. */
565   int highres_sampling;
566 
567   /* Flame options. */
568   float burning_rate, flame_smoke, flame_vorticity;
569   float flame_ignition, flame_max_temp;
570   float flame_smoke_color[3];
571 
572   /* Noise options. */
573   float noise_strength;
574   float noise_pos_scale;
575   float noise_time_anim;
576   int res_noise[3];
577   int noise_scale;
578   short noise_type; /* Noise type: wave, curl, anisotropic. */
579   char _pad3[2];    /* Unused. */
580 
581   /* Liquid domain options. */
582   float particle_randomness;
583   int particle_number;
584   int particle_minimum;
585   int particle_maximum;
586   float particle_radius;
587   float particle_band_width;
588   float fractions_threshold;
589   float fractions_distance;
590   float flip_ratio;
591   int sys_particle_maximum;
592   short simulation_method;
593   char _pad4[6];
594 
595   /* Diffusion options. */
596   float surface_tension;
597   float viscosity_base;
598   int viscosity_exponent;
599 
600   /* Mesh options. */
601   float mesh_concave_upper;
602   float mesh_concave_lower;
603   float mesh_particle_radius;
604   int mesh_smoothen_pos;
605   int mesh_smoothen_neg;
606   int mesh_scale;
607   int totvert;
608   short mesh_generator;
609   char _pad5[6]; /* Unused. */
610 
611   /* Secondary particle options. */
612   int particle_type;
613   int particle_scale;
614   float sndparticle_tau_min_wc;
615   float sndparticle_tau_max_wc;
616   float sndparticle_tau_min_ta;
617   float sndparticle_tau_max_ta;
618   float sndparticle_tau_min_k;
619   float sndparticle_tau_max_k;
620   int sndparticle_k_wc;
621   int sndparticle_k_ta;
622   float sndparticle_k_b;
623   float sndparticle_k_d;
624   float sndparticle_l_min;
625   float sndparticle_l_max;
626   int sndparticle_potential_radius;
627   int sndparticle_update_radius;
628   char sndparticle_boundary;
629   char sndparticle_combined_export;
630   char _pad6[6]; /* Unused. */
631 
632   /* Fluid guiding options. */
633   float guide_alpha;      /* Guiding weight scalar (determines strength). */
634   int guide_beta;         /* Guiding blur radius (affects size of vortices). */
635   float guide_vel_factor; /* Multiply guiding velocity by this factor. */
636   int guide_res[3];       /* Res for velocity guide grids - independent from base res. */
637   short guide_source;
638   char _pad7[2]; /* Unused. */
639 
640   /* Cache options. */
641   int cache_frame_start;
642   int cache_frame_end;
643   int cache_frame_pause_data;
644   int cache_frame_pause_noise;
645   int cache_frame_pause_mesh;
646   int cache_frame_pause_particles;
647   int cache_frame_pause_guide;
648   int cache_frame_offset;
649   int cache_flag;
650   char cache_mesh_format;
651   char cache_data_format;
652   char cache_particle_format;
653   char cache_noise_format;
654   char cache_directory[1024];
655   char error[64]; /* Bake error description. */
656   short cache_type;
657   char cache_id[4]; /* Run-time only */
658   char _pad8[2];
659 
660   /* Time options. */
661   float dt;
662   float time_total;
663   float time_per_frame;
664   float frame_length;
665   float time_scale;
666   float cfl_condition;
667   int timesteps_minimum;
668   int timesteps_maximum;
669 
670   /* Display options. */
671   float slice_per_voxel;
672   float slice_depth;
673   float display_thickness;
674   float grid_scale;
675   struct ColorBand *coba;
676   float vector_scale;
677   float gridlines_lower_bound;
678   float gridlines_upper_bound;
679   float gridlines_range_color[4];
680   char axis_slice_method;
681   char slice_axis;
682   char show_gridlines;
683   char draw_velocity;
684   char vector_draw_type;
685   char vector_field; /* Simulation field used for vector display. */
686   char vector_scale_with_magnitude;
687   char vector_draw_mac_components;
688   char use_coba;
689   char coba_field; /* Simulation field used for the color mapping. */
690   char interp_method;
691   char gridlines_color_field; /* Simulation field used to color map onto gridlines. */
692   char gridlines_cell_filter;
693   char _pad9[7];
694 
695   /* OpenVDB cache options. */
696   int openvdb_compression;
697   float clipping;
698   char openvdb_data_depth;
699   char _pad10[7]; /* Unused. */
700 
701   /* -- Deprecated / unsed options (below). -- */
702 
703   /* View options. */
704   int viewsettings;
705   char _pad11[4]; /* Unused. */
706 
707   /* Pointcache options. */
708   /* Smoke uses only one cache from now on (index [0]), but keeping the array for now for reading
709    * old files. */
710   struct PointCache *point_cache[2]; /* Definition is in DNA_object_force_types.h. */
711   struct ListBase ptcaches[2];
712   int cache_comp;
713   int cache_high_comp;
714   char cache_file_format;
715   char _pad12[7]; /* Unused. */
716 
717 } FluidDomainSettings;
718 
719 /* Flow types. */
720 enum {
721   FLUID_FLOW_TYPE_SMOKE = 1,
722   FLUID_FLOW_TYPE_FIRE = 2,
723   FLUID_FLOW_TYPE_SMOKEFIRE = 3,
724   FLUID_FLOW_TYPE_LIQUID = 4,
725 };
726 
727 /* Flow behavior types. */
728 enum {
729   FLUID_FLOW_BEHAVIOR_INFLOW = 0,
730   FLUID_FLOW_BEHAVIOR_OUTFLOW = 1,
731   FLUID_FLOW_BEHAVIOR_GEOMETRY = 2,
732 };
733 
734 /* Flow source types. */
735 enum {
736   FLUID_FLOW_SOURCE_PARTICLES = 0,
737   FLUID_FLOW_SOURCE_MESH = 1,
738 };
739 
740 /* Flow texture types. */
741 enum {
742   FLUID_FLOW_TEXTURE_MAP_AUTO = 0,
743   FLUID_FLOW_TEXTURE_MAP_UV = 1,
744 };
745 
746 /* Flow flags. */
747 enum {
748   /* Old style emission. */
749   FLUID_FLOW_ABSOLUTE = (1 << 1),
750   /* Passes particles speed to the smoke. */
751   FLUID_FLOW_INITVELOCITY = (1 << 2),
752   /* Use texture to control emission speed. */
753   FLUID_FLOW_TEXTUREEMIT = (1 << 3),
754   /* Use specific size for particles instead of closest cell. */
755   FLUID_FLOW_USE_PART_SIZE = (1 << 4),
756   /* Control when to apply inflow. */
757   FLUID_FLOW_USE_INFLOW = (1 << 5),
758   /* Control how to initialize flow objects. */
759   FLUID_FLOW_USE_PLANE_INIT = (1 << 6),
760   /* Notify domain objects about state change (invalidate cache). */
761   FLUID_FLOW_NEEDS_UPDATE = (1 << 7),
762 };
763 
764 typedef struct FluidFlowSettings {
765 
766   /* -- Runtime-only fields (from here on). -- */
767 
768   /* For fast RNA access. */
769   struct FluidModifierData *fmd;
770   struct Mesh *mesh;
771   struct ParticleSystem *psys;
772   struct Tex *noise_texture;
773 
774   /* Initial velocity. */
775   /* Previous vertex positions in domain space. */
776   float *verts_old;
777   int numverts;
778   float vel_multi; /* Multiplier for inherited velocity. */
779   float vel_normal;
780   float vel_random;
781   float vel_coord[3];
782   char _pad1[4];
783 
784   /* -- User-accesible fields (from here on). -- */
785 
786   /* Emission. */
787   float density;
788   float color[3];
789   float fuel_amount;
790   /* Delta temperature (temp - ambient temp). */
791   float temperature;
792   /* Density emitted within mesh volume. */
793   float volume_density;
794   /* Maximum emission distance from mesh surface. */
795   float surface_distance;
796   float particle_size;
797   int subframes;
798 
799   /* Texture control. */
800   float texture_size;
801   float texture_offset;
802   char _pad2[4];
803   /* MAX_CUSTOMDATA_LAYER_NAME. */
804   char uvlayer_name[64];
805   short vgroup_density;
806 
807   short type;     /* Smoke, flames, both, outflow, liquid.  */
808   short behavior; /* Inflow, outflow, static.  */
809   short source;
810   short texture_type;
811   short _pad3[3];
812   int flags; /* Absolute emission etc. */
813 } FluidFlowSettings;
814 
815 /* Effector types. */
816 enum {
817   FLUID_EFFECTOR_TYPE_COLLISION = 0,
818   FLUID_EFFECTOR_TYPE_GUIDE = 1,
819 };
820 
821 /* Guiding velocity modes. */
822 enum {
823   FLUID_EFFECTOR_GUIDE_MAX = 0,
824   FLUID_EFFECTOR_GUIDE_MIN = 1,
825   FLUID_EFFECTOR_GUIDE_OVERRIDE = 2,
826   FLUID_EFFECTOR_GUIDE_AVERAGED = 3,
827 };
828 
829 /* Effector flags. */
830 enum {
831   /* Control when to apply inflow. */
832   FLUID_EFFECTOR_USE_EFFEC = (1 << 1),
833   /* Control how to initialize flow objects. */
834   FLUID_EFFECTOR_USE_PLANE_INIT = (1 << 2),
835   /* Notify domain objects about state change (invalidate cache). */
836   FLUID_EFFECTOR_NEEDS_UPDATE = (1 << 3),
837 };
838 
839 /* Collision objects (filled with smoke). */
840 typedef struct FluidEffectorSettings {
841 
842   /* -- Runtime-only fields (from here on). -- */
843 
844   /* For fast RNA access. */
845   struct FluidModifierData *fmd;
846   struct Mesh *mesh;
847   float *verts_old;
848   int numverts;
849 
850   /* -- User-accesible fields (from here on). -- */
851 
852   float surface_distance; /* Thickness of mesh surface, used in obstacle sdf. */
853   int flags;
854   int subframes;
855   short type;
856   char _pad1[6];
857 
858   /* Guiding options. */
859   float vel_multi; /* Multiplier for object velocity. */
860   short guide_mode;
861   char _pad2[2];
862 } FluidEffectorSettings;
863