Blender  V2.93
TriangleRep.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 
25 #include "Rep.h"
26 
27 namespace Freestyle {
28 
30 class TriangleRep : public Rep {
31  public:
36  };
37 
38  private:
39  TRIANGLE_STYLE _Style;
40  Vec3r _vertices[3];
41  Vec3r _colors[3];
42 
43  public:
44  inline TriangleRep() : Rep()
45  {
46  _Style = FILL;
47  }
48 
57  inline TriangleRep(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2) : Rep()
58  {
59  _vertices[0] = v0;
60  _vertices[1] = v1;
61  _vertices[2] = v2;
62  _Style = FILL;
63  }
64 
65  inline TriangleRep(const Vec3r &v0,
66  const Vec3r &c0,
67  const Vec3r &v1,
68  const Vec3r &c1,
69  const Vec3r &v2,
70  const Vec3r &c2)
71  : Rep()
72  {
73  _vertices[0] = v0;
74  _vertices[1] = v1;
75  _vertices[2] = v2;
76  _colors[0] = c0;
77  _colors[1] = c1;
78  _colors[2] = c2;
79  _Style = FILL;
80  }
81 
82  virtual ~TriangleRep()
83  {
84  }
85 
87  inline const TRIANGLE_STYLE style() const
88  {
89  return _Style;
90  }
91 
92  inline const Vec3r &vertex(int index) const
93  {
94  return _vertices[index];
95  }
96 
97  inline const Vec3r &color(int index) const
98  {
99  return _colors[index];
100  }
101 
103  inline void setStyle(const TRIANGLE_STYLE iStyle)
104  {
105  _Style = iStyle;
106  }
107 
108  inline void setVertex(int index, const Vec3r &iVertex)
109  {
110  _vertices[index] = iVertex;
111  }
112 
113  inline void setColor(int index, const Vec3r &iColor)
114  {
115  _colors[index] = iColor;
116  }
117 
118  inline void setVertices(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2)
119  {
120  _vertices[0] = v0;
121  _vertices[1] = v1;
122  _vertices[2] = v2;
123  }
124 
125  inline void setColors(const Vec3r &c0, const Vec3r &c1, const Vec3r &c2)
126  {
127  _colors[0] = c0;
128  _colors[1] = c1;
129  _colors[2] = c2;
130  }
131 
133  virtual void accept(SceneVisitor &v)
134  {
135  Rep::accept(v);
136  v.visitTriangleRep(*this);
137  }
138 
140  virtual void ComputeBBox();
141 };
142 
143 } /* 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
virtual void accept(SceneVisitor &v)
Definition: Rep.h:108
void setColor(int index, const Vec3r &iColor)
Definition: TriangleRep.h:113
const Vec3r & vertex(int index) const
Definition: TriangleRep.h:92
TriangleRep(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2)
Definition: TriangleRep.h:57
void setStyle(const TRIANGLE_STYLE iStyle)
Definition: TriangleRep.h:103
TriangleRep(const Vec3r &v0, const Vec3r &c0, const Vec3r &v1, const Vec3r &c1, const Vec3r &v2, const Vec3r &c2)
Definition: TriangleRep.h:65
virtual void ComputeBBox()
Definition: TriangleRep.cpp:26
const TRIANGLE_STYLE style() const
Definition: TriangleRep.h:87
void setColors(const Vec3r &c0, const Vec3r &c1, const Vec3r &c2)
Definition: TriangleRep.h:125
void setVertices(const Vec3r &v0, const Vec3r &v1, const Vec3r &v2)
Definition: TriangleRep.h:118
virtual void accept(SceneVisitor &v)
Definition: TriangleRep.h:133
const Vec3r & color(int index) const
Definition: TriangleRep.h:97
void setVertex(int index, const Vec3r &iVertex)
Definition: TriangleRep.h:108
inherits from class Rep
Definition: AppCanvas.cpp:32