ClangFormat: apply to source, most of intern
[blender.git] / source / blender / blenkernel / BKE_dynamicpaint.h
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
17 #ifndef __BKE_DYNAMICPAINT_H__
18 #define __BKE_DYNAMICPAINT_H__
19
20 /** \file
21  * \ingroup bke
22  */
23
24 struct Depsgraph;
25 struct DynamicPaintCanvasSettings;
26 struct DynamicPaintModifierData;
27 struct DynamicPaintRuntime;
28 struct Main;
29 struct Scene;
30 struct ViewLayer;
31
32 /* Actual surface point */
33 typedef struct PaintSurfaceData {
34   void *format_data;             /* special data for each surface "format" */
35   void *type_data;               /* data used by specific surface type */
36   struct PaintAdjData *adj_data; /* adjacency data for current surface */
37
38   struct PaintBakeData *bData; /* temporary per step data used for frame calculation */
39   int total_points;
40
41 } PaintSurfaceData;
42
43 /* Paint type surface point */
44 typedef struct PaintPoint {
45
46   /* Wet paint is handled at effect layer only
47    * and mixed to surface when drying */
48   float e_color[4];
49   float wetness;
50   short state;
51   float color[4];
52 } PaintPoint;
53
54 /* height field waves */
55 typedef struct PaintWavePoint {
56
57   float height;
58   float velocity;
59   float brush_isect;
60   short state;
61 } PaintWavePoint;
62
63 struct Mesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pmd,
64                                       struct Depsgraph *depsgraph,
65                                       struct Scene *scene,
66                                       struct Object *ob,
67                                       struct Mesh *me);
68 void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd);
69 void dynamicPaint_Modifier_free_runtime(struct DynamicPaintRuntime *runtime);
70 void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
71                                 struct DynamicPaintModifierData *tsmd,
72                                 int flag);
73
74 bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene);
75 struct DynamicPaintSurface *dynamicPaint_createNewSurface(
76     struct DynamicPaintCanvasSettings *canvas, struct Scene *scene);
77 void dynamicPaint_clearSurface(const struct Scene *scene, struct DynamicPaintSurface *surface);
78 bool dynamicPaint_resetSurface(const struct Scene *scene, struct DynamicPaintSurface *surface);
79 void dynamicPaint_freeSurface(const struct DynamicPaintModifierData *pmd,
80                               struct DynamicPaintSurface *surface);
81 void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
82 void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
83 void dynamicPaint_freeSurfaceData(struct DynamicPaintSurface *surface);
84
85 void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface);
86 bool dynamicPaint_surfaceHasColorPreview(struct DynamicPaintSurface *surface);
87 bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface,
88                                     struct Object *ob,
89                                     int output);
90 void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface);
91 void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, const char *basename);
92 void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas);
93 struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings *canvas);
94
95 /* image sequence baking */
96 int dynamicPaint_createUVSurface(struct Scene *scene,
97                                  struct DynamicPaintSurface *surface,
98                                  float *progress,
99                                  short *do_update);
100 int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface,
101                                 struct Depsgraph *depsgraph,
102                                 struct Scene *scene,
103                                 struct Object *cObject,
104                                 int frame);
105 void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface,
106                                      char *filename,
107                                      short output_layer);
108
109 /* PaintPoint state */
110 #define DPAINT_PAINT_NONE -1
111 #define DPAINT_PAINT_DRY 0
112 #define DPAINT_PAINT_WET 1
113 #define DPAINT_PAINT_NEW 2
114
115 /* PaintWavePoint state */
116 #define DPAINT_WAVE_ISECT_CHANGED -1
117 #define DPAINT_WAVE_NONE 0
118 #define DPAINT_WAVE_OBSTACLE 1
119 #define DPAINT_WAVE_REFLECT_ONLY 2
120
121 #endif /* __BKE_DYNAMICPAINT_H__ */