Blender  V3.3
BKE_gpencil_geom.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. */
3 
4 #pragma once
5 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 struct Depsgraph;
15 struct Main;
16 struct Object;
17 struct RegionView3D;
18 struct Scene;
19 struct bGPDcurve;
20 struct bGPDframe;
21 struct bGPDspoint;
22 struct bGPDstroke;
23 struct bGPdata;
24 
25 /* Object bound-box. */
26 
34 bool BKE_gpencil_data_minmax(const struct bGPdata *gpd, float r_min[3], float r_max[3]);
43 bool BKE_gpencil_stroke_minmax(const struct bGPDstroke *gps,
44  bool use_select,
45  float r_min[3],
46  float r_max[3]);
47 
53 struct BoundBox *BKE_gpencil_boundbox_get(struct Object *ob);
59 void BKE_gpencil_centroid_3d(struct bGPdata *gpd, float r_centroid[3]);
65 
66 /* Stroke geometry utilities. */
67 
73 void BKE_gpencil_stroke_normal(const struct bGPDstroke *gps, float r_normal[3]);
85  struct bGPDstroke *gps,
86  float epsilon);
92 void BKE_gpencil_stroke_simplify_fixed(struct bGPdata *gpd, struct bGPDstroke *gps);
100 void BKE_gpencil_stroke_subdivide(struct bGPdata *gpd,
101  struct bGPDstroke *gps,
102  int level,
103  int type);
108 bool BKE_gpencil_stroke_trim(struct bGPdata *gpd, struct bGPDstroke *gps);
121  struct bGPDframe *gpf,
122  struct bGPDstroke *gps,
123  float threshold,
124  bool use_unselected);
125 
134 void BKE_gpencil_stroke_2d_flat(const struct bGPDspoint *points,
135  int totpoints,
136  float (*points2d)[2],
137  int *r_direction);
149 void BKE_gpencil_stroke_2d_flat_ref(const struct bGPDspoint *ref_points,
150  int ref_totpoints,
151  const struct bGPDspoint *points,
152  int totpoints,
153  float (*points2d)[2],
154  float scale,
155  int *r_direction);
166 void BKE_gpencil_stroke_geometry_update(struct bGPdata *gpd, struct bGPDstroke *gps);
171 void BKE_gpencil_stroke_uv_update(struct bGPDstroke *gps);
172 
178 void BKE_gpencil_transform(struct bGPdata *gpd, const float mat[4][4]);
179 
180 typedef struct GPencilPointCoordinates {
181  /* This is used when doing "move only origin" in object_data_transform.c.
182  * pressure is needs to be stored here as it is tied to object scale. */
183  float co[3];
184  float pressure;
186 
194 void BKE_gpencil_point_coords_get(struct bGPdata *gpd, GPencilPointCoordinates *elem_data);
198 void BKE_gpencil_point_coords_apply(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data);
203  const GPencilPointCoordinates *elem_data,
204  const float mat[4][4]);
205 
213 bool BKE_gpencil_stroke_sample(struct bGPdata *gpd,
214  struct bGPDstroke *gps,
215  const float dist,
216  const bool select,
217  const float sharp_threshold);
229  int point_index,
230  float influence,
231  int iterations,
232  bool smooth_caps,
233  bool keep_shape,
234  struct bGPDstroke *r_gps);
244  int point_index,
245  float influence,
246  int iterations,
247  struct bGPDstroke *r_gps);
257  int point_index,
258  float influence,
259  int iterations,
260  struct bGPDstroke *r_gps);
270  int point_index,
271  float influence,
272  int iterations,
273  struct bGPDstroke *r_gps);
286 void BKE_gpencil_stroke_smooth(struct bGPDstroke *gps,
287  const float influence,
288  const int iterations,
289  const bool smooth_position,
290  const bool smooth_strength,
291  const bool smooth_thickness,
292  const bool smooth_uv,
293  const bool keep_shape,
294  const float *weights);
299 bool BKE_gpencil_stroke_close(struct bGPDstroke *gps);
307 void BKE_gpencil_dissolve_points(struct bGPdata *gpd,
308  struct bGPDframe *gpf,
309  struct bGPDstroke *gps,
310  short tag);
311 
321 bool BKE_gpencil_stroke_stretch(struct bGPDstroke *gps,
322  float dist,
323  float overshoot_fac,
324  short mode,
325  bool follow_curvature,
326  int extra_point_count,
327  float segment_influence,
328  float max_angle,
329  bool invert_curvature);
336 bool BKE_gpencil_stroke_trim_points(struct bGPDstroke *gps, int index_from, int index_to);
343  struct bGPDframe *gpf,
344  struct bGPDstroke *gps,
345  struct bGPDstroke *next_stroke,
346  int tag_flags,
347  bool select,
348  bool flat_cap,
349  int limit);
351  struct bGPDframe *gpf,
352  struct bGPDstroke *gps,
353  struct bGPDstroke *next_stroke,
354  struct bGPDcurve *gpc,
355  int tag_flags);
356 
360 void BKE_gpencil_stroke_flip(struct bGPDstroke *gps);
370 bool BKE_gpencil_stroke_split(struct bGPdata *gpd,
371  struct bGPDframe *gpf,
372  struct bGPDstroke *gps,
373  int before_index,
374  struct bGPDstroke **remaining_gps);
381 bool BKE_gpencil_stroke_shrink(struct bGPDstroke *gps, float dist, short mode);
382 
389 float BKE_gpencil_stroke_length(const struct bGPDstroke *gps, bool use_3d);
391 float BKE_gpencil_stroke_segment_length(const struct bGPDstroke *gps,
392  int start_index,
393  int end_index,
394  bool use_3d);
395 
401 
405 void BKE_gpencil_stroke_join(struct bGPDstroke *gps_a,
406  struct bGPDstroke *gps_b,
407  bool leave_gaps,
408  bool fit_thickness,
409  bool smooth);
414  struct bGPDlayer *gpl,
415  struct bGPDframe *gpf,
416  struct bGPDstroke *gps,
417  bool tail);
418 
435 bool BKE_gpencil_convert_mesh(struct Main *bmain,
436  struct Depsgraph *depsgraph,
437  struct Scene *scene,
438  struct Object *ob_gp,
439  struct Object *ob_mesh,
440  float angle,
441  int thickness,
442  float offset,
443  const float matrix[4][4],
444  int frame_offset,
445  bool use_seams,
446  bool use_faces,
447  bool use_vgroups);
448 
459  struct bGPDstroke *gps,
460  uint32_t target_number,
461  bool select);
462 
470  struct bGPDstroke *gps,
471  const float diff_mat[4][4]);
479  struct bGPDstroke *gps,
480  const float diff_mat[4][4]);
487  struct bGPdata *gpd,
488  const struct bGPDlayer *gpl,
489  struct bGPDstroke *gps,
490  int subdivisions,
491  const float diff_mat[4][4]);
500 #ifdef __cplusplus
501 }
502 #endif
void BKE_gpencil_stroke_flip(struct bGPDstroke *gps)
void BKE_gpencil_stroke_fill_triangulate(struct bGPDstroke *gps)
float BKE_gpencil_stroke_average_pressure_get(struct bGPDstroke *gps)
bool BKE_gpencil_stroke_shrink(struct bGPDstroke *gps, float dist, short mode)
void BKE_gpencil_stroke_2d_flat(const struct bGPDspoint *points, int totpoints, float(*points2d)[2], int *r_direction)
bool BKE_gpencil_stroke_stretch(struct bGPDstroke *gps, float dist, float overshoot_fac, short mode, bool follow_curvature, int extra_point_count, float segment_influence, float max_angle, bool invert_curvature)
void BKE_gpencil_centroid_3d(struct bGPdata *gpd, float r_centroid[3])
void BKE_gpencil_stroke_2d_flat_ref(const struct bGPDspoint *ref_points, int ref_totpoints, const struct bGPDspoint *points, int totpoints, float(*points2d)[2], float scale, int *r_direction)
void BKE_gpencil_point_coords_apply(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data)
bool BKE_gpencil_stroke_trim_points(struct bGPDstroke *gps, int index_from, int index_to)
void BKE_gpencil_stroke_join(struct bGPDstroke *gps_a, struct bGPDstroke *gps_b, bool leave_gaps, bool fit_thickness, bool smooth)
void BKE_gpencil_stroke_from_view_space(struct RegionView3D *rv3d, struct bGPDstroke *gps, const float diff_mat[4][4])
void BKE_gpencil_stroke_normal(const struct bGPDstroke *gps, float r_normal[3])
void BKE_gpencil_dissolve_points(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, short tag)
void BKE_gpencil_stroke_copy_to_keyframes(struct bGPdata *gpd, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps, bool tail)
float BKE_gpencil_stroke_length(const struct bGPDstroke *gps, bool use_3d)
void BKE_gpencil_stroke_subdivide(struct bGPdata *gpd, struct bGPDstroke *gps, int level, int type)
bool BKE_gpencil_stroke_smooth_thickness(struct bGPDstroke *gps, int point_index, float influence, int iterations, struct bGPDstroke *r_gps)
void BKE_gpencil_stroke_simplify_adaptive(struct bGPdata *gpd, struct bGPDstroke *gps, float epsilon)
struct bGPDstroke * BKE_gpencil_stroke_perimeter_from_view(struct RegionView3D *rv3d, struct bGPdata *gpd, const struct bGPDlayer *gpl, struct bGPDstroke *gps, int subdivisions, const float diff_mat[4][4])
void BKE_gpencil_stroke_geometry_update(struct bGPdata *gpd, struct bGPDstroke *gps)
float BKE_gpencil_stroke_segment_length(const struct bGPDstroke *gps, int start_index, int end_index, bool use_3d)
bool BKE_gpencil_stroke_sample(struct bGPdata *gpd, struct bGPDstroke *gps, const float dist, const bool select, const float sharp_threshold)
void BKE_gpencil_transform(struct bGPdata *gpd, const float mat[4][4])
bool BKE_gpencil_stroke_smooth_strength(struct bGPDstroke *gps, int point_index, float influence, int iterations, struct bGPDstroke *r_gps)
void BKE_gpencil_stroke_smooth(struct bGPDstroke *gps, const float influence, const int iterations, const bool smooth_position, const bool smooth_strength, const bool smooth_thickness, const bool smooth_uv, const bool keep_shape, const float *weights)
void BKE_gpencil_stroke_to_view_space(struct RegionView3D *rv3d, struct bGPDstroke *gps, const float diff_mat[4][4])
struct GPencilPointCoordinates GPencilPointCoordinates
void BKE_gpencil_stroke_simplify_fixed(struct bGPdata *gpd, struct bGPDstroke *gps)
void BKE_gpencil_stroke_uv_update(struct bGPDstroke *gps)
void BKE_gpencil_stroke_uniform_subdivide(struct bGPdata *gpd, struct bGPDstroke *gps, uint32_t target_number, bool select)
bool BKE_gpencil_stroke_is_pressure_constant(struct bGPDstroke *gps)
bool BKE_gpencil_stroke_smooth_uv(struct bGPDstroke *gps, int point_index, float influence, int iterations, struct bGPDstroke *r_gps)
void BKE_gpencil_stroke_boundingbox_calc(struct bGPDstroke *gps)
struct BoundBox * BKE_gpencil_boundbox_get(struct Object *ob)
void BKE_gpencil_point_coords_get(struct bGPdata *gpd, GPencilPointCoordinates *elem_data)
struct bGPDstroke * BKE_gpencil_stroke_delete_tagged_points(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, struct bGPDstroke *next_stroke, int tag_flags, bool select, bool flat_cap, int limit)
void BKE_gpencil_stroke_set_random_color(struct bGPDstroke *gps)
void BKE_gpencil_curve_delete_tagged_points(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, struct bGPDstroke *next_stroke, struct bGPDcurve *gpc, int tag_flags)
int BKE_gpencil_stroke_point_count(const struct bGPdata *gpd)
bool BKE_gpencil_stroke_split(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, int before_index, struct bGPDstroke **remaining_gps)
bool BKE_gpencil_data_minmax(const struct bGPdata *gpd, float r_min[3], float r_max[3])
void BKE_gpencil_stroke_merge_distance(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, float threshold, bool use_unselected)
void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data, const float mat[4][4])
bool BKE_gpencil_stroke_smooth_point(struct bGPDstroke *gps, int point_index, float influence, int iterations, bool smooth_caps, bool keep_shape, struct bGPDstroke *r_gps)
bool BKE_gpencil_stroke_close(struct bGPDstroke *gps)
bool BKE_gpencil_stroke_trim(struct bGPdata *gpd, struct bGPDstroke *gps)
bool BKE_gpencil_stroke_minmax(const struct bGPDstroke *gps, bool use_select, float r_min[3], float r_max[3])
bool BKE_gpencil_convert_mesh(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_gp, struct Object *ob_mesh, float angle, int thickness, float offset, const float matrix[4][4], int frame_offset, bool use_seams, bool use_faces, bool use_vgroups)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
Scene scene
const Depsgraph * depsgraph
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
static double epsilon
smooth(Type::FLOAT, "mask_weight")
unsigned int uint32_t
Definition: stdint.h:80
Definition: BKE_main.h:121