OGRE  1.9.0
OgreShaderRenderState.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions:
14
15The above copyright notice and this permission notice shall be included in
16all copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24THE SOFTWARE.
25-----------------------------------------------------------------------------
26*/
27#ifndef _ShaderRenderState_
28#define _ShaderRenderState_
29
32
33namespace Ogre {
34namespace RTShader {
35
50{
51
52 // Interface.
53public:
54
57
59 virtual ~RenderState();
60
62 void reset();
63
68
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.
115protected:
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
123private:
124 friend class ProgramManager;
125 friend class FFPRenderStateBuilder;
126};
127
128
130typedef RenderStateList::iterator RenderStateIterator;
131typedef RenderStateList::const_iterator RenderStateConstIterator;
132
133
139{
140
141// Interface.
142public:
143
146
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
167protected:
168
171
175
179
180 /* Destroy the program set of this render state. */
182
186
191
196
197
198// Attributes.
199protected:
200 // Tells if the list of the sub render states is sorted.
202 // The program set of this RenderState.
204
205
206private:
207 friend class ProgramManager;
209};
210
211
215}
216}
217
218#endif
219
#define _OgreRTSSExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
This utility class is used to hold the information used to generate the matrices and other informatio...
Class defining a single pass of a Technique (of a Material), i.e.
Definition: OgrePass.h:81
A singleton manager class that manages shader based programs.
Container class for shader based programs.
This is a container class for sub render state class.
void reset()
Reset this render state.
SubRenderStateList mSubRenderStateList
void setLightCount(const int lightCount[3])
Set the light count per light type.
RenderState()
Class default constructor.
void getLightCount(int lightCount[3]) const
Get the light count per light type.
void setLightCountAutoUpdate(bool autoUpdate)
Set the light count auto update state.
virtual ~RenderState()
Class destructor.
void removeTemplateSubRenderState(SubRenderState *subRenderState)
Remove a template sub render state from this render state.
bool getLightCountAutoUpdate() const
Return true if this render state override the light count.
const SubRenderStateList & getTemplateSubRenderStateList() const
Get the list of the template sub render states composing this render state.
void addTemplateSubRenderState(SubRenderState *subRenderState)
Add a template sub render state to this render state.
This class is the base interface of sub part from a shader based rendering pipeline.
This is the target render state.
ProgramSet * getProgramSet()
Return the program set of this render state.
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.
void removeSubRenderStateInstance(SubRenderState *subRenderState)
Remove sub render state from this render state.
virtual ~TargetRenderState()
Class destructor.
void addSubRenderStateInstance(SubRenderState *subRenderState)
Add sub render state to this render state.
ProgramSet * createProgramSet()
Create the program set of this render state.
void updateGpuProgramsParams(Renderable *rend, Pass *pass, const AutoParamDataSource *source, const LightList *pLightList)
Update the GPU programs constant parameters before a renderable is rendered.
void sortSubRenderStates()
Sort the sub render states composing this render state.
TargetRenderState()
Class default constructor.
Abstract class defining the interface all renderable objects must implement.
vector< SubRenderState * >::type SubRenderStateList
vector< RenderState * >::type RenderStateList
RenderStateList::const_iterator RenderStateConstIterator
RenderStateList::iterator RenderStateIterator
std::vector< T, A > type