Blender V4.3
TriangleRep.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
13#include "Rep.h"
14
15namespace Freestyle {
16
18class TriangleRep : public Rep {
19 public:
25
26 private:
27 TRIANGLE_STYLE _Style;
28 Vec3r _vertices[3];
29 Vec3r _colors[3];
30
31 public:
32 inline TriangleRep() : Rep()
33 {
34 _Style = FILL;
35 }
36
45 inline TriangleRep(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2) : Rep()
46 {
47 _vertices[0] = v0;
48 _vertices[1] = v1;
49 _vertices[2] = v2;
50 _Style = FILL;
51 }
52
53 inline TriangleRep(const Vec3r &v0,
54 const Vec3r &c0,
55 const Vec3r &v1,
56 const Vec3r &c1,
57 const Vec3r &v2,
58 const Vec3r &c2)
59 : Rep()
60 {
61 _vertices[0] = v0;
62 _vertices[1] = v1;
63 _vertices[2] = v2;
64 _colors[0] = c0;
65 _colors[1] = c1;
66 _colors[2] = c2;
67 _Style = FILL;
68 }
69
70 virtual ~TriangleRep() {}
71
73 inline const TRIANGLE_STYLE style() const
74 {
75 return _Style;
76 }
77
78 inline const Vec3r &vertex(int index) const
79 {
80 return _vertices[index];
81 }
82
83 inline const Vec3r &color(int index) const
84 {
85 return _colors[index];
86 }
87
89 inline void setStyle(const TRIANGLE_STYLE iStyle)
90 {
91 _Style = iStyle;
92 }
93
94 inline void setVertex(int index, const Vec3r &iVertex)
95 {
96 _vertices[index] = iVertex;
97 }
98
99 inline void setColor(int index, const Vec3r &iColor)
100 {
101 _colors[index] = iColor;
102 }
103
104 inline void setVertices(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2)
105 {
106 _vertices[0] = v0;
107 _vertices[1] = v1;
108 _vertices[2] = v2;
109 }
110
111 inline void setColors(const Vec3r &c0, const Vec3r &c1, const Vec3r &c2)
112 {
113 _colors[0] = c0;
114 _colors[1] = c1;
115 _colors[2] = c2;
116 }
117
119 virtual void accept(SceneVisitor &v)
120 {
121 Rep::accept(v);
122 v.visitTriangleRep(*this);
123 }
124
126 virtual void ComputeBBox();
127};
128
129} /* namespace Freestyle */
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
virtual void accept(SceneVisitor &v)
Definition Rep.h:96
void setColor(int index, const Vec3r &iColor)
Definition TriangleRep.h:99
TriangleRep(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2)
Definition TriangleRep.h:45
void setStyle(const TRIANGLE_STYLE iStyle)
Definition TriangleRep.h:89
TriangleRep(const Vec3r &v0, const Vec3r &c0, const Vec3r &v1, const Vec3r &c1, const Vec3r &v2, const Vec3r &c2)
Definition TriangleRep.h:53
virtual void ComputeBBox()
const Vec3r & vertex(int index) const
Definition TriangleRep.h:78
const TRIANGLE_STYLE style() const
Definition TriangleRep.h:73
void setColors(const Vec3r &c0, const Vec3r &c1, const Vec3r &c2)
void setVertices(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2)
virtual void accept(SceneVisitor &v)
const Vec3r & color(int index) const
Definition TriangleRep.h:83
void setVertex(int index, const Vec3r &iVertex)
Definition TriangleRep.h:94
inherits from class Rep
Definition AppCanvas.cpp:20