Frapper  1.0a
HairRenderNodeAlpha.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-2010 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 
33 
34 #ifndef HAIRRENDERNODE_H
35 #define HAIRRENDERNODE_H
36 
37 #include "GeometryRenderNode.h"
38 #include "OgreTools.h"
39 
40 // OGRE
41 #include <Ogre.h>
42 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32)
43 #include <windows.h>
44 #endif
45 
46 //#define LIGHT_DEBUG
47 
48 namespace HairRenderAlphaNode {
49 using namespace Frapper;
50 
55 {
56 
57  Q_OBJECT
58 
59 public: // constructors and destructors
60 
67  HairRenderNode ( const QString &name, ParameterGroup *parameterRoot );
68 
76  virtual ~HairRenderNode ();
77 
78 private slots:
79 
88  void loadLightDescriptionFile ();
89 
93  void setLightScale ();
94 
98  void setShadowParameter();
99 
103  void setShaderParameter ();
104 
112  void setParameter(const Ogre::String &matName, const Ogre::String &paramName, const float value);
113 
117  void setNbrLights();
118 
119 
120 public slots: //
121 
125  void processOutputImage ();
126 
127 public:
128 
129  void redrawTriggered();
130 
131 private: // functions
132 
137  float greatestComponent(const Ogre::Vector3 &vec) const;
138 
142  void setCustomVertexShader();
143 
147  static bool greaterThan(const QPair<Ogre::Vector3, Ogre::Vector3> &d1, const QPair<Ogre::Vector3, Ogre::Vector3> &d2);
148 
149 protected: // data
150 
154  Ogre::Light *m_sceneLight;
155 
159  Ogre::Camera *m_cameraCopy;
160 
165 
169  QList<QPair<Ogre::Vector3, Ogre::Vector3>> m_lightPositions;
170 
175 
176 #ifdef LIGHT_DEBUG
177 
178 
179 
180  QString m_outputShadowImageName;
181 #endif
182 
183 };
184 
185 } // namespace HairRenderAlphaNode
186 
187 #endif