OGRE  1.9
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 #include "OgreShaderParameter.h"
34 
35 #define SGX_FUNC_TRIPLANAR_TEXTURING "SGX_TriplanarTexturing"
36 
37 namespace Ogre {
38 namespace RTShader {
39 
50 class _OgreRTSSExport TriplanarTexturing : public SubRenderState
51 {
52 
53 protected:
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 
127 public:
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 
180 class _OgreRTSSExport TriplanarTexturingFactory : public SubRenderStateFactory
181 {
182 public:
183 
187  virtual const String& getType() const;
188 
192  virtual SubRenderState* createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator);
193 
194 protected:
195 
199  virtual SubRenderState* createInstanceImpl();
200 
201 
202 
203 };
204 
209 }
210 }
211 
212 #endif
213 #endif
HashedVector< Light * > LightList
Definition: OgreCommon.h:541
SharedPtr< Parameter > ParameterPtr
#define _OgreRTSSExport
unsigned short ushort
_StringBase String
SharedPtr< UniformParameter > UniformParameterPtr