glc_lod.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef GLC_LOD_H_
00026 #define GLC_LOD_H_
00027
00028 #include <QVector>
00029 #include "../glc_ext.h"
00030
00031 #include "../glc_config.h"
00032
00035
00036
00037 class GLC_LIB_EXPORT GLC_Lod
00038 {
00039 friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_Lod &);
00040 friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_Lod &);
00041
00042 public:
00044
00046
00047 public:
00049 GLC_Lod();
00050
00052 GLC_Lod(double accuracy);
00053
00055 GLC_Lod(const GLC_Lod&);
00056
00058 GLC_Lod& operator=(const GLC_Lod&);
00059
00061 virtual ~GLC_Lod();
00063
00065
00067
00068 public:
00070 static quint32 chunckID();
00071
00073 inline double accuracy() const
00074 {return m_Accuracy;}
00075
00077
00082 QVector<GLuint> indexVector() const;
00083
00085
00090 inline QVector<GLuint>* indexVectorHandle()
00091 { return &m_IndexVector;}
00092
00094 inline int indexVectorSize() const
00095 {return m_IndexVector.size();}
00096
00098 inline unsigned int trianglesCount() const
00099 {return m_TrianglesCount;}
00100
00102
00104
00106
00107 public:
00109 void copyIboToClientSide();
00110
00112 void releaseIboClientSide(bool update= false);
00113
00115 inline void finishVbo()
00116 {
00117 m_IndexSize= m_IndexVector.size();
00118 m_IndexVector.clear();
00119 }
00121 inline void setAccuracy(const double& accuracy)
00122 {m_Accuracy= accuracy;}
00123
00125 inline void trianglesAdded(unsigned int count)
00126 {
00127 m_TrianglesCount+= count;
00128 }
00129
00130
00132
00134
00136
00137 public:
00139 inline void createIBO()
00140 {
00141 if (0 == m_IboId && !m_IndexVector.isEmpty())
00142 {
00143 glGenBuffers(1, &m_IboId);
00144 }
00145 }
00146
00148 inline void useIBO() const
00149 {glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_IboId);}
00150
00152
00154
00156 private:
00157
00159 double m_Accuracy;
00160
00162 GLuint m_IboId;
00163
00165 QVector<GLuint> m_IndexVector;
00166
00168 int m_IndexSize;
00169
00171 unsigned int m_TrianglesCount;
00172
00174 static quint32 m_ChunkId;
00175
00176 };
00177
00179 GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_Lod &);
00180 GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_Lod &);
00181
00182 #endif