Blender  V3.3
WingedEdgeBuilder.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
11 #include "WEdge.h"
12 
13 #include "../scene_graph/IndexedFaceSet.h"
14 #include "../scene_graph/NodeTransform.h"
15 #include "../scene_graph/SceneVisitor.h"
16 
17 #include "../system/FreestyleConfig.h"
18 #include "../system/RenderMonitor.h"
19 
20 namespace Freestyle {
21 
23  public:
25  {
26  _current_wshape = NULL;
27  _current_frs_material = NULL;
28  _current_matrix = NULL;
29  _winged_edge = new WingedEdge; // Not deleted by the destructor
31  }
32 
34  {
35  for (vector<Matrix44r *>::iterator it = _matrices_stack.begin(); it != _matrices_stack.end();
36  ++it) {
37  delete *it;
38  }
39  _matrices_stack.clear();
40  }
41 
45 
46  virtual void visitNodeTransformAfter(NodeTransform &);
47 
48  //
49  // Accessors
50  //
52 
54  {
55  return _winged_edge;
56  }
57 
59  {
60  return _current_wshape;
61  }
62 
64  {
65  return _current_frs_material;
66  }
67 
69  {
70  return _current_matrix;
71  }
72 
73  //
74  // Modifiers
75  //
77 
78  inline void setCurrentWShape(WShape *wshape)
79  {
80  _current_wshape = wshape;
81  }
82 
84  {
85  _current_frs_material = mat;
86  }
87 
88 #if 0
89  inline void setCurrentMatrix(Matrix44r *matrix)
90  {
91  _current_matrix = matrix;
92  }
93 #endif
94 
95  inline void setRenderMonitor(RenderMonitor *iRenderMonitor)
96  {
97  _pRenderMonitor = iRenderMonitor;
98  }
99 
100  protected:
101  virtual bool buildWShape(WShape &shape, IndexedFaceSet &ifs);
102  virtual void buildWVertices(WShape &shape, const float *vertices, unsigned vsize);
103 
105 
106  private:
107  void buildTriangleStrip(const float *vertices,
108  const float *normals,
109  vector<FrsMaterial> &iMaterials,
110  const float *texCoords,
111  const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
112  const unsigned *vindices,
113  const unsigned *nindices,
114  const unsigned *mindices,
115  const unsigned *tindices,
116  const unsigned nvertices);
117 
118  void buildTriangleFan(const float *vertices,
119  const float *normals,
120  vector<FrsMaterial> &iMaterials,
121  const float *texCoords,
122  const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
123  const unsigned *vindices,
124  const unsigned *nindices,
125  const unsigned *mindices,
126  const unsigned *tindices,
127  const unsigned nvertices);
128 
129  void buildTriangles(const float *vertices,
130  const float *normals,
131  vector<FrsMaterial> &iMaterials,
132  const float *texCoords,
133  const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks,
134  const unsigned *vindices,
135  const unsigned *nindices,
136  const unsigned *mindices,
137  const unsigned *tindices,
138  const unsigned nvertices);
139 
140  void transformVertices(const float *vertices,
141  unsigned vsize,
142  const Matrix44r &transform,
143  float *res);
144 
145  void transformNormals(const float *normals,
146  unsigned nsize,
147  const Matrix44r &transform,
148  float *res);
149 
150  WShape *_current_wshape;
151  FrsMaterial *_current_frs_material;
152  WingedEdge *_winged_edge;
153  Matrix44r *_current_matrix;
154  vector<Matrix44r *> _matrices_stack;
155 
156 #ifdef WITH_CXX_GUARDEDALLOC
157  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:WingedEdgeBuilder")
158 #endif
159 };
160 
161 } /* namespace Freestyle */
Classes to define a Winged Edge data structure.
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
void setCurrentFrsMaterial(FrsMaterial *mat)
virtual void buildWVertices(WShape &shape, const float *vertices, unsigned vsize)
void setCurrentWShape(WShape *wshape)
virtual void visitNodeTransformAfter(NodeTransform &)
void setRenderMonitor(RenderMonitor *iRenderMonitor)
virtual bool buildWShape(WShape &shape, IndexedFaceSet &ifs)
FrsMaterial * getCurrentFrsMaterial()
inherits from class Rep
Definition: AppCanvas.cpp:18
MutableSpan< float3 > normals