OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreShaderExTriplanarTexturing.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-2014 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 _ShaderExTriplanarTexturing_
28 #define _ShaderExTriplanarTexturing_
29 
31 #ifdef RTSHADER_SYSTEM_BUILD_EXT_SHADERS
33 
34 #define SGX_FUNC_TRIPLANAR_TEXTURING "SGX_TriplanarTexturing"
35 
36 namespace Ogre {
37 namespace RTShader {
38 
49 class _OgreRTSSExport TriplanarTexturing : public SubRenderState
50 {
51 
52 protected:
53 
55  Vector3 mParameters;
56 
58  UniformParameterPtr mPSTPParams;
59 
61  ParameterPtr mVSInNormal;
62 
64  ParameterPtr mVSOutNormal;
65 
67  ParameterPtr mPSInNormal;
68 
70  ParameterPtr mVSInPosition;
71 
73  ParameterPtr mVSOutPosition;
74 
76  ParameterPtr mPSInPosition;
77 
79  UniformParameterPtr mSamplerFromX;
80 
82  UniformParameterPtr mSamplerFromY;
83 
85  UniformParameterPtr mSamplerFromZ;
86 
88  ParameterPtr mPSInDiffuse;
89 
91  ParameterPtr mPSOutDiffuse;
92 
94  String mTextureNameFromX;
95 
97  ushort mTextureSamplerIndexFromX;
98 
100  String mTextureNameFromY;
101 
103  ushort mTextureSamplerIndexFromY;
104 
106  String mTextureNameFromZ;
107 
109  ushort mTextureSamplerIndexFromZ;
110 
114  virtual bool resolveParameters(ProgramSet* programSet);
115 
119  virtual bool resolveDependencies(ProgramSet* programSet);
120 
124  virtual bool addFunctionInvocations(ProgramSet* programSet);
125 
126 public:
127 
129  static String type;
130 
135  virtual void setParameters(const Vector3 &parameters);
136 
145  virtual void setTextureNames(const String &textureNameFromX, const String &textureNameFromY, const String &textureNameFromZ);
146 
150  virtual const String& getType() const;
151 
155  virtual int getExecutionOrder() const;
156 
160  virtual bool preAddToRenderState (const RenderState* renderState, Pass* srcPass, Pass* dstPass);
161 
165  virtual void copyFrom(const SubRenderState& rhs);
166 
170  virtual void updateGpuProgramsParams(Renderable* rend, Pass* pass, const AutoParamDataSource* source, const LightList* pLightList);
171 
172 };
173 
174 
179 class _OgreRTSSExport TriplanarTexturingFactory : public SubRenderStateFactory
180 {
181 public:
182 
186  virtual const String& getType() const;
187 
191  virtual SubRenderState* createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator);
192 
193 protected:
194 
198  virtual SubRenderState* createInstanceImpl();
199 
200 
201 
202 };
203 
208 }
209 }
210 
211 #endif
212 #endif
#define _OgreRTSSExport
SharedPtr< Parameter > ParameterPtr
HashedVector< LightClosest > LightList
Definition: OgreCommon.h:569
unsigned short ushort
SharedPtr< UniformParameter > UniformParameterPtr
_StringBase String
Definition: OgreCommon.h:53