Blender  V2.93
BKE_lattice.h
Go to the documentation of this file.
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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
20 #pragma once
21 
26 #include "BLI_compiler_attrs.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 struct BMEditMesh;
33 struct BPoint;
34 struct Depsgraph;
35 struct Lattice;
36 struct MDeformVert;
37 struct Main;
38 struct Mesh;
39 struct Object;
40 struct Scene;
41 
42 void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb);
43 struct Lattice *BKE_lattice_add(struct Main *bmain, const char *name);
44 void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
45 
46 bool object_deform_mball(struct Object *ob, struct ListBase *dispbase);
47 void outside_lattice(struct Lattice *lt);
48 
49 float (*BKE_lattice_vert_coords_alloc(const struct Lattice *lt, int *r_vert_len))[3];
50 void BKE_lattice_vert_coords_get(const struct Lattice *lt, float (*vert_coords)[3]);
52  const float (*vert_coords)[3],
53  const float mat[4][4]);
54 void BKE_lattice_vert_coords_apply(struct Lattice *lt, const float (*vert_coords)[3]);
56  struct Scene *scene,
57  struct Object *ob);
58 
59 struct MDeformVert *BKE_lattice_deform_verts_get(const struct Object *oblatt);
60 struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt);
61 
62 struct BoundBox *BKE_lattice_boundbox_get(struct Object *ob);
63 void BKE_lattice_minmax_dl(struct Object *ob, struct Lattice *lt, float min[3], float max[3]);
64 void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3]);
65 void BKE_lattice_center_median(struct Lattice *lt, float cent[3]);
66 void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3]);
67 void BKE_lattice_translate(struct Lattice *lt, const float offset[3], bool do_keys);
68 void BKE_lattice_transform(struct Lattice *lt, const float mat[4][4], bool do_keys);
69 
70 bool BKE_lattice_is_any_selected(const struct Lattice *lt);
71 
72 int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w);
73 void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w);
75  struct Lattice *lt, const int index, const bool flip_u, const bool flip_v, const bool flip_w);
77  unsigned int *bitmap,
78  const uint8_t flag,
79  const bool clear,
80  const bool respecthide);
81 
82 /* **** Depsgraph evaluation **** */
83 
84 struct Depsgraph;
85 
87 
88 /* Draw Cache */
89 enum {
92 };
93 void BKE_lattice_batch_cache_dirty_tag(struct Lattice *lt, int mode);
94 void BKE_lattice_batch_cache_free(struct Lattice *lt);
95 
96 extern void (*BKE_lattice_batch_cache_dirty_tag_cb)(struct Lattice *lt, int mode);
97 extern void (*BKE_lattice_batch_cache_free_cb)(struct Lattice *lt);
98 
99 /* -------------------------------------------------------------------- */
104  const struct Object *oblatt, const struct Object *ob) ATTR_WARN_UNUSED_RESULT;
105 void BKE_lattice_deform_data_eval_co(struct LatticeDeformData *lattice_deform_data,
106  float co[3],
107  float weight);
108 void BKE_lattice_deform_data_destroy(struct LatticeDeformData *lattice_deform_data);
109 
110 void BKE_lattice_deform_coords(const struct Object *ob_lattice,
111  const struct Object *ob_target,
112  float (*vert_coords)[3],
113  const int vert_coords_len,
114  const short flag,
115  const char *defgrp_name,
116  float fac);
117 
118 void BKE_lattice_deform_coords_with_mesh(const struct Object *ob_lattice,
119  const struct Object *ob_target,
120  float (*vert_coords)[3],
121  const int vert_coords_len,
122  const short flag,
123  const char *defgrp_name,
124  const float fac,
125  const struct Mesh *me_target);
126 
127 void BKE_lattice_deform_coords_with_editmesh(const struct Object *ob_lattice,
128  const struct Object *ob_target,
129  float (*vert_coords)[3],
130  const int vert_coords_len,
131  const short flag,
132  const char *defgrp_name,
133  const float fac,
134  struct BMEditMesh *em_target);
137 #ifdef __cplusplus
138 }
139 #endif
typedef float(TangentPoint)[2]
void BKE_lattice_deform_data_destroy(struct LatticeDeformData *lattice_deform_data)
@ BKE_LATTICE_BATCH_DIRTY_SELECT
Definition: BKE_lattice.h:91
@ BKE_LATTICE_BATCH_DIRTY_ALL
Definition: BKE_lattice.h:90
void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w)
Definition: lattice.c:222
void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
Definition: lattice.c:542
void BKE_lattice_translate(struct Lattice *lt, const float offset[3], bool do_keys)
Definition: lattice.c:737
void BKE_lattice_center_bounds(struct Lattice *lt, float cent[3])
Definition: lattice.c:705
void BKE_lattice_batch_cache_free(struct Lattice *lt)
Definition: lattice.c:799
void BKE_lattice_deform_coords_with_mesh(const struct Object *ob_lattice, const struct Object *ob_target, float(*vert_coords)[3], const int vert_coords_len, const short flag, const char *defgrp_name, const float fac, const struct Mesh *me_target)
void BKE_lattice_deform_coords_with_editmesh(const struct Object *ob_lattice, const struct Object *ob_target, float(*vert_coords)[3], const int vert_coords_len, const short flag, const char *defgrp_name, const float fac, struct BMEditMesh *em_target)
float(* BKE_lattice_vert_coords_alloc(const struct Lattice *lt, int *r_vert_len))[3]
void BKE_lattice_center_median(struct Lattice *lt, float cent[3])
Definition: lattice.c:623
struct BPoint * BKE_lattice_active_point_get(struct Lattice *lt)
Definition: lattice.c:606
void BKE_lattice_transform(struct Lattice *lt, const float mat[4][4], bool do_keys)
Definition: lattice.c:715
bool object_deform_mball(struct Object *ob, struct ListBase *dispbase)
Definition: lattice.c:410
void BKE_lattice_batch_cache_dirty_tag(struct Lattice *lt, int mode)
Definition: lattice.c:793
void BKE_lattice_deform_data_eval_co(struct LatticeDeformData *lattice_deform_data, float co[3], float weight)
void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du)
Definition: lattice.c:273
void(* BKE_lattice_batch_cache_free_cb)(struct Lattice *lt)
Definition: lattice.c:791
void BKE_lattice_minmax(struct Lattice *lt, float min[3], float max[3])
Definition: lattice.c:691
struct BoundBox * BKE_lattice_boundbox_get(struct Object *ob)
Definition: lattice.c:661
int BKE_lattice_index_flip(struct Lattice *lt, const int index, const bool flip_u, const bool flip_v, const bool flip_w)
Definition: lattice.c:232
struct Lattice * BKE_lattice_add(struct Main *bmain, const char *name)
Definition: lattice.c:401
struct LatticeDeformData * BKE_lattice_deform_data_create(const struct Object *oblatt, const struct Object *ob) ATTR_WARN_UNUSED_RESULT
bool BKE_lattice_is_any_selected(const struct Lattice *lt)
void BKE_lattice_vert_coords_apply(struct Lattice *lt, const float(*vert_coords)[3])
Definition: lattice.c:534
void BKE_lattice_bitmap_from_flag(struct Lattice *lt, unsigned int *bitmap, const uint8_t flag, const bool clear, const bool respecthide)
Definition: lattice.c:254
void(* BKE_lattice_batch_cache_dirty_tag_cb)(struct Lattice *lt, int mode)
Definition: lattice.c:790
void BKE_lattice_minmax_dl(struct Object *ob, struct Lattice *lt, float min[3], float max[3])
Definition: lattice.c:668
void BKE_lattice_eval_geometry(struct Depsgraph *depsgraph, struct Lattice *latt)
void BKE_lattice_vert_coords_apply_with_mat4(struct Lattice *lt, const float(*vert_coords)[3], const float mat[4][4])
Definition: lattice.c:524
void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb)
Definition: lattice.c:289
void BKE_lattice_vert_coords_get(const struct Lattice *lt, float(*vert_coords)[3])
int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w)
Definition: lattice.c:214
void BKE_lattice_deform_coords(const struct Object *ob_lattice, const struct Object *ob_target, float(*vert_coords)[3], const int vert_coords_len, const short flag, const char *defgrp_name, float fac)
void outside_lattice(struct Lattice *lt)
Definition: lattice.c:430
struct MDeformVert * BKE_lattice_deform_verts_get(const struct Object *oblatt)
Definition: lattice.c:599
void BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() ATTR_WARN_UNUSED_RESULT
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
Scene scene
const Depsgraph * depsgraph
static void clear(Message *msg)
Definition: msgfmt.c:294
#define min(a, b)
Definition: sort.c:51
unsigned char uint8_t
Definition: stdint.h:81
Definition: BKE_main.h:116
float max