GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_world.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 *****************************************************************************/
22 
24 
25 #ifndef GLC_WORLD_H_
26 #define GLC_WORLD_H_
27 
28 #include "glc_3dviewcollection.h"
29 #include "glc_structoccurence.h"
30 #include "glc_structreference.h"
31 #include "glc_structinstance.h"
32 #include "glc_worldhandle.h"
33 
34 #include "../glc_config.h"
35 
38 
45 
47 {
49 
51 
52 public:
54  GLC_World();
55 
57  explicit GLC_World(GLC_StructOccurence* pOcc);
58 
60  GLC_World(const GLC_World&);
61 
63  virtual ~GLC_World();
65 
67 
69 
70 public:
72  inline GLC_BoundingBox boundingBox()
73  { return m_pWorldHandle->collection()->boundingBox();}
74 
76  inline GLC_StructOccurence* rootOccurence() const
77  {return m_pRoot;}
78 
80  inline GLC_3DViewCollection* collection()
81  {return m_pWorldHandle->collection();}
82 
84  inline int size() const
85  {return m_pWorldHandle->collection()->size();}
86 
88  inline bool isEmpty() const
89  {return m_pWorldHandle->collection()->isEmpty() && !m_pRoot->hasChild();}
90 
92  inline int numberOfFaces() const
93  {return m_pRoot->numberOfFaces();}
94 
96  inline int numberOfVertex() const
97  {return m_pRoot->numberOfVertex();}
98 
100  inline int numberOfMaterials() const
101  {return m_pRoot->numberOfMaterials();}
102 
104  inline QList<GLC_Material*> listOfMaterials() const
105  {return m_pRoot->materialSet().toList();}
106 
108  inline QList<GLC_3DViewInstance*> instancesHandle() const
109  {return m_pWorldHandle->collection()->instancesHandle();}
110 
112  inline QList<GLC_3DViewInstance*> visibleInstancesHandle() const
113  {return m_pWorldHandle->collection()->visibleInstancesHandle();}
114 
116  inline QList<QString> instanceNamesFromShadingGroup(GLuint id) const
117  {return m_pWorldHandle->collection()->instanceNamesFromShadingGroup(id);}
118 
120  inline int numberOfUsedShadingGroup() const
121  {return m_pWorldHandle->collection()->numberOfUsedShadingGroup();}
122 
124  inline GLC_WorldHandle* worldHandle()
125  {return m_pWorldHandle;}
126 
128 
129  inline GLC_StructOccurence* occurence(GLC_uint id) const
130  {return m_pWorldHandle->getOccurence(id);}
131 
133  inline QList<GLC_StructOccurence*> listOfOccurence() const
134  {return m_pWorldHandle->occurences();}
135 
137  inline int numberOfOccurence() const
138  {return m_pWorldHandle->numberOfOccurence();}
139 
141  inline int containsOccurence(GLC_uint id) const
142  {return m_pWorldHandle->containsOccurence(id);}
143 
145  inline QList<GLC_StructInstance*> instances() const
146  {return m_pWorldHandle->instances();}
147 
149  inline QList<GLC_StructReference*> references() const
150  {return m_pWorldHandle->references();}
151 
153  inline int numberOfBody() const
154  {return m_pWorldHandle->numberOfBody();}
155 
157  inline int representationCount() const
158  {return m_pWorldHandle->representationCount();}
159 
161  inline GLC_Vector3d upVector() const
162  {return m_pWorldHandle->upVector();}
163 
165  int selectionSize() const
166  {return m_pWorldHandle->selectionSetHandle()->size();}
167 
169  inline bool isSelected(const GLC_StructOccurence* pOccurence) const
170  {return m_pWorldHandle->selectionSetHandle()->contains(pOccurence);}
171 
173  inline bool isSelected(GLC_uint selectionId) const
174  {return m_pWorldHandle->selectionSetHandle()->contains(selectionId);}
175 
177  inline QList<GLC_StructOccurence*> selectedOccurenceList() const
178  {return m_pWorldHandle->selectionSetHandle()->occurencesList();}
179 
181  QList<GLC_StructOccurence*> minimumSelectedOccurenceList() const;
182 
184  GLC_StructOccurence* takeRootOccurrence();
185 
187 
189 
191 
192 public:
194  void replaceRootOccurrence(GLC_StructOccurence* pOcc);
195 
197  void mergeWithAnotherWorld(GLC_World &);
198 
200  inline void reversePartNormal() {m_pRoot->reverseNormals();}
201 
203  GLC_World& clear() {return *this= GLC_World();}
204 
206  inline void setRootName(const QString& name)
207  {m_pRoot->setName(name);}
208 
210  inline void setUpVector(const GLC_Vector3d& vect)
211  {m_pWorldHandle->setUpVector(vect);}
212 
214  inline void setAttachedViewport(GLC_Viewport* pViewport)
215  {m_pWorldHandle->setAttachedViewport(pViewport);}
216 
218 
219  inline void select(const GLC_StructOccurence* pOccurence)
220  {m_pWorldHandle->select(pOccurence->id());}
221 
223 
224  inline void select(GLC_uint occurenceId)
225  {m_pWorldHandle->select(occurenceId);}
226 
228 
229  inline void unselect(GLC_uint occurenceId)
230  {m_pWorldHandle->unselect(occurenceId);}
231 
233  inline void selectAllWith3DViewInstance()
234  {m_pWorldHandle->selectAllWith3DViewInstance(true);}
235 
237  inline void selectAllWith3DViewInstanceInCurrentShowState()
238  {m_pWorldHandle->selectAllWith3DViewInstance(false);}
239 
241  inline void unselectAll()
242  {m_pWorldHandle->unselectAll();}
243 
245  inline void showHideSelected3DViewInstance()
246  {m_pWorldHandle->showHideSelected3DViewInstance();}
247 
249  inline void showSelected3DViewInstance()
250  {m_pWorldHandle->setSelected3DViewInstanceVisibility(true);}
251 
253  inline void hideSelected3DViewInstance()
254  {m_pWorldHandle->setSelected3DViewInstanceVisibility(false);}
256 
258 
260 
261 public:
263  GLC_World& operator=(const GLC_World&);
264 
266  bool operator==(const GLC_World& other) const;
267 
269 
271 
273 
274 public:
276  inline void render(GLuint groupId, glc::RenderFlag renderFlag= glc::ShadingFlag)
277  {m_pWorldHandle->collection()->render(groupId, renderFlag);}
278 
280  inline void renderShaderGroup(glc::RenderFlag renderFlag= glc::ShadingFlag)
281  {m_pWorldHandle->collection()->renderShaderGroup(renderFlag);}
282 
284 
285 // private members
287 private:
290 
293 };
294 
295 Q_DECLARE_METATYPE(GLC_World)
296 
297 #endif /*GLC_WORLD_H_*/

©2005-2013 Laurent Ribon