GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_extrudedmesh.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2013 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21 *****************************************************************************/
22 
24 
25 #ifndef GLC_EXTRUDEDMESH_H
26 #define GLC_EXTRUDEDMESH_H
27 
28 #include <QList>
29 #include "glc_mesh.h"
30 #include "../maths/glc_vector3d.h"
31 
32 #include "../glc_config.h"
33 
36 
38 
39 
41 {
43 
45 
46 
47 public:
49 
50  GLC_ExtrudedMesh(const QList<GLC_Point3d>& points, const GLC_Vector3d& dir, double lenght);
51 
53  GLC_ExtrudedMesh(const GLC_ExtrudedMesh& other);
54 
56  virtual ~GLC_ExtrudedMesh();
57 
59 
61 
63 
64 public:
66  static quint32 chunckID();
67 
69  inline QList<GLC_Point3d> facePoints() const
70  {return m_Points;}
71 
73  inline GLC_Vector3d extrusionVector() const
74  {return m_ExtrusionVector;}
75 
77  inline double extrusionLenght() const
78  {return m_ExtrusionLenght;}
79 
81  virtual GLC_Geometry* clone() const;
82 
84  virtual const GLC_BoundingBox& boundingBox(void);
85 
87 
89 
91 
92 public:
95 
97  void setGeometry(const QList<GLC_Point3d>& points, const GLC_Vector3d& extrudedVector, double lenght);
98 
100  void setPoints(const QList<GLC_Point3d>& points);
101 
103  void setExtrudedVector(const GLC_Vector3d& extrudedVector);
104 
106  void setExtrudedLenght(double lenght);
107 
108 
110 
112 
114 
115 protected:
117 
118  virtual void glDraw(const GLC_RenderProperties& renderProperties);
119 
121 
123 
125 
126 private:
128  void createMeshAndWire();
129 
131  void createMesh();
132 
134  void createWire();
135 
137  void computeGivenFaceNormal();
138 
140  bool pointsLieOnAPlane() const;
141 
143  GLfloatVector baseOutlineNormals() const;
144 
146  GLfloatVector createdOutlineNormals() const;
147 
149  GLfloatVector baseFaceVertices() const;
150 
152  GLfloatVector baseFaceTexels() const;
153 
155  GLfloatVector baseOutlineFacesVertices() const;
156 
158  GLfloatVector basedOutlineFacesTexels() const;
159 
161  GLfloatVector baseFaceNormals() const;
162 
164  QList<GLC_Point3d> createdFacePoints() const;
165 
167  GLfloatVector createdFaceNormals() const;
168 
170  GLfloatVector createdFaceVertices() const;
171 
173  GLfloatVector createdFaceTexels() const;
174 
176  GLfloatVector createdOutlineFacesVertices() const;
177 
179  GLfloatVector createdOutlineFacesTexels() const;
180 
182 
184 // Private members
186 private:
188  QList<GLC_Point3d> m_Points;
189 
192 
195 
198 
200  static quint32 m_ChunkId;
201 };
202 
203 #endif // GLC_EXTRUDEDMESH_H

©2005-2013 Laurent Ribon