OGRE  1.9.0
OgreShaderExTriplanarTexturing.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 _ShaderExTriplanarTexturing_
28#define _ShaderExTriplanarTexturing_
29
31#ifdef RTSHADER_SYSTEM_BUILD_EXT_SHADERS
33#include "OgreShaderParameter.h"
34
35#define SGX_FUNC_TRIPLANAR_TEXTURING "SGX_TriplanarTexturing"
36
37namespace Ogre {
38namespace RTShader {
39
50class _OgreRTSSExport TriplanarTexturing : public SubRenderState
51{
52
53protected:
54
56 Vector3 mParameters;
57
59 UniformParameterPtr mPSTPParams;
60
62 ParameterPtr mVSInNormal;
63
65 ParameterPtr mVSOutNormal;
66
68 ParameterPtr mPSInNormal;
69
71 ParameterPtr mVSInPosition;
72
74 ParameterPtr mVSOutPosition;
75
77 ParameterPtr mPSInPosition;
78
80 UniformParameterPtr mSamplerFromX;
81
83 UniformParameterPtr mSamplerFromY;
84
86 UniformParameterPtr mSamplerFromZ;
87
89 ParameterPtr mPSInDiffuse;
90
92 ParameterPtr mPSOutDiffuse;
93
95 String mTextureNameFromX;
96
98 ushort mTextureSamplerIndexFromX;
99
101 String mTextureNameFromY;
102
104 ushort mTextureSamplerIndexFromY;
105
107 String mTextureNameFromZ;
108
110 ushort mTextureSamplerIndexFromZ;
111
115 virtual bool resolveParameters(ProgramSet* programSet);
116
120 virtual bool resolveDependencies(ProgramSet* programSet);
121
125 virtual bool addFunctionInvocations(ProgramSet* programSet);
126
127public:
128
130 static String type;
131
136 virtual void setParameters(const Vector3 &parameters);
137
146 virtual void setTextureNames(const String &textureNameFromX, const String &textureNameFromY, const String &textureNameFromZ);
147
151 virtual const String& getType() const;
152
156 virtual int getExecutionOrder() const;
157
161 virtual bool preAddToRenderState (const RenderState* renderState, Pass* srcPass, Pass* dstPass);
162
166 virtual void copyFrom(const SubRenderState& rhs);
167
171 virtual void updateGpuProgramsParams(Renderable* rend, Pass* pass, const AutoParamDataSource* source, const LightList* pLightList);
172
173};
174
175
180class _OgreRTSSExport TriplanarTexturingFactory : public SubRenderStateFactory
181{
182public:
183
187 virtual const String& getType() const;
188
192 virtual SubRenderState* createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator);
193
194protected:
195
199 virtual SubRenderState* createInstanceImpl();
200
201
202
203};
204
209}
210}
211
212#endif
213#endif
#define _OgreRTSSExport
SharedPtr< Parameter > ParameterPtr
SharedPtr< UniformParameter > UniformParameterPtr
_StringBase String
unsigned short ushort