OGRE  1.9
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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-2014 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 
174  bool createCpuPrograms();
175 
179 
180  /* Destroy the program set of this render state. */
181  void destroyProgramSet();
182 
186 
190  void addSubRenderStateInstance(SubRenderState* subRenderState);
191 
195  void removeSubRenderStateInstance(SubRenderState* subRenderState);
196 
197 
198 // Attributes.
199 protected:
200  // Tells if the list of the sub render states is sorted.
202  // The program set of this RenderState.
204 
205 
206 private:
207  friend class ProgramManager;
208  friend class FFPRenderStateBuilder;
209 };
210 
211 
215 }
216 }
217 
218 #endif
219 
TargetRenderState()
Class default constructor.
vector< RenderState * >::type RenderStateList
ProgramSet * createProgramSet()
Create the program set of this render state.
virtual ~TargetRenderState()
Class destructor.
SubRenderStateList mSubRenderStateList
bool createCpuPrograms()
Create CPU programs that represent this render state.
void link(const RenderState &other, Pass *srcPass, Pass *dstPass)
Link this target render state with the given render state.
RenderStateList::const_iterator RenderStateConstIterator
#define _OgreRTSSExport
Class defining a single pass of a Technique (of a Material), i.e.
Definition: OgrePass.h:80
const SubRenderStateList & getTemplateSubRenderStateList() const
Get the list of the template sub render states composing this render state.
Abstract class defining the interface all renderable objects must implement.
This is the target render state.
This is a container class for sub render state class.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
void sortSubRenderStates()
Sort the sub render states composing this render state.
ProgramSet * getProgramSet()
Return the program set of this render state.
void setLightCountAutoUpdate(bool autoUpdate)
Set the light count auto update state.
RenderStateList::iterator RenderStateIterator
void removeSubRenderStateInstance(SubRenderState *subRenderState)
Remove sub render state from this render state.
void addSubRenderStateInstance(SubRenderState *subRenderState)
Add sub render state to this render state.
vector< SubRenderState * >::type SubRenderStateList
This class is the base interface of sub part from a shader based rendering pipeline.
Container class for shader based programs.
bool getLightCountAutoUpdate() const
Return true if this render state override the light count.
A singleton manager class that manages shader based programs.
void updateGpuProgramsParams(Renderable *rend, Pass *pass, const AutoParamDataSource *source, const LightList *pLightList)
Update the GPU programs constant parameters before a renderable is rendered.
This utility class is used to hold the information used to generate the matrices and other informatio...