GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_lod.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_LOD_H_
26 #define GLC_LOD_H_
27 
28 #include <QVector>
29 #include <QGLBuffer>
30 
31 #include "../glc_ext.h"
32 
33 #include "../glc_config.h"
34 
37 
38 
40 {
41  friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_Lod &);
42  friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_Lod &);
43 
44 public:
46 
48 
49 public:
51  GLC_Lod();
52 
54  GLC_Lod(double accuracy);
55 
57  GLC_Lod(const GLC_Lod&);
58 
60  GLC_Lod& operator=(const GLC_Lod&);
61 
63  virtual ~GLC_Lod();
65 
67 
69 
70 public:
72  static quint32 chunckID();
73 
75  inline double accuracy() const
76  {return m_Accuracy;}
77 
79 
84  QVector<GLuint> indexVector() const;
85 
87 
92  inline QVector<GLuint>* indexVectorHandle()
93  {return &m_IndexVector;}
94 
96  inline int indexVectorSize() const
97  {return m_IndexVector.size();}
98 
100  inline unsigned int trianglesCount() const
101  {return m_TrianglesCount;}
102 
104 
106 
108 
109 public:
111  void copyIboToClientSide();
112 
114  void releaseIboClientSide(bool update= false);
115 
117  inline void setAccuracy(const double& accuracy)
118  {m_Accuracy= accuracy;}
119 
121  inline void trianglesAdded(unsigned int count)
122  {
123  m_TrianglesCount+= count;
124  }
125 
127  void setIboUsage(bool usage);
128 
129 
131 
133 
135 
136 public:
138  inline void createIBO()
139  {
140  if (!m_IndexBuffer.isCreated() && !m_IndexVector.isEmpty())
141  {
142  m_IndexBuffer.create();
143  }
144  }
145 
147  void useIBO() const;
148 
150  inline void fillIbo()
151  {releaseIboClientSide(true);}
152 
154 
156 // Private members
158 private:
159 
161  double m_Accuracy;
162 
164  QGLBuffer m_IndexBuffer;
165 
167  QVector<GLuint> m_IndexVector;
168 
171 
173  unsigned int m_TrianglesCount;
174 
176  static quint32 m_ChunkId;
177 
178 };
179 
181 GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_Lod &);
182 GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_Lod &);
183 
184 #endif /* GLC_LOD_H_ */

©2005-2013 Laurent Ribon