glc_3dstoworld.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  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 *****************************************************************************/
00024 
00026 
00027 #ifndef GLC_3DSTOWORLD_H_
00028 #define GLC_3DSTOWORLD_H_
00029 
00030 #include <QObject>
00031 #include <QFile>
00032 #include <QDataStream>
00033 #include <QString>
00034 #include <QHash>
00035 #include <QSet>
00036 #include <QStringList>
00037 
00038 #include "../sceneGraph/glc_3dviewinstance.h"
00039 
00040 #include "../glc_config.h"
00041 
00042 class GLC_World;
00043 class QGLContext;
00044 class GLC_Mesh;
00045 class GLC_StructOccurence;
00046 class GLC_Material;
00047 
00048 struct Lib3dsFile;
00049 struct Lib3dsNode;
00050 struct Lib3dsMesh;
00051 struct Lib3dsMaterial;
00052 
00055 
00065 
00066 
00067 class GLC_LIB_EXPORT GLC_3dsToWorld : public QObject
00068 {
00069         Q_OBJECT
00070 
00072 
00074 
00075 
00076 public:
00077         GLC_3dsToWorld(const QGLContext*);
00078         virtual ~GLC_3dsToWorld();
00080 
00082 
00084 
00085 public:
00087         GLC_World* CreateWorldFrom3ds(QFile &file);
00088 
00090         inline QStringList listOfAttachedFileName() const
00091         {return m_ListOfAttachedFileName.toList();}
00092 
00094 
00096 
00098 
00099 private:
00101         void clear();
00102 
00104         void createMeshes(GLC_StructOccurence*, Lib3dsNode*);
00105 
00107         GLC_3DRep create3DRep(Lib3dsMesh*);
00108 
00110         void loadMaterial(Lib3dsMaterial*);
00111 
00113 
00115 // Qt Signals
00117         signals:
00118         void currentQuantum(int);
00119 
00121         /* Private members */
00123 private:
00125         GLC_World* m_pWorld;
00126 
00128         QString m_FileName;
00129 
00131         const QGLContext* m_pQGLContext;
00132 
00134         GLC_Mesh* m_pCurrentMesh;
00135 
00137         Lib3dsFile* m_pLib3dsFile;
00138 
00140         QHash<QString, GLC_Material*> m_Materials;
00141 
00143         int m_NextMaterialIndex;
00144 
00145         // The Hash of loaded meshes
00146         QSet<QString> m_LoadedMeshes;
00147 
00148         // Initial quantum value
00149         const int m_InitQuantumValue;
00150 
00151         // The current quantum value
00152         int m_CurrentQuantumValue;
00153 
00154         // The previous quantum value
00155         int m_PreviousQuantumValue;
00156 
00157         // The number of meshes
00158         int m_NumberOfMeshes;
00159 
00160         // The Current mesh index
00161         int m_CurrentMeshNumber;
00162 
00164         QSet<QString> m_ListOfAttachedFileName;
00165 
00166 
00167 
00168 
00169 
00170 };
00171 
00172 #endif /*GLC_3DSTOWORLD_H_*/

SourceForge.net Logo

©2005 Laurent Ribon