Blender  V3.3
BasicStrokeShaders.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
8 #include <fstream>
9 
10 #include "AdvancedFunctions0D.h"
11 #include "AdvancedFunctions1D.h"
12 #include "BasicStrokeShaders.h"
13 #include "StrokeIO.h"
14 #include "StrokeIterators.h"
15 #include "StrokeRenderer.h"
16 
17 #include "../system/PseudoNoise.h"
18 #include "../system/RandGen.h"
19 #include "../system/StringUtils.h"
20 
21 #include "../view_map/Functions0D.h"
22 #include "../view_map/Functions1D.h"
23 
24 #include "BKE_global.h"
25 
26 #include "IMB_imbuf.h"
27 #include "IMB_imbuf_types.h"
28 
30 
31 //
32 // Thickness modifiers
33 //
35 
37 {
39  int i = 0;
40  int size = stroke.strokeVerticesSize();
41  for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
42  // XXX What's the use of i here? And is not the thickness always overridden by the last line of
43  // the loop?
44  if ((1 == i) || (size - 2 == i)) {
45  v->attribute().setThickness(_thickness / 4.0, _thickness / 4.0);
46  }
47  if ((0 == i) || (size - 1 == i)) {
48  v->attribute().setThickness(0, 0);
49  }
50 
51  v->attribute().setThickness(_thickness / 2.0, _thickness / 2.0);
52  }
53  return 0;
54 }
55 
57 {
59  int i = 0;
60  int size = stroke.strokeVerticesSize();
61  for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
62  // XXX What's the use of i here? And is not the thickness always overridden by the last line of
63  // the loop?
64  if ((1 == i) || (size - 2 == i)) {
65  v->attribute().setThickness(_thickness / 2.0, 0);
66  }
67  if ((0 == i) || (size - 1 == i)) {
68  v->attribute().setThickness(0, 0);
69  }
70 
71  v->attribute().setThickness(_thickness, 0);
72  }
73  return 0;
74 }
75 
77 {
78  int n = stroke.strokeVerticesSize() - 1, i;
80  for (i = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend;
81  ++v, ++i) {
82  float t;
83  if (i < (float)n / 2.0f) {
84  t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * _ThicknessMax;
85  }
86  else {
87  t = (1.0 - (float)i / (float)n) * _ThicknessMax + (float)i / (float)n * _ThicknessMin;
88  }
89  v->attribute().setThickness(t / 2.0, t / 2.0);
90  }
91  return 0;
92 }
93 
95 {
96  float slength = stroke.getLength2D();
97  float maxT = min(_ratio * slength, _ThicknessMax);
98  int n = stroke.strokeVerticesSize() - 1, i;
100  for (i = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend;
101  ++v, ++i) {
102  // XXX Why not using an if/else here? Else, if last condition is true, everything else is
103  // computed for nothing!
104  float t;
105  if (i < (float)n / 2.0f) {
106  t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * maxT;
107  }
108  else {
109  t = (1.0 - (float)i / (float)n) * maxT + (float)i / (float)n * _ThicknessMin;
110  }
111  v->attribute().setThickness(t / 2.0, t / 2.0);
112  if (i == n - 1) {
113  v->attribute().setThickness(_ThicknessMin / 2.0, _ThicknessMin / 2.0);
114  }
115  }
116  return 0;
117 }
118 
120 {
121  float step = (_maxThickness - _minThickness) / 3.0f;
122  float l = stroke.getLength2D();
123  float thickness = 0.0f;
124  if (l > 300.0f) {
125  thickness = _minThickness + 3.0f * step;
126  }
127  else if ((l < 300.0f) && (l > 100.0f)) {
128  thickness = _minThickness + 2.0f * step;
129  }
130  else if ((l < 100.0f) && (l > 50.0f)) {
131  thickness = _minThickness + 1.0f * step;
132  }
133  else { // else if (l < 50.0f), tsst...
134  thickness = _minThickness;
135  }
136 
138  int i = 0;
139  int size = stroke.strokeVerticesSize();
140  for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
141  // XXX What's the use of i here? And is not the thickness always overridden by the last line of
142  // the loop?
143  if ((1 == i) || (size - 2 == i)) {
144  v->attribute().setThickness(thickness / 4.0, thickness / 4.0);
145  }
146  if ((0 == i) || (size - 1 == i)) {
147  v->attribute().setThickness(0, 0);
148  }
149 
150  v->attribute().setThickness(thickness / 2.0, thickness / 2.0);
151  }
152  return 0;
153 }
154 
155 static const unsigned NB_VALUE_NOISE = 512;
156 
158 {
159  _amplitude = 1.0f;
160  _scale = 1.0f / 2.0f / (float)NB_VALUE_NOISE;
161 }
162 
163 ThicknessNoiseShader::ThicknessNoiseShader(float iAmplitude, float iPeriod)
164 {
165  _amplitude = iAmplitude;
166  _scale = 1.0f / iPeriod / (float)NB_VALUE_NOISE;
167 }
168 
170 {
172  real initU1 = v->strokeLength() * real(NB_VALUE_NOISE) +
174  real initU2 = v->strokeLength() * real(NB_VALUE_NOISE) +
176 
177  real bruit, bruit2;
178  PseudoNoise mynoise, mynoise2;
179  for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
180  bruit = mynoise.turbulenceSmooth(_scale * v->curvilinearAbscissa() + initU1,
181  2); // 2 : nbOctaves
182  bruit2 = mynoise2.turbulenceSmooth(_scale * v->curvilinearAbscissa() + initU2,
183  2); // 2 : nbOctaves
184  const float *originalThickness = v->attribute().getThickness();
185  float r = bruit * _amplitude + originalThickness[0];
186  float l = bruit2 * _amplitude + originalThickness[1];
187  v->attribute().setThickness(r, l);
188  }
189 
190  return 0;
191 }
192 
193 //
194 // Color shaders
195 //
197 
199 {
201  for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
202  v->attribute().setColor(_color[0], _color[1], _color[2]);
203  v->attribute().setAlpha(_color[3]);
204  }
205  return 0;
206 }
207 
209 {
211  int n = stroke.strokeVerticesSize() - 1, yo;
212  float newcolor[4];
213  for (yo = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend;
214  ++v, ++yo) {
215  for (int i = 0; i < 4; ++i) {
216  newcolor[i] = (1.0 - (float)yo / (float)n) * _colorMin[i] +
217  (float)yo / (float)n * _colorMax[i];
218  }
219  v->attribute().setColor(newcolor[0], newcolor[1], newcolor[2]);
220  v->attribute().setAlpha(newcolor[3]);
221  }
222  return 0;
223 }
224 
226 {
227  Interface0DIterator v, vend;
229  StrokeVertex *sv;
230  for (v = stroke.verticesBegin(), vend = stroke.verticesEnd(); v != vend; ++v) {
231  if (fun(v) < 0) {
232  return -1;
233  }
234  const float *diffuse = fun.result.diffuse();
235  sv = dynamic_cast<StrokeVertex *>(&(*v));
236  sv->attribute().setColor(
237  diffuse[0] * _coefficient, diffuse[1] * _coefficient, diffuse[2] * _coefficient);
238  sv->attribute().setAlpha(diffuse[3]);
239  }
240  return 0;
241 }
242 
244 {
245  _amplitude = 1.0f;
246  _scale = 1.0f / 2.0f / (float)NB_VALUE_NOISE;
247 }
248 
249 ColorNoiseShader::ColorNoiseShader(float iAmplitude, float iPeriod)
250 {
251  _amplitude = iAmplitude;
252  _scale = 1.0f / iPeriod / (float)NB_VALUE_NOISE;
253 }
254 
255 int ColorNoiseShader::shade(Stroke &stroke) const
256 {
258  real initU = v->strokeLength() * real(NB_VALUE_NOISE) +
260 
261  real bruit;
262  PseudoNoise mynoise;
263  for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
264  bruit = mynoise.turbulenceSmooth(_scale * v->curvilinearAbscissa() + initU,
265  2); // 2 : nbOctaves
266  const float *originalColor = v->attribute().getColor();
267  float r = bruit * _amplitude + originalColor[0];
268  float g = bruit * _amplitude + originalColor[1];
269  float b = bruit * _amplitude + originalColor[2];
270  v->attribute().setColor(r, g, b);
271  }
272  return 0;
273 }
274 
275 //
276 // Texture Shaders
277 //
279 
281 {
282  if (_mtex) {
283  return stroke.setMTex(_mtex);
284  }
285  if (_nodeTree) {
286  stroke.setNodeTree(_nodeTree);
287  return 0;
288  }
289  return -1;
290 }
291 
293 {
294  stroke.setTextureStep(_step);
295  return 0;
296 }
297 
298 //
299 // Geometry Shaders
300 //
302 
304 {
305  float l = stroke.getLength2D();
306  if (l <= 1.0e-6) {
307  return 0;
308  }
309 
312  ++v1;
314  --vn;
316  --vn_1;
317 
318  Vec2d first((v0)->x(), (v0)->y());
319  Vec2d last((vn)->x(), (vn)->y());
320 
321  Vec2d d1(first - Vec2d((v1)->x(), (v1)->y()));
322  d1.normalize();
323  Vec2d dn(last - Vec2d((vn_1)->x(), (vn_1)->y()));
324  dn.normalize();
325 
326  Vec2d newFirst(first + _amount * d1);
327  (v0)->setPoint(newFirst[0], newFirst[1]);
328  Vec2d newLast(last + _amount * dn);
329  (vn)->setPoint(newLast[0], newLast[1]);
330 
331  stroke.UpdateLength();
332  return 0;
333 }
334 
335 int SamplingShader::shade(Stroke &stroke) const
336 {
337  stroke.Resample(_sampling);
338  stroke.UpdateLength();
339  return 0;
340 }
341 
343 {
344  // float l = stroke.getLength2D();
347  StrokeVertex *sv;
348  for (it = stroke.verticesBegin(); !it.isEnd(); ++it) {
349  if (fun(it) < 0) {
350  return -1;
351  }
352  Vec2f n(fun.result);
353  sv = dynamic_cast<StrokeVertex *>(&(*it));
354  Vec2d newPoint(sv->x() + _amount * n.x(), sv->y() + _amount * n.y());
355  sv->setPoint(newPoint[0], newPoint[1]);
356  }
357  stroke.UpdateLength();
358  return 0;
359 }
360 
363 {
364  if (stroke.strokeVerticesSize() < 4) {
365  return 0;
366  }
367 
368  // Build the Bezier curve from this set of data points:
369  vector<Vec2d> data;
371  data.emplace_back(v->x(), v->y()); // first one
373  ++v;
374  for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
375  if (!((fabs(v->x() - (previous)->x()) < M_EPSILON) &&
376  ((fabs(v->y() - (previous)->y()) < M_EPSILON)))) {
377  data.emplace_back(v->x(), v->y());
378  }
379  previous = v;
380  }
381 
382  // here we build the bezier curve
383  BezierCurve bcurve(data, _error);
384 
385  // bad performances are here !!! // FIXME
386  vector<Vec2d> CurveVertices;
387  vector<BezierCurveSegment *> &bsegments = bcurve.segments();
388  vector<BezierCurveSegment *>::iterator s = bsegments.begin(), send;
389  vector<Vec2d> &segmentsVertices = (*s)->vertices();
390  vector<Vec2d>::iterator p, pend;
391  // first point
392  CurveVertices.push_back(segmentsVertices[0]);
393  for (send = bsegments.end(); s != send; ++s) {
394  segmentsVertices = (*s)->vertices();
395  p = segmentsVertices.begin();
396  ++p;
397  for (pend = segmentsVertices.end(); p != pend; ++p) {
398  CurveVertices.push_back((*p));
399  }
400  }
401 
402  // Re-sample the Stroke depending on the number of vertices of the bezier curve:
403  int originalSize = CurveVertices.size();
404 #if 0
405  float sampling = stroke.ComputeSampling(originalSize);
406  stroke.Resample(sampling);
407 #endif
408  stroke.Resample(originalSize);
409  int newsize = stroke.strokeVerticesSize();
410  int nExtraVertex = 0;
411  if (newsize < originalSize) {
412  cerr << "Warning: insufficient resampling" << endl;
413  }
414  else {
415  nExtraVertex = newsize - originalSize;
416  if (nExtraVertex != 0) {
417  if (G.debug & G_DEBUG_FREESTYLE) {
418  cout << "Bezier Shader : Stroke " << stroke.getId() << " have not been resampled" << endl;
419  }
420  }
421  }
422 
423  // assigns the new coordinates:
424  p = CurveVertices.begin();
425  vector<Vec2d>::iterator last = p;
426  int n;
428  for (n = 0,
429  it = stroke.strokeVerticesBegin(),
430  itend = stroke.strokeVerticesEnd(),
431  pend = CurveVertices.end();
432  (it != itend) && (p != pend);
433  ++it, ++p, ++n) {
434  it->setX(p->x());
435  it->setY(p->y());
436  last = p;
437  }
438  stroke.UpdateLength();
439 
440  // Deal with extra vertices:
441  if (nExtraVertex == 0) {
442  return 0;
443  }
444 
445  // nExtraVertex should stay unassigned
446  vector<StrokeAttribute> attributes;
447  vector<StrokeVertex *> verticesToRemove;
448  for (int i = 0; i < nExtraVertex; ++i, ++it, ++n) {
449  verticesToRemove.push_back(&(*it));
450  if (it.isEnd()) {
451  // XXX Shocking! :P Shouldn't we break in this case???
452  if (G.debug & G_DEBUG_FREESTYLE) {
453  cout << "messed up!" << endl;
454  }
455  }
456  }
457  for (it = stroke.strokeVerticesBegin(); it != itend; ++it) {
458  attributes.push_back(it->attribute());
459  }
460 
461  for (vector<StrokeVertex *>::iterator vr = verticesToRemove.begin(),
462  vrend = verticesToRemove.end();
463  vr != vrend;
464  ++vr) {
465  stroke.RemoveVertex(*vr);
466  }
467 
468  vector<StrokeAttribute>::iterator a = attributes.begin(), aend = attributes.end();
469  int index = 0;
470  int index1 = (int)floor((float)originalSize / 2.0);
471  int index2 = index1 + nExtraVertex;
472  for (it = stroke.strokeVerticesBegin(), itend = stroke.strokeVerticesEnd();
473  (it != itend) && (a != aend);
474  ++it) {
475  (it)->setAttribute(*a);
476  if ((index <= index1) || (index > index2)) {
477  ++a;
478  }
479  ++index;
480  }
481  return 0;
482 }
483 
484 class CurvePiece {
485  public:
490  int size;
491  float _error;
492 
495  int iSize)
496  {
497  _error = 0.0f;
498  _begin = b;
499  _last = l;
500  A = Vec2d((_begin)->x(), (_begin)->y());
501  B = Vec2d((_last)->x(), (_last)->y());
502  size = iSize;
503  }
504 
505  float error()
506  {
507  float maxE = 0.0f;
508  for (StrokeInternal::StrokeVertexIterator it = _begin; it != _last; ++it) {
509  Vec2d P(it->x(), it->y());
510  float d = GeomUtils::distPointSegment(P, A, B);
511  if (d > maxE) {
512  maxE = d;
513  }
514  }
515  _error = maxE;
516  return maxE;
517  }
518 
520  // The first piece is this same object (modified)
521  // The second piece is returned by the method
523  {
525  int ns = size - 1; // number of segments (ns > 1)
526  int ns1 = ns / 2;
527  int ns2 = ns - ns1;
528  for (int i = 0; i < ns1; ++it, ++i) {
529  /* pass */
530  }
531 
532  CurvePiece *second = new CurvePiece(it, _last, ns2 + 1);
533  size = ns1 + 1;
534  _last = it;
535  B = Vec2d((_last)->x(), (_last)->y());
536  return second;
537  }
538 };
539 
541 {
542  vector<CurvePiece *> _pieces;
543  vector<CurvePiece *> _results;
544  vector<CurvePiece *>::iterator cp, cpend;
545 
546  // Compute first approx:
549  --b;
550  int size = stroke.strokeVerticesSize();
551 
552  CurvePiece *piece = new CurvePiece(a, b, size);
553  _pieces.push_back(piece);
554 
555  while (!_pieces.empty()) {
556  piece = _pieces.back();
557  _pieces.pop_back();
558  if (piece->size > 2 && piece->error() > _error) {
559  CurvePiece *second = piece->subdivide();
560  _pieces.push_back(second);
561  _pieces.push_back(piece);
562  }
563  else {
564  _results.push_back(piece);
565  }
566  }
567 
568  // actually modify the geometry for each piece:
569  for (cp = _results.begin(), cpend = _results.end(); cp != cpend; ++cp) {
570  a = (*cp)->_begin;
571  b = (*cp)->_last;
572  Vec2d u = (*cp)->B - (*cp)->A;
573  Vec2d n(u[1], -u[0]);
574  n.normalize();
575  // Vec2d n(0, 0);
576  float offset = ((*cp)->_error);
578  for (v = a; v != b; ++v) {
579  v->setPoint((*cp)->A.x() + v->u() * u.x() + n.x() * offset,
580  (*cp)->A.y() + v->u() * u.y() + n.y() * offset);
581  }
582 #if 0
583  u.normalize();
584  (*a)->setPoint((*a)->x() - u.x() * 10, (*a)->y() - u.y() * 10);
585 #endif
586  }
587  stroke.UpdateLength();
588 
589  // delete stuff
590  for (cp = _results.begin(), cpend = _results.end(); cp != cpend; ++cp) {
591  delete (*cp);
592  }
593  _results.clear();
594  return 0;
595 }
596 
598 {
599  Functions1D::Normal2DF1D norm_fun;
602  --b;
603  int size = stroke.strokeVerticesSize();
604  CurvePiece piece(a, b, size);
605 
606  Vec2d u = piece.B - piece.A;
607  Vec2f n(u[1], -u[0]);
608  n.normalize();
609  if (norm_fun(stroke) < 0) {
610  return -1;
611  }
612  Vec2f strokeN(norm_fun.result);
613  if (n * strokeN < 0) {
614  n[0] = -n[0];
615  n[1] = -n[1];
616  }
617  float offset = (piece.error()) / 2.0f * _offset;
619  for (v = a, vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
620  v->setPoint(piece.A.x() + v->u() * u.x() + n.x() * offset,
621  piece.A.y() + v->u() * u.y() + n.y() * offset);
622  }
623  stroke.UpdateLength();
624  return 0;
625 }
626 
628 //
629 // Tip Remover
630 //
632 
634 {
635  _tipLength = tipLength;
636 }
637 
638 int TipRemoverShader::shade(Stroke &stroke) const
639 {
640  int originalSize = stroke.strokeVerticesSize();
641 
642  if (originalSize < 4) {
643  return 0;
644  }
645 
647  vector<StrokeVertex *> verticesToRemove;
648  vector<StrokeAttribute> oldAttributes;
649  for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
650  if ((v->curvilinearAbscissa() < _tipLength) ||
651  (v->strokeLength() - v->curvilinearAbscissa() < _tipLength)) {
652  verticesToRemove.push_back(&(*v));
653  }
654  oldAttributes.push_back(v->attribute());
655  }
656 
657  if (originalSize - verticesToRemove.size() < 2) {
658  return 0;
659  }
660 
661  vector<StrokeVertex *>::iterator sv, svend;
662  for (sv = verticesToRemove.begin(), svend = verticesToRemove.end(); sv != svend; ++sv) {
663  stroke.RemoveVertex((*sv));
664  }
665 
666  // Resample so that our new stroke have the same number of vertices than before
667  stroke.Resample(originalSize);
668 
669  if ((int)stroke.strokeVerticesSize() != originalSize) { // soc
670  cerr << "Warning: resampling problem" << endl;
671  }
672 
673  // assign old attributes to new stroke vertices:
674  vector<StrokeAttribute>::iterator a = oldAttributes.begin(), aend = oldAttributes.end();
675  for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd();
676  (v != vend) && (a != aend);
677  ++v, ++a) {
678  v->setAttribute(*a);
679  }
680  // we're done!
681  return 0;
682 }
683 
684 } // namespace Freestyle::StrokeShaders
Functions taking 0D input.
Functions taking 1D input.
typedef float(TangentPoint)[2]
@ G_DEBUG_FREESTYLE
Definition: BKE_global.h:181
Class gathering basic stroke shaders.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint vn
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Contains defines and structs used throughout the imbuf module.
Functions to manage I/O for the stroke.
Iterators used to iterate over the elements of the Stroke.
Classes to render a stroke with OpenGL.
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
std::vector< BezierCurveSegment * > & segments()
Definition: Bezier.h:68
const float * diffuse() const
Definition: FrsMaterial.h:88
virtual bool isEnd() const
Definition: Interface0D.h:282
real turbulenceSmooth(real x, unsigned nbOctave=8)
Definition: PseudoNoise.cpp:82
static real drand48()
Definition: RandGen.cpp:90
void setColor(float r, float g, float b)
Definition: Stroke.h:200
void setAlpha(float alpha)
Definition: Stroke.h:222
virtual int shade(Stroke &stroke) const
! Bezier curve stroke shader
virtual int shade(Stroke &stroke) const
StrokeInternal::StrokeVertexIterator _begin
CurvePiece * subdivide()
Subdivides the curve into two pieces.
StrokeInternal::StrokeVertexIterator _last
CurvePiece(StrokeInternal::StrokeVertexIterator b, StrokeInternal::StrokeVertexIterator l, int iSize)
virtual int shade(Stroke &stroke) const
virtual int shade(Stroke &stroke) const
const StrokeAttribute & attribute() const
Definition: Stroke.h:374
void setY(real y)
Definition: Stroke.h:411
void setX(real x)
Definition: Stroke.h:405
void setPoint(real x, real y)
Definition: Stroke.h:417
real x() const
Definition: Stroke.h:350
real y() const
Definition: Stroke.h:356
virtual Id getId() const
Definition: Stroke.h:498
void setTextureStep(float step)
Definition: Stroke.h:753
virtual Interface0DIterator verticesBegin()
Definition: Stroke.cpp:765
void RemoveVertex(StrokeVertex *iVertex)
Definition: Stroke.cpp:697
virtual Interface0DIterator verticesEnd()
Definition: Stroke.cpp:772
void UpdateLength()
Definition: Stroke.cpp:717
int setMTex(MTex *mtex)
Definition: Stroke.h:759
float ComputeSampling(int iNVertices)
Definition: Stroke.cpp:487
StrokeInternal::StrokeVertexIterator strokeVerticesEnd()
Definition: Stroke.cpp:759
StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t=0.0f)
Definition: Stroke.cpp:750
void setNodeTree(bNodeTree *iNodeTree)
Definition: Stroke.h:771
real getLength2D() const
Definition: Stroke.h:621
int Resample(int iNPoints)
Definition: Stroke.cpp:521
unsigned int strokeVerticesSize() const
Definition: Stroke.h:837
value_type x() const
Definition: VecMat.h:305
value_type y() const
Definition: VecMat.h:315
Vec< T, N > & normalize()
Definition: VecMat.h:105
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_device_inline float2 fabs(const float2 &a)
Definition: math_float2.h:222
static float P(float k)
Definition: math_interp.c:25
#define G(x, y, z)
real distPointSegment(const T &P, const T &A, const T &B)
Definition: GeomUtils.h:30
VecMat::Vec2< double > Vec2d
Definition: Geom.h:21
static const unsigned NB_VALUE_NOISE
static const real M_EPSILON
Definition: Precision.h:15
static unsigned x[3]
Definition: RandGen.cpp:73
static unsigned a[3]
Definition: RandGen.cpp:78
double real
Definition: Precision.h:12
T floor(const T &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
#define min(a, b)
Definition: sort.c:35