Blender  V3.3
Public Types | Public Member Functions | List of all members
Freestyle::Stroke Class Reference

#include <Stroke.h>

Inheritance diagram for Freestyle::Stroke:
Freestyle::Interface1D

Public Types

enum  MediumType { DRY_MEDIUM , HUMID_MEDIUM , OPAQUE_MEDIUM }
 
typedef std::deque< StrokeVertex * > vertex_container
 
typedef std::vector< ViewEdge * > viewedge_container
 
typedef StrokeInternal::vertex_iterator_base< StrokeInternal::vertex_nonconst_traitsvertex_iterator
 
typedef StrokeInternal::vertex_iterator_base< StrokeInternal::vertex_const_traitsconst_vertex_iterator
 

Public Member Functions

virtual string getExactTypeName () const
 
virtual Id getId () const
 
 Stroke ()
 
 Stroke (const Stroke &iBrother)
 
template<class InputVertexIterator >
 Stroke (InputVertexIterator iBegin, InputVertexIterator iEnd)
 
virtual ~Stroke ()
 
Strokeoperator= (const Stroke &iBrother)
 
float ComputeSampling (int iNVertices)
 
int Resample (int iNPoints)
 
int Resample (float iSampling)
 
void RemoveAllVertices ()
 
void RemoveVertex (StrokeVertex *iVertex)
 
void InsertVertex (StrokeVertex *iVertex, StrokeInternal::StrokeVertexIterator next)
 
void UpdateLength ()
 
void ScaleThickness (float iFactor)
 
void Render (const StrokeRenderer *iRenderer)
 
void RenderBasic (const StrokeRenderer *iRenderer)
 
real getLength2D () const
 
MediumType getMediumType () const
 
unsigned int getTextureId ()
 
float getTextureStep ()
 
MTexgetMTex (int idx)
 
bNodeTreegetNodeTree ()
 
bool hasTex () const
 
bool hasTips () const
 
int vertices_size () const
 
viewedge_container::const_iterator viewedges_begin () const
 
viewedge_container::iterator viewedges_begin ()
 
viewedge_container::const_iterator viewedges_end () const
 
viewedge_container::iterator viewedges_end ()
 
int viewedges_size () const
 
Vec2r getBeginningOrientation () const
 
real getBeginningOrientationX () const
 
real getBeginningOrientationY () const
 
Vec2r getEndingOrientation () const
 
real getEndingOrientationX () const
 
real getEndingOrientationY () const
 
void setId (const Id &id)
 
void setLength (float iLength)
 
void setMediumType (MediumType iType)
 
void setTextureId (unsigned int id)
 
void setTextureStep (float step)
 
int setMTex (MTex *mtex)
 
void setNodeTree (bNodeTree *iNodeTree)
 
void setTips (bool iTips)
 
void push_back (StrokeVertex *iVertex)
 
void push_front (StrokeVertex *iVertex)
 
void AddViewEdge (ViewEdge *iViewEdge)
 
void setBeginningOrientation (const Vec2r &iOrientation)
 
void setBeginningOrientation (real x, real y)
 
void setEndingOrientation (const Vec2r &iOrientation)
 
void setEndingOrientation (real x, real y)
 
const_vertex_iterator vertices_begin () const
 embedding vertex iterator More...
 
vertex_iterator vertices_begin (float sampling=0.0f)
 
const_vertex_iterator vertices_end () const
 
vertex_iterator vertices_end ()
 
StrokeInternal::StrokeVertexIterator strokeVerticesBegin (float t=0.0f)
 
StrokeInternal::StrokeVertexIterator strokeVerticesEnd ()
 
unsigned int strokeVerticesSize () const
 
StrokeVertexstrokeVerticeAt (unsigned int i)
 
virtual Interface0DIterator verticesBegin ()
 
virtual Interface0DIterator verticesEnd ()
 
virtual Interface0DIterator pointsBegin (float t=0.0f)
 
virtual Interface0DIterator pointsEnd (float t=0.0f)
 
- Public Member Functions inherited from Freestyle::Interface1D
 Interface1D ()
 
virtual ~Interface1D ()
 
virtual Nature::EdgeNature getNature () const
 
virtual unsigned getTimeStamp () const
 
void setTimeStamp (unsigned iTimeStamp)
 

Additional Inherited Members

- Protected Attributes inherited from Freestyle::Interface1D
unsigned _timeStamp
 

Detailed Description

Class to define a stroke. A stroke is made of a set of 2D vertices (StrokeVertex), regularly spaced out. This set of vertices defines the stroke's backbone geometry. Each of these stroke vertices defines the stroke's shape and appearance at this vertex position.

Definition at line 487 of file Stroke.h.

Member Typedef Documentation

◆ const_vertex_iterator

Definition at line 516 of file Stroke.h.

◆ vertex_container

Definition at line 511 of file Stroke.h.

◆ vertex_iterator

Definition at line 514 of file Stroke.h.

◆ viewedge_container

Definition at line 512 of file Stroke.h.

Member Enumeration Documentation

◆ MediumType

The different blending modes available to simulate the interaction media-medium.

Enumerator
DRY_MEDIUM 

To simulate a dry medium such as Pencil or Charcoal.

HUMID_MEDIUM 

To simulate ink painting (color subtraction blending).

OPAQUE_MEDIUM 

To simulate an opaque medium (oil, spray...).

Definition at line 504 of file Stroke.h.

Constructor & Destructor Documentation

◆ Stroke() [1/3]

Freestyle::Stroke::Stroke ( )

default constructor

Definition at line 391 of file Stroke.cpp.

References Freestyle::a, MAX_MTEX, and OPAQUE_MEDIUM.

◆ Stroke() [2/3]

Freestyle::Stroke::Stroke ( const Stroke iBrother)

copy constructor

Definition at line 408 of file Stroke.cpp.

References Freestyle::a, MAX_MTEX, and v.

◆ Stroke() [3/3]

template<class InputVertexIterator >
Freestyle::Stroke::Stroke ( InputVertexIterator  iBegin,
InputVertexIterator  iEnd 
)

Builds a stroke from a set of StrokeVertex. This constructor is templated by an iterator type. This iterator type must allow the vertices parsing using the ++ operator.

Parameters
iBeginThe iterator pointing to the first vertex.
iEndThe iterator pointing to the end of the vertex list.

Definition at line 869 of file Stroke.h.

References v.

◆ ~Stroke()

Freestyle::Stroke::~Stroke ( )
virtual

Destructor

Definition at line 436 of file Stroke.cpp.

References v.

Member Function Documentation

◆ AddViewEdge()

void Freestyle::Stroke::AddViewEdge ( ViewEdge iViewEdge)
inline

Definition at line 792 of file Stroke.h.

◆ ComputeSampling()

float Freestyle::Stroke::ComputeSampling ( int  iNVertices)

Compute the sampling needed to get iNVertices vertices. If the specified number of vertices is less than the actual number of vertices, the actual sampling value is returned. (To remove Vertices, use the RemoveVertex() method of this class).

Parameters
iNVerticesThe number of StrokeVertices we eventually want in our Stroke.
Returns
the sampling that must be used in the Resample(float) method.
See also
Resample(int)
Resample(float)

Definition at line 487 of file Stroke.cpp.

References float().

Referenced by Freestyle::StrokeShaders::BezierCurveShader::shade().

◆ getBeginningOrientation()

Vec2r Freestyle::Stroke::getBeginningOrientation ( ) const
inline

Definition at line 700 of file Stroke.h.

◆ getBeginningOrientationX()

real Freestyle::Stroke::getBeginningOrientationX ( ) const
inline

Definition at line 705 of file Stroke.h.

References Freestyle::VecMat::Vec2< T >::x().

◆ getBeginningOrientationY()

real Freestyle::Stroke::getBeginningOrientationY ( ) const
inline

Definition at line 710 of file Stroke.h.

References Freestyle::VecMat::Vec2< T >::y().

◆ getEndingOrientation()

Vec2r Freestyle::Stroke::getEndingOrientation ( ) const
inline

Definition at line 715 of file Stroke.h.

◆ getEndingOrientationX()

real Freestyle::Stroke::getEndingOrientationX ( ) const
inline

Definition at line 720 of file Stroke.h.

References Freestyle::VecMat::Vec2< T >::x().

◆ getEndingOrientationY()

real Freestyle::Stroke::getEndingOrientationY ( ) const
inline

Definition at line 725 of file Stroke.h.

References Freestyle::VecMat::Vec2< T >::y().

◆ getExactTypeName()

virtual string Freestyle::Stroke::getExactTypeName ( ) const
inlinevirtual

Returns the string "Stroke"

Reimplemented from Freestyle::Interface1D.

Definition at line 490 of file Stroke.h.

◆ getId()

virtual Id Freestyle::Stroke::getId ( ) const
inlinevirtual

◆ getLength2D()

real Freestyle::Stroke::getLength2D ( ) const
inlinevirtual

◆ getMediumType()

MediumType Freestyle::Stroke::getMediumType ( ) const
inline

Returns a reference to the time stamp value of the stroke. Returns the MediumType used for this Stroke.

Definition at line 628 of file Stroke.h.

Referenced by Freestyle::operator<<(), and Freestyle::StrokeRep::StrokeRep().

◆ getMTex()

MTex* Freestyle::Stroke::getMTex ( int  idx)
inline

Returns the texture used at given index to simulate the marks system for this Stroke

Definition at line 646 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ getNodeTree()

bNodeTree* Freestyle::Stroke::getNodeTree ( )
inline

Return the shader node tree to define textures.

Definition at line 652 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ getTextureId()

unsigned int Freestyle::Stroke::getTextureId ( )
inline

Returns the id of the texture used to simulate th marks system for this Stroke

Definition at line 634 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ getTextureStep()

float Freestyle::Stroke::getTextureStep ( )
inline

Returns the spacing of texture coordinates along the stroke length

Definition at line 640 of file Stroke.h.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ hasTex()

bool Freestyle::Stroke::hasTex ( ) const
inline

Returns true if this Stroke has textures assigned, false otherwise.

Definition at line 658 of file Stroke.h.

References NULL.

Referenced by Freestyle::StrokeRep::StrokeRep().

◆ hasTips()

bool Freestyle::Stroke::hasTips ( ) const
inline

Returns true if this Stroke uses a texture with tips, false otherwise.

Definition at line 664 of file Stroke.h.

◆ InsertVertex()

void Freestyle::Stroke::InsertVertex ( StrokeVertex iVertex,
StrokeInternal::StrokeVertexIterator  next 
)

Inserts the stroke vertex iVertex in the stroke before next. The length, curvilinear abscissa are updated consequently.

Parameters
iVertexThe StrokeVertex to insert in the Stroke.
nextA StrokeVertexIterator pointing to the StrokeVertex before which iVertex must be inserted.

Definition at line 710 of file Stroke.cpp.

References next, and UpdateLength().

◆ operator=()

Stroke & Freestyle::Stroke::operator= ( const Stroke iBrother)

operator =

Definition at line 453 of file Stroke.cpp.

References v.

◆ pointsBegin()

Interface0DIterator Freestyle::Stroke::pointsBegin ( float  t = 0.0f)
virtual

Returns an iterator over the Interface1D points, pointing to the first point. The difference with verticesBegin() is that here we can iterate over points of the 1D element at a any given sampling. Indeed, for each iteration, a virtual point is created.

Parameters
tThe sampling with which we want to iterate over points of this 1D element.

Reimplemented from Freestyle::Interface1D.

Definition at line 779 of file Stroke.cpp.

References verticesBegin().

◆ pointsEnd()

Interface0DIterator Freestyle::Stroke::pointsEnd ( float  t = 0.0f)
virtual

Returns an iterator over the Interface1D points, pointing after the last point. The difference with verticesEnd() is that here we can iterate over points of the 1D element at a any given sampling. Indeed, for each iteration, a virtual point is created.

Parameters
tThe sampling with which we want to iterate over points of this 1D element.

Reimplemented from Freestyle::Interface1D.

Definition at line 784 of file Stroke.cpp.

References verticesEnd().

◆ push_back()

void Freestyle::Stroke::push_back ( StrokeVertex iVertex)
inline

Definition at line 782 of file Stroke.h.

Referenced by Freestyle::createStroke().

◆ push_front()

void Freestyle::Stroke::push_front ( StrokeVertex iVertex)
inline

Definition at line 787 of file Stroke.h.

◆ RemoveAllVertices()

void Freestyle::Stroke::RemoveAllVertices ( )

Removes all vertices from the Stroke.

Definition at line 687 of file Stroke.cpp.

References UpdateLength().

◆ RemoveVertex()

void Freestyle::Stroke::RemoveVertex ( StrokeVertex iVertex)

Removes the stroke vertex iVertex from the stroke. The length and curvilinear abscissa are updated consequently.

Definition at line 697 of file Stroke.cpp.

References UpdateLength().

Referenced by Freestyle::StrokeShaders::BezierCurveShader::shade(), and Freestyle::StrokeShaders::TipRemoverShader::shade().

◆ Render()

void Freestyle::Stroke::Render ( const StrokeRenderer iRenderer)

◆ RenderBasic()

void Freestyle::Stroke::RenderBasic ( const StrokeRenderer iRenderer)

◆ Resample() [1/2]

int Freestyle::Stroke::Resample ( float  iSampling)

Resampling method. Resamples the curve with a given sampling. If this sampling is < to the actual sampling value, no resampling is done.

Parameters
iSamplingThe new sampling value.

Definition at line 630 of file Stroke.cpp.

References Freestyle::a, usdtokens::b(), next, Freestyle::VecMat::Vec< T, N >::norm(), strokeVerticesBegin(), strokeVerticesEnd(), and t.

◆ Resample() [2/2]

int Freestyle::Stroke::Resample ( int  iNPoints)

Resampling method. Resamples the curve so that it eventually has iNPoints. That means it is going to add iNPoints-vertices_size, if vertices_size is the number of points we already have. If vertices_size >= iNPoints, no resampling is done.

Parameters
iNPointsThe number of vertices we eventually want in our stroke.

Definition at line 521 of file Stroke.cpp.

References Freestyle::a, usdtokens::b(), float(), blender::math::floor(), N, next, Freestyle::VecMat::Vec< T, N >::norm(), strokeVerticesBegin(), strokeVerticesEnd(), strokeVerticesSize(), and t.

Referenced by Freestyle::StrokeShaders::SamplingShader::shade(), Freestyle::StrokeShaders::BezierCurveShader::shade(), Freestyle::StrokeShaders::TipRemoverShader::shade(), strokeVerticesBegin(), and vertices_begin().

◆ ScaleThickness()

void Freestyle::Stroke::ScaleThickness ( float  iFactor)

◆ setBeginningOrientation() [1/2]

void Freestyle::Stroke::setBeginningOrientation ( const Vec2r iOrientation)
inline

Definition at line 797 of file Stroke.h.

◆ setBeginningOrientation() [2/2]

void Freestyle::Stroke::setBeginningOrientation ( real  x,
real  y 
)
inline

Definition at line 802 of file Stroke.h.

References Freestyle::x, and y.

◆ setEndingOrientation() [1/2]

void Freestyle::Stroke::setEndingOrientation ( const Vec2r iOrientation)
inline

Definition at line 807 of file Stroke.h.

◆ setEndingOrientation() [2/2]

void Freestyle::Stroke::setEndingOrientation ( real  x,
real  y 
)
inline

Definition at line 812 of file Stroke.h.

References Freestyle::x, and y.

◆ setId()

void Freestyle::Stroke::setId ( const Id id)
inline

sets the Id of the Stroke.

Definition at line 732 of file Stroke.h.

References id.

Referenced by Freestyle::createStroke().

◆ setLength()

void Freestyle::Stroke::setLength ( float  iLength)

sets the 2D length of the Stroke.

Definition at line 479 of file Stroke.cpp.

References v.

Referenced by Freestyle::createStroke().

◆ setMediumType()

void Freestyle::Stroke::setMediumType ( MediumType  iType)
inline

sets the medium type that must be used for this Stroke.

Definition at line 741 of file Stroke.h.

◆ setMTex()

int Freestyle::Stroke::setMTex ( MTex mtex)
inline

assigns a blender texture to the first available slot.

Definition at line 759 of file Stroke.h.

References Freestyle::a, and MAX_MTEX.

Referenced by Freestyle::StrokeShaders::BlenderTextureShader::shade().

◆ setNodeTree()

void Freestyle::Stroke::setNodeTree ( bNodeTree iNodeTree)
inline

assigns a node tree (of new shading nodes) to define textures.

Definition at line 771 of file Stroke.h.

Referenced by Freestyle::StrokeShaders::BlenderTextureShader::shade().

◆ setTextureId()

void Freestyle::Stroke::setTextureId ( unsigned int  id)
inline

sets the texture id to be used to simulate the marks system for this Stroke.

Definition at line 747 of file Stroke.h.

References id.

◆ setTextureStep()

void Freestyle::Stroke::setTextureStep ( float  step)
inline

sets the spacing of texture coordinates along the stroke length.

Definition at line 753 of file Stroke.h.

Referenced by Freestyle::StrokeShaders::StrokeTextureStepShader::shade().

◆ setTips()

void Freestyle::Stroke::setTips ( bool  iTips)
inline

sets the flag telling whether this stroke is using a texture with tips or not.

Definition at line 777 of file Stroke.h.

◆ strokeVerticeAt()

StrokeVertex& Freestyle::Stroke::strokeVerticeAt ( unsigned int  i)
inline

Returns the i-th StrokeVertex constituting the Stroke.

Definition at line 843 of file Stroke.h.

◆ strokeVerticesBegin()

StrokeInternal::StrokeVertexIterator Freestyle::Stroke::strokeVerticesBegin ( float  t = 0.0f)

◆ strokeVerticesEnd()

StrokeInternal::StrokeVertexIterator Freestyle::Stroke::strokeVerticesEnd ( )

◆ strokeVerticesSize()

unsigned int Freestyle::Stroke::strokeVerticesSize ( ) const
inline

◆ UpdateLength()

void Freestyle::Stroke::UpdateLength ( )

◆ vertices_begin() [1/2]

Stroke::const_vertex_iterator Freestyle::Stroke::vertices_begin ( ) const

embedding vertex iterator

Definition at line 735 of file Stroke.cpp.

Referenced by Freestyle::operator<<(), and Freestyle::StrokeTesselator::Tesselate().

◆ vertices_begin() [2/2]

Stroke::vertex_iterator Freestyle::Stroke::vertices_begin ( float  sampling = 0.0f)

Definition at line 814 of file Stroke.cpp.

References Resample().

◆ vertices_end() [1/2]

Stroke::vertex_iterator Freestyle::Stroke::vertices_end ( )

Definition at line 745 of file Stroke.cpp.

◆ vertices_end() [2/2]

Stroke::const_vertex_iterator Freestyle::Stroke::vertices_end ( ) const

Definition at line 740 of file Stroke.cpp.

Referenced by Freestyle::operator<<(), and Freestyle::StrokeTesselator::Tesselate().

◆ vertices_size()

int Freestyle::Stroke::vertices_size ( ) const
inline

◆ verticesBegin()

Interface0DIterator Freestyle::Stroke::verticesBegin ( )
virtual

◆ verticesEnd()

Interface0DIterator Freestyle::Stroke::verticesEnd ( )
virtual

Returns an Interface0DIterator pointing after the last StrokeVertex of the Stroke.

Reimplemented from Freestyle::Interface1D.

Definition at line 772 of file Stroke.cpp.

References ret.

Referenced by pointsEnd(), and Freestyle::StrokeShaders::MaterialColorShader::shade().

◆ viewedges_begin() [1/2]

viewedge_container::iterator Freestyle::Stroke::viewedges_begin ( )
inline

Definition at line 680 of file Stroke.h.

◆ viewedges_begin() [2/2]

viewedge_container::const_iterator Freestyle::Stroke::viewedges_begin ( ) const
inline

Definition at line 675 of file Stroke.h.

◆ viewedges_end() [1/2]

viewedge_container::iterator Freestyle::Stroke::viewedges_end ( )
inline

Definition at line 690 of file Stroke.h.

◆ viewedges_end() [2/2]

viewedge_container::const_iterator Freestyle::Stroke::viewedges_end ( ) const
inline

Definition at line 685 of file Stroke.h.

◆ viewedges_size()

int Freestyle::Stroke::viewedges_size ( ) const
inline

Definition at line 695 of file Stroke.h.


The documentation for this class was generated from the following files: