Blender V4.3
LineRep.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
12#include <list>
13#include <vector>
14
15#include "Rep.h"
16
18
19using namespace std;
20
21namespace Freestyle {
22
24class LineRep : public Rep {
25 public:
32
33 inline LineRep() : Rep()
34 {
35 _width = 0.0f;
36 }
37
44 inline LineRep(const Vec3r &v1, const Vec3r &v2) : Rep()
45 {
47 AddVertex(v1);
49 _width = 0.0f;
50 }
51
53 inline LineRep(const vector<Vec3r> &vertices) : Rep()
54 {
55 _vertices = vertices;
57 _width = 0.0f;
58 }
59
61 inline LineRep(const list<Vec3r> &vertices) : Rep()
62 {
63 for (list<Vec3r>::const_iterator v = vertices.begin(), end = vertices.end(); v != end; ++v) {
64 _vertices.push_back(*v);
65 }
67 _width = 0.0f;
68 }
69
70 virtual ~LineRep()
71 {
72 _vertices.clear();
73 }
74
76 inline const LINES_STYLE style() const
77 {
78 return _Style;
79 }
80
81 inline const vector<Vec3r> &vertices() const
82 {
83 return _vertices;
84 }
85
86 inline float width() const
87 {
88 return _width;
89 }
90
92 inline void setStyle(const LINES_STYLE iStyle)
93 {
94 _Style = iStyle;
95 }
96
97 inline void AddVertex(const Vec3r &iVertex)
98 {
99 _vertices.push_back(iVertex);
100 }
101
102 inline void setVertices(const vector<Vec3r> &iVertices)
103 {
104 if (0 != _vertices.size()) {
105 _vertices.clear();
106 }
107 for (vector<Vec3r>::const_iterator v = iVertices.begin(), end = iVertices.end(); v != end; ++v)
108 {
109 _vertices.push_back(*v);
110 }
111 }
112
113 inline void setWidth(float iWidth)
114 {
115 _width = iWidth;
116 }
117
119 virtual void accept(SceneVisitor &v)
120 {
121 Rep::accept(v);
122 v.visitLineRep(*this);
123 }
124
126 virtual void ComputeBBox();
127
128 private:
129 LINES_STYLE _Style;
130 vector<Vec3r> _vertices;
131 float _width;
132
133#ifdef WITH_CXX_GUARDEDALLOC
134 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:LineRep")
135#endif
136};
137
138} /* namespace Freestyle */
Configuration definitions.
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:53
void AddVertex(const Vec3r &iVertex)
Definition LineRep.h:97
const vector< Vec3r > & vertices() const
Definition LineRep.h:81
void setStyle(const LINES_STYLE iStyle)
Definition LineRep.h:92
LineRep(const list< Vec3r > &vertices)
Definition LineRep.h:61
void setVertices(const vector< Vec3r > &iVertices)
Definition LineRep.h:102
virtual void ComputeBBox()
Definition LineRep.cpp:14
virtual ~LineRep()
Definition LineRep.h:70
virtual void accept(SceneVisitor &v)
Definition LineRep.h:119
const LINES_STYLE style() const
Definition LineRep.h:76
void setWidth(float iWidth)
Definition LineRep.h:113
LineRep(const Vec3r &v1, const Vec3r &v2)
Definition LineRep.h:44
float width() const
Definition LineRep.h:86
virtual void accept(SceneVisitor &v)
Definition Rep.h:96
inherits from class Rep
Definition AppCanvas.cpp:20