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 
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 
Ogre::HashedVector< Light * >
Ogre::AutoParamDataSource
This utility class is used to hold the information used to generate the matrices and other informatio...
Definition: OgreAutoParamDataSource.h:60
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::RTShader::RenderStateIterator
RenderStateList::iterator RenderStateIterator
Definition: OgreShaderRenderState.h:130
Ogre::RTShader::SubRenderState
This class is the base interface of sub part from a shader based rendering pipeline.
Definition: OgreShaderSubRenderState.h:56
Ogre::RTShader::TargetRenderState::updateGpuProgramsParams
void updateGpuProgramsParams(Renderable *rend, Pass *pass, const AutoParamDataSource *source, const LightList *pLightList)
Update the GPU programs constant parameters before a renderable is rendered.
Ogre::RTShader::TargetRenderState::sortSubRenderStates
void sortSubRenderStates()
Sort the sub render states composing this render state.
Ogre::RTShader::ProgramSet
Container class for shader based programs.
Definition: OgreShaderProgramSet.h:46
Ogre::RTShader::SubRenderStateList
vector< SubRenderState * >::type SubRenderStateList
Definition: OgreShaderSubRenderState.h:162
Ogre::RTShader::TargetRenderState::TargetRenderState
TargetRenderState()
Class default constructor.
Ogre::Pass
Class defining a single pass of a Technique (of a Material), i.e.
Definition: OgrePass.h:80
Ogre::RTShader::RenderStateConstIterator
RenderStateList::const_iterator RenderStateConstIterator
Definition: OgreShaderRenderState.h:131
OgreShaderPrerequisites.h
Ogre::RTShader::TargetRenderState::mSubRenderStateSortValid
bool mSubRenderStateSortValid
Definition: OgreShaderRenderState.h:201
Ogre::RTShader::RenderState::getLightCountAutoUpdate
bool getLightCountAutoUpdate() const
Return true if this render state override the light count.
Definition: OgreShaderRenderState.h:109
Ogre::RTShader::TargetRenderState::link
void link(const RenderState &other, Pass *srcPass, Pass *dstPass)
Link this target render state with the given render state.
Ogre::RTShader::TargetRenderState::mProgramSet
ProgramSet * mProgramSet
Definition: OgreShaderRenderState.h:203
Ogre::RTShader::RenderState
This is a container class for sub render state class.
Definition: OgreShaderRenderState.h:49
Ogre::RTShader::TargetRenderState::removeSubRenderStateInstance
void removeSubRenderStateInstance(SubRenderState *subRenderState)
Remove sub render state from this render state.
Ogre::RTShader::TargetRenderState::destroyProgramSet
void destroyProgramSet()
Ogre::RTShader::TargetRenderState::addSubRenderStateInstance
void addSubRenderStateInstance(SubRenderState *subRenderState)
Add sub render state to this render state.
Ogre::RTShader::ProgramManager
A singleton manager class that manages shader based programs.
Definition: OgreShaderProgramManager.h:46
Ogre::RTShader::RenderState::mSubRenderStateList
SubRenderStateList mSubRenderStateList
Definition: OgreShaderRenderState.h:117
Ogre::RTShader::RenderState::getTemplateSubRenderStateList
const SubRenderStateList & getTemplateSubRenderStateList() const
Get the list of the template sub render states composing this render state.
Definition: OgreShaderRenderState.h:75
Ogre::RTShader::TargetRenderState::FFPRenderStateBuilder
friend class FFPRenderStateBuilder
Definition: OgreShaderRenderState.h:208
Ogre::Renderable
Abstract class defining the interface all renderable objects must implement.
Definition: OgreRenderable.h:63
Ogre::RTShader::TargetRenderState
This is the target render state.
Definition: OgreShaderRenderState.h:138
OgreShaderSubRenderState.h
Ogre::RTShader::TargetRenderState::getProgramSet
ProgramSet * getProgramSet()
Return the program set of this render state.
Definition: OgreShaderRenderState.h:185
Ogre::RTShader::RenderStateList
vector< RenderState * >::type RenderStateList
Definition: OgreShaderRenderState.h:129
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::RTShader::RenderState::mLightCountAutoUpdate
bool mLightCountAutoUpdate
Definition: OgreShaderRenderState.h:121
Ogre::RTShader::TargetRenderState::createCpuPrograms
bool createCpuPrograms()
Create CPU programs that represent this render state.
Ogre::RTShader::TargetRenderState::~TargetRenderState
virtual ~TargetRenderState()
Class destructor.
_OgreRTSSExport
#define _OgreRTSSExport
Definition: OgreShaderPrerequisites.h:108
Ogre::RTShader::TargetRenderState::createProgramSet
ProgramSet * createProgramSet()
Create the program set of this render state.
Ogre::RTShader::RenderState::setLightCountAutoUpdate
void setLightCountAutoUpdate(bool autoUpdate)
Set the light count auto update state.
Definition: OgreShaderRenderState.h:103

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.