Blender  V2.93
AdvancedStrokeShaders.h
Go to the documentation of this file.
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 
17 #pragma once
18 
24 #include "BasicStrokeShaders.h"
25 
26 namespace Freestyle {
27 
34  public:
45  CalligraphicShader(real iMinThickness,
46  real iMaxThickness,
47  const Vec2f &iOrientation,
48  bool clamp);
49 
52  {
53  }
54 
56  virtual int shade(Stroke &ioStroke) const;
57 
58  protected:
62  bool _clamp;
63 };
64 
71  public:
84  SpatialNoiseShader(float iAmount, float ixScale, int nbOctave, bool smooth, bool pureRandom);
85 
88  {
89  }
90 
92  virtual int shade(Stroke &ioStroke) const;
93 
94  protected:
95  float _amount;
96  float _xScale;
97  int _nbOctave;
98  bool _smooth;
100 };
101 
110  public:
129  SmoothingShader(int iNbIteration,
130  real iFactorPoint,
131  real ifactorCurvature,
132  real iFactorCurvatureDifference,
133  real iAnisoPoint,
134  real iAnisoNormal,
135  real iAnisoCurvature,
136  real icarricatureFactor);
137 
140  {
141  }
142 
144  virtual int shade(Stroke &ioStroke) const;
145 
146  protected:
155 };
156 
157 class Smoother {
158  public:
159  Smoother(Stroke &ioStroke);
160 
161  virtual ~Smoother();
162 
163  void smooth(int nbIterations,
164  real iFactorPoint,
165  real ifactorCurvature,
166  real iFactorCurvatureDifference,
167  real iAnisoPoint,
168  real iAnisoNormal,
169  real iAnisoCurvature,
170  real icarricatureFactor);
171 
172  void computeCurvature();
173 
174  protected:
182 
183  void iteration();
184  void copyVertices();
185 
192 
194  bool _safeTest;
195 };
196 
197 class Omitter : public Smoother {
198  public:
199  Omitter(Stroke &ioStroke);
200 
201  virtual ~Omitter()
202  {
203  }
204 
205  void omit(real sizeWindow, real thrVari, real thrFlat, real lFlat);
206 
207  protected:
209 
214 };
215 
217 class OmissionShader : public StrokeShader {
218  public:
219  OmissionShader(real sizeWindow, real thrVari, real thrFlat, real lFlat);
220  virtual ~OmissionShader()
221  {
222  }
223 
224  virtual int shade(Stroke &ioStroke) const;
225 
226  protected:
231 };
232 
233 } /* namespace Freestyle */
Class gathering basic stroke shaders.
CalligraphicShader(real iMinThickness, real iMaxThickness, const Vec2f &iOrientation, bool clamp)
virtual int shade(Stroke &ioStroke) const
OmissionShader(real sizeWindow, real thrVari, real thrFlat, real lFlat)
virtual int shade(Stroke &ioStroke) const
Omitter(Stroke &ioStroke)
void omit(real sizeWindow, real thrVari, real thrFlat, real lFlat)
void smooth(int nbIterations, real iFactorPoint, real ifactorCurvature, real iFactorCurvatureDifference, real iAnisoPoint, real iAnisoNormal, real iAnisoCurvature, real icarricatureFactor)
virtual int shade(Stroke &ioStroke) const
SmoothingShader(int iNbIteration, real iFactorPoint, real ifactorCurvature, real iFactorCurvatureDifference, real iAnisoPoint, real iAnisoNormal, real iAnisoCurvature, real icarricatureFactor)
virtual int shade(Stroke &ioStroke) const
SpatialNoiseShader(float iAmount, float ixScale, int nbOctave, bool smooth, bool pureRandom)
inherits from class Rep
Definition: AppCanvas.cpp:32
double real
Definition: Precision.h:26
ccl_device_inline int clamp(int a, int mn, int mx)
Definition: util_math.h:283