GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_primitivegroup.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 *****************************************************************************/
22 
24 
25 #ifndef GLC_PRIMITIVEGROUP_H_
26 #define GLC_PRIMITIVEGROUP_H_
27 
28 #include "../glc_ext.h"
29 #include "../glc_global.h"
30 
31 #include "../glc_config.h"
32 
35 
39 
41 {
42  friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_PrimitiveGroup &);
43  friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_PrimitiveGroup &);
44 
45 public:
47 
49 
50 
53 
56 
59 
61  GLC_PrimitiveGroup& operator=(const GLC_PrimitiveGroup&);
62 
64 
66 
68 
70 
71 public:
73  static quint32 chunckID();
74 
76  inline bool isFinished() const
77  {return m_IsFinished;}
78 
80  inline GLC_uint id() const
81  {return m_Id;}
82 
84  inline bool containsTriangles() const
85  {return m_TrianglesIndexSize > 0;}
86 
88  inline bool containsTrianglesGroupId() const
89  {return !m_TrianglesId.isEmpty();}
90 
92  inline QList<GLC_uint> triangleGroupId() const
93  {return m_TrianglesId;}
94 
96  inline GLC_uint triangleGroupId(int index) const
97  {return m_TrianglesId.at(index);}
98 
100  inline int trianglesIndexSize() const
101  {return m_TrianglesIndexSize;}
102 
104  inline const IndexSizes& trianglesIndexSizes() const
105  {return m_TrianglesGroupsSizes;}
106 
108  inline const IndexList& trianglesIndex() const
109  {
110  Q_ASSERT(!m_IsFinished);
111  return m_TrianglesIndex;
112  }
113 
115  inline const GLvoid* trianglesIndexOffset() const
116  {return m_TrianglesGroupOffset.first();}
117 
119  inline int trianglesIndexOffseti() const
120  {return m_TrianglesGroupOffseti.first();}
121 
123  inline const OffsetVector& trianglesGroupOffset() const
124  {return m_TrianglesGroupOffset;}
125 
127  inline const OffsetVectori& trianglesGroupOffseti() const
128  {return m_TrianglesGroupOffseti;}
129 
131  inline bool containsStrip() const
132  {return m_TrianglesStripSize > 0;}
133 
135  inline bool containsStripGroupId() const
136  {return !m_StripsId.isEmpty();}
137 
139  inline QList<GLC_uint> stripGroupId() const
140  {return m_StripsId;}
141 
143  inline GLC_uint stripGroupId(int index) const
144  {return m_StripsId.at(index);}
145 
147  inline int stripsIndexSize() const
148  {return m_TrianglesStripSize;}
149 
151  inline const IndexList& stripsIndex() const
152  {
153  Q_ASSERT(!m_IsFinished);
154  return m_StripsIndex;
155  }
156 
158  inline const IndexSizes& stripsSizes() const
159  {return m_StripIndexSizes;}
160 
162  inline const OffsetVector& stripsOffset() const
163  {return m_StripIndexOffset;}
164 
166  inline const OffsetVectori& stripsOffseti() const
167  {return m_StripIndexOffseti;}
168 
170  inline bool containsFan() const
171  {return m_TrianglesFanSize > 0;}
172 
174  inline bool containsFanGroupId() const
175  {return !m_FansId.isEmpty();}
176 
178  inline QList<GLC_uint> fanGroupId() const
179  {return m_FansId;}
180 
182  inline GLC_uint fanGroupId(int index) const
183  {return m_FansId.at(index);}
184 
186  inline int fansIndexSize() const
187  {return m_TrianglesFanSize;}
188 
190  inline const IndexList& fansIndex() const
191  {
192  Q_ASSERT(!m_IsFinished);
193  return m_FansIndex;
194  }
195 
197  inline const IndexSizes& fansSizes() const
198  {return m_FansIndexSizes;}
199 
201  inline const OffsetVector& fansOffset() const
202  {return m_FanIndexOffset;}
203 
205  inline const OffsetVectori& fansOffseti() const
206  {return m_FanIndexOffseti;}
207 
209 
211 
213 
214 public:
216  inline void setId(GLC_uint id)
217  {m_Id= id;}
218 
220  void addTriangles(const IndexList& input, GLC_uint id= 0);
221 
223  void setTrianglesOffset(GLvoid* pOffset);
224 
226  void setTrianglesOffseti(int offset);
227 
229  void addTrianglesStrip(const IndexList&, GLC_uint id= 0);
230 
232  void setBaseTrianglesStripOffset(GLvoid*);
233 
235  void setBaseTrianglesStripOffseti(int);
236 
238  void addTrianglesFan(const IndexList&, GLC_uint id= 0);
239 
241  void setBaseTrianglesFanOffset(GLvoid*);
242 
244  void setBaseTrianglesFanOffseti(int);
245 
247  void computeVboOffset();
248 
250  inline void finish()
251  {
252  m_TrianglesIndex.clear();
253  m_StripsIndex.clear();
254  m_FansIndex.clear();
255  m_IsFinished= true;
256  }
257 
259  void clear();
260 
262 
264 // Private members
266 private:
269 
272 
275 
279 
281  QList<GLC_uint> m_TrianglesId;
282 
285 
288 
292 
294  QList<GLC_uint> m_StripsId;
295 
298 
301 
305 
307  QList<GLC_uint> m_FansId;
308 
311 
314 
317 
320 
322  static quint32 m_ChunkId;
323 
324 };
325 
327 GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_PrimitiveGroup &);
328 GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_PrimitiveGroup &);
329 
330 #endif /* GLC_PRIMITIVEGROUP_H_ */

©2005-2013 Laurent Ribon