00001 /****************************************************************************\ 00002 * VRVis * 00003 * http://vrvis.sourceforge.net * 00004 * (C) 2004 by Alex Loeffler * 00005 * mailto:aloeffler@users.sourceforge.net * 00006 **************************************************************************** 00007 * License * 00008 * * 00009 * This library is free software; you can redistribute it and/or modify it * 00010 * under the terms of the GNU Library General Public License as published * 00011 * by the Free Software Foundation, version 2. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, but * 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Library General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Library General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00021 \****************************************************************************/ 00022 00023 #ifndef LAYER_HPP 00024 #define LAYER_HPP 00025 00026 #include <list> 00027 #include "Common.hpp" 00028 #include "Drawable.hpp" 00029 #include "Selectable.hpp" 00030 00031 namespace vrvis 00032 { 00033 00034 class LayerComponent; 00035 00038 class Layer : public Drawable, public Selectable 00039 { 00040 // ================================================================== PUBLIC 00041 00042 public: 00043 00044 // ----------------------------------------------- Constructor & Destructor. 00046 00048 Layer(const float cSizeX, const float cSizeY); 00050 ~Layer(void); 00051 00053 // ------------------------------------------------------------- Components. 00055 00057 void addComponent(LayerComponent* pComponent, 00058 const float cRelativeOriginX = 0.0f, 00059 const float cRelativeOriginY = 0.0f, 00060 const float cRelativeSizeX = 1.0f, 00061 const float cRelativeSizeY = 1.0f); 00062 00064 void removeComponent(LayerComponent* pComponent); 00065 00067 // -------------------------------------------------------------- Accessors. 00069 00071 float getSizeX(void); 00073 float getSizeY(void); 00075 const std::list<LayerComponent*>& getComponentList(void); 00076 00078 // --------------------------------------------------------- Transformation. 00080 00082 void moveTo(const float cX, const float cY, const float cZ); 00083 00085 void rotateDegrees(const float cDegX, 00086 const float cDegY, 00087 const float cDegZ); 00088 00090 // -------------------- GL Context Initialization (Inherited from Drawable). 00092 00094 virtual void contextInit(void); 00095 00096 // ----------------------------------- GL Drawing (Inherited from Drawable). 00097 00099 virtual void draw(void); 00100 00102 // ================================================================= PRIVATE 00103 00104 private: 00105 00106 // --------------------------------------------------------------- Typedefs. 00107 00109 typedef std::list<Layer*> LayerList; 00111 typedef std::list<LayerComponent*> ComponentList; 00112 00113 // ---------------------------------------------------------------- Members. 00114 00115 float mSizeX; 00116 float mSizeY; 00117 00119 float mOriginX; 00121 float mOriginY; 00123 float mOriginZ; 00124 00125 float mRotX; 00126 float mRotY; 00127 float mRotZ; 00128 00129 ComponentList mComponents; 00130 00131 // --------------------------------------------------------- Static Members. 00132 00134 static LayerList sAllLayers; 00135 }; 00136 00137 } // End namespace. 00138 00139 #endif // LAYER_HPP