GScene.h

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Raphael Langerhorst                             *
00003  *   raphael@raphael.g-system.at                                           *
00004  *                                                                         *
00005  *   Permission is hereby granted, free of charge, to any person obtaining *
00006  *   a copy of this software and associated documentation files (the       *
00007  *   "Software"), to deal in the Software without restriction, including   *
00008  *   without limitation the rights to use, copy, modify, merge, publish,   *
00009  *   distribute, sublicense, and/or sell copies of the Software, and to    *
00010  *   permit persons to whom the Software is furnished to do so, subject to *
00011  *   the following conditions:                                             *
00012  *                                                                         *
00013  *   The above copyright notice and this permission notice shall be        *
00014  *   included in all copies or substantial portions of the Software.       *
00015  *                                                                         *
00016  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
00017  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
00018  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
00019  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
00020  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
00021  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
00022  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
00023  ***************************************************************************/
00024 
00025 #ifndef GSCENEH
00026 #define GSCENEH
00027 
00028 #include <QObject>
00029 #include <QMap>
00030 
00031 #include <GElementID.h>
00032 #include <GForm.h>
00033 
00034 namespace X3DTK
00035 {
00036   namespace X3D
00037   {
00038     class Scene;
00039     class X3DGroupingNode;
00040   }
00041 
00042   namespace GL
00043   {
00044     class Scene;
00045   }
00046 }
00047 
00048 namespace GCS
00049 {
00050   class GElement;
00051 }
00052 
00053 namespace GWE
00054 {
00055   class GInformationInterface;
00056 }
00057 
00058 
00059 namespace GCE
00060 {
00061 
00062   class GOpenGLFrame;
00063   
00064 /*
00065 class GSceneElement
00066 {
00067   public:
00068     GCS::GElementID Element;
00069     GCS::GForm Form;
00070     QString SceneName;
00071   public:
00072 //     GSceneElement(const GCS::GElementID& element, const GCS::GForm& form = GCS::GForm(), const QString& scenename);
00073     
00074     GMatrix44 getTransformation();
00075     GMatrix44 getTransformationNoScale();
00076     GMatrix44 getTransformationScaleOnly();
00077 };
00078 */
00079 
00099 class GScene : public QObject
00100 {
00101   Q_OBJECT
00102   
00103   protected:
00104   
00108     GWE::GInformationInterface* InformationInterface;
00109     
00114     GCE::GOpenGLFrame* Frame;
00115     
00121     GCS::GElementID RootElement;
00122     
00136     int MaxSceneDepth;
00137     
00138   private:
00139   
00145     const GCS::GElement* findRootElement() const;
00146     
00156     X3DTK::X3D::X3DGroupingNode* appendElementToGroup(const GCS::GElementID& element, X3DTK::X3D::X3DGroupingNode* group, bool recursive = false, int depth = 1);
00157     
00158   protected:
00159   
00170     QString DataPath;
00171   
00182     QMap<QString,X3DTK::X3D::Scene*> LoadedScenes;
00183     
00188     QMap<QString,X3DTK::GL::Scene*> LoadedScenesGl;
00189     
00202     void loadScene(QString name);
00203     
00208     void removeScene(const QString& name);
00209     
00210   public:
00211   
00216     GScene(GWE::GInformationInterface* info);
00217     
00221     virtual ~GScene();
00222     
00226     GCS::GElementID getRootElement();
00227     
00231     int getMaxSceneDepth();
00232     
00236     QString getDataPath();
00237     
00238   public slots:
00239   
00241     void setOpenGLFrame(GCE::GOpenGLFrame* frame);
00242     
00244     void setDataPath(const QString& path);
00245     
00250     void setRootElement(const GCS::GElementID& root);
00251     
00256     void setMaxSceneDepth(int depth);
00257     
00262     void renderScene();
00263     
00269     void renderElement(const GCS::GElement* element, int depth = 1);
00270   
00271 };
00272 
00273 }
00274 
00275 #endif

Generated on Thu Nov 16 07:49:12 2006 for G System by  doxygen 1.4.7