Frapper  1.0a
CompositorNode.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; 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 
34 
35 #ifndef COMPOSITORNODE_H
36 #define COMPOSITORNODE_H
37 
38 #include "FrapperPrerequisites.h"
39 #include "RenderNode.h"
40 
41 // OGRE
42 #include <Ogre.h>
43 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32)
44 #include <windows.h>
45 #endif
46 
47 namespace Frapper {
48 
52 class FRAPPER_CORE_EXPORT CompositorNode : public RenderNode, public Ogre::CompositorInstance::Listener
53 {
54 
55  Q_OBJECT
56 
57 public: // constructors and destructors
58 
65  CompositorNode ( const QString &name, ParameterGroup *parameterRoot );
66 
74  virtual ~CompositorNode ();
75 
76  protected slots:
77 
81  virtual void reload ();
82 
83 protected: // functions
84 
91  virtual void resizeRenderTexture(int width, int height, Ogre::PixelFormat pixelFormat = Ogre::PF_R8G8B8);
92 
98  Ogre::GpuProgramParametersSharedPtr getShaderParameters( Ogre::MaterialPtr &mat );
99 
106  void setTexture( Ogre::MaterialPtr &mat, Ogre::TexturePtr texture, unsigned int slot );
107 
115  void setShaderParameter( Ogre::GpuProgramParametersSharedPtr fpParams, Ogre::String name, int value );
116 
124  void setShaderParameter( Ogre::GpuProgramParametersSharedPtr fpParams, Ogre::String name, Ogre::Real value );
125 
133  void setShaderParameter(Ogre::GpuProgramParametersSharedPtr fpParams, Ogre::String name, Ogre::Vector2 vector);
134 
142  void setShaderParameter( Ogre::GpuProgramParametersSharedPtr fpParams, Ogre::String name, Ogre::Vector3 vector );
143 
151  void setShaderParameter( Ogre::GpuProgramParametersSharedPtr fpParams, Ogre::String name, Ogre::Vector4 vector );
152 
160  void setShaderParameter( Ogre::GpuProgramParametersSharedPtr fpParams, Ogre::String name, Ogre::Matrix4 matrix );
161 
168  virtual void notifyMaterialRender ( Ogre::uint32 pass_id, Ogre::MaterialPtr &mat );
169 
170 protected: // data
171 
175  Ogre::CompositorInstance *m_compositor;
176 
181 };
182 
183 } // end namespace Frapper
184 
185 #endif