Frapper  1.0a
RenderNode.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-2011 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; either version 2 of the License, or (at your option) any later
12 version.
13 
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License along with
19 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21 http://www.gnu.org/copyleft/lesser.txt.
22 -----------------------------------------------------------------------------
23 */
24 
35 
36 #ifndef RENDERNODE_H
37 #define RENDERNODE_H
38 
39 #include "ImageNode.h"
40 
41 // OGRE
42 #include <Ogre.h>
43 #include "OgreTools.h"
44 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32)
45 #include <windows.h>
46 #endif
47 
48 namespace Frapper {
49 
54 {
55 
56  Q_OBJECT
57 
58 protected: // static constants
59 
63  static const QString BackgroundColorParameterName;
64 
68  static const int DefaultRenderWidth = 1200;
69 
73  static const int DefaultRenderHeight = 720;
74 
78  static float DefaultGamma;
79 
83  static QStringList resLiterals;
84 
88  static QStringList resValues;
89 
90 
91 
92 public: // constructors and destructors
93 
100  RenderNode ( const QString &name, ParameterGroup *parameterRoot );
101 
109  virtual ~RenderNode ();
110 
111 public: // methods
112 
118  unsigned int getWidth() const;
119 
125  unsigned int getHeight() const;
126 
127 public slots: //
128 
132  virtual void redrawTriggered ();
133 
137  void setTargetMultiplier();
138 
139 
140 protected: // methods
141 
147  Ogre::String generateTexture(const QString &name, Ogre::TextureType texType, Ogre::uint width, Ogre::uint height, int num_mips, Ogre::PixelFormat format, int usage=Ogre::TU_DEFAULT);
148 
154  void initializeRenderTarget(Ogre::Camera* cam, Ogre::ColourValue bkColor = Ogre::ColourValue(0,0,0), Ogre::PixelFormat format = Ogre::PF_R8G8B8, bool clearFrame = true, int fsaa = 4);
155 
161  void initializeRenderTargetsInHash (Ogre::Camera* cam = 0, bool clearFrame = true);
162 
168  void initializeAllTargets(Ogre::Camera* cam);
169 
176  void resizeAllTargets(int width, int height);
177 
184  void resizeAllTexturesInHash(int width, int height);
185 
192  void resizeRenderTexture(int width, int height, Ogre::PixelFormat pixelFormat = Ogre::PF_R8G8B8, int fsaa = 4);
193 
197  void finalizeRenderTargets();
198 
202  void removeRenderTexture(Ogre::TexturePtr &texture);
203 
207  void removeViewportsFromRenderTargets();
208 
209 
210 protected: // data
211 
216 
220  Ogre::SceneManager *m_sceneManager;
221 
225  Ogre::Viewport *m_viewport;
226 
230  Ogre::Camera *m_camera;
231 
235  Ogre::TexturePtr m_renderTexture;
236 
240  Ogre::String m_renderTextureName;
241 
246 
251 
256 
260  Ogre::TexturePtr m_defaultTexture;
261 
265  QHash<QString, Ogre::TexturePtr> m_textureHash;
266 
270  QHash<QString, Ogre::Viewport*> m_viewportHash;
271 
275  QList<QString> m_outParameterNameList;
276 };
277 
278 } // end namespace Frapper
279 
280 #endif