Blender  V3.3
BlenderStrokeRenderer.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
9 #include "BLI_map.hh"
10 
11 #include "../stroke/StrokeRenderer.h"
12 #include "../system/FreestyleConfig.h"
13 
14 extern "C" {
15 struct Depsgraph;
16 struct GHash;
17 struct Main;
18 struct Material;
19 struct Object;
20 struct Render;
21 struct Scene;
22 struct bContext;
23 struct bNodeTree;
24 }
25 
26 namespace Freestyle {
27 
29  public:
30  BlenderStrokeRenderer(Render *re, int render_count);
31  virtual ~BlenderStrokeRenderer();
32 
34  virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const;
35  virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const;
36 
37  Object *NewMesh() const;
38 
39  struct StrokeGroup {
40  explicit StrokeGroup() : totvert(0), totedge(0), totpoly(0), totloop(0)
41  {
42  }
43  vector<StrokeRep *> strokes;
45  int totvert;
46  int totedge;
47  int totpoly;
48  int totloop;
49  };
50  vector<StrokeGroup *> strokeGroups, texturedStrokeGroups;
51 
52  int GenerateScene();
53  void GenerateStrokeMesh(StrokeGroup *group, bool hasTex);
54  void FreeStrokeGroups();
55 
56  Render *RenderScene(Render *re, bool render);
57 
58  static Material *GetStrokeShader(Main *bmain, bNodeTree *iNodeTree, bool do_id_user);
59 
60  protected:
66  float _width, _height;
67  float _z, _z_delta;
68  unsigned int _mesh_id;
71 
72  static const char *uvNames[];
73 
74  int get_stroke_count() const;
75  float get_stroke_vertex_z(void) const;
76  unsigned int get_stroke_mesh_id(void) const;
77  bool test_triangle_visibility(StrokeVertexRep *svRep[3]) const;
79  int *visible_faces,
80  int *visible_segments) const;
81 
82  vector<StrokeRep *> _strokeReps;
83 
84 #ifdef WITH_CXX_GUARDEDALLOC
85  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BlenderStrokeRenderer")
86 #endif
87 };
88 
89 } /* namespace Freestyle */
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
bool test_triangle_visibility(StrokeVertexRep *svRep[3]) const
vector< StrokeGroup * > texturedStrokeGroups
vector< StrokeGroup * > strokeGroups
Render * RenderScene(Render *re, bool render)
void test_strip_visibility(Strip::vertex_container &strip_vertices, int *visible_faces, int *visible_segments) const
void GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
static Material * GetStrokeShader(Main *bmain, bNodeTree *iNodeTree, bool do_id_user)
virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const
BlenderStrokeRenderer(Render *re, int render_count)
unsigned int get_stroke_mesh_id(void) const
virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
std::vector< StrokeVertexRep * > vertex_container
Definition: StrokeRep.h:125
inherits from class Rep
Definition: AppCanvas.cpp:18
Definition: BKE_main.h:121