glc_3drep.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_3DREP_H_
00025 #define GLC_3DREP_H_
00026 
00027 #include "glc_geometry.h"
00028 #include "glc_rep.h"
00029 
00030 #include "../glc_config.h"
00031 
00034 
00035 
00036 class GLC_LIB_EXPORT GLC_3DRep : public GLC_Rep
00037 {
00038         friend GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_3DRep &);
00039         friend GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_3DRep &);
00040 
00042 
00044 
00045 public:
00047         GLC_3DRep();
00048 
00050         GLC_3DRep(GLC_Geometry*);
00051 
00053         GLC_3DRep(const GLC_3DRep&);
00054 
00056         virtual GLC_3DRep &operator=(const GLC_Rep&);
00057 
00059         virtual GLC_Rep* clone() const;
00060 
00062         virtual GLC_Rep* deepCopy() const;
00063 
00065         virtual ~GLC_3DRep();
00066 
00068 
00070 
00072 
00073 public:
00075         static quint32 chunckID();
00076 
00078         virtual int type() const;
00079 
00081         inline GLC_Geometry* geomAt(int index) const
00082         {
00083                 Q_ASSERT(NULL != m_pGeomList);
00084                 Q_ASSERT(m_pGeomList->size() > index);
00085                 return m_pGeomList->at(index);
00086         }
00087 
00089         inline int numberOfBody() const
00090         {
00091                 Q_ASSERT(NULL != m_pGeomList);
00092                 return m_pGeomList->size();
00093         }
00094 
00096         inline virtual bool isEmpty() const
00097         {
00098                 Q_ASSERT(NULL != m_pGeomList);
00099                 return m_pGeomList->isEmpty();
00100         }
00101 
00103         bool boundingBoxIsValid() const;
00104 
00106         GLC_BoundingBox boundingBox() const;
00107 
00109         inline bool contains(GLC_Geometry* pGeom)
00110         {return m_pGeomList->contains(pGeom);}
00111 
00113         unsigned int faceCount() const;
00114 
00116         unsigned int vertexCount() const;
00117 
00119         unsigned int materialCount() const;
00120 
00122         QSet<GLC_Material*> materialSet() const;
00123 
00125         double volume() const;
00126 
00128 
00130 
00132 
00133 public:
00135         inline void addGeom(GLC_Geometry* pGeom)
00136         {
00137                 m_pGeomList->append(pGeom);
00138                 *m_pIsLoaded= true;
00139         }
00140 
00142         void clean();
00143 
00145         void reverseNormals();
00146 
00148         virtual bool load();
00149 
00151         virtual bool unload();
00152 
00154         virtual void replace(GLC_Rep*);
00155 
00157         void replaceMaterial(GLC_uint, GLC_Material*);
00158 
00160         void merge(const GLC_3DRep*);
00161 
00163         void take(GLC_3DRep* pSource);
00164 
00166         void copyVboToClientSide();
00167 
00169         void releaseVboClientSide(bool update= false);
00170 
00172         void transformSubGeometries(const GLC_Matrix4x4& matrix);
00173 
00175         void setVboUsage(bool usage);
00176 
00178 
00180 // private services functions
00182 private:
00184         void clear();
00185 
00187 // Private members
00189 private:
00191         QList<GLC_Geometry*>* m_pGeomList;
00192 
00194         int* m_pType;
00195 
00197         static quint32 m_ChunkId;
00198 
00199 };
00200 
00202 GLC_LIB_EXPORT QDataStream &operator<<(QDataStream &, const GLC_3DRep &);
00203 GLC_LIB_EXPORT QDataStream &operator>>(QDataStream &, GLC_3DRep &);
00204 
00205 #endif /* GLC_3DREP_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon