Frapper  1.0a
ImageNode.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2009 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; version 2.1 of the License.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
21 -----------------------------------------------------------------------------
22 */
23 
32 
33 #ifndef IMAGENODE_H
34 #define IMAGENODE_H
35 
36 #include "FrapperPrerequisites.h"
37 #include "ViewNode.h"
38 #include <Ogre.h>
39 
40 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32)
41 #include <windows.h>
42 #endif
43 
44 namespace Frapper {
45 
50 {
51 
52  Q_OBJECT
53 
54 public: // static constants
55 
60  static const int NumberUnknown = -1;
61 
62 public: // constructors and destructors
63 
72  ImageNode ( const QString &name, ParameterGroup *parameterRoot, bool cacheEnabled = true, const QString &outputImageName = "Image" );
73 
81  virtual ~ImageNode ();
82 
83 public: // functions
84 
90  virtual Ogre::TexturePtr getImage ();
91 
99  bool isCached ( int index ) const;
100 
107  Ogre::Image * getCachedImage ( int index ) const;
108 
109  public slots: //
110 
114  void clearImageCache ();
115 
116 protected: // functions
117 
123  void setNumberOfImagesToCache ( unsigned int numberOfImagesToCache );
124 
131  Ogre::Image * createImageFromTexture ( Ogre::TexturePtr texturePointer );
132 
139  void cacheImage ( int index, Ogre::Image *image );
140 
146  void setOutputImage ( Ogre::Image *image );
147 
148 private: // functions
149 
153  void updateCacheStatus ();
154 
155 protected: // data
156 
161 
166 
171 
176 
182  QMap<int, Ogre::Image *> m_imageCache;
183 
184 };
185 
186 } // end namespace Frapper
187 
188 #endif