glc_wiredata.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 3 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021  *****************************************************************************/
00023 
00024 #ifndef GLC_WIREDATA_H_
00025 #define GLC_WIREDATA_H_
00026 
00027 #include <QColor>
00028 #include "../glc_global.h"
00029 #include "../glc_boundingbox.h"
00030 #include "../shading/glc_renderproperties.h"
00031 
00032 #include "../glc_config.h"
00035 
00037 
00038 class GLC_LIB_EXPORT GLC_WireData
00039 {
00040         friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_WireData &);
00041         friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_WireData &);
00042 
00044 
00046 
00047 public:
00049         GLC_WireData();
00050 
00052         GLC_WireData(const GLC_WireData&);
00053 
00055         GLC_WireData& operator=(const GLC_WireData&);
00056 
00058         virtual ~GLC_WireData();
00060 
00062 
00064 
00065 public:
00067         static quint32 chunckID();
00068 
00070         GLfloatVector positionVector() const;
00071 
00073         inline bool isEmpty() const
00074         {return ((m_PositionSize == 0) && m_Positions.isEmpty());}
00075 
00077         GLC_BoundingBox& boundingBox();
00078 
00080         inline int verticeGroupCount() const
00081         {return m_VerticeGroupCount;}
00082 
00084         inline GLuint verticeGroupOffset(int index) const
00085         {return m_VerticeGroupOffset.at(index);}
00086 
00088         inline GLsizei verticeGroupSize(int index) const
00089         {return m_VerticeGrouprSizes.at(index);}
00090 
00092 
00094 
00096 
00097 public:
00099         GLC_uint addVerticeGroup(const GLfloatVector&);
00100 
00102         void clear();
00103 
00105         void copyVboToClientSide();
00106 
00108         void releaseVboClientSide(bool update= false);
00109 
00111 
00113 
00115 
00116 public:
00118         void finishVbo();
00119 
00121         void useVBO(bool usage);
00122 
00124 
00125         void glDraw(const GLC_RenderProperties&, GLenum mode);
00126 
00127 private:
00129         void createVBOs();
00130 
00132         void fillVBOs();
00134 
00136 // Private members
00138 private:
00140         GLuint m_VboId;
00141 
00143         GLC_uint m_NextPrimitiveLocalId;
00144 
00146         GLfloatVector m_Positions;
00147 
00149         int m_PositionSize;
00150 
00152         GLC_BoundingBox* m_pBoundingBox;
00153 
00155         IndexSizes m_VerticeGrouprSizes;
00156 
00158         OffsetVectori m_VerticeGroupOffset;
00159 
00161         QList<GLC_uint> m_VerticeGroupId;
00162 
00164         int m_VerticeGroupCount;
00165 
00167         static quint32 m_ChunkId;
00168 };
00169 
00171 GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_WireData &);
00172 GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_WireData &);
00173 
00174 #endif /* GLC_WIREDATA_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon