Blender  V3.3
LineRep.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include <list>
11 #include <vector>
12 
13 #include "Rep.h"
14 
15 #include "../system/FreestyleConfig.h"
16 
17 using namespace std;
18 
19 namespace Freestyle {
20 
22 class LineRep : public Rep {
23  public:
25  enum LINES_STYLE {
29  };
30 
31  inline LineRep() : Rep()
32  {
33  _width = 0.0f;
34  }
35 
42  inline LineRep(const Vec3r &v1, const Vec3r &v2) : Rep()
43  {
44  setStyle(LINES);
45  AddVertex(v1);
46  AddVertex(v2);
47  _width = 0.0f;
48  }
49 
51  inline LineRep(const vector<Vec3r> &vertices) : Rep()
52  {
53  _vertices = vertices;
54  setStyle(LINE_STRIP);
55  _width = 0.0f;
56  }
57 
59  inline LineRep(const list<Vec3r> &vertices) : Rep()
60  {
61  for (list<Vec3r>::const_iterator v = vertices.begin(), end = vertices.end(); v != end; ++v) {
62  _vertices.push_back(*v);
63  }
64  setStyle(LINE_STRIP);
65  _width = 0.0f;
66  }
67 
68  virtual ~LineRep()
69  {
70  _vertices.clear();
71  }
72 
74  inline const LINES_STYLE style() const
75  {
76  return _Style;
77  }
78 
79  inline const vector<Vec3r> &vertices() const
80  {
81  return _vertices;
82  }
83 
84  inline float width() const
85  {
86  return _width;
87  }
88 
90  inline void setStyle(const LINES_STYLE iStyle)
91  {
92  _Style = iStyle;
93  }
94 
95  inline void AddVertex(const Vec3r &iVertex)
96  {
97  _vertices.push_back(iVertex);
98  }
99 
100  inline void setVertices(const vector<Vec3r> &iVertices)
101  {
102  if (0 != _vertices.size()) {
103  _vertices.clear();
104  }
105  for (vector<Vec3r>::const_iterator v = iVertices.begin(), end = iVertices.end(); v != end;
106  ++v) {
107  _vertices.push_back(*v);
108  }
109  }
110 
111  inline void setWidth(float iWidth)
112  {
113  _width = iWidth;
114  }
115 
117  virtual void accept(SceneVisitor &v)
118  {
119  Rep::accept(v);
120  v.visitLineRep(*this);
121  }
122 
124  virtual void ComputeBBox();
125 
126  private:
127  LINES_STYLE _Style;
128  vector<Vec3r> _vertices;
129  float _width;
130 
131 #ifdef WITH_CXX_GUARDEDALLOC
132  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:LineRep")
133 #endif
134 };
135 
136 } /* namespace Freestyle */
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Base class for all shapes. Inherits from BasicObjects for references counter management (addRef,...
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
LineRep(const vector< Vec3r > &vertices)
Definition: LineRep.h:51
void AddVertex(const Vec3r &iVertex)
Definition: LineRep.h:95
void setStyle(const LINES_STYLE iStyle)
Definition: LineRep.h:90
LineRep(const list< Vec3r > &vertices)
Definition: LineRep.h:59
void setVertices(const vector< Vec3r > &iVertices)
Definition: LineRep.h:100
virtual ~LineRep()
Definition: LineRep.h:68
virtual void accept(SceneVisitor &v)
Definition: LineRep.h:117
const vector< Vec3r > & vertices() const
Definition: LineRep.h:79
const LINES_STYLE style() const
Definition: LineRep.h:74
void setWidth(float iWidth)
Definition: LineRep.h:111
LineRep(const Vec3r &v1, const Vec3r &v2)
Definition: LineRep.h:42
float width() const
Definition: LineRep.h:84
inherits from class Rep
Definition: AppCanvas.cpp:18