Blender V4.3
Operators.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
12#include <iostream>
13#include <vector>
14
15#include "Chain.h"
16#include "ChainingIterators.h"
17#include "Predicates0D.h"
18#include "Predicates1D.h"
19#include "StrokeShader.h"
20
21#include "../system/TimeStamp.h"
22
24#include "../view_map/ViewMap.h"
25
26#ifdef WITH_CXX_GUARDEDALLOC
27# include "MEM_guardedalloc.h"
28#endif
29
30namespace Freestyle {
31
37class Operators {
38
39 public:
40 typedef vector<Interface1D *> I1DContainer;
41 typedef vector<Stroke *> StrokesContainer;
42
43 //
44 // Operators
45 //
47
51 static int select(UnaryPredicate1D &pred);
52
68 UnaryPredicate1D &pred,
69 UnaryFunction1D_void &modifier);
70
85
101
116 static int bidirectionalChain(ChainingIterator &it);
117
134 static int sequentialSplit(UnaryPredicate0D &startingPred,
135 UnaryPredicate0D &stoppingPred,
136 float sampling = 0.0f);
137
149 static int sequentialSplit(UnaryPredicate0D &pred, float sampling = 0.0f);
150
169 UnaryPredicate1D &pred,
170 float sampling = 0);
171
197 UnaryPredicate0D &pred0d,
198 UnaryPredicate1D &pred,
199 float sampling = 0.0f);
200
206 static int sort(BinaryPredicate1D &pred);
207
215 static int create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders);
216
217 //
218 // Data access
219 //
221
223 {
224 return dynamic_cast<ViewEdge *>(_current_view_edges_set[i]);
225 }
226
228 {
229 return dynamic_cast<Chain *>(_current_chains_set[i]);
230 }
231
233 {
234 return _current_strokes_set[i];
235 }
236
238 {
239 return _current_view_edges_set.size();
240 }
241
243 {
244 return _current_chains_set.size();
245 }
246
248 {
249 return _current_strokes_set.size();
250 }
251
252 //
253 // Not exported in Python
254 //
256
258 {
259 return &_current_strokes_set;
260 }
261
262 static void reset(bool removeStrokes = true);
263
264 private:
265 Operators() {}
266
267 static I1DContainer _current_view_edges_set;
268 static I1DContainer _current_chains_set;
269 static I1DContainer *_current_set;
270 static StrokesContainer _current_strokes_set;
271
272#ifdef WITH_CXX_GUARDEDALLOC
273 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Operators")
274#endif
275};
276
277} /* namespace Freestyle */
unsigned int uint
Class to define a chain of view-edges.
Chaining iterators.
Interface 1D and related tools definitions.
Read Guarded memory(de)allocation.
Class gathering stroke creation algorithms.
Class gathering stroke creation algorithms.
Class defining StrokeShader.
Class defining a singleton used as timestamp.
Classes to define a View Map (ViewVertex, ViewEdge, etc.)
void reset()
clear internal cached data and reset random seed
static int sort(BinaryPredicate1D &pred)
static ViewEdge * getViewEdgeFromIndex(uint i)
Definition Operators.h:222
static int select(UnaryPredicate1D &pred)
Definition Operators.cpp:30
static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred, UnaryFunction1D_void &modifier)
Definition Operators.cpp:72
static uint getChainsSize()
Definition Operators.h:242
static uint getViewEdgesSize()
Definition Operators.h:237
static uint getStrokesSize()
Definition Operators.h:247
vector< Interface1D * > I1DContainer
Definition Operators.h:40
static int sequentialSplit(UnaryPredicate0D &startingPred, UnaryPredicate0D &stoppingPred, float sampling=0.0f)
static int recursiveSplit(UnaryFunction0D< double > &func, UnaryPredicate1D &pred, float sampling=0)
static int bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred)
static Stroke * getStrokeFromIndex(uint i)
Definition Operators.h:232
static int create(UnaryPredicate1D &pred, vector< StrokeShader * > shaders)
static Chain * getChainFromIndex(uint i)
Definition Operators.h:227
static StrokesContainer * getStrokesSet()
Definition Operators.h:257
vector< Stroke * > StrokesContainer
Definition Operators.h:41
inherits from class Rep
Definition AppCanvas.cpp:20