Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BKE_dynamicpaint.h « blenkernel « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 31f48be2c2767bf052bf0537046ad74f1916c534 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#pragma once

/** \file
 * \ingroup bke
 */

#include "BLI_utildefines.h"

#ifdef __cplusplus
extern "C" {
#endif

struct Depsgraph;
struct DynamicPaintCanvasSettings;
struct DynamicPaintModifierData;
struct DynamicPaintRuntime;
struct Object;
struct Scene;

/* Actual surface point */
typedef struct PaintSurfaceData {
  void *format_data;             /* special data for each surface "format" */
  void *type_data;               /* data used by specific surface type */
  struct PaintAdjData *adj_data; /* adjacency data for current surface */

  struct PaintBakeData *bData; /* temporary per step data used for frame calculation */
  int total_points;

} PaintSurfaceData;

/* Paint type surface point */
typedef struct PaintPoint {

  /* Wet paint is handled at effect layer only
   * and mixed to surface when drying */
  float e_color[4];
  float wetness;
  short state;
  float color[4];
} PaintPoint;

/* height field waves */
typedef struct PaintWavePoint {

  float height;
  float velocity;
  float brush_isect;
  short state;
} PaintWavePoint;

struct Mesh *dynamicPaint_Modifier_do(struct DynamicPaintModifierData *pmd,
                                      struct Depsgraph *depsgraph,
                                      struct Scene *scene,
                                      struct Object *ob,
                                      struct Mesh *me);
void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd);
void dynamicPaint_Modifier_free_runtime(struct DynamicPaintRuntime *runtime);
void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
                                struct DynamicPaintModifierData *tpmd,
                                int flag);

bool dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene);
struct DynamicPaintSurface *dynamicPaint_createNewSurface(
    struct DynamicPaintCanvasSettings *canvas, struct Scene *scene);
void dynamicPaint_clearSurface(const struct Scene *scene, struct DynamicPaintSurface *surface);
bool dynamicPaint_resetSurface(const struct Scene *scene, struct DynamicPaintSurface *surface);
void dynamicPaint_freeSurface(const struct DynamicPaintModifierData *pmd,
                              struct DynamicPaintSurface *surface);
void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
void dynamicPaint_freeSurfaceData(struct DynamicPaintSurface *surface);

void dynamicPaint_cacheUpdateFrames(struct DynamicPaintSurface *surface);
bool dynamicPaint_outputLayerExists(struct DynamicPaintSurface *surface,
                                    struct Object *ob,
                                    int output);
void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface);
void dynamicPaintSurface_setUniqueName(struct DynamicPaintSurface *surface, const char *basename);
struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings *canvas);

/* image sequence baking */
int dynamicPaint_createUVSurface(struct Scene *scene,
                                 struct DynamicPaintSurface *surface,
                                 float *progress,
                                 short *do_update);
int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface,
                                struct Depsgraph *depsgraph,
                                struct Scene *scene,
                                struct Object *cObject,
                                int frame);
void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface,
                                     char *filename,
                                     short output_layer);

/* PaintPoint state */
#define DPAINT_PAINT_NONE -1
#define DPAINT_PAINT_DRY 0
#define DPAINT_PAINT_WET 1
#define DPAINT_PAINT_NEW 2

/* PaintWavePoint state */
#define DPAINT_WAVE_ISECT_CHANGED -1
#define DPAINT_WAVE_NONE 0
#define DPAINT_WAVE_OBSTACLE 1
#define DPAINT_WAVE_REFLECT_ONLY 2

#ifdef __cplusplus
}
#endif