OgreShaderRenderState.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef _ShaderRenderState_
#define _ShaderRenderState_
#include "OgreShaderPrerequisites.h"
#include "OgreShaderSubRenderState.h"
namespace Ogre {
namespace RTShader {
class _OgreRTSSExport RenderState : public RTShaderSystemAlloc
{
// Interface.
public:
RenderState();
virtual ~RenderState();
void reset();
void addTemplateSubRenderState(SubRenderState* subRenderState);
void removeTemplateSubRenderState(SubRenderState* subRenderState);
const SubRenderStateList& getTemplateSubRenderStateList() const { return mSubRenderStateList; }
void setLightCount(const int lightCount[3]);
void getLightCount(int lightCount[3]) const;
void setLightCountAutoUpdate(bool autoUpdate) { mLightCountAutoUpdate = autoUpdate; }
bool getLightCountAutoUpdate() const { return mLightCountAutoUpdate; }
// Attributes.
protected:
// The sub render states list.
SubRenderStateList mSubRenderStateList;
// The light count per light type definition.
int mLightCount[3];
// True if light count was explicitly set.
bool mLightCountAutoUpdate;
private:
friend class ProgramManager;
friend class FFPRenderStateBuilder;
};
typedef vector<RenderState*>::type RenderStateList;
typedef RenderStateList::iterator RenderStateIterator;
typedef RenderStateList::const_iterator RenderStateConstIterator;
class TargetRenderState : public RenderState
{
// Interface.
public:
TargetRenderState();
virtual ~TargetRenderState();
void link(const RenderState& other, Pass* srcPass, Pass* dstPass);
void updateGpuProgramsParams(Renderable* rend, Pass* pass, const AutoParamDataSource* source, const LightList* pLightList);
// Protected methods
protected:
void sortSubRenderStates();
bool createCpuPrograms();
ProgramSet* createProgramSet();
/* Destroy the program set of this render state. */
void destroyProgramSet();
ProgramSet* getProgramSet() { return mProgramSet; }
void addSubRenderStateInstance(SubRenderState* subRenderState);
void removeSubRenderStateInstance(SubRenderState* subRenderState);
// Attributes.
protected:
// Tells if the list of the sub render states is sorted.
bool mSubRenderStateSortValid;
// The program set of this RenderState.
ProgramSet* mProgramSet;
private:
friend class ProgramManager;
friend class FFPRenderStateBuilder;
};
}
}
#endif
Ogre::RTShader::RenderStateIterator
RenderStateList::iterator RenderStateIterator
Definition: OgreShaderRenderState.h:130
Ogre::Renderable
Abstract class defining the interface all renderable objects must implement.
Definition: OgreRenderable.h:63
Ogre::Pass
Class defining a single pass of a Technique (of a Material), i.e.
Definition: OgrePass.h:80
Ogre::RTShader::TargetRenderState
This is the target render state.
Definition: OgreShaderRenderState.h:138
Ogre::RTShader::SubRenderState
This class is the base interface of sub part from a shader based rendering pipeline.
Definition: OgreShaderSubRenderState.h:56
Ogre::RTShader::RenderState::mSubRenderStateList
SubRenderStateList mSubRenderStateList
Definition: OgreShaderRenderState.h:117
Ogre::RTShader::TargetRenderState::mProgramSet
ProgramSet * mProgramSet
Definition: OgreShaderRenderState.h:203
Ogre::RTShader::SubRenderStateList
vector< SubRenderState * >::type SubRenderStateList
Definition: OgreShaderSubRenderState.h:162
Ogre::RTShader::RenderStateConstIterator
RenderStateList::const_iterator RenderStateConstIterator
Definition: OgreShaderRenderState.h:131
OgreShaderPrerequisites.h
Ogre::RTShader::ProgramSet
Container class for shader based programs.
Definition: OgreShaderProgramSet.h:46
Ogre::RTShader::RenderState
This is a container class for sub render state class.
Definition: OgreShaderRenderState.h:49
Ogre::HashedVector
A hashed vector.
Definition: OgreCommon.h:332
Ogre::RTShader::RenderState::setLightCountAutoUpdate
void setLightCountAutoUpdate(bool autoUpdate)
Set the light count auto update state.
Definition: OgreShaderRenderState.h:103
Ogre::RTShader::ProgramManager
A singleton manager class that manages shader based programs.
Definition: OgreShaderProgramManager.h:46
Ogre::RTShader::RenderState::getLightCountAutoUpdate
bool getLightCountAutoUpdate() const
Return true if this render state override the light count.
Definition: OgreShaderRenderState.h:109
OgreShaderSubRenderState.h
_OgreRTSSExport
#define _OgreRTSSExport
Definition: OgreShaderPrerequisites.h:108
Ogre::RTShader::TargetRenderState::getProgramSet
ProgramSet * getProgramSet()
Return the program set of this render state.
Definition: OgreShaderRenderState.h:185
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::RTShader::RenderState::mLightCountAutoUpdate
bool mLightCountAutoUpdate
Definition: OgreShaderRenderState.h:121
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::mSubRenderStateSortValid
bool mSubRenderStateSortValid
Definition: OgreShaderRenderState.h:201
Ogre::AutoParamDataSource
This utility class is used to hold the information used to generate the matrices and other informatio...
Definition: OgreAutoParamDataSource.h:60
Ogre::RTShader::RenderStateList
vector< RenderState * >::type RenderStateList
Definition: OgreShaderRenderState.h:129
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58

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