Frapper  1.0a
HairSingleScatterRenderNode.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 
33 
34 #ifndef HAIRSINGLESCATTERRENDERNODE_H
35 #define HAIRSINGLESCATTERRENDERNODE_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 HairSingleScatterRenderNode {
49 using namespace Frapper;
50 
55 {
56 
57  Q_OBJECT
58 
59 public: // constructors and destructors
60 
67  HairSingleScatterRenderNode ( const QString &name, ParameterGroup *parameterRoot );
68 
76  virtual ~HairSingleScatterRenderNode ();
77 
78 private slots:
79 
88  void loadLightDescriptionFile ();
89 
93  void setLightScale ();
94 
98  void setShaderParameter ();
99 
103  void setShaderColor();
104 
108  void setNbrLights();
109 
110 public slots: //
111 
115  void processOutputImage ();
116 
117 public:
118 
119  void redrawTriggered();
120 
121 
122 private: // functions
123 
128  float greatestComponent(const Ogre::Vector3 &vec) const;
129 
133  void setCustomVertexShader();
134 
138  static bool greaterThan(const QPair<Ogre::Vector3, Ogre::Vector3> &d1, const QPair<Ogre::Vector3, Ogre::Vector3> &d2);
139 
140 protected: // data
141 
145  Ogre::Light *m_sceneLight;
146 
150  Ogre::Camera *m_cameraCopy;
151 
156 
160  QList<QPair<Ogre::Vector3, Ogre::Vector3>> m_lightPositions;
161 
166 
167 
168 #ifdef LIGHT_DEBUG
169 
170 
171 
173 #endif
174 
175 };
176 
177 } // namespace HairSingleScatterRenderNode
178 
179 #endif