2011-02-18 13:05:18 +00:00
|
|
|
/*
|
2002-10-12 11:37:38 +00:00
|
|
|
* 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
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BKE_LATTICE_H__
|
|
|
|
#define __BKE_LATTICE_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2011-02-18 13:05:18 +00:00
|
|
|
*/
|
|
|
|
|
2014-02-05 16:18:46 +01:00
|
|
|
#include "BLI_compiler_attrs.h"
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-06-13 13:14:07 +10:00
|
|
|
struct BMEditMesh;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct BPoint;
|
|
|
|
struct Depsgraph;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct Lattice;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct MDeformVert;
|
2013-02-05 12:46:15 +00:00
|
|
|
struct Main;
|
2018-04-25 11:04:40 +02:00
|
|
|
struct Mesh;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct Object;
|
2009-01-04 14:14:06 +00:00
|
|
|
struct Scene;
|
2018-08-30 12:22:55 +02:00
|
|
|
struct bGPDstroke;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-05 16:03:57 +00:00
|
|
|
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
|
2013-02-05 12:46:15 +00:00
|
|
|
struct Lattice *BKE_lattice_add(struct Main *bmain, const char *name);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Lattice *BKE_lattice_copy(struct Main *bmain, const struct Lattice *lt);
|
2012-10-15 09:11:17 +00:00
|
|
|
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
|
2009-01-07 16:05:55 +00:00
|
|
|
|
2014-02-05 22:36:15 +11:00
|
|
|
bool object_deform_mball(struct Object *ob, struct ListBase *dispbase);
|
2002-10-12 11:37:38 +00:00
|
|
|
void outside_lattice(struct Lattice *lt);
|
2009-01-04 14:14:06 +00:00
|
|
|
|
2019-08-22 06:28:35 +10:00
|
|
|
float (*BKE_lattice_vert_coords_alloc(const struct Lattice *lt, int *r_vert_len))[3];
|
2019-08-22 13:20:05 +10:00
|
|
|
void BKE_lattice_vert_coords_get(const struct Lattice *lt, float (*vert_coords)[3]);
|
2019-08-22 13:45:31 +10:00
|
|
|
void BKE_lattice_vert_coords_apply_with_mat4(struct Lattice *lt,
|
|
|
|
const float (*vert_coords)[3],
|
|
|
|
const float mat[4][4]);
|
2019-08-22 06:28:35 +10:00
|
|
|
void BKE_lattice_vert_coords_apply(struct Lattice *lt, const float (*vert_coords)[3]);
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2020-06-13 16:08:34 +10:00
|
|
|
struct MDeformVert *BKE_lattice_deform_verts_get(const struct Object *lattice);
|
2013-06-09 20:28:08 +00:00
|
|
|
struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt);
|
2008-11-03 23:17:36 +00:00
|
|
|
|
2015-08-13 18:12:08 +02:00
|
|
|
struct BoundBox *BKE_lattice_boundbox_get(struct Object *ob);
|
2015-08-17 16:59:32 +02:00
|
|
|
void BKE_lattice_minmax_dl(struct Object *ob, struct Lattice *lt, float min[3], float max[3]);
|
2013-02-01 15:17:39 +00:00
|
|
|
void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3]);
|
|
|
|
void BKE_lattice_center_median(struct Lattice *lt, float cent[3]);
|
|
|
|
void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]);
|
2014-02-03 18:55:59 +11:00
|
|
|
void BKE_lattice_translate(struct Lattice *lt, float offset[3], bool do_keys);
|
2014-09-01 20:09:31 +10:00
|
|
|
void BKE_lattice_transform(struct Lattice *lt, float mat[4][4], bool do_keys);
|
2013-02-01 15:17:39 +00:00
|
|
|
|
2018-05-22 08:11:13 +02:00
|
|
|
bool BKE_lattice_is_any_selected(const struct Lattice *lt);
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w);
|
2013-06-24 13:45:35 +00:00
|
|
|
void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w);
|
2019-04-17 06:17:24 +02:00
|
|
|
int BKE_lattice_index_flip(
|
|
|
|
struct Lattice *lt, const int index, const bool flip_u, const bool flip_v, const bool flip_w);
|
|
|
|
void BKE_lattice_bitmap_from_flag(struct Lattice *lt,
|
|
|
|
unsigned int *bitmap,
|
|
|
|
const short flag,
|
|
|
|
const bool clear,
|
|
|
|
const bool respecthide);
|
2013-06-24 13:45:35 +00:00
|
|
|
|
2015-05-12 13:57:11 +05:00
|
|
|
/* **** Depsgraph evaluation **** */
|
|
|
|
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2015-05-12 13:57:11 +05:00
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void BKE_lattice_eval_geometry(struct Depsgraph *depsgraph, struct Lattice *latt);
|
2015-05-12 13:57:11 +05:00
|
|
|
|
2017-04-21 21:14:11 +10:00
|
|
|
/* Draw Cache */
|
|
|
|
enum {
|
2019-04-17 06:17:24 +02:00
|
|
|
BKE_LATTICE_BATCH_DIRTY_ALL = 0,
|
|
|
|
BKE_LATTICE_BATCH_DIRTY_SELECT,
|
2017-04-21 21:14:11 +10:00
|
|
|
};
|
2018-08-23 10:14:29 -03:00
|
|
|
void BKE_lattice_batch_cache_dirty_tag(struct Lattice *lt, int mode);
|
2017-04-21 21:14:11 +10:00
|
|
|
void BKE_lattice_batch_cache_free(struct Lattice *lt);
|
|
|
|
|
2019-02-23 12:58:39 +11:00
|
|
|
extern void (*BKE_lattice_batch_cache_dirty_tag_cb)(struct Lattice *lt, int mode);
|
|
|
|
extern void (*BKE_lattice_batch_cache_free_cb)(struct Lattice *lt);
|
|
|
|
|
2020-06-12 15:12:54 +10:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
/** \name Deform 3D Coordinates by Lattice (lattice_deform.c)
|
|
|
|
* \{ */
|
|
|
|
|
2020-06-13 16:08:34 +10:00
|
|
|
struct LatticeDeformData *BKE_lattice_deform_data_create(
|
|
|
|
const struct Object *oblatt, const struct Object *ob) ATTR_WARN_UNUSED_RESULT;
|
2020-06-13 15:41:34 +10:00
|
|
|
void BKE_lattice_deform_data_eval_co(struct LatticeDeformData *lattice_deform_data,
|
|
|
|
float co[3],
|
|
|
|
float weight);
|
|
|
|
void BKE_lattice_deform_data_destroy(struct LatticeDeformData *lattice_deform_data);
|
2020-06-12 15:12:54 +10:00
|
|
|
|
2020-06-13 16:08:34 +10:00
|
|
|
void BKE_lattice_deform_coords(const struct Object *ob_lattice,
|
|
|
|
const struct Object *ob_target,
|
2020-06-12 15:12:54 +10:00
|
|
|
float (*vert_coords)[3],
|
|
|
|
const int vert_coords_len,
|
|
|
|
const short flag,
|
|
|
|
const char *defgrp_name,
|
|
|
|
float influence);
|
|
|
|
|
2020-06-13 16:08:34 +10:00
|
|
|
void BKE_lattice_deform_coords_with_mesh(const struct Object *ob_lattice,
|
|
|
|
const struct Object *ob_target,
|
2020-06-12 15:12:54 +10:00
|
|
|
float (*vert_coords)[3],
|
|
|
|
const int vert_coords_len,
|
|
|
|
const short flag,
|
|
|
|
const char *defgrp_name,
|
|
|
|
const float influence,
|
|
|
|
const struct Mesh *me_target);
|
2020-06-13 13:14:07 +10:00
|
|
|
|
2020-06-13 16:08:34 +10:00
|
|
|
void BKE_lattice_deform_coords_with_editmesh(const struct Object *ob_lattice,
|
|
|
|
const struct Object *ob_target,
|
2020-06-13 13:14:07 +10:00
|
|
|
float (*vert_coords)[3],
|
|
|
|
const int vert_coords_len,
|
|
|
|
const short flag,
|
|
|
|
const char *defgrp_name,
|
|
|
|
const float influence,
|
|
|
|
struct BMEditMesh *em_target);
|
2020-06-12 15:12:54 +10:00
|
|
|
/** \} */
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
#endif /* __BKE_LATTICE_H__ */
|