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