GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_worldto3ds.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  *****************************************************************************/
23 
24 #ifndef GLC_WORLDTO3DS_H_
25 #define GLC_WORLDTO3DS_H_
26 
27 #include <QObject>
28 #include <QString>
29 
30 #include "../sceneGraph/glc_world.h"
31 
32 #include "../glc_config.h"
33 
34 struct Lib3dsFile;
35 struct Lib3dsMesh;
36 struct Lib3dsMaterial;
37 struct Lib3dsNode;
38 
40 class GLC_3DRep;
41 class GLC_Mesh;
43 class GLC_Matrix4x4;
44 
47 
48 
49 class GLC_LIB_EXPORT GLC_WorldTo3ds : public QObject
50 {
51  Q_OBJECT
53 
55 
56 public:
57  GLC_WorldTo3ds(const GLC_World& world);
58  virtual ~GLC_WorldTo3ds();
60 
62 
64 
65 public:
67  bool exportToFile(const QString& fileName, bool useAbsolutePosition= false);
68 
70 
72 
74 
75 private:
77  void saveWorld();
78 
80  void saveMeshes();
81 
83  void saveBranch(GLC_StructOccurence* pOcc);
84 
86  void createNodeFromOccurrence(GLC_StructOccurence* pOcc);
87 
89  QList<Lib3dsMesh*> createMeshsFrom3DRep(GLC_3DRep* pRep, const QString& name, const GLC_Matrix4x4& matrix= GLC_Matrix4x4());
90 
92  Lib3dsMesh* create3dsMeshFromGLC_Mesh(GLC_Mesh* pMesh, const QString& meshName);
93 
95  Lib3dsMaterial* get3dsMaterialFromGLC_Material(GLC_Material* pMat);
96 
98  Lib3dsMaterial* create3dsMaterialFromGLC_Material(GLC_Material* pMat, const QString& materialName);
99 
101  QString materialName(GLC_Material* pMat) const;
102 
104  void setNodePosition(Lib3dsNode* pNode, const GLC_Matrix4x4& matrix);
105 
107 
109 // Qt Signals
111 signals:
112  void currentQuantum(int);
113 
115  /* Private members */
117 private:
120 
122  Lib3dsFile* m_pLib3dsFile;
123 
125  QString m_FileName;
126 
128  QHash<GLC_StructReference*, Lib3dsMesh*> m_ReferenceToMesh;
129 
131  QHash<QString, Lib3dsMaterial*> m_NameToMaterial;
132 
134  Lib3dsNode* m_pRootLib3dsNode;
135 
138 
140  QHash<GLC_uint, int> m_OccIdToNodeId;
141 
144 
147 
149  QHash<GLC_Texture*, QString> m_TextureToFileName;
150 };
151 
152 #endif /* GLC_WORLDTO3DS_H_ */

©2005-2013 Laurent Ribon