OgreShaderFFPFog.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 _ShaderFFPFog_
#define _ShaderFFPFog_
#include "OgreShaderPrerequisites.h"
#ifdef RTSHADER_SYSTEM_BUILD_CORE_SHADERS
#include "OgreShaderParameter.h"
#include "OgreShaderSubRenderState.h"
#include "OgreVector4.h"
namespace Ogre {
namespace RTShader {
class _OgreRTSSExport FFPFog : public SubRenderState
{
public:
// Fog calculation mode enum.
enum CalcMode
{
CM_PER_VERTEX = 1, // Per vertex fog calculations. (Default).
CM_PER_PIXEL = 2 // Per pixel fog calculations.
};
// Interface.
public:
FFPFog();
virtual const String& getType() const;
virtual int getExecutionOrder() const;
virtual void updateGpuProgramsParams(Renderable* rend, Pass* pass, const AutoParamDataSource* source, const LightList* pLightList);
virtual void copyFrom(const SubRenderState& rhs);
virtual bool preAddToRenderState(const RenderState* renderState, Pass* srcPass, Pass* dstPass);
void setFogProperties(FogMode fogMode,
const ColourValue& fogColour,
float fogStart,
float fogEnd,
float fogDensity);
void setCalcMode(CalcMode calcMode) { mCalcMode = calcMode; }
CalcMode getCalcMode() const { return mCalcMode; }
static String Type;
// Protected methods
protected:
virtual bool resolveParameters(ProgramSet* programSet);
virtual bool resolveDependencies(ProgramSet* programSet);
virtual bool addFunctionInvocations(ProgramSet* programSet);
// Attributes.
protected:
// Fog calculation mode.
CalcMode mCalcMode;
// Fog formula.
FogMode mFogMode;
// Fog colour value.
ColourValue mFogColourValue;
// Fog parameters (density, start, end, 1/end-start).
Vector4 mFogParamsValue;
// True if the fog parameters should be taken from the pass.
bool mPassOverrideParams;
// World view projection parameter.
UniformParameterPtr mWorldViewProjMatrix;
// Fog colour parameter.
UniformParameterPtr mFogColour;
// Fog parameters program parameter.
UniformParameterPtr mFogParams;
// Vertex shader input position parameter.
ParameterPtr mVSInPos;
// Vertex shader output fog colour parameter.
ParameterPtr mVSOutFogFactor;
// Pixel shader input fog factor.
ParameterPtr mPSInFogFactor;
// Vertex shader output depth.
ParameterPtr mVSOutDepth;
// Pixel shader input depth.
ParameterPtr mPSInDepth;
// Pixel shader output diffuse colour.
ParameterPtr mPSOutDiffuse;
};
class _OgreRTSSExport FFPFogFactory : public SubRenderStateFactory
{
public:
virtual const String& getType() const;
virtual SubRenderState* createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator);
virtual void writeInstance(MaterialSerializer* ser, SubRenderState* subRenderState, Pass* srcPass, Pass* dstPass);
protected:
virtual SubRenderState* createInstanceImpl();
};
}
}
#endif
#endif
OgreVector4.h
Ogre::RTShader::UniformParameterPtr
SharedPtr< UniformParameter > UniformParameterPtr
Definition: OgreShaderParameter.h:568
Ogre::LightList
HashedVector< Light * > LightList
Definition: OgreCommon.h:541
Ogre::FogMode
FogMode
Fog modes.
Definition: OgreCommon.h:121
OgreShaderParameter.h
OgreShaderPrerequisites.h
Ogre::RTShader::ParameterPtr
SharedPtr< Parameter > ParameterPtr
Definition: OgreShaderParameter.h:369
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
OgreShaderSubRenderState.h
_OgreRTSSExport
#define _OgreRTSSExport
Definition: OgreShaderPrerequisites.h:108
Ogre
Definition: OgreAndroidLogListener.h:34

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