OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
| 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 * The Original Code is Copyright (C) 2010 Blender Foundation. |
| 19 * All rights reserved. |
| 20 * |
| 21 * The Original Code is: all of this file. |
| 22 * |
| 23 * Contributor(s): none yet. |
| 24 * |
| 25 * ***** END GPL LICENSE BLOCK ***** |
| 26 */ |
| 27 |
| 28 #ifndef __FREESTYLE_STROKE_SHADERS_H__ |
| 29 #define __FREESTYLE_STROKE_SHADERS_H__ |
| 30 |
| 31 /** \file blender/freestyle/intern/stroke/StrokeShader.h |
| 32 * \ingroup freestyle |
| 33 * \brief Class defining StrokeShader |
| 34 * \author Stephane Grabli |
| 35 * \author Emmanuel Turquin |
| 36 * \date 01/07/2003 |
| 37 */ |
| 38 |
| 39 #include <iostream> |
| 40 #include <vector> |
| 41 |
| 42 #include "../python/Director.h" |
| 43 |
| 44 // |
| 45 // StrokeShader base class |
| 46 // |
| 47 ////////////////////////////////////////////////////// |
| 48 |
| 49 class Stroke; |
| 50 |
| 51 /*! Base class for Stroke Shaders. |
| 52 * Any Stroke Shader must inherit from this class and overload the shade() meth
od. |
| 53 * A StrokeShader is designed to modify any Stroke's attribute such as Thicknes
s, Color, |
| 54 * Geometry, Texture, Blending mode... |
| 55 * The basic way to achieve this operation consists in iterating over the Strok
eVertices of the Stroke |
| 56 * and to modify each one's StrokeAttribute. |
| 57 * Here is a python code example of such an iteration: |
| 58 * \code |
| 59 * it = ioStroke.strokeVerticesBegin() |
| 60 * while not it.isEnd(): |
| 61 * att = it.getObject().attribute() |
| 62 * ## perform here any attribute modification |
| 63 * it.increment() |
| 64 * \endcode |
| 65 * Here is a C++ code example of such an iteration: |
| 66 * \code |
| 67 * for(StrokeInternal::StrokeVertexIterator v = ioStroke.strokeVerticesBegin(),
vend = ioStroke.strokeVerticesEnd(); |
| 68 * v != vend; |
| 69 * ++v) |
| 70 * { |
| 71 * StrokeAttribute& att = v->attribute(); |
| 72 * // perform any attribute modification here... |
| 73 * } |
| 74 * \endcode |
| 75 */ |
| 76 class LIB_STROKE_EXPORT StrokeShader |
| 77 { |
| 78 public: |
| 79 PyObject *py_ss; |
| 80 |
| 81 /*! Default constructor. */ |
| 82 StrokeShader() |
| 83 { |
| 84 py_ss = 0; |
| 85 } |
| 86 |
| 87 /*! Destructor. */ |
| 88 virtual ~StrokeShader() {} |
| 89 |
| 90 /*! Returns the string corresponding to the shader's name. */ |
| 91 virtual string getName() const |
| 92 { |
| 93 return "StrokeShader"; |
| 94 } |
| 95 |
| 96 /*! The shading method. This method must be overloaded by inherited clas
ses. |
| 97 * \param ioStroke |
| 98 * The stroke we wish to shade. this Stroke is modified by the Shader
(which typically |
| 99 * modifies the Stroke's attribute's values such as Color, Thickness,
Geometry...) |
| 100 */ |
| 101 virtual int shade(Stroke& ioStroke) const |
| 102 { |
| 103 return Director_BPy_StrokeShader_shade( const_cast<StrokeShader
*>(this), ioStroke); |
| 104 } |
| 105 }; |
| 106 |
| 107 #endif // __FREESTYLE_STROKE_SHADERS_H__ |
OLD | NEW |