Blender V5.0
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
11
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#include "MEM_guardedalloc.h"
27
28namespace Freestyle {
29
35class Operators {
36
37 public:
38 typedef vector<Interface1D *> I1DContainer;
39 typedef vector<Stroke *> StrokesContainer;
40
41 //
42 // Operators
43 //
45
49 static int select(UnaryPredicate1D &pred);
50
66 UnaryPredicate1D &pred,
67 UnaryFunction1D_void &modifier);
68
83
99
114 static int bidirectionalChain(ChainingIterator &it);
115
132 static int sequentialSplit(UnaryPredicate0D &startingPred,
133 UnaryPredicate0D &stoppingPred,
134 float sampling = 0.0f);
135
147 static int sequentialSplit(UnaryPredicate0D &pred, float sampling = 0.0f);
148
167 UnaryPredicate1D &pred,
168 float sampling = 0);
169
195 UnaryPredicate0D &pred0d,
196 UnaryPredicate1D &pred,
197 float sampling = 0.0f);
198
204 static int sort(BinaryPredicate1D &pred);
205
213 static int create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders);
214
215 //
216 // Data access
217 //
219
221 {
222 return dynamic_cast<ViewEdge *>(_current_view_edges_set[i]);
223 }
224
226 {
227 return dynamic_cast<Chain *>(_current_chains_set[i]);
228 }
229
231 {
232 return _current_strokes_set[i];
233 }
234
236 {
237 return _current_view_edges_set.size();
238 }
239
241 {
242 return _current_chains_set.size();
243 }
244
246 {
247 return _current_strokes_set.size();
248 }
249
250 //
251 // Not exported in Python
252 //
254
256 {
257 return &_current_strokes_set;
258 }
259
260 static void reset(bool removeStrokes = true);
261
262 private:
263 Operators() {}
264
265 static I1DContainer _current_view_edges_set;
266 static I1DContainer _current_chains_set;
267 static I1DContainer *_current_set;
268 static StrokesContainer _current_strokes_set;
269
270 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Operators")
271};
272
273} /* 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:220
static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred, UnaryFunction1D_void &modifier)
Definition Operators.cpp:72
static uint getChainsSize()
Definition Operators.h:240
static uint getViewEdgesSize()
Definition Operators.h:235
static uint getStrokesSize()
Definition Operators.h:245
vector< Interface1D * > I1DContainer
Definition Operators.h:38
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:230
static int create(UnaryPredicate1D &pred, vector< StrokeShader * > shaders)
static Chain * getChainFromIndex(uint i)
Definition Operators.h:225
static StrokesContainer * getStrokesSet()
Definition Operators.h:255
vector< Stroke * > StrokesContainer
Definition Operators.h:39
#define select(A, B, C)
inherits from class Rep
Definition AppCanvas.cpp:20
i
Definition text_draw.cc:230