2009-08-15 19:48:50 +00:00
|
|
|
/*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-08-15 19:48:50 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2009 by Nicholas Bishop
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_PAINT_H__
|
|
|
|
#define __BKE_PAINT_H__
|
2009-08-15 19:48:50 +00:00
|
|
|
|
2011-02-18 13:05:18 +00:00
|
|
|
/** \file BKE_paint.h
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
|
|
|
|
2012-06-04 07:29:45 +00:00
|
|
|
struct bContext;
|
2012-12-30 18:27:33 +00:00
|
|
|
struct BMesh;
|
2013-01-19 16:10:21 +00:00
|
|
|
struct BMFace;
|
2009-08-16 19:50:00 +00:00
|
|
|
struct Brush;
|
2012-03-14 06:31:38 +00:00
|
|
|
struct MDisps;
|
2012-03-17 04:41:36 +00:00
|
|
|
struct MeshElemMap;
|
2012-05-10 20:33:55 +00:00
|
|
|
struct GridPaintMask;
|
2009-08-28 21:47:11 +00:00
|
|
|
struct MFace;
|
|
|
|
struct MultireModifierData;
|
|
|
|
struct MVert;
|
2009-08-15 19:48:50 +00:00
|
|
|
struct Object;
|
2009-08-16 19:50:00 +00:00
|
|
|
struct Paint;
|
2009-10-27 19:53:34 +00:00
|
|
|
struct PBVH;
|
2009-08-16 19:50:00 +00:00
|
|
|
struct Scene;
|
2009-08-28 21:47:11 +00:00
|
|
|
struct StrokeCache;
|
2009-08-16 19:50:00 +00:00
|
|
|
|
2009-08-20 16:00:17 +00:00
|
|
|
extern const char PAINT_CURSOR_SCULPT[3];
|
|
|
|
extern const char PAINT_CURSOR_VERTEX_PAINT[3];
|
|
|
|
extern const char PAINT_CURSOR_WEIGHT_PAINT[3];
|
|
|
|
extern const char PAINT_CURSOR_TEXTURE_PAINT[3];
|
|
|
|
|
2012-07-25 13:44:59 +00:00
|
|
|
void BKE_paint_init(struct Paint *p, const char col[3]);
|
2012-07-25 22:37:52 +00:00
|
|
|
void BKE_paint_free(struct Paint *p);
|
|
|
|
void BKE_paint_copy(struct Paint *src, struct Paint *tar);
|
2009-08-16 19:50:00 +00:00
|
|
|
|
2012-07-25 22:37:52 +00:00
|
|
|
/* TODO, give these BKE_ prefix too */
|
2009-08-16 19:50:00 +00:00
|
|
|
struct Paint *paint_get_active(struct Scene *sce);
|
2012-06-04 07:29:45 +00:00
|
|
|
struct Paint *paint_get_active_from_context(const struct bContext *C);
|
2009-08-16 19:50:00 +00:00
|
|
|
struct Brush *paint_brush(struct Paint *paint);
|
|
|
|
void paint_brush_set(struct Paint *paint, struct Brush *br);
|
2009-08-15 19:48:50 +00:00
|
|
|
|
|
|
|
/* testing face select mode
|
|
|
|
* Texture paint could be removed since selected faces are not used
|
|
|
|
* however hiding faces is useful */
|
|
|
|
int paint_facesel_test(struct Object *ob);
|
2011-07-12 19:06:06 +00:00
|
|
|
int paint_vertsel_test(struct Object *ob);
|
2009-08-15 19:48:50 +00:00
|
|
|
|
2012-03-14 06:31:38 +00:00
|
|
|
/* partial visibility */
|
|
|
|
int paint_is_face_hidden(const struct MFace *f, const struct MVert *mvert);
|
|
|
|
int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
|
2012-05-11 08:05:47 +00:00
|
|
|
int gridsize, int x, int y);
|
2013-01-19 16:10:21 +00:00
|
|
|
int paint_is_bmesh_face_hidden(struct BMFace *f);
|
2012-03-14 06:31:38 +00:00
|
|
|
|
2012-05-10 20:33:55 +00:00
|
|
|
/* paint masks */
|
|
|
|
float paint_grid_paint_mask(const struct GridPaintMask *gpm, unsigned level,
|
2012-05-11 08:05:47 +00:00
|
|
|
unsigned x, unsigned y);
|
2012-05-10 20:33:55 +00:00
|
|
|
|
2009-08-28 21:47:11 +00:00
|
|
|
/* Session data (mode-specific) */
|
|
|
|
|
|
|
|
typedef struct SculptSession {
|
|
|
|
/* Mesh data (not copied) can come either directly from a Mesh, or from a MultiresDM */
|
|
|
|
struct MultiresModifierData *multires; /* Special handling for multires meshes */
|
|
|
|
struct MVert *mvert;
|
2012-02-05 04:11:34 +00:00
|
|
|
struct MPoly *mpoly;
|
|
|
|
struct MLoop *mloop;
|
|
|
|
int totvert, totpoly;
|
2009-08-28 21:47:11 +00:00
|
|
|
float *face_normals;
|
2010-06-21 20:10:59 +00:00
|
|
|
struct KeyBlock *kb;
|
2012-05-10 20:34:47 +00:00
|
|
|
float *vmask;
|
2009-08-28 21:47:11 +00:00
|
|
|
|
|
|
|
/* Mesh connectivity */
|
2012-03-17 04:41:36 +00:00
|
|
|
const struct MeshElemMap *pmap;
|
2009-08-28 21:47:11 +00:00
|
|
|
|
2012-12-30 18:27:33 +00:00
|
|
|
/* BMesh for dynamic topology sculpting */
|
|
|
|
struct BMesh *bm;
|
|
|
|
int bm_smooth_shading;
|
|
|
|
/* Undo/redo log for dynamic topology sculpting */
|
|
|
|
struct BMLog *bm_log;
|
|
|
|
|
2010-03-22 11:59:36 +00:00
|
|
|
/* PBVH acceleration structure */
|
|
|
|
struct PBVH *pbvh;
|
2012-10-22 17:33:53 +00:00
|
|
|
int show_diffuse_color;
|
2010-03-22 11:59:36 +00:00
|
|
|
|
2011-01-31 20:02:51 +00:00
|
|
|
/* Paiting on deformed mesh */
|
|
|
|
int modifiers_active; /* object is deformed with some modifiers */
|
|
|
|
float (*orig_cos)[3]; /* coords of undeformed mesh */
|
|
|
|
float (*deform_cos)[3]; /* coords of deformed mesh but without stroke displacement */
|
2011-10-17 02:20:53 +00:00
|
|
|
float (*deform_imats)[3][3]; /* crazyspace deformation matrices */
|
2009-10-27 19:53:34 +00:00
|
|
|
|
|
|
|
/* Partial redraw */
|
|
|
|
int partial_redraw;
|
2011-12-04 23:13:28 +00:00
|
|
|
|
2009-08-28 21:47:11 +00:00
|
|
|
/* Used to cache the render of the active texture */
|
|
|
|
unsigned int texcache_side, *texcache, texcache_actual;
|
|
|
|
|
|
|
|
/* Layer brush persistence between strokes */
|
2011-11-11 13:09:14 +00:00
|
|
|
float (*layer_co)[3]; /* Copy of the mesh vertices' locations */
|
2009-08-28 21:47:11 +00:00
|
|
|
|
|
|
|
struct SculptStroke *stroke;
|
|
|
|
struct StrokeCache *cache;
|
2012-05-03 03:51:30 +00:00
|
|
|
|
|
|
|
/* last paint/sculpt stroke location */
|
|
|
|
int last_stroke_valid;
|
|
|
|
float last_stroke[3];
|
2009-08-28 21:47:11 +00:00
|
|
|
} SculptSession;
|
|
|
|
|
2010-03-22 11:59:36 +00:00
|
|
|
void free_sculptsession(struct Object *ob);
|
2011-09-14 00:37:27 +00:00
|
|
|
void free_sculptsession_deformMats(struct SculptSession *ss);
|
2012-12-30 18:27:33 +00:00
|
|
|
void sculptsession_bm_to_me(struct Object *ob, int reorder);
|
2009-08-28 21:47:11 +00:00
|
|
|
|
2009-08-15 19:48:50 +00:00
|
|
|
#endif
|