Blender V2.61 - r43446

subd_build.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2011, Blender Foundation.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef __SUBD_BUILD_H__
00020 #define __SUBD_BUILD_H__
00021 
00022 CCL_NAMESPACE_BEGIN
00023 
00024 class SubdFace;
00025 class SubdFaceRing;
00026 class SubdVert;
00027 class GregoryAccStencil;
00028 class Patch;
00029 class StencilMask;
00030 
00031 /* Builder */
00032 
00033 class SubdBuilder
00034 {
00035 public:
00036     virtual ~SubdBuilder() {};
00037     virtual Patch *run(SubdFace *face) = 0;
00038     static SubdBuilder *create(bool linear);
00039 };
00040 
00041 /* Approximate Catmull Clark using Loop's approximation */
00042 
00043 class SubdAccBuilder : public SubdBuilder
00044 {
00045 public:
00046     SubdAccBuilder();
00047     ~SubdAccBuilder();
00048 
00049     Patch *run(SubdFace *face);
00050 
00051 protected:
00052     /* Gregory Patch */
00053     void computeCornerStencil(SubdFaceRing *ring, GregoryAccStencil *stencil);
00054     void computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *stencil);
00055     void computeInteriorStencil(SubdFaceRing *ring, GregoryAccStencil *stencil);
00056     void computeBoundaryTangentStencils(SubdFaceRing *ring,
00057         SubdVert *vert,
00058         StencilMask & r0, StencilMask & r1);
00059 };
00060 
00061 /* Linear Subdivision */
00062 
00063 class SubdLinearBuilder : public SubdBuilder
00064 {
00065 public:
00066     SubdLinearBuilder();
00067     ~SubdLinearBuilder();
00068 
00069     Patch *run(SubdFace *face);
00070 };
00071 
00072 CCL_NAMESPACE_END
00073 
00074 #endif /* __SUBD_BUILD_H__ */
00075