Blender  V2.93
LineRep.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include <list>
25 #include <vector>
26 
27 #include "Rep.h"
28 
29 #include "../system/FreestyleConfig.h"
30 
31 using namespace std;
32 
33 namespace Freestyle {
34 
36 class LineRep : public Rep {
37  public:
39  enum LINES_STYLE {
43  };
44 
45  inline LineRep() : Rep()
46  {
47  _width = 0.0f;
48  }
49 
56  inline LineRep(const Vec3r &v1, const Vec3r &v2) : Rep()
57  {
58  setStyle(LINES);
59  AddVertex(v1);
60  AddVertex(v2);
61  _width = 0.0f;
62  }
63 
65  inline LineRep(const vector<Vec3r> &vertices) : Rep()
66  {
67  _vertices = vertices;
68  setStyle(LINE_STRIP);
69  _width = 0.0f;
70  }
71 
73  inline LineRep(const list<Vec3r> &vertices) : Rep()
74  {
75  for (list<Vec3r>::const_iterator v = vertices.begin(), end = vertices.end(); v != end; ++v) {
76  _vertices.push_back(*v);
77  }
78  setStyle(LINE_STRIP);
79  _width = 0.0f;
80  }
81 
82  virtual ~LineRep()
83  {
84  _vertices.clear();
85  }
86 
88  inline const LINES_STYLE style() const
89  {
90  return _Style;
91  }
92 
93  inline const vector<Vec3r> &vertices() const
94  {
95  return _vertices;
96  }
97 
98  inline float width() const
99  {
100  return _width;
101  }
102 
104  inline void setStyle(const LINES_STYLE iStyle)
105  {
106  _Style = iStyle;
107  }
108 
109  inline void AddVertex(const Vec3r &iVertex)
110  {
111  _vertices.push_back(iVertex);
112  }
113 
114  inline void setVertices(const vector<Vec3r> &iVertices)
115  {
116  if (0 != _vertices.size()) {
117  _vertices.clear();
118  }
119  for (vector<Vec3r>::const_iterator v = iVertices.begin(), end = iVertices.end(); v != end;
120  ++v) {
121  _vertices.push_back(*v);
122  }
123  }
124 
125  inline void setWidth(float iWidth)
126  {
127  _width = iWidth;
128  }
129 
131  virtual void accept(SceneVisitor &v)
132  {
133  Rep::accept(v);
134  v.visitLineRep(*this);
135  }
136 
138  virtual void ComputeBBox();
139 
140  private:
141  LINES_STYLE _Style;
142  vector<Vec3r> _vertices;
143  float _width;
144 
145 #ifdef WITH_CXX_GUARDEDALLOC
146  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:LineRep")
147 #endif
148 };
149 
150 } /* 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:65
void AddVertex(const Vec3r &iVertex)
Definition: LineRep.h:109
void setStyle(const LINES_STYLE iStyle)
Definition: LineRep.h:104
LineRep(const list< Vec3r > &vertices)
Definition: LineRep.h:73
void setVertices(const vector< Vec3r > &iVertices)
Definition: LineRep.h:114
virtual ~LineRep()
Definition: LineRep.h:82
virtual void accept(SceneVisitor &v)
Definition: LineRep.h:131
const vector< Vec3r > & vertices() const
Definition: LineRep.h:93
const LINES_STYLE style() const
Definition: LineRep.h:88
void setWidth(float iWidth)
Definition: LineRep.h:125
LineRep(const Vec3r &v1, const Vec3r &v2)
Definition: LineRep.h:56
float width() const
Definition: LineRep.h:98
inherits from class Rep
Definition: AppCanvas.cpp:32