OgreShaderRenderState.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
14 
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
17 
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE.
25 -----------------------------------------------------------------------------
26 */
27 #ifndef _ShaderRenderState_
28 #define _ShaderRenderState_
29 
32 
33 namespace Ogre {
34 namespace RTShader {
35 
50 {
51 
52  // Interface.
53 public:
54 
56  RenderState();
57 
59  virtual ~RenderState();
60 
62  void reset();
63 
67  void addTemplateSubRenderState(SubRenderState* subRenderState);
68 
72  void removeTemplateSubRenderState(SubRenderState* subRenderState);
73 
75  const SubRenderStateList& getTemplateSubRenderStateList() const { return mSubRenderStateList; }
76 
85  void setLightCount(const int lightCount[3]);
86 
95  void getLightCount(int lightCount[3]) const;
96 
103  void setLightCountAutoUpdate(bool autoUpdate) { mLightCountAutoUpdate = autoUpdate; }
104 
109  bool getLightCountAutoUpdate() const { return mLightCountAutoUpdate; }
110 
111 
112 
113 
114  // Attributes.
115 protected:
116  // The sub render states list.
118  // The light count per light type definition.
119  int mLightCount[3];
120  // True if light count was explicitly set.
122 
123 private:
124  friend class ProgramManager;
125  friend class FFPRenderStateBuilder;
126 };
127 
128 
130 typedef RenderStateList::iterator RenderStateIterator;
131 typedef RenderStateList::const_iterator RenderStateConstIterator;
132 
133 
139 {
140 
141 // Interface.
142 public:
143 
146 
148  virtual ~TargetRenderState();
149 
156  void link(const RenderState& other, Pass* srcPass, Pass* dstPass);
157 
164  void updateGpuProgramsParams(Renderable* rend, Pass* pass, const AutoParamDataSource* source, const LightList* pLightList);
165 
166 // Protected methods
167 protected:
168 
170  void sortSubRenderStates();
171 
173  static int sSubRenderStateCompare(const void * p0, const void *p1);
174 
175 
178  bool createCpuPrograms();
179 
183 
184  /* Destroy the program set of this render state. */
185  void destroyProgramSet();
186 
190 
194  void addSubRenderStateInstance(SubRenderState* subRenderState);
195 
199  void removeSubRenderStateInstance(SubRenderState* subRenderState);
200 
201 
202 // Attributes.
203 protected:
204  // Tells if the list of the sub render states is sorted.
206  // The program set of this RenderState.
208 
209 
210 private:
211  friend class ProgramManager;
212  friend class FFPRenderStateBuilder;
213 };
214 
215 
219 }
220 }
221 
222 #endif
223 

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Oct 16 2013 14:35:45