add BLI_strcpy_rlen, replace strcat, which was used in misleading way.
[blender.git] / intern / cycles / subd / subd_build.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 __SUBD_BUILD_H__
20 #define __SUBD_BUILD_H__
21
22 CCL_NAMESPACE_BEGIN
23
24 class SubdFace;
25 class SubdFaceRing;
26 class SubdVert;
27 class GregoryAccStencil;
28 class Patch;
29 class StencilMask;
30
31 /* Builder */
32
33 class SubdBuilder
34 {
35 public:
36         virtual ~SubdBuilder() {};
37         virtual Patch *run(SubdFace *face) = 0;
38         static SubdBuilder *create(bool linear);
39 };
40
41 /* Approximate Catmull Clark using Loop's approximation */
42
43 class SubdAccBuilder : public SubdBuilder
44 {
45 public:
46         SubdAccBuilder();
47         ~SubdAccBuilder();
48
49         Patch *run(SubdFace *face);
50
51 protected:
52         /* Gregory Patch */
53         void computeCornerStencil(SubdFaceRing *ring, GregoryAccStencil *stencil);
54         void computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *stencil);
55         void computeInteriorStencil(SubdFaceRing *ring, GregoryAccStencil *stencil);
56         void computeBoundaryTangentStencils(SubdFaceRing *ring,
57                 SubdVert *vert,
58                 StencilMask & r0, StencilMask & r1);
59 };
60
61 /* Linear Subdivision */
62
63 class SubdLinearBuilder : public SubdBuilder
64 {
65 public:
66         SubdLinearBuilder();
67         ~SubdLinearBuilder();
68
69         Patch *run(SubdFace *face);
70 };
71
72 CCL_NAMESPACE_END
73
74 #endif /* __SUBD_BUILD_H__ */
75