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) 2010 Blender Foundation.
17  * All rights reserved.
18  */
19 
20 #pragma once
21 
22 /** \file
23  * \ingroup DNA
24  */
25 
26 #include "DNA_defs.h"
27 #include "DNA_listBase.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct Collection;
34 struct FreestyleLineStyle;
35 struct Text;
36 
37 /* FreestyleConfig::flags */
38 enum {
39   FREESTYLE_SUGGESTIVE_CONTOURS_FLAG = 1 << 0,
40   FREESTYLE_RIDGES_AND_VALLEYS_FLAG = 1 << 1,
41   FREESTYLE_MATERIAL_BOUNDARIES_FLAG = 1 << 2,
42   FREESTYLE_FACE_SMOOTHNESS_FLAG = 1 << 3,
43   FREESTYLE_ADVANCED_OPTIONS_FLAG = 1 << 4,
44   FREESTYLE_CULLING = 1 << 5,
45   FREESTYLE_VIEW_MAP_CACHE = 1 << 6,
46   FREESTYLE_AS_RENDER_PASS = 1 << 7,
47 };
48 
49 /* FreestyleConfig::mode */
50 enum {
51   FREESTYLE_CONTROL_SCRIPT_MODE = 1,
52   FREESTYLE_CONTROL_EDITOR_MODE = 2,
53 };
54 
55 /* FreestyleLineSet::flags */
56 enum {
57   FREESTYLE_LINESET_CURRENT = 1 << 0,
58   FREESTYLE_LINESET_ENABLED = 1 << 1,
59   FREESTYLE_LINESET_FE_NOT = 1 << 2,
60   FREESTYLE_LINESET_FE_AND = 1 << 3,
61   FREESTYLE_LINESET_GR_NOT = 1 << 4,
62   FREESTYLE_LINESET_FM_NOT = 1 << 5,
63   FREESTYLE_LINESET_FM_BOTH = 1 << 6,
64 };
65 
66 /* FreestyleLineSet::selection */
67 enum {
68   FREESTYLE_SEL_VISIBILITY = 1 << 0,
69   FREESTYLE_SEL_EDGE_TYPES = 1 << 1,
70   FREESTYLE_SEL_GROUP = 1 << 2,
71   FREESTYLE_SEL_IMAGE_BORDER = 1 << 3,
72   FREESTYLE_SEL_FACE_MARK = 1 << 4,
73 };
74 
75 /* FreestyleLineSet::edge_types, exclude_edge_types */
76 enum {
77   FREESTYLE_FE_SILHOUETTE = 1 << 0,
78   FREESTYLE_FE_BORDER = 1 << 1,
79   FREESTYLE_FE_CREASE = 1 << 2,
80   FREESTYLE_FE_RIDGE_VALLEY = 1 << 3,
81   /* FREESTYLE_FE_VALLEY              = 1 << 4, */ /* No longer used */
82   FREESTYLE_FE_SUGGESTIVE_CONTOUR = 1 << 5,
83   FREESTYLE_FE_MATERIAL_BOUNDARY = 1 << 6,
84   FREESTYLE_FE_CONTOUR = 1 << 7,
85   FREESTYLE_FE_EXTERNAL_CONTOUR = 1 << 8,
86   FREESTYLE_FE_EDGE_MARK = 1 << 9,
87 };
88 
89 /* FreestyleLineSet::qi */
90 enum {
91   FREESTYLE_QI_VISIBLE = 1,
92   FREESTYLE_QI_HIDDEN = 2,
93   FREESTYLE_QI_RANGE = 3,
94 };
95 
96 /* FreestyleConfig::raycasting_algorithm */
97 /* Defines should be replaced with ViewMapBuilder::visibility_algo */
98 enum {
99   FREESTYLE_ALGO_REGULAR = 1,
100   FREESTYLE_ALGO_FAST = 2,
101   FREESTYLE_ALGO_VERYFAST = 3,
102   FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL = 4,
103   FREESTYLE_ALGO_ADAPTIVE_TRADITIONAL = 5,
104   FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE = 6,
105   FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE = 7,
106 };
107 
108 typedef struct FreestyleLineSet {
109   struct FreestyleLineSet *next, *prev;
110 
111   /** Line set name, MAX_NAME. */
112   char name[64];
113   int flags;
114 
115   /** Selection criteria. */
116   int selection;
117   /** Quantitative invisibility. */
118   short qi;
119   char _pad1[2];
120   int qi_start, qi_end;
121   /** Feature edge types. */
122   int edge_types, exclude_edge_types;
123   char _pad2[4];
124   /** Group of target objects. */
125   struct Collection *group;
126 
127   struct FreestyleLineStyle *linestyle;
128 } FreestyleLineSet;
129 
130 typedef struct FreestyleModuleConfig {
131   struct FreestyleModuleConfig *next, *prev;
132 
133   struct Text *script;
134   short is_displayed;
135   char _pad[6];
136 } FreestyleModuleConfig;
137 
138 typedef struct FreestyleConfig {
139   ListBase modules;
140 
141   /** Scripting, editor. */
142   int mode;
143   int raycasting_algorithm DNA_DEPRECATED;
144   /** Suggestive contours, ridges/valleys, material boundaries. */
145   int flags;
146   float sphere_radius;
147   float dkr_epsilon;
148   /** In radians!. */
149   float crease_angle;
150 
151   ListBase linesets;
152 } FreestyleConfig;
153 
154 #ifdef __cplusplus
155 }
156 #endif
157