glc_world.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 *****************************************************************************/
00022 
00024 
00025 #ifndef GLC_WORLD_H_
00026 #define GLC_WORLD_H_
00027 
00028 #include "glc_3dviewcollection.h"
00029 #include "glc_structoccurence.h"
00030 #include "glc_structreference.h"
00031 #include "glc_structinstance.h"
00032 #include "glc_worldhandle.h"
00033 
00034 #include "../glc_config.h"
00035 
00038 
00045 
00046 class GLC_LIB_EXPORT GLC_World
00047 {
00049 
00051 
00052 public:
00054         GLC_World();
00055 
00057         GLC_World(const GLC_World&);
00058 
00060         virtual ~GLC_World();
00062 
00064 
00066 
00067 public:
00069         inline GLC_BoundingBox boundingBox()
00070         { return m_pWorldHandle->collection()->boundingBox();}
00071 
00073         inline GLC_StructOccurence* rootOccurence() const
00074         {return m_pRoot;}
00075 
00077         inline GLC_3DViewCollection* collection()
00078         {return m_pWorldHandle->collection();}
00079 
00081         inline int size() const
00082         {return m_pWorldHandle->collection()->size();}
00083 
00085         inline bool isEmpty() const
00086         {return  m_pWorldHandle->collection()->isEmpty() && !m_pRoot->hasChild();}
00087 
00089         inline int numberOfFaces() const
00090         {return m_pRoot->numberOfFaces();}
00091 
00093         inline int numberOfVertex() const
00094         {return m_pRoot->numberOfVertex();}
00095 
00097         inline int numberOfMaterials() const
00098         {return m_pRoot->numberOfMaterials();}
00099 
00101         inline QList<GLC_Material*> listOfMaterials() const
00102         {return m_pRoot->materialSet().toList();}
00103 
00105         inline QList<GLC_3DViewInstance*> instancesHandle() const
00106         {return m_pWorldHandle->collection()->instancesHandle();}
00107 
00109         inline QList<GLC_3DViewInstance*> visibleInstancesHandle() const
00110         {return m_pWorldHandle->collection()->visibleInstancesHandle();}
00111 
00113         inline QList<QString> instanceNamesFromShadingGroup(GLuint id) const
00114         {return m_pWorldHandle->collection()->instanceNamesFromShadingGroup(id);}
00115 
00117         inline int numberOfUsedShadingGroup() const
00118         {return m_pWorldHandle->collection()->numberOfUsedShadingGroup();}
00119 
00121         inline GLC_WorldHandle* worldHandle()
00122         {return m_pWorldHandle;}
00123 
00125 
00126         inline GLC_StructOccurence* occurence(GLC_uint id) const
00127         {return m_pWorldHandle->getOccurence(id);}
00128 
00130         inline QList<GLC_StructOccurence*> listOfOccurence() const
00131         {return m_pWorldHandle->occurences();}
00132 
00134         inline int numberOfOccurence() const
00135         {return m_pWorldHandle->numberOfOccurence();}
00136 
00138         inline int containsOccurence(GLC_uint id) const
00139         {return m_pWorldHandle->containsOccurence(id);}
00140 
00142         inline QList<GLC_StructInstance*> instances() const
00143         {return m_pWorldHandle->instances();}
00144 
00146         inline QList<GLC_StructReference*> references() const
00147         {return m_pWorldHandle->references();}
00148 
00150         inline int numberOfBody() const
00151         {return m_pWorldHandle->numberOfBody();}
00152 
00154         inline int representationCount() const
00155         {return m_pWorldHandle->representationCount();}
00156 
00158         inline GLC_Vector3d upVector() const
00159         {return m_pWorldHandle->upVector();}
00160 
00162         int selectionSize() const
00163         {return m_pWorldHandle->selectionSetHandle()->size();}
00164 
00166         inline bool isSelected(const GLC_StructOccurence* pOccurence) const
00167         {return m_pWorldHandle->selectionSetHandle()->contains(pOccurence);}
00168 
00170         inline bool isSelected(GLC_uint selectionId) const
00171         {return m_pWorldHandle->selectionSetHandle()->contains(selectionId);}
00172 
00174         inline QList<GLC_StructOccurence*> selectedOccurenceList() const
00175         {return m_pWorldHandle->selectionSetHandle()->occurencesList();}
00176 
00178         inline QList<GLC_StructOccurence*> selectedPrimitiveOccurenceList() const
00179         {return m_pWorldHandle->selectionSetHandle()->occurencesListWithSelectedPrimitive();}
00180 
00182 
00184 
00186 
00187 public:
00189         void mergeWithAnotherWorld(GLC_World &);
00190 
00192         inline void reversePartNormal() {m_pRoot->reverseNormals();}
00193 
00195         GLC_World& clear() {return *this= GLC_World();}
00196 
00198         inline void setRootName(const QString& name)
00199         {m_pRoot->setName(name);}
00200 
00202         inline void setUpVector(const GLC_Vector3d& vect)
00203         {m_pWorldHandle->setUpVector(vect);}
00204 
00206         inline void setAttachedViewport(GLC_Viewport* pViewport)
00207         {m_pWorldHandle->setAttachedViewport(pViewport);}
00208 
00210 
00211         inline void select(const GLC_StructOccurence* pOccurence)
00212         {m_pWorldHandle->select(pOccurence->id());}
00213 
00215 
00216         inline void select(GLC_uint occurenceId)
00217         {m_pWorldHandle->select(occurenceId);}
00218 
00220 
00221         inline void unselect(GLC_uint occurenceId)
00222         {m_pWorldHandle->unselect(occurenceId);}
00223 
00225         inline void selectAllWith3DViewInstance()
00226         {m_pWorldHandle->selectAllWith3DViewInstance(true);}
00227 
00229         inline void selectAllWith3DViewInstanceInCurrentShowState()
00230         {m_pWorldHandle->selectAllWith3DViewInstance(false);}
00231 
00233         inline void unselectAll()
00234         {m_pWorldHandle->unselectAll();}
00235 
00237         inline void showHideSelected3DViewInstance()
00238         {m_pWorldHandle->showHideSelected3DViewInstance();}
00239 
00241         inline void showSelected3DViewInstance()
00242         {m_pWorldHandle->setSelected3DViewInstanceVisibility(true);}
00243 
00245         inline void hideSelected3DViewInstance()
00246         {m_pWorldHandle->setSelected3DViewInstanceVisibility(false);}
00247 
00248 
00250 
00252 
00254 
00255 public:
00257         GLC_World& operator=(const GLC_World&);
00259 
00261 
00263 
00264 public:
00266         inline void render(GLuint groupId, glc::RenderFlag renderFlag= glc::ShadingFlag)
00267         {m_pWorldHandle->collection()->render(groupId, renderFlag);}
00268 
00270         inline void renderShaderGroup(glc::RenderFlag renderFlag= glc::ShadingFlag)
00271         {m_pWorldHandle->collection()->renderShaderGroup(renderFlag);}
00272 
00274 
00275 // private members
00277 private:
00279         GLC_WorldHandle* m_pWorldHandle;
00280 
00282         GLC_StructOccurence* m_pRoot;
00283 };
00284 
00285 #endif /*GLC_WORLD_H_*/

SourceForge.net Logo

©2005-2011 Laurent Ribon