add BLI_strcpy_rlen, replace strcat, which was used in misleading way.
[blender.git] / intern / cycles / render / curves.h
1 /*
2  * Copyright 2011, Blender Foundation.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18
19 #ifndef __CURVES_H__
20 #define __CURVES_H__
21
22 #include "util_types.h"
23 #include "util_vector.h"
24
25 CCL_NAMESPACE_BEGIN
26
27 class Device;
28 class DeviceScene;
29 class Progress;
30 class Scene;
31
32 void curvebounds(float *lower, float *upper, float3 *p, int dim);
33
34 typedef enum curve_presets {
35         CURVE_CUSTOM,
36         CURVE_FAST_PLANES,
37         CURVE_TANGENT_SHADING,
38         CURVE_TRUE_NORMAL,
39         CURVE_ACCURATE_PRESET,
40         CURVE_SMOOTH_CURVES,
41         CURVE_SMOOTH_RIBBONS
42 } curve_presets;
43
44 typedef enum curve_primitives {
45         CURVE_TRIANGLES,
46         CURVE_LINE_SEGMENTS,
47         CURVE_SEGMENTS,
48         CURVE_RIBBONS
49 } curve_primitives;
50
51 typedef enum curve_triangles {
52         CURVE_CAMERA_TRIANGLES,
53         CURVE_RIBBON_TRIANGLES,
54         CURVE_TESSELATED_TRIANGLES
55 } curve_triangles;
56
57 typedef enum curve_lines {
58         CURVE_ACCURATE,
59         CURVE_CORRECTED,
60         CURVE_POSTCORRECTED,
61         CURVE_UNCORRECTED
62 } curve_lines;
63
64 typedef enum curve_interpolation {
65         CURVE_LINEAR,
66         CURVE_CARDINAL,
67         CURVE_BSPLINE
68 } curve_interpolation;
69
70 class ParticleCurveData {
71
72 public:
73
74         ParticleCurveData();
75         ~ParticleCurveData();
76
77         vector<int> psys_firstcurve;
78         vector<int> psys_curvenum;
79         vector<int> psys_shader;
80
81         vector<float> psys_rootradius;
82         vector<float> psys_tipradius;
83         vector<float> psys_shape;
84         vector<bool> psys_closetip;
85
86         vector<int> curve_firstkey;
87         vector<int> curve_keynum;
88         vector<float> curve_length;
89         vector<float3> curve_uv;
90         vector<float3> curve_vcol;
91
92         vector<float3> curvekey_co;
93         vector<float> curvekey_time;
94 };
95
96 /* HairSystem Manager */
97
98 class CurveSystemManager {
99 public:
100
101         int primitive;
102         int line_method;
103         int interpolation;
104         int triangle_method;
105         int resolution;
106         int segments;
107         int subdivisions;
108
109         float normalmix;
110         float encasing_ratio;
111         float minimum_width;
112         float maximum_width;
113
114         bool use_curves;
115         bool use_smooth;
116         bool use_parents;
117         bool use_encasing;
118         bool use_backfacing;
119         bool use_tangent_normal;
120         bool use_tangent_normal_correction;
121         bool use_tangent_normal_geometry;
122         bool use_joined;
123
124         bool need_update;
125         bool need_mesh_update;
126
127         CurveSystemManager();
128         ~CurveSystemManager();
129
130         void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
131         void device_free(Device *device, DeviceScene *dscene);
132         bool modified(const CurveSystemManager& CurveSystemManager);
133         bool modified_mesh(const CurveSystemManager& CurveSystemManager);
134
135         void tag_update(Scene *scene);
136         void tag_update_mesh();
137 };
138
139 CCL_NAMESPACE_END
140
141 #endif /* __CURVES_H__ */
142