00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org 00006 00007 Copyright (c) 2000-2013 Torus Knot Software Ltd 00008 Permission is hereby granted, free of charge, to any person obtaining a copy 00009 of this software and associated documentation files (the "Software"), to deal 00010 in the Software without restriction, including without limitation the rights 00011 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00012 copies of the Software, and to permit persons to whom the Software is 00013 furnished to do so, subject to the following conditions: 00014 00015 The above copyright notice and this permission notice shall be included in 00016 all copies or substantial portions of the Software. 00017 00018 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00019 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00020 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00021 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00022 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00023 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00024 THE SOFTWARE. 00025 ----------------------------------------------------------------------------- 00026 */ 00027 #ifndef _ShaderExTriplanarTexturing_ 00028 #define _ShaderExTriplanarTexturing_ 00029 00030 #include "OgreShaderPrerequisites.h" 00031 #ifdef RTSHADER_SYSTEM_BUILD_EXT_SHADERS 00032 #include "OgreShaderSubRenderState.h" 00033 #include "OgreShaderParameter.h" 00034 00035 #define SGX_FUNC_TRIPLANAR_TEXTURING "SGX_TriplanarTexturing" 00036 00037 namespace Ogre { 00038 namespace RTShader { 00039 00050 class _OgreRTSSExport TriplanarTexturing : public SubRenderState 00051 { 00052 00053 protected: 00054 00056 Vector3 mParameters; 00057 00059 UniformParameterPtr mPSTPParams; 00060 00062 ParameterPtr mVSInNormal; 00063 00065 ParameterPtr mVSOutNormal; 00066 00068 ParameterPtr mPSInNormal; 00069 00071 ParameterPtr mVSInPosition; 00072 00074 ParameterPtr mVSOutPosition; 00075 00077 ParameterPtr mPSInPosition; 00078 00080 UniformParameterPtr mSamplerFromX; 00081 00083 UniformParameterPtr mSamplerFromY; 00084 00086 UniformParameterPtr mSamplerFromZ; 00087 00089 ParameterPtr mPSInDiffuse; 00090 00092 ParameterPtr mPSOutDiffuse; 00093 00095 String mTextureNameFromX; 00096 00098 ushort mTextureSamplerIndexFromX; 00099 00101 String mTextureNameFromY; 00102 00104 ushort mTextureSamplerIndexFromY; 00105 00107 String mTextureNameFromZ; 00108 00110 ushort mTextureSamplerIndexFromZ; 00111 00115 virtual bool resolveParameters(ProgramSet* programSet); 00116 00120 virtual bool resolveDependencies(ProgramSet* programSet); 00121 00125 virtual bool addFunctionInvocations(ProgramSet* programSet); 00126 00127 public: 00128 00130 static String type; 00131 00136 virtual void setParameters(const Vector3 ¶meters); 00137 00146 virtual void setTextureNames(const String &textureNameFromX, const String &textureNameFromY, const String &textureNameFromZ); 00147 00151 virtual const String& getType() const; 00152 00156 virtual int getExecutionOrder() const; 00157 00161 virtual bool preAddToRenderState (const RenderState* renderState, Pass* srcPass, Pass* dstPass); 00162 00166 virtual void copyFrom(const SubRenderState& rhs); 00167 00171 virtual void updateGpuProgramsParams(Renderable* rend, Pass* pass, const AutoParamDataSource* source, const LightList* pLightList); 00172 00173 }; 00174 00175 00180 class _OgreRTSSExport TriplanarTexturingFactory : public SubRenderStateFactory 00181 { 00182 public: 00183 00187 virtual const String& getType() const; 00188 00192 virtual SubRenderState* createInstance(ScriptCompiler* compiler, PropertyAbstractNode* prop, Pass* pass, SGScriptTranslator* translator); 00193 00194 protected: 00195 00199 virtual SubRenderState* createInstanceImpl(); 00200 00201 00202 00203 }; 00204 00209 } 00210 } 00211 00212 #endif 00213 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:46