GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_3drep.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 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  *****************************************************************************/
23 
24 #ifndef GLC_3DREP_H_
25 #define GLC_3DREP_H_
26 
27 #include "glc_geometry.h"
28 #include "glc_rep.h"
29 
30 #include "../glc_config.h"
31 
34 
35 
37 {
38  friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_3DRep &);
39  friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_3DRep &);
40 
42 
44 
45 public:
47  GLC_3DRep();
48 
51 
53  GLC_3DRep(const GLC_3DRep&);
54 
56  virtual GLC_3DRep &operator=(const GLC_Rep&);
57 
59  virtual GLC_Rep* clone() const;
60 
62  virtual GLC_Rep* deepCopy() const;
63 
65  virtual ~GLC_3DRep();
66 
68 
70 
72 
73 public:
75  static quint32 chunckID();
76 
78  virtual int type() const;
79 
81  inline GLC_Geometry* geomAt(int index) const
82  {
83  Q_ASSERT(NULL != m_pGeomList);
84  Q_ASSERT(m_pGeomList->size() > index);
85  return m_pGeomList->at(index);
86  }
87 
89  inline int numberOfBody() const
90  {
91  Q_ASSERT(NULL != m_pGeomList);
92  return m_pGeomList->size();
93  }
94 
96  inline virtual bool isEmpty() const
97  {
98  Q_ASSERT(NULL != m_pGeomList);
99  return m_pGeomList->isEmpty();
100  }
101 
103  bool boundingBoxIsValid() const;
104 
106  GLC_BoundingBox boundingBox() const;
107 
109  inline bool contains(GLC_Geometry* pGeom)
110  {return m_pGeomList->contains(pGeom);}
111 
113  unsigned int faceCount() const;
114 
116  unsigned int vertexCount() const;
117 
119  unsigned int materialCount() const;
120 
122  QSet<GLC_Material*> materialSet() const;
123 
125  double volume() const;
126 
128 
130 
132 
133 public:
135  inline void addGeom(GLC_Geometry* pGeom)
136  {
137  m_pGeomList->append(pGeom);
138  *m_pIsLoaded= true;
139  }
140 
142  void clean();
143 
145  void reverseNormals();
146 
148  virtual bool load();
149 
151  virtual bool unload();
152 
154  virtual void replace(GLC_Rep*);
155 
157  void replaceMaterial(GLC_uint, GLC_Material*);
158 
160  void merge(const GLC_3DRep*);
161 
163  void take(GLC_3DRep* pSource);
164 
166  void copyVboToClientSide();
167 
169  void releaseVboClientSide(bool update= false);
170 
172  void transformSubGeometries(const GLC_Matrix4x4& matrix);
173 
175  void setVboUsage(bool usage);
176 
178 
180 // private services functions
182 private:
184  void clear3DRepGeom();
185 
187 // Private members
189 private:
191  QList<GLC_Geometry*>* m_pGeomList;
192 
194  int* m_pType;
195 
197  static quint32 m_ChunkId;
198 
199 };
200 
202 GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_3DRep &);
203 GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_3DRep &);
204 
205 #endif /* GLC_3DREP_H_ */

©2005-2013 Laurent Ribon