Blender  V2.93
DNA_curveprofile_types.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  * Copyright (C) 2019 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "DNA_vec_types.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
33 #define PROF_TABLE_MAX 512
35 #define PROF_RESOL 16
37 #define PROF_TABLE_LEN(n_pts) min_ii(PROF_TABLE_MAX, (((n_pts - 1)) * PROF_RESOL) + 1)
38 
44 typedef struct CurveProfilePoint {
46  float x, y;
48  short flag;
50  char h1, h2;
53  float h1_loc[2];
54  float h2_loc[2];
55  char _pad[4];
59 
61 enum {
62  PROF_SELECT = (1 << 0),
63  PROF_H1_SELECT = (1 << 1),
64  PROF_H2_SELECT = (1 << 2),
65 };
66 
68 typedef struct CurveProfile {
70  short path_len;
72  short segments_len;
74  int preset;
82  int flag;
88 
90 enum {
91  PROF_USE_CLIP = (1 << 0), /* Keep control points inside bounding rectangle. */
92  /* PROF_SYMMETRY_MODE = (1 << 1), Unused for now. */
93  PROF_SAMPLE_STRAIGHT_EDGES = (1 << 2), /* Sample extra points on straight edges. */
94  PROF_SAMPLE_EVEN_LENGTHS = (1 << 3), /* Put segments evenly spaced along the path. */
95  PROF_DIRTY_PRESET = (1 << 4), /* Marks when the dynamic preset has been changed. */
96 };
97 
98 typedef enum eCurveProfilePresets {
99  PROF_PRESET_LINE = 0, /* Default simple line between end points. */
100  PROF_PRESET_SUPPORTS = 1, /* Support loops for a regular curved profile. */
101  PROF_PRESET_CORNICE = 2, /* Molding type example. */
102  PROF_PRESET_CROWN = 3, /* Second molding example. */
103  PROF_PRESET_STEPS = 4, /* Dynamic number of steps defined by segments_len. */
105 
106 #ifdef __cplusplus
107 }
108 #endif
eCurveProfilePresets
@ PROF_PRESET_CROWN
@ PROF_PRESET_LINE
@ PROF_PRESET_CORNICE
@ PROF_PRESET_SUPPORTS
@ PROF_PRESET_STEPS
@ PROF_DIRTY_PRESET
@ PROF_USE_CLIP
@ PROF_SAMPLE_EVEN_LENGTHS
@ PROF_SAMPLE_STRAIGHT_EDGES
struct CurveProfile CurveProfile
@ PROF_H1_SELECT
@ PROF_H2_SELECT
struct CurveProfilePoint CurveProfilePoint
struct CurveProfile * profile
CurveProfilePoint * path
CurveProfilePoint * table
CurveProfilePoint * segments